about summary refs log tree commit diff stats
path: root/src/html
Commit message (Collapse)AuthorAgeFilesLines
...
* dom: prevent leaking window size through media queriesbptato2024-10-121-3/+4
|
* dom: html -> documentElementbptato2024-10-101-7/+4
| | | | it's effectively a dupe, except html wouldn't work in XML
* env: fix getComputedStyle arg2bptato2024-10-101-1/+1
|
* promise: remove newPromisebptato2024-10-101-3/+1
| | | | normal construction is enough (and it wasn't really used anyway)
* color: reduce CellColor size, misc color refactoringbptato2024-10-061-3/+3
| | | | | | * split out CSSColor from CellColor; now CellColor is just 4 bytes (which helps reduce FormatCell size) * unify color function naming (still not perfect)
* timeout: accept err stream as parambptato2024-09-301-1/+1
| | | | | gets rid of a todo. (not sure why I thought this was important, but it sure looks nicer)
* dom: optimize element size, remove importc hack & dead codebptato2024-09-303-98/+72
| | | | | This switches CAtom to uint32; it seems better to use the same size on all platforms.
* dom: invalidate shared images on loadbptato2024-09-251-0/+1
| | | | fixes the race where reused images wouldn't show up after page load
* Replace std/selectors with pollbptato2024-09-231-19/+14
| | | | | | | | | | | | std/selectors uses OS-specific selector APIs, which sounds good in theory (faster than poll!), but sucks for portability in practice. Sure, you can fix portability bugs, but who knows how many there are on untested platforms... poll is standard, so if it works on one computer it should work on all other ones. (I hope.) As a bonus, I rewrote the timeout API for poll, which incidentally fixes setTimeout across forks. Also, SIGWINCH should now work on all platforms (as we self-pipe instead of signalfd/kqueue magic).
* dom: add forms, elements getter + misc fixesbptato2024-09-172-71/+133
| | | | | | | | | | | | * add document.forms * add form.elements * remove redundant jshasprop functions * use mpairs for attribute iteration (mpairs use pointers, but pairs copies) * fix remove() crash * fix remove() collection invalidation for children (if parent is not in the collection) * update monoucha
* loader: refactor/move around some procsbptato2024-09-153-5/+6
| | | | | | | | | | | | | | Module boundaries didn't make much sense here either. Specifically: * loader/cgi was originally just one of the many "real" protocols supported by loader, so it was in a separate module (like the other ones). Now it's mostly an "internal" protocol, and it was getting cumbersome to pass all required loader state to loadCGI. * The loader interface has grown quite large, but there is no need for (or advantage in) putting it in the same module as the implementation. Now CGI is handled by loader, and the interface is in the new module "loaderiface".
* Refactor img/*bptato2024-09-151-8/+8
| | | | | I've moved most image logic to adapter, so it doesn't really make sense to have this subdir anymore.
* loader: refactor, misc optimizations & fixesbptato2024-09-141-15/+6
| | | | | | | | * factor out input/output handle tables; use a seq instead * add possibility to directly open cached items onto stdin (mainly an optimization for reading images, which are always cached) * close used handles on local CGI execution * make clone during load work again
* dom: fix crash on wrong CSS content typebptato2024-09-101-3/+1
|
* canvas: make sure we don't link to QJSbptato2024-09-011-22/+23
|
* path: fix swap bug, refactor linesbptato2024-09-011-3/+1
|
* canvas: move to separate CGI scriptbptato2024-09-011-136/+256
| | | | | | | | | | * stream: and passFd is now client-based, and accessible for buffers * Bitmap's width & height is now int, not uint64 * no more non-network Bitmap special case in the pager for canvas I just shoehorned it into the static image model, so it still doesn't render changes after page load. But at least now it doesn't crash the browser.
* dom: toBlob fixesbptato2024-08-251-20/+7
| | | | | | | | | | * fix return type * don't choke on empty bitmaps * don't check for Cha-Image-Dimensions in encoder output (it was unused anyways) Mainly so that I can spec the encoder without Cha-Image-Dimensions as an output header - it's pointless redundancy.
* dom, xhr: slight progress on modules, fix an XHR bugbptato2024-08-153-53/+112
| | | | | | * actually download & compile modules (but don't run them yet) * fix a bug in XHR (on some older Nim versions, move() doesn't actually move)
* xhr: more progressbptato2024-08-154-48/+156
| | | | | | | | | | * add responseText, response * add net tests -> currently sync XHR only; should find a way to do async tests... * update monoucha -> simplified & updated some related code that no longer worked properly
* xhr: progressbptato2024-08-131-33/+115
| | | | | | | | | | | | | * fix header case sensitivity issues -> probably still wrong as it discards the original casing. better than nothing, anyway * fix fulfill on generic promises * support standard open() async parameter weirdness * refactor loader response body reading (so bodyRead is no longer mandatory) * actually read response body still missing: response body getters
* dom: remove generic JS bindingsbptato2024-08-112-80/+100
| | | | Dispatch manually with fromJS instead.
* dom: fix crash on wrong image content typebptato2024-08-111-2/+5
| | | | + slightly optimize getContentType
* Update monouchabptato2024-08-095-61/+72
|
* env, dom: add History stub, basic LocalStoragebptato2024-07-302-0/+78
| | | | | | | * History: doesn't really do anything, just adding it to fix some pages * LocalStorage: kind of works, but does lookups with linear search, and the quota limitation is on the number of entries not their size. plus it doesn't actually store anything on disk yet (like cookies).
* Fixes for Nim 2.2bptato2024-07-293-2/+2
| | | | | | | | | * xmlhttprequest: fix missing import * painter: generic tuple workaround * dynstream: merge module with implementations (so it will work with vtables) Not enabling vtables yet since it doesn't work with refc.
* css: hash attribute namesbptato2024-07-291-1/+1
|
* buffer, pager, config: add meta-refresh + misc fixesbptato2024-07-283-7/+15
| | | | | | | | | * buffer, pager, config: add meta-refresh value, which makes it possible to follow http-equiv=refresh META tags. * config: clean up redundant format mode parser * timeout: accept varargs for params to pass on to functions * pager: add "options" dict to JS gotoURL * twtstr: remove redundant startsWithNoCase
* dom: add missing nil checksbptato2024-07-271-1/+4
| | | | document is not set in the main process.
* headers, request: bring it closer to the standardbptato2024-07-273-6/+11
| | | | | | * add standard interfaces to headers * use window base URL for newRequest * remove pointless generic in newRequest
* env: add alert shimbptato2024-07-271-0/+3
| | | | just call console.error for now
* dom: fix wrong proc call in fireEventbptato2024-07-222-2/+2
| | | | dispatchEvent is for JS only, since it unsets isTrusted.
* buffer, dom, event: JS binding for dispatchEventbptato2024-07-225-95/+125
| | | | | | * move dispatchEvent to event, add a JS binding * only reshape if the document was actually invalidated after event dispatch/interval call/etc.
* dom: fix getElementById signaturebptato2024-07-211-3/+3
|
* buffer: replace dispatchEvent procs with that in dombptato2024-07-212-4/+3
|
* dom: fix race condition in image loadingbptato2024-07-211-3/+4
| | | | | | We were not setting the invalid flag on bitmap load, so any incremental reshape could interfere with displaying images that got loaded after the reshape.
* buffer: fix nil deref on click without clickable elementbptato2024-07-191-3/+0
|
* html: event cleanup, XHR progressbptato2024-07-186-97/+459
|
* dom, match, event: small cleanupbptato2024-07-172-27/+26
|
* timeout: simplify, misc fixesbptato2024-07-161-7/+7
| | | | | | Merge timeout & interval code paths. This fixes clearTimeout not clearing intervals.
* css, html: fix CSS dependency invalidationbptato2024-07-032-69/+95
|
* dom, pager: cache images from networkbptato2024-06-291-2/+36
| | | | | | | | | | | With many limitations: * slightly randomized expiry, so it's harder to fingerprint * only images. so e.g. CSS is still left uncached * it's per-buffer and non-persistent, so images are still redownloaded for every new page load so it's more of an image sharing between placements than true caching.
* config: add various missing optionsbptato2024-06-292-3/+5
| | | | | | | Mainly things you could already set with [[siteconf]] but not normally. Also, a `styling' option to disable author styles. Also, `images' is now documented as an "experimental" option, since it's halfway usable now.
* img, loader: add image resizing, misc fixesbptato2024-06-281-27/+33
| | | | | | | | | | | | | | | * resize images with stb_image_resize * use tee for output handle redirection (redirectToFile blocks) * cache original image files * accept lseek in sandbox * misc stbi fixes For now, I just pulled in stb_image_resize v1. v2 is an extra 150K in size, not sure if it's worth the cost. (Either way, we can always switch later if needed, since the API is almost the same.) Next step: move sixel/kitty encoders to CGI, and cache their output in memory instead of the intermediate RGBA representation.
* Update monouchabptato2024-06-221-1/+1
|
* env: fix nil deref in clientbptato2024-06-221-1/+3
|
* misc cleanupsbptato2024-06-222-7/+5
|
* stbi: add encodersbptato2024-06-211-8/+18
|
* img, term: try to detect unknown images, improve kitty encoderbptato2024-06-211-1/+1
| | | | | | * preserve alpha in kitty + simplify encoder * pass unknown image types to stbi (as image/x-unknown) and let it detect the type
* img: use stb_image, drop zlib as dependencybptato2024-06-201-11/+15
| | | | | | | Now we have decoders for gif, jpeg, bmp. Also, the in-house PNG decoder has been replaced in favor of the stbi implementation; this means we no longer depend on zlib, since stbi comes with a built in inflate implementation.