From fc13dd11698524b2b332ad4579fb377a8324248f Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Fri, 7 Aug 2015 18:08:08 -0700 Subject: [PATCH] compositor: Allow children of layers that don't want scroll events to be scrolled. Necessary for `overflow: scroll`. --- components/compositing/compositor_layer.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/components/compositing/compositor_layer.rs b/components/compositing/compositor_layer.rs index 707b7ce06b6..302ac340f09 100644 --- a/components/compositing/compositor_layer.rs +++ b/components/compositing/compositor_layer.rs @@ -292,13 +292,7 @@ impl CompositorLayer for Layer { delta: TypedPoint2D, cursor: TypedPoint2D) -> 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 { } } + // 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) }