about summary refs log tree commit diff stats
path: root/src/css
Commit message (Collapse)AuthorAgeFilesLines
...
* 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).
* layout: also propagate xminwidth from table captionbptato2024-12-151-0/+1
| | | | | | | this is necessary too, now that I think of it (well, table caption sizing is still half-broken, but that's a problem for another day...)
* layout: set table intrinsic min width to specified widthbptato2024-12-151-0/+3
|
* layout: do not trust specified table cell heightbptato2024-12-151-3/+4
| | | | | If the contents are larger than the specified cell height, then it is simply ignored.
* dom, css: fix case-insensitive class/id/attr matchingbptato2024-12-154-19/+18
| | | | Uses an additional lower-case map for O(1) case-insensitive comparisons.
* css: align h[1-6] behavior with w3mbptato2024-12-142-0/+6
| | | | | | | | | | | Implemented using proprietary selectors -cha-first-node and -cha-last-node, modeled after -moz-first-node and -moz-last-node. I think they are compatible. That does mean this is more limited than w3m's trimming, e.g. it can't really deal with nesting or empty tags. I think this is fine, as it's mainly meant for unstyled documents in the first place (which are unlikely to have e.g. MAIN tags).
* cascade: misc cleanupbptato2024-12-141-6/+3
|
* lunit: remove redundant codebptato2024-12-132-6/+2
| | | | | | using div instead of / is sort of weird, but it makes it clearer if we're dividing floats or layoutunits (and is already what the code uses).
* css: CSSComputedValue -> CSSValuebptato2024-12-126-109/+109
| | | | | "Computed" was redundant; other types of values don't have a common type.
* layout: small cleanupbptato2024-12-101-60/+60
|
* render: apply visibility to inline boxesbptato2024-12-101-21/+23
|
* layout: override table cell width if its min width is greaterbptato2024-12-101-0/+2
| | | | We can do this now that xminwidth is more accurate.
* layout: proper min width clampingbptato2024-12-101-73/+70
| | | | better
* layout: another min width clamping hackbptato2024-12-101-20/+29
| | | | still not quite right, but it's slowly taking shape
* layout: another xminwidth kludgebptato2024-12-081-0/+4
| | | | yeah idk
* cssparser: misc cleanupbptato2024-12-072-120/+64
| | | | another case of "the object model was unnecessarily complex"
* layout: round inline block padding to cellsbptato2024-12-071-1/+7
| | | | | Seems more compatible with websites that use smaller fonts + padding for styled code tags.
* cssparser: misc cleanupbptato2024-12-051-50/+47
|
* pager, term: use cell offset with kitty imagesbptato2024-12-032-3/+11
| | | | | | | | Gets rid of rounding errors when positioning images. Theoretically this is possible with Sixel too, but as always, it's ten times as difficult to implement as with Kitty, so I'll leave it for later.
* cascade: add cellspacingbptato2024-12-031-0/+7
|