layout: Partial support for keyword sizes on preferred cross size (#35682)

This changes `FlexItem::content_cross_size` into `Size<Au>` to preserve
keyword sizes. The calculation of the hypothetical cross size still
ignores them though, that will be addressed in a follow-up.

Also, browsers don't follow the spec and treat a stretch size different
than a stretch alignment: the former stretches to the containing block,
while the latter stretches to the line. This aligns Servo with that
behavior (following the spec would require bigger refactorings), so
`stretches()` is renamed to `stretches_to_line()` for clarity.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
Oriol Brufau 2025-03-04 06:58:46 +01:00 committed by GitHub
parent f3e6e4f04e
commit ff5683680f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 84 additions and 113 deletions

View file

@ -53,15 +53,6 @@
[.test 27]
expected: FAIL
[.test 28]
expected: FAIL
[.test 29]
expected: FAIL
[.test 30]
expected: FAIL
[.test 31]
expected: FAIL
@ -98,6 +89,15 @@
[.test 45]
expected: FAIL
[.test 46]
expected: FAIL
[.test 47]
expected: FAIL
[.test 48]
expected: FAIL
[.test 49]
expected: FAIL
@ -116,24 +116,6 @@
[.test 54]
expected: FAIL
[.test 57]
expected: FAIL
[.test 58]
expected: FAIL
[.test 59]
expected: FAIL
[.test 66]
expected: FAIL
[.test 67]
expected: FAIL
[.test 68]
expected: FAIL
[.test 69]
expected: FAIL

View file

@ -1,28 +1,4 @@
[keyword-sizes-on-flex-item-002.html]
[.test 1]
expected: FAIL
[.test 2]
expected: FAIL
[.test 3]
expected: FAIL
[.test 4]
expected: FAIL
[.test 6]
expected: FAIL
[.test 7]
expected: FAIL
[.test 8]
expected: FAIL
[.test 9]
expected: FAIL
[.test 10]
expected: FAIL

View file

@ -2,6 +2,9 @@
[[data-expected-height\] 8]
expected: FAIL
[[data-expected-height\] 19]
expected: FAIL
[[data-expected-height\] 21]
expected: FAIL
@ -11,6 +14,9 @@
[[data-expected-height\] 31]
expected: FAIL
[[data-expected-height\] 42]
expected: FAIL
[[data-expected-height\] 44]
expected: FAIL

View file

@ -2,17 +2,11 @@
[[data-expected-width\] 8]
expected: FAIL
[[data-expected-width\] 21]
expected: FAIL
[[data-expected-width\] 22]
expected: FAIL
[[data-expected-width\] 31]
expected: FAIL
[[data-expected-width\] 44]
expected: FAIL
[[data-expected-width\] 45]
expected: FAIL