From e4db0715e1c662be77f41fe960296ab723f33557 Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Mon, 25 Jan 2016 16:40:16 -0800 Subject: [PATCH] Dispatch scroll events to layers above others. Closes #9416. --- components/compositing/compositor_layer.rs | 2 +- tests/html/iframe-scroll-stacking.html | 27 ++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 tests/html/iframe-scroll-stacking.html diff --git a/components/compositing/compositor_layer.rs b/components/compositing/compositor_layer.rs index 9c7d567c43a..9e2b47a5c08 100644 --- a/components/compositing/compositor_layer.rs +++ b/components/compositing/compositor_layer.rs @@ -317,7 +317,7 @@ impl CompositorLayer for Layer { // Allow children to scroll. let scroll_offset = self.extra_data.borrow().scroll_offset; let new_cursor = cursor - scroll_offset; - for child in &*self.children() { + for child in self.children().iter().rev() { let child_bounds = child.bounds.borrow(); if child_bounds.contains(&new_cursor) { let result = child.handle_scroll_event(delta, new_cursor - child_bounds.origin); diff --git a/tests/html/iframe-scroll-stacking.html b/tests/html/iframe-scroll-stacking.html new file mode 100644 index 00000000000..a554bede526 --- /dev/null +++ b/tests/html/iframe-scroll-stacking.html @@ -0,0 +1,27 @@ + + + + +