mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
script: Get scroll offsets from layout (#37509)
No longer store scroll offsets for elements in the DOM. Instead consistently get and set these in layout's `ScrollTree`. This more consistently requires layout to run when querying scroll offsets, which ensures that they are up-to-date and properly bounded by scrollable overflow area. Testing: This causes several WPT tests to start passing, and one to start failing. In the case of `/shadow-dom/scroll-to-the-fragment-in-shadow-tree.html`, I believe the issue is that we don't properly handle scrolling and shadow DOM elements. Before, the faulty scrolling was hiding this issue. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
518729a4f5
commit
3774ef00d4
14 changed files with 116 additions and 117 deletions
|
@ -472,6 +472,14 @@ impl Layout for LayoutThread {
|
|||
.scroll_tree
|
||||
.set_all_scroll_offsets(scroll_states);
|
||||
}
|
||||
|
||||
fn scroll_offset(&self, id: ExternalScrollId) -> Option<LayoutVector2D> {
|
||||
self.stacking_context_tree
|
||||
.borrow_mut()
|
||||
.as_mut()
|
||||
.and_then(|tree| tree.compositor_info.scroll_tree.scroll_offset(id))
|
||||
.map(|scroll_offset| -scroll_offset)
|
||||
}
|
||||
}
|
||||
|
||||
impl LayoutThread {
|
||||
|
@ -996,7 +1004,7 @@ impl LayoutThread {
|
|||
.scroll_tree
|
||||
.set_scroll_offset_for_node_with_external_scroll_id(
|
||||
external_scroll_id,
|
||||
offset,
|
||||
-offset,
|
||||
ScrollType::Script,
|
||||
)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue