about summary refs log tree commit diff stats
path: root/src/css
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* layout: absolute sizing fixesbptato2024-12-301-4/+16
|
* cascade: inline presentational hint calculationbptato2024-12-301-19/+19
| | | | no need to alloc a seq for this
* layout: fix position: relative for right, bottombptato2024-12-301-4/+2
| | | | | | | They are relative to the box's actual position, not that of the parent: > For relatively positioned boxes, the offset is with respect to the > bottom edge of the box itself.
* dom, cssvalues: add getComputedStylebptato2024-12-302-37/+75
| | | | Only available in "app" mode.
* layout: fix an overflow bugbptato2024-12-301-1/+3
|
* cssvalues: fix length shorthand parsingbptato2024-12-301-1/+1
|
* cssvalues: fix font-weight parsingbptato2024-12-291-2/+2
| | | | | | you can't bisearch an unsorted map... (also, turn on text styling for colored layout tests because it would have caught this)
* layout: fix various padding bugsbptato2024-12-281-32/+26
| | | | | | | | They need some peculiar conditions to manifest, but the logic errors are clear: * padding contributing to intrinsic minimum size wasn't being clamped * inline padding was being applied twice
* env: do not copy attrs, fix screen on clientbptato2024-12-281-5/+5
| | | | Now screen.width etc. works in the pager too.
* layout: fix a flex sizing bugbptato2024-12-271-5/+4
| | | | | it has to accept percentage sizes too for intrinsic size clamping, it seems
* dom: standard querySelector/All; type erase childrenbptato2024-12-271-15/+4
|
* layout: improve intrinsic minimum size calculationbptato2024-12-261-83/+104
| | | | | It's a fair bit more accurate now on flex-heavy pages. Image sizing remains a broken mess.
* buffer: add "app" scripting modebptato2024-12-261-1/+2
| | | | | | | | | | For APIs that cannot be implemented in a privacy-friendly manner. As a start, I've added accurate screen size queries; getComputedStyle, getBoundingClientRect, etc. should follow. (We have a harmless getComputedStyle already, but it's broken.) Probably, things like JS-based scroll belong in here too, but I'm not sure yet. (Perhaps autofocus should be reused instead?)
* layout: resolve percentage width for auto table cellsbptato2024-12-211-9/+14
| | | | | It is still wrong in case the table is too small, but at least it fixes the regression from 0971ad85.
* cascade: actually, it should be inline-blockbptato2024-12-201-1/+1
| | | | what was I expecting
* cascade: blockify on position: absolute or fixedbptato2024-12-201-4/+4
| | | | | | | | | | | | | | Welp, turns out I was overthinking it. CSS does not support inline position: absolute at all, it just blockifies. That does leave us with the question of "why does inline-block behave differently than block?" Especially because both in Gecko and Blink, getComputedStyle for absolute inline-blocks gives me "block", not "inline-block", and yet there is the same difference in rendering when I change the CSS. I first thought it's a quirks mode issue, but standards mode doesn't affect it. Wat.
* box: InlineFragment -> InlineBoxbptato2024-12-203-143/+140
| | | | | | It was named "fragment" mainly because I added it back when there was still a separate InlineBox type and I needed another name. Now InlineBox is gone, and I'm tired of typing fragment.
* cssparser: small refactoringbptato2024-12-201-37/+23
| | | | | | | * isValidEscape was fairly pointless, and occasionally used incorrectly. * "starts with an ident sequence" is normally called on the next 3 codepoints; on the one occasion where it isn't, just hardcode the dash case.
* layout, render: image sizing fixes/workaroundsbptato2024-12-202-12/+16
| | | | | | | | * fix clip for image * switch back img's display to inline * fix image width calculation without specified width/height I'm not 100% sure if this is correct, but it certainly looks better.
* dom: add inline SVG supportbptato2024-12-202-0/+10
|
* layout: apply padding to intrinsic minimum widthbptato2024-12-191-4/+3
|
* layout, render: implement overflow propertybptato2024-12-184-106/+201
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Overflow pretty much requires scrollbars, but those wouldn't work in dump mode, plus of course they would be a pain to implement. So as a simple alternative: * overflow: hidden, clip works as per spec. * overflow: auto, overlay, scroll invert the intrinsic minimum size clamping logic instead of adding a scrollbar. What this concretely means, is that this <pre style="overflow: scroll; height: 1em"> test test test </pre> will, instead of creating a scroll container, just override the specified height. This hack works surprisingly well, because CSS pretty much requires setting height on scroll containers, so authors aren't incentivized to set height on the parent container too (because the contents are already sized appropriately). One issue left is how to deal with overflow: hidden ancestors. For now, I've made it so that it can spill for overflow-x, and always clips on overflow-y, because it's much less likely to bleed into other text horizontally than vertically. But there is definitely room for improvement, e.g. we could track space requested by scrolling children and expand parent boxes based on that.
* match: fix nested hover selectorbptato2024-12-181-1/+2
| | | | | | | I didn't get it right :( true is the default return value, and true + continue should resolve to false.
* match: optimize dependency trackingbptato2024-12-172-39/+78
| | | | | | | | | | | | | | | | | | | This is a bit tricky, but it seems to work. It optimizes selectors in the line of "div :hover" (note the space.) Previously such selectors would add a hover dependency to pretty much every element, and trigger a re-style for all elements that changed their hover status. After this patch, when :hover and friends would return false, they first try to match the element *without* pseudo selectors, and only add their dependencies if the element would match like that. (Notably, it only does this for when :hover is false. Probably it would help somewhat if we checked for the opposite with true too, but I'm not sure how much. For now, I'll keep it like this, and maybe try to further optimize it later.)
* css: add :target pseudo classbptato2024-12-172-0/+5
|
* match: refactor a bitbptato2024-12-172-63/+47
| | | | | Now we use the node index to optimize next/subsequent sibling combinators.
* dom, match: optimize :nth-child, :nth-last-childbptato2024-12-172-33/+45
| | | | | | I want to use it in the UA sheet, so the loop won't cut it. (Also fix a parsing bug that prevented "of" from working.)
* default(T) -> T.default, add some strict defsbptato2024-12-171-6/+6
|
* layout: propagate intrinsic minimum heightbptato2024-12-172-126/+154
| | | | | | | | | | | | Necessary for flex. Previously we just used the actual height, but that didn't account for boxes that size themselves depending on the available height (mainly just images for now). This also irons out intrinsic min width calculation somewhat, squashing several bugs. I hope it works well. It is a significant change in size calculation, so maybe there are still new bugs lurking.
* css: resolve units to px before layoutbptato2024-12-166-219/+217
| | | | Lets us skip a couple pointless multiplications/divisions during layout.
* layout: do not allow canpx for scFitContentbptato2024-12-151-2/+2
| | | | | The test case attached is undefined in CSS 2.1, but css-sizing-3 wants us to just ignore the width property (I think).