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:
Martin Robinson 2014-09-23 16:53:50 -07:00
parent f346a215f3
commit 65c6689bcc

View file

@ -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;