compositor: Allow children of layers that don't want scroll events to be

scrolled.

Necessary for `overflow: scroll`.
This commit is contained in:
Patrick Walton 2015-08-07 18:08:08 -07:00
parent 11822f3eb1
commit fc13dd1169

View file

@ -292,13 +292,7 @@ impl CompositorLayer for Layer<CompositorData> {
delta: TypedPoint2D<LayerPixel, f32>,
cursor: TypedPoint2D<LayerPixel, f32>)
-> ScrollEventResult {
// If this layer doesn't want scroll events, neither it nor its children can handle scroll
// events.
if self.wants_scroll_events() != WantsScrollEventsFlag::WantsScrollEvents {
return ScrollEventResult::ScrollEventUnhandled;
}
//// Allow children to scroll.
// Allow children to scroll.
let scroll_offset = self.extra_data.borrow().scroll_offset;
let new_cursor = cursor - scroll_offset;
for child in self.children().iter() {
@ -311,6 +305,11 @@ impl CompositorLayer for Layer<CompositorData> {
}
}
// If this layer doesn't want scroll events, it can't handle scroll events.
if self.wants_scroll_events() != WantsScrollEventsFlag::WantsScrollEvents {
return ScrollEventResult::ScrollEventUnhandled;
}
self.clamp_scroll_offset_and_scroll_layer(scroll_offset + delta)
}