mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Compound scrolling offsets when setting content offset
When traversing the layer tree to assign content offset, the new offset needs to take into account any additional offset from children that are also scrolling roots. This means that when you scroll a parent frame, it doesn't override the scroll position of its children, but adds to it.
This commit is contained in:
parent
f346a215f3
commit
65c6689bcc
1 changed files with 2 additions and 1 deletions
|
@ -143,8 +143,9 @@ fn scroll_layer_and_all_child_layers(layer: Rc<Layer<CompositorData>>,
|
|||
result = true
|
||||
}
|
||||
|
||||
let offset_for_children = new_offset + layer.extra_data.borrow().scroll_offset;
|
||||
for child in layer.children().iter() {
|
||||
result |= scroll_layer_and_all_child_layers(child.clone(), new_offset);
|
||||
result |= scroll_layer_and_all_child_layers(child.clone(), offset_for_children);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue