mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
compositor: Allow children of layers that don't want scroll events to be
scrolled. Necessary for `overflow: scroll`.
This commit is contained in:
parent
11822f3eb1
commit
fc13dd1169
1 changed files with 6 additions and 7 deletions
|
@ -292,13 +292,7 @@ impl CompositorLayer for Layer<CompositorData> {
|
||||||
delta: TypedPoint2D<LayerPixel, f32>,
|
delta: TypedPoint2D<LayerPixel, f32>,
|
||||||
cursor: TypedPoint2D<LayerPixel, f32>)
|
cursor: TypedPoint2D<LayerPixel, f32>)
|
||||||
-> ScrollEventResult {
|
-> ScrollEventResult {
|
||||||
// If this layer doesn't want scroll events, neither it nor its children can handle scroll
|
// Allow children to scroll.
|
||||||
// events.
|
|
||||||
if self.wants_scroll_events() != WantsScrollEventsFlag::WantsScrollEvents {
|
|
||||||
return ScrollEventResult::ScrollEventUnhandled;
|
|
||||||
}
|
|
||||||
|
|
||||||
//// Allow children to scroll.
|
|
||||||
let scroll_offset = self.extra_data.borrow().scroll_offset;
|
let scroll_offset = self.extra_data.borrow().scroll_offset;
|
||||||
let new_cursor = cursor - scroll_offset;
|
let new_cursor = cursor - scroll_offset;
|
||||||
for child in self.children().iter() {
|
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)
|
self.clamp_scroll_offset_and_scroll_layer(scroll_offset + delta)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue