diff options
Diffstat (limited to 'components/compositing')
-rw-r--r-- | components/compositing/compositor.rs | 10 | ||||
-rw-r--r-- | components/compositing/compositor_thread.rs | 7 |
2 files changed, 17 insertions, 0 deletions
diff --git a/components/compositing/compositor.rs b/components/compositing/compositor.rs index 71528e8b88a..bfc2fa1abc6 100644 --- a/components/compositing/compositor.rs +++ b/components/compositing/compositor.rs @@ -714,6 +714,16 @@ impl<Window: WindowMethods> IOCompositor<Window> { let _ = sender.send(()); } + (Msg::GetScrollOffset(pipeline_id, layer_id, sender), ShutdownState::NotShuttingDown) => { + match self.find_layer_with_pipeline_and_layer_id(pipeline_id, layer_id) { + Some(ref layer) => { + let typed = layer.extra_data.borrow().scroll_offset; + let _ = sender.send(Point2D::new(typed.x.get(), typed.y.get())); + }, + None => {}, + } + } + // When we are shutting_down, we need to avoid performing operations // such as Paint that may crash because we have begun tearing down // the rest of our resources. diff --git a/components/compositing/compositor_thread.rs b/components/compositing/compositor_thread.rs index fdfd4c633bf..d624e0212a9 100644 --- a/components/compositing/compositor_thread.rs +++ b/components/compositing/compositor_thread.rs @@ -98,6 +98,10 @@ pub fn run_script_listener_thread(compositor_proxy: Box<CompositorProxy + 'stati compositor_proxy.send(Msg::TouchEventProcessed(result)) } + ScriptToCompositorMsg::GetScrollOffset(pid, lid, send) => { + compositor_proxy.send(Msg::GetScrollOffset(pid, lid, send)); + } + ScriptToCompositorMsg::Exited => break, } } @@ -231,6 +235,8 @@ pub enum Msg { MoveTo(Point2D<i32>), /// Resize the window to size ResizeTo(Size2D<u32>), + /// Get scroll offset of a layer + GetScrollOffset(PipelineId, LayerId, IpcSender<Point2D<f32>>), /// A pipeline was shut down. // This message acts as a synchronization point between the constellation, // when it shuts down a pipeline, to the compositor; when the compositor @@ -272,6 +278,7 @@ impl Debug for Msg { Msg::MoveTo(..) => write!(f, "MoveTo"), Msg::ResizeTo(..) => write!(f, "ResizeTo"), Msg::PipelineExited(..) => write!(f, "PipelineExited"), + Msg::GetScrollOffset(..) => write!(f, "GetScrollOffset"), } } } |