about summary refs log tree commit diff stats
path: root/src/css/cascade.nim
Commit message (Collapse)AuthorAgeFilesLines
* cascade: add missing nil checkbptato2024-09-021-1/+1
|
* canvas: move to separate CGI scriptbptato2024-09-011-7/+9
| | | | | | | | | | * 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.
* winattrs: un-snakeifybptato2024-08-231-2/+2
|
* cssvalues, twtstr, mediaquery: refactor & fixesbptato2024-08-021-11/+5
| | | | | | | * cssvalues, twtstr: unify enum parsing code paths, parse enums by bisearch instead of hash tables * mediaquery: refactor (long overdue), fix range comparison syntax parsing, make ident comparisons case-insensitive (as they should be)
* css: hash attribute namesbptato2024-07-291-3/+22
|
* cascade: move some presentational hints to ua.cssbptato2024-07-291-66/+0
|
* cascade: add some presentational hintsbptato2024-07-271-3/+7
| | | | | | * top/middle/bottom for img, remove redundant display: block for floats (they get blockified anyway) * map align for p too, not just div
* css: clean up a bitbptato2024-07-121-11/+7
|
* cascade: reduce allocationsbptato2024-07-101-57/+42
| | | | | | | Just use the previous tree when possible. The child list is still reconstructed, but at least we no longer alloc every single node again at every single restyle.
* cascade: fix style cachingbptato2024-07-091-3/+7
| | | | the invalid flag must be toggled after styling
* css, html: fix CSS dependency invalidationbptato2024-07-031-3/+6
|
* cascade: support align=left, align=right on imgbptato2024-06-291-2/+14
|
* img, loader: add image resizing, misc fixesbptato2024-06-281-2/+3
| | | | | | | | | | | | | | | * 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-2/+1
|
* css: slightly optimize cascadebptato2024-06-021-41/+109
| | | | Parse rule values in sheet addRule, not during cascade.
* stylednode: remove `text' fieldbptato2024-05-281-4/+6
| | | | This avoids some unnecessary string copying.
* css/values -> css/cssvaluesbptato2024-05-161-1/+1
| | | | for consistency
* cascade: avoid empty ::before/::afterbptato2024-05-051-3/+2
| | | | | If `content' is empty, then generating before/after pseudo-elements is wrong.
* color: separate out JS convertersbptato2024-05-051-0/+1
| | | | | ansi2html depends on color, but we definitely do not want to link it to QJS, so the converters must be moved into a separate module.
* css, dom: simplify ident parsing, canvas fixesbptato2024-05-011-10/+16
| | | | | | | | * add CSSStyleDeclaration setter * move ident maps directly into enums * more complete CSSComputedValue stringifier * turn canvas into a pseudo-image in cascade * set canvas to inline-block
* Initial image supportbptato2024-04-251-1/+5
| | | | | | | | | | | | | | | | | * png: add missing filters, various decoder fixes * term: fix kitty response interpretation, add support for kitty image detection * buffer, pager: initial image display support Emphasis on "initial"; it only "works" with kitty output and PNG input. Also, it's excruciatingly slow, and repaints images way too often. Left undocumented intentionally it for now, until it actually becomes useful. In the meantime, adventurous users can find out themselves why: [[siteconf]] url = "https://.*" images = true
* Update code stylebptato2024-04-171-95/+100
| | | | | | * separate params with ; (semicolon) instead of , (colon) * reduce screaming snake case use * wrap long lines
* catom: at -> satbptato2024-03-211-18/+18
| | | | just for consistency
* rudimentary support for <video>, <audio>bptato2024-03-131-0/+14
| | | | | we just treat them as img tags. lazy, but works suprisingly well -- so long as the server sends us a Content-Type, anyway.
* catom: merge TagType with AttrTypebptato2024-03-041-0/+1
| | | | | it's inefficient and pointless to treat them differently, so just derive a new enum from TagType with a macro
* Allow non-RGB colors in CSSbptato2024-02-241-3/+3
| | | | | | | | | | | 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
* css: reduce CSSComputedValue sizebptato2024-02-171-6/+2
| | | | | | | The `t' field was completely redundant, as it's already included in the CSSComputedValues index. + removed some unused functions
* layout: use html/body bgcolor as canvas bgcolorbptato2024-02-171-0/+5
| | | | | | This is required by the standard. (Without this, lots of websites have incorrect background colors, because they set the body height to 100% of the viewport.)
* css: hide noscript tags when scripting is enabledbptato2024-02-131-0/+2
|
* buffer: load external resources when they are attachedbptato2024-02-081-0/+2
| | | | | We no longer have to wait for the entire document to be loaded to start loading CSS.
* dom: enumize attribute namesbptato2024-02-081-18/+18
|
* Update chamebptato2024-02-071-4/+4
| | | | | | | | * Update chame to the latest version * Get rid of nodeType usage * Add atoms * Re-implement DOM attributes * document.write
* Fix windowChange not refreshing valid media queriesbptato2024-01-101-1/+2
| | | | | | | | * css/cascade: copy stylesheet in applyMediaQuery (so that changes are reverted on re-style) * buffer: clear prevstyled in windowChange (to avoid using cached results from previous cascading passes); set window.attrs * pager: avoid windowChange if new attrs are identical to the old ones
* Use std/* imports everywherebptato2024-01-071-3/+3
|
* cascade: simplifybptato2023-12-091-2/+1
|
* cascade: fix regressionbptato2023-12-091-18/+23
| | | | | Styled children must be added to their parents *before* they are styled, because match expects this to hold.
* sheet: fix a correctness issue, misc refactoringsbptato2023-12-091-2/+2
| | | | | | | * Fix a bug where rules would be sorted incorrectly if retrieved from the cache. * Use withValue where possible * camelCase some variables, de-extern some functions, etc.
* cascade: refactor & optimizebptato2023-12-091-153/+192
| | | | | | * Break up applyRules into smaller functions * Do not call calcRules for every child pseudo element separately; just use parent's DeclarationListMap
* layout: add floatsbptato2023-11-171-2/+2
| | | | | | | | | | | | | yay!!!! * Add support for float: left, float: right Also, misc stuff: * Add support for display: flow-root * Set line width to the maximum allowed width on line wrap * Various refactorings Still todo: support clear
* Add jspropnames, CSSStyleDeclaration stubbptato2023-10-251-5/+3
|
* css: fix list style type presentational hintsbptato2023-10-141-17/+20
| | | | third time's the charm
* css: support more list types, fix <ul/ol type=...bptato2023-10-141-5/+15
| | | | | | | Turns out you can't just throw the value into the CSS value parser. (Also, correction for the previous commit message: it is not LI but UL or OL.)
* css: support alphabetic list types, support <LI TYPE=...bptato2023-10-141-0/+9
|
* update chamebptato2023-09-191-0/+1
| | | | and with that, resolve the unknown input type issue
* move around more modulesbptato2023-09-141-1/+1
| | | | | | | | | | * ips -> io/ * loader related stuff -> loader/ * tempfile -> extern/ * buffer, forkserver -> server/ * lineedit, window -> display/ * cell -> types/ * opt -> types/
* color: fix parseLegacyColor bugsbptato2023-09-131-6/+10
| | | | | | * lower-case the input string. * do not fall back to black on error. (i.e. remove the special cased parseLegacyColor0 in cascade)
* config: allow modification through JSbptato2023-08-271-9/+12
| | | | | | | This used to be possible until I moved everything under separate headers to their respective objects. Now it works again, mostly; modification of some attributes is still missing.
* Move HTML parsing into Chamebptato2023-08-151-1/+2
| | | | Operation "modularize Chawan somewhat" part 2
* css: very minor optimizationsbptato2023-07-281-5/+5
| | | | probably insignificant overall
* Fix bug in media-query parsingbptato2023-07-041-6/+16
| | | | This fixes interpretation of "@media (min/max-width: 1234px)".