layout: Paint flex and grid items like inline blocks (#38574)

As specified in https://drafts.csswg.org/css-flexbox-1/#painting and
https://drafts.csswg.org/css-grid/#z-order

Testing: Makes some WPT pass.
Fixes: #38573

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
Oriol Brufau 2025-08-09 10:42:12 -07:00 committed by GitHub
parent 7b057be780
commit c49d53b8dd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 6 additions and 28 deletions

View file

@ -930,7 +930,8 @@ struct OverflowFrameData {
impl BoxFragment {
fn get_stacking_context_type(&self) -> Option<StackingContextType> {
if self.style.establishes_stacking_context(self.base.flags) {
let flags = self.base.flags;
if self.style.establishes_stacking_context(flags) {
return Some(StackingContextType::RealStackingContext);
}
@ -943,7 +944,10 @@ impl BoxFragment {
return Some(StackingContextType::FloatStackingContainer);
}
if self.is_atomic_inline_level() {
// Flex and grid items are painted like inline blocks.
// <https://drafts.csswg.org/css-flexbox-1/#painting>
// <https://drafts.csswg.org/css-grid/#z-order>
if self.is_atomic_inline_level() || flags.contains(FragmentFlags::IS_FLEX_OR_GRID_ITEM) {
return Some(StackingContextType::AtomicInlineStackingContainer);
}

View file

@ -1,2 +0,0 @@
[flexbox-items-as-stacking-contexts-002.html]
expected: FAIL

View file

@ -1,3 +0,0 @@
[flexbox-mbp-horiz-003-reverse.xhtml]
expected:
if os == "linux": FAIL

View file

@ -1,3 +0,0 @@
[flexbox-mbp-horiz-003.xhtml]
expected:
if os == "linux": FAIL

View file

@ -1,3 +0,0 @@
[flexbox-mbp-horiz-003v.xhtml]
expected:
if os == "linux": FAIL

View file

@ -1,4 +0,0 @@
[hittest-overlapping-margin.html]
[Flexboxes should perform hit testing in reverse paint order for overlapping elements: negative margin case (crbug.com/844505)]
expected: FAIL

View file

@ -1,4 +0,0 @@
[hittest-overlapping-order.html]
[Flexboxes should perform hit testing in reverse paint order for overlapping elements: flex order case (crbug.com/844505)]
expected: FAIL

View file

@ -1,2 +0,0 @@
[grid-inline-items-inline-blocks-001.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[grid-items-inline-blocks-001.html]
expected: FAIL

View file

@ -1,3 +0,0 @@
[grid-item-hit-test.html]
[grid-item-hit-test]
expected: FAIL