Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

layout: Implement basic `overflow: scroll` functionality. #7090

Merged
merged 6 commits into from Aug 11, 2015

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

scrolled.

Necessary for `overflow: scroll`.
  • Loading branch information
pcwalton committed Aug 11, 2015
commit fc13dd11698524b2b332ad4579fb377a8324248f
@@ -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)
}

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.