diff --git a/components/layout/query.rs b/components/layout/query.rs index 0a35c24e344..c4630f90f9a 100644 --- a/components/layout/query.rs +++ b/components/layout/query.rs @@ -701,10 +701,13 @@ pub(crate) fn process_scroll_parent_query( continue; }; - let (ancestor_style, ancestor_flags) = ancestor_layout_box + let Some((ancestor_style, ancestor_flags)) = ancestor_layout_box .with_base_flat(|base| vec![(base.style.clone(), base.base_fragment_info.flags)]) .first() - .cloned()?; + .cloned() + else { + continue; + }; let is_containing_block = match current_position_value { Position::Static | Position::Relative | Position::Sticky => { diff --git a/tests/wpt/meta/MANIFEST.json b/tests/wpt/meta/MANIFEST.json index 08490dc7f0a..1edd12daeed 100644 --- a/tests/wpt/meta/MANIFEST.json +++ b/tests/wpt/meta/MANIFEST.json @@ -630047,7 +630047,7 @@ ] ], "scrollParent.html": [ - "344ee522ef2664e0b963e79812074f08f343f5bf", + "b1c6898af349691d357a3d39cc8fd8e578612d94", [ null, {} diff --git a/tests/wpt/tests/css/cssom-view/scrollParent.html b/tests/wpt/tests/css/cssom-view/scrollParent.html index 344ee522ef2..b1c6898af34 100644 --- a/tests/wpt/tests/css/cssom-view/scrollParent.html +++ b/tests/wpt/tests/css/cssom-view/scrollParent.html @@ -57,6 +57,10 @@ + +
+
+
@@ -82,6 +86,9 @@ test(() => { assert_equals(fixedContainedByRoot.scrollParent, document.scrolling "scrollParent of fixed element contained within root is document scrolling element."); test(() => { assert_equals(document.body.scrollParent, null); }, "scrollParent of body is null."); - +test(() => { assert_equals(document.documentElement.scrollParent, null); }, + "scrollParent of root is null."); +test(() => { assert_equals(childOfDisplayContents.scrollParent, scroller1); }, + "scrollParent skips ancestors with `display: contents`.");