about summary refs log tree commit diff stats
path: root/src/html/dom.nim
Commit message (Collapse)AuthorAgeFilesLines
* dom: optimize element size, remove importc hack & dead codebptato2024-09-301-81/+60
| | | | | 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
* dom: add forms, elements getter + misc fixesbptato2024-09-171-70/+125
| | | | | | | | | | | | * 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-151-3/+4
| | | | | | | | | | | | | | 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-151-37/+63
| | | | | | * 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-151-28/+44
| | | | | | | | | | * 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
* dom: remove generic JS bindingsbptato2024-08-111-67/+82
| | | | Dispatch manually with fromJS instead.
* dom: fix crash on wrong image content typebptato2024-08-111-2/+5
| | | | + slightly optimize getContentType
* Update monouchabptato2024-08-091-29/+35
|
* env, dom: add History stub, basic LocalStoragebptato2024-07-301-0/+10
| | | | | | | * 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).
* css: hash attribute namesbptato2024-07-291-1/+1
|
* buffer, pager, config: add meta-refresh + misc fixesbptato2024-07-281-0/+6
| | | | | | | | | * 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-271-0/+3
| | | | | | * add standard interfaces to headers * use window base URL for newRequest * remove pointless generic in newRequest
* dom: fix wrong proc call in fireEventbptato2024-07-221-1/+1
| | | | dispatchEvent is for JS only, since it unsets isTrusted.
* buffer, dom, event: JS binding for dispatchEventbptato2024-07-221-81/+63
| | | | | | * 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-211-0/+2
|
* 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-181-34/+115
|
* dom, match, event: small cleanupbptato2024-07-171-26/+25
|
* css, html: fix CSS dependency invalidationbptato2024-07-031-68/+94
|
* 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-291-2/+3
| | | | | | | 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.
* misc cleanupsbptato2024-06-221-5/+3
|
* 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.
* loader: better error handlingbptato2024-06-201-1/+1
| | | | we no longer crash on broken codecs. yay
* img, loader: separate out png codec into cgi, misc improvementsbptato2024-06-201-30/+138
| | | | | | | | | | | | | | | * multi-processed and sandboxed PNG decoding & encoding (through local CGI) * improved request body passing (including support for output id as response body) * simplified & faster blob()/text() - now every request starts suspended, and OngoingData.buf has been replaced with loader's buffering capability * image caching: we no longer pull bitmaps from the container after every single getLines call Next steps: replace our bespoke PNG decoder with something more usable, add other decoders, and make them stream.
* Update Chame, Chagashibptato2024-06-131-5/+2
|
* dom: simplify window.loaderbptato2024-06-091-14/+8
| | | | the Option setup hasn't made much sense for a long time now
* buffer: add autofocusbptato2024-06-081-0/+6
| | | | naturally, it's opt-in
* Move JS wrapper into Monouchabptato2024-06-031-9/+13
| | | | Operation "modularize Chawan somewhat" part 3
* stylednode: remove `text' fieldbptato2024-05-281-1/+1
| | | | This avoids some unnecessary string copying.
* stylednode: move invalidation data to DOMbptato2024-05-271-0/+7
| | | | this way, we do not refer to nodes of previous cascade passes
* html: improve Request, derive Client from Windowbptato2024-05-201-25/+29
| | | | | | | * make Client an instance of Window (for less special casing) * misc work on Request & fetch * improve origin comparison (opaque origins of same URLs are now considered the same)
* css/values -> css/cssvaluesbptato2024-05-161-3/+3
| | | | for consistency
* js: allow var instead of ptrbptato2024-05-121-20/+20
|
* buffer: fix multipart formsbptato2024-05-111-31/+26
| | | | | | | | | * fix enctype not getting picked up * fix form data constructor requiring open() syscall (which gets blocked by our seccomp filter) * add closing boundary to multipart end * pass fds instead of path names through WebFile/Blob and send those through bufwriter/bufreader
* dom: simplify ButtonTypebptato2024-05-081-10/+4
|