about summary refs log tree commit diff stats
path: root/src/html
Commit message (Collapse)AuthorAgeFilesLines
* Move around some modulesbptato2024-03-144-4/+299
| | | | | | | | * extern -> gone, runproc absorbed by pager, others moved into io/ * display -> local/ (where else would we display?) * xhr -> html/ * move out WindowAttributes from term, so we don't depend on local from server
* rudimentary support for <video>, <audio>bptato2024-03-131-0/+22
| | | | | we just treat them as img tags. lazy, but works suprisingly well -- so long as the server sends us a Content-Type, anyway.
* loader: remove applyHeadersbptato2024-03-121-2/+2
| | | | | | | Better compute the values we need on-demand at the call sites; this way, we can pass through content type attributes to mailcap too. (Also, remove a bug where applyResponse was called twice.)
* loader: rework process modelbptato2024-03-112-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Originally we had several loader processes so that the loader did not need asynchronity for loading several buffers at once. Since then, the scope of what loader does has been reduced significantly, and with that loader has become mostly asynchronous. This patch finishes the above work as follows: * We only fork a single loader process for the browser. It is a waste of resources to do otherwise, and would have made future work on a download manager very difficult. * loader becomes (almost) fully async. Now the only sync part is a) processing commands and b) waiting for clients to consume responses. b) is a bit more problematic than a), but should not cause problems unless some other horrible bug exists in a client. (TODO: make it fully async.) This gives us a noticable improvement in CSS loading speed, since all resources can now be queried at once (even before the previous ones are connected). * Buffers now only get processes when the *connection* is finished. So headers, status code, etc. are handled by the client, and the buffer is forked when the loader starts streaming the response body. As a result, mailcap entries can simply dup2 the first UNIX domain socket connection as their stdin. This allows us to remove the ugly (and slow) `canredir' hack, which required us to send file handles on a tour accross the entire codebase. * The "cache" has been reworked somewhat: - Since canredir is gone, buffer-level requests usually start in a suspended state, and are explicitly resumed only after the client could decide whether it wants to cache the response. - Instead of a flag on Request and the URL as the cache key, we now use a global counter and the special `cache:' scheme. * misc fixes: referer_from is now actually respected by buffers (not just the pager), load info display should work slightly better, etc.
* catom: merge TagType with AttrTypebptato2024-03-043-110/+131
| | | | | it's inefficient and pointless to treat them differently, so just derive a new enum from TagType with a macro
* dom: use relList for stylesheet checksbptato2024-03-042-10/+17
|
* dom: misc fixesbptato2024-03-041-2/+28
| | | | | | | | * parse XHR URL with document base URL * allow setting XHR responseType * add tagName, nodeName * make hasChildNodes a function * fix horribly broken insertNode
* quickjs: reduce diff with upstreambptato2024-03-021-2/+3
| | | | | | * the uint8array thing is probably from txiki.js, but we never used it * upstream now has JS_GetClassID, importing that instead... (so this commit won't build :/)
* env: add window.screenbptato2024-03-022-1/+25
|
* dom: fix canvas element crashbptato2024-03-011-2/+3
|
* dom: fix non-stylesheets being downloaded as stylesheetsbptato2024-02-271-0/+2
|
* term: improve pixels-per-column/line detectionbptato2024-02-252-2/+2
| | | | | | | | | Some terminal emulators (AKA vte) refuse to set ws_xpixel and ws_ypixel in the TIOCGWINSZ ioctl, so we now query for CSI 14 t as well. (Also CSI 18 t for good measure, just in case we can't ioctl for some reason.) Also added some fallback (optionally forced) config values for width, height, ppc, and ppl. (This is especially useful in dump mode.)
* Separate ANSI text decoding from main binarybptato2024-02-251-10/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Handling text/plain as ANSI colored text was problematic for two reasons: * You couldn't actually look at the real source of HTML pages or text files that used ANSI colors in the source. In general, I only want ANSI colors when piping something into my pager, not when viewing any random file. * More importantly, it introduced a separate rendering mode for plaintext documents, which resulted in the problem that only some buffers had DOMs. This made it impossible to add functionality that would operate on the buffer's DOM, to e.g. implement w3m's MARK_URL. Also, it locked us into the horribly inefficient line-based rendering model of entire documents. Now we solve the problem in two separate parts: * text/x-ansi is used automatically for documents received through stdin. A text/x-ansi handler ansi2html converts ANSI formatting to HTML. text/x-ansi is also used for .ans, .asc file extensions. * text/plain is a separate input mode in buffer, which places all text in a single <plaintext> tag. Crucially, this does not invoke the HTML parser; that would eat NUL characters, which we should avoid. One blind spot still remains: copiousoutput used to display ANSI colors, and now it doesn't. To solve this, users can put the x-ansioutput extension field to their mailcap entries, which behaves like x-htmloutput except it first pipes the output into ansi2html.
* dom: use AttrType in DOMTokenList supportsbptato2024-02-241-5/+3
|
* dom: check rel attribute for link tags before downloadbptato2024-02-241-1/+1
|
* Allow non-RGB colors in CSSbptato2024-02-241-2/+8
| | | | | | | | | | | The -cha-ansi color type now sets ANSI colors in CSS. Also, color correction etc. has been improved a bit: * don't completely reset output state in processFormat for new colors * defaultColor is now separated from ANSI color type 0 * bright ANSI colors are no longer replaced with bold + dark variant * replaced ANSI color map to match xterm defaults
* dom: add onload content attribute to bodybptato2024-02-242-5/+23
|
* dom: print parse errors to consolebptato2024-02-241-7/+8
| | | | instead of trying to evaluate exceptions...
* buffer: improve cancel, use _exit, misc cleanupsbptato2024-02-231-3/+3
| | | | | | * cancel resources on cancel() call * call _exit in signal handler (also in loader) * misc cleanups
* buffer: remove BufferSourcebptato2024-02-221-6/+3
| | | | | | | | | | Aside from being a wrapper of Request, it was just storing the -I charset, except even that didn't actually work. Whoops. This fixes -I effectively not doing anything; now it's a forced override that even disables BOM sniffing. (If the user wants to decode a file using a certain encoding, it seems wise to assume that they really meant it.)
* Replace Chakasu with Chagashibptato2024-02-222-126/+28
| | | | | | The API is horrid :( but at least it copies less. TODO: think of a better API.
* dom: fix href stringifierbptato2024-02-151-0/+2
| | | | Return the empty string if it's unset.
* buffer: improve style invalidationbptato2024-02-142-1/+3
|
* loader: fixes & improvementsbptato2024-02-131-24/+20
| | | | | | | | * factor out pushBuffer to make loadFromCache async * fix incorrect cache path * replace rewind with loadFromCache (it does the same thing except actually works) * remove rewindImpl callback, rewind in buffer instead
* buffer: more form fixesbptato2024-02-132-1/+2
|
* buffer: form fixesbptato2024-02-121-0/+5
| | | | | * show submission URL on hover for all form-associated elements * skip non-checked checkbox/radio inputs
* Add pager.externFilterSourcebptato2024-02-121-1/+1
| | | | useful for filtering stuff through commands like rdrview
* Remove CLONE BufferSource; cache document sources in tmpdirbptato2024-02-121-19/+45
| | | | | | | | | | | | | | | | | | | | | | | At last all BufferSources are unified. To achieve the same effect as the previous CLONE source type, we now use the "fromcache" flag in Request. This *forces* the document to be streamed from the disk; if the file no longer exists for some reason, an error is returned (i.e. the document is not re-downloaded). For a document to be cached, it has to be the main document of the buffer (i.e. no additional resources requested with fetch()), and also not an x-htmloutput HTML file (for those, the original source is saved). The result is that toggleSource now always returns the actual source for e.g. markdown files, not the HTML-transformed version. Also, it is now possible to view the source of a document that is still being downloaded. buffer.sstream has almost been eliminated; it still exists, but only as a pseudo-buffer to interface with EncoderStream and DecoderStream. It no longer holds the entire source of a buffer at any point, and is cleared as soon as the buffer is completely loaded.
* buffer: load external resources when they are attachedbptato2024-02-082-22/+125
| | | | | We no longer have to wait for the entire document to be loaded to start loading CSS.
* dom: reduce todosbptato2024-02-081-10/+20
| | | | | * enumize insertAdjacentHTML position * un-extern attrs
* chadombuilder: remove unnecessary pragmabptato2024-02-081-1/+1
|
* dom: enumize attribute namesbptato2024-02-083-160/+279
|
* dom: atomize id, name, DOMTokenListbptato2024-02-081-36/+72
|
* dom: reduce tagType usebptato2024-02-083-62/+39
| | | | | tagType is now a function call, but usually it's enough to just test for the object type.
* Fix some document.write bugsbptato2024-02-072-44/+88
|
* Incremental renderingbptato2024-02-072-115/+150
| | | | | | | | | | | | Yay! Admittedly, it is not very useful in its current form, except maybe on very slow networks. The problem is that renderDocument is *slow*, so we only run it when onload fails to consume all bytes from the network in a single pass. Even then, we are guaranteed to get a FOUC, since CSS is only downloaded in finishLoad(). Well, I think it's cool, anyway.
* Update chamebptato2024-02-075-523/+960
| | | | | | | | * Update chame to the latest version * Get rid of nodeType usage * Add atoms * Re-implement DOM attributes * document.write
* Fix form action when submitter has a "form" attrbptato2024-01-191-17/+26
| | | | | | | * Unify form variable for all form-associated elements * Fix broken form association logic in resetFormOwner * Use form action for all form-associated submitters * Remove unused getElementsByTag + de-extern some functions
* dom: fix innerHTML tag name regressionbptato2024-01-171-2/+8
|
* dom: fix invalid object conversion defectbptato2024-01-171-1/+1
|
* dom: standard-compliant innerHTML/outerHTMLbptato2024-01-122-5/+73
| | | | | | | | It's still not perfect, but at least now we do not apply non-standard whitespace changes. The stringifier is left as it is since it's more useful for debugging this way.
* js: merge some type modules into jstypesbptato2024-01-112-2/+2
| | | | They only had type definitions, no need to put them in separate modules.
* Use std/* imports everywherebptato2024-01-073-7/+7
|
* Fix some casing issuesbptato2024-01-061-3/+5
|
* Compile with styleCheck:usagesbptato2023-12-282-7/+7
| | | | much better
* dom: export import maps allowedbptato2023-12-251-1/+1
| | | | whoops
* dom: use JS_EvalFunction; add module fetching stubsbptato2023-12-253-50/+153
| | | | (still no module support in buffer...)
* Fix warnings on Nim 2.0.2bptato2023-12-241-1/+2
| | | | | | | | One is a false-positive (in dom). The other one in pager is something I hadn't noticed before, that's nice. For now I want to avoid making a change that may break things, so I just removed the dead code.
* dom: use std/ in importsbptato2023-12-221-8/+8
|
* dom: simplify fetch classic scriptbptato2023-12-221-22/+21
|