about summary refs log tree commit diff stats
path: root/src/css
Commit message (Collapse)AuthorAgeFilesLines
* cascade: support nested variablesbptato2025-01-202-78/+77
| | | | ...and refactor applyValue in the process.
* cascade: collapse StyledNode tree into DOMbptato2025-01-206-383/+124
| | | | | We now compute styles on-demand, which is both more efficient and simpler than the convoluted tree diffing logic we previously used.
* dom: CSSStyleDeclaration improvementsbptato2025-01-192-3/+5
| | | | Now getComputedStyle works with pseudo-elements too.
* cascade: simplify RuleListMapbptato2025-01-181-42/+31
| | | | it can be a value type again
* dom, stylednode: move more fields, handle pseudo-element getComputedStylebptato2025-01-184-78/+41
|
* sheet: dedupe tag :is hashesbptato2025-01-171-1/+2
|
* render: fix formatting being lost outside boxes with bgcolorbptato2025-01-171-21/+20
| | | | | | An ancient bug, but the fix seems to be quite simple: stop confusing the last X position before the existing string on the line with the last X position that the new string occupies.
* render: simplify some pointless delete/insert callsbptato2025-01-171-8/+4
|
* stylednode: remove obsolete templatebptato2025-01-171-4/+1
|
* render: overprint existing text when painting backgroundsbptato2025-01-161-9/+29
| | | | | | | | Even if we don't do some z-ordering correctly, it's no excuse to paint boxes incorrectly. It's also extremely annoying when I try to use a menu and text bleeds into the drop-down window.
* css: reduce StyledNode usebptato2025-01-164-55/+59
| | | | | Eventually the tree should be collapsed into the DOM, and StyledNode should be created on the stack.
* cssvalues: serialize quotes, add font-size, opacitybptato2025-01-162-34/+42
| | | | | | | | | | | | font-size isn't very useful, but some scripts assume it exists. opacity: 0 for now is special cased: it inhibits rendering of further boxes. This isn't quite right, as it should just behave as a pseudo visibility: hidden... nonetheless it's quite effective at hiding garbage. (Also, remove incorrect comment - it can be nil if the branch has no variables.)
* cascade: basic CSS variable supportbptato2025-01-163-163/+286
| | | | | | | | | | | and once again, there was light... Well, it barely works, but it's enough to get colors back on most sites. Nested variables aren't supported for now, and shorthand expansion only "works" for `background' (it's a hack). Props to the W3C for introducing the C preprocessor to CSS - I was starting to confuse it with JSSS after calc().
* sheet, selectorparser: fix attr hashing, hash multiple tags in :isbptato2025-01-162-17/+18
|
* cssparser: enumize CSSFunction namebptato2025-01-153-15/+30
|
* layout: truncate inline-block margins as wellbptato2025-01-151-0/+4
|
* cascade, stylednode: remove parent field from StyledNodebptato2025-01-152-128/+134
| | | | | | | | Now StyledNode has an "element" reference, which refers to the element it was derived from. This reduces the object's size, removes the need for casting around the "node" field, and also gets rid of a pointless cycle.
* cascade: fix hasValues filterbptato2025-01-141-6/+5
|
* css: refactor selector parsing & cascading, some work on variablesbptato2025-01-145-198/+252
| | | | | | | | | Untangled some nested arrays to reduce the number of intermediary seqs in cascade, and collapsed the two rule def sorts into just one (per pseudo element). This should make cascading somewhat faster. Also, we now parse variables, but they aren't resolved yet. Probably a seq won't cut it for var lookup...
* cssvalues: set text-decoration to bit, vertical-align to wordbptato2025-01-121-27/+25
| | | | they fit into 8 and 64 bits respectively
* cssvalues: reduce CSSValues sizebptato2025-01-127-262/+323
| | | | | | | | | | | | | | | | * switch from float64 -> float32; other browsers use 32-bit floats too * specify integer size as 32-bit * use NetworkBitmap for background-image value (currently just an invalid dummy value) * remove "none" property & value types CSSValue's payload is always one word (plus another for the type tag). CSSValues keeps its size, but no longer has to heap-alloc + refcount word-sized CSSValues. (On 32-bit systems, CSSValues might actually be larger than before, but I expect it's still a net benefit with the removal of refcounting and the switch to 32-bit floats.)
* cssvalues, sheet: fix quotes parsing, misc cleanupbptato2025-01-122-81/+71
|
* cascade: collapse inited into one arraybptato2025-01-122-32/+30
| | | | less work for memset
* ua.css: improve select renderingbptato2025-01-091-0/+5
| | | | | | | | | Regular select is now rendered as flex, and does not wrap. This gets rid of the pointless whitespace before/after options. multiple still looks weird, but maybe a bit less? Probably we should just render it with pseudo-checkboxes, and drop the special mode from select.nim.
* layout: remove needsReLayoutbptato2025-01-091-7/+3
| | | | we always do 2 passes
* buffer: make iframes clickablebptato2025-01-094-1/+11
| | | | better than nothing
* layout: clear intrinsic minimum block size on shrink-to-fit relayoutbptato2025-01-081-0/+1
| | | | starting to run out of test case names
* cssparser, mediaquery: factor out tflagb, fix a media query bugbptato2025-01-073-54/+43
| | | | @media (grid: 1) works again.
* layout: get rid of flex-direction reverse hackbptato2025-01-072-47/+59
| | | | | This must not be handled by the tree builder, as that needlessly complicates tree caching.
* mediaquery: add serializationbptato2025-01-062-42/+48
| | | | also, reduce the number of types named MediaQueryList by 50%
* env: add media query matchingbptato2025-01-062-52/+59
| | | | | | | In lite mode, it uses default window attributes. Incidentally, this also untangles media query matching from cascade, saving us a forward declaration hack (yay!)
* layout: wrap on inline floats that exceed the line's lengthbptato2025-01-061-4/+4
| | | | | | | In this case, it seems we have to wrap. (It's still not quite there; replace flow-root with inline-box to see another interesting bug...)
* layout, render: establish absolute container with position: stickybptato2025-01-063-19/+13
| | | | We do not support sticky scrolling, but this much should still work.
* layout: fix percentage margins in shrink-to-fitbptato2025-01-051-13/+17
| | | | | | | | Turns out this doesn't work like I thought it does... the second layout is always needed. This probably means that it's possible to layout absolutes during flow after all...
* dom: DOMTokenList fixes/improvementsbptato2025-01-052-2/+2
|
* layout: margin fixesbptato2025-01-052-15/+20
| | | | | | | | * respect flex item starting margin on main axis * pass left margin as offset input too -> fixes some sub-layout cache inconsistencies well, I *think* it does, but I haven't managed to find a case where it changes anything... either way, at least the code is prettier now
* layout: InnerBlockContext -> BlockBuilderContextbptato2025-01-041-65/+65
|
* layout: respect margin-top of root boxbptato2025-01-031-1/+1
|
* LayoutUnit -> LUnitbptato2025-01-034-162/+162
|
* lunit: use saturation arithmeticbptato2024-12-232-23/+76
| | | | | | | I'm not a fan, because it hides bugs. But working around the overflow errors is starting to get unwieldy. On 32-bit systems, we try to use compiler intrinsics as Nim does.
* layout: drop overflow trackingbptato2025-01-032-72/+10
| | | | | It's probably possible to do it in layout, but it's way too hard. Just do it in render.
* Unify PositionStaticLike, update todobptato2025-01-032-6/+0
| | | | | sticky, ruby, writing-mode: lots of complexity for little gain, and the fallback works just as well (if not better)
* layout: implement layoutFlexItem as layoutRootBlockbptato2025-01-021-16/+15
| | | | | | | This way, it benefits from sub-layout caching. Which is great because our flex layout likes to unnecessarily redo item layout... Also, we now account for the bottom margin in flex items.
* layout: cache sub-layoutsbptato2025-01-022-46/+53
| | | | | | | | Only root blocks for now; for non-roots, you'd have to cache exclusions too, and that is a fair bit harder. It isn't very noticable as an optimization, but it's a good first step towards a cached layout.
* layout: ignore general category Me, Mnbptato2025-01-021-1/+6
| | | | | | | | | | I'm not sure if this is the best way. On one hand, it probably breaks text in some languages that cannot be represented in normal form. On the other hand, some terminals may crash on such strange sequences (or worse). I'll just skip them for now, because it's marginally faster than returning 0 from width. We'll see if somebody complains.
* layout, dom: input rendering fixesbptato2025-01-011-1/+1
| | | | | * do not display submit/reset text with empty value * fix erroneous blank placement with white-space: pre on new line
* layout: fix regression in cd069a76ebptato2025-01-011-17/+13
|
* layout: prevent double-clear for flow rootsbptato2025-01-011-11/+20
| | | | I don't like the extra flag, but I don't see a better way.
* layout: add missing StyledNode ref to parent inline boxesbptato2025-01-011-1/+2
| | | | this broke gotoAnchor in some cases
* cascade: prevent blockification for non-inline absolute boxesbptato2024-12-301-4/+8
| | | | The standard says we should blockify. Alas, the standard is lying.