From 0db02702e78fe435ef489c28593bd71a0fc32b76 Mon Sep 17 00:00:00 2001 From: Martin Robinson Date: Tue, 8 Jul 2025 21:27:42 +0200 Subject: [PATCH] layout: When setting post-layout / renderer scroll offsets limit by scroll area (#37829) Previously when scroll offsets were restored to a new scroll tree post-layout or when receiving scroll offsets from the compositor, they were not clamped to the available scroll area. This change fixes that. Testing: This change fixes some WPT subtests. Signed-off-by: Martin Robinson --- components/shared/compositing/display_list.rs | 2 +- ...ll-to-the-fragment-in-shadow-tree.html.ini | 27 ------------------- 2 files changed, 1 insertion(+), 28 deletions(-) delete mode 100644 tests/wpt/meta/shadow-dom/scroll-to-the-fragment-in-shadow-tree.html.ini diff --git a/components/shared/compositing/display_list.rs b/components/shared/compositing/display_list.rs index 60692a9d913..ed4cc24cccc 100644 --- a/components/shared/compositing/display_list.rs +++ b/components/shared/compositing/display_list.rs @@ -397,7 +397,7 @@ impl ScrollTree { for node in self.nodes.iter_mut() { if let SpatialTreeNodeInfo::Scroll(ref mut scroll_info) = node.info { if let Some(offset) = offsets.get(&scroll_info.external_id) { - scroll_info.offset = *offset; + scroll_info.scroll_to_offset(*offset, ScrollType::Script); } } } diff --git a/tests/wpt/meta/shadow-dom/scroll-to-the-fragment-in-shadow-tree.html.ini b/tests/wpt/meta/shadow-dom/scroll-to-the-fragment-in-shadow-tree.html.ini deleted file mode 100644 index 35aabf27d67..00000000000 --- a/tests/wpt/meta/shadow-dom/scroll-to-the-fragment-in-shadow-tree.html.ini +++ /dev/null @@ -1,27 +0,0 @@ -[scroll-to-the-fragment-in-shadow-tree.html] - [The user agent scroll to the fragment when there is an anchor element with a name attribute exactly equal to the decoded fragid] - expected: FAIL - - [The user agent should not scroll to an element with an ID exactly equal to the decoded fragid in an open shadow tree] - expected: FAIL - - [The user agent should not scroll to an element with an ID exactly equal to the decoded fragid in a closed shadow tree] - expected: FAIL - - [The user agent should not scroll to an anchor element with a name attribute exactly equal to the decoded fragid in an open shadow tree] - expected: FAIL - - [The user agent should not scroll to an anchor element with a name attribute exactly equal to the decoded fragid in a closed shadow tree] - expected: FAIL - - [The user agent should scroll to an element with an ID exactly equal to the decoded fragid in the document tree even if there was another element with the same ID inside an open shadow tree earlier in tree order] - expected: FAIL - - [The user agent should scroll to an element with an ID exactly equal to the decoded fragid in the document tree even if there was another element with the same ID inside a closed shadow tree earlier in tree order] - expected: FAIL - - [The user agent should scroll to an anchor element with a name attribute exactly equal to the decoded fragid in the document tree even if there was another element with the same ID inside an open shadow tree earlier in tree order] - expected: FAIL - - [The user agent should scroll to an anchor element with a name attribute exactly equal to the decoded fragid in the document tree even if there was another element with the same ID inside a closed shadow tree earlier in tree order] - expected: FAIL