aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/dom')
-rw-r--r--components/script/dom/window.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs
index 4862cb83c9e..3d6695986ae 100644
--- a/components/script/dom/window.rs
+++ b/components/script/dom/window.rs
@@ -995,13 +995,18 @@ impl Window {
};
// TODO (farodin91): Raise an event to stop the current_viewport
- let size = self.current_viewport.get().size;
- self.current_viewport.set(Rect::new(Point2D::new(Au::from_f32_px(x), Au::from_f32_px(y)), size));
+ self.update_viewport_for_scroll(x, y);
let message = ConstellationMsg::ScrollFragmentPoint(self.pipeline(), layer_id, point, smooth);
self.constellation_chan.send(message).unwrap();
}
+ pub fn update_viewport_for_scroll(&self, x: f32, y: f32) {
+ let size = self.current_viewport.get().size;
+ let new_viewport = Rect::new(Point2D::new(Au::from_f32_px(x), Au::from_f32_px(y)), size);
+ self.current_viewport.set(new_viewport)
+ }
+
pub fn client_window(&self) -> (Size2D<u32>, Point2D<i32>) {
let (send, recv) = ipc::channel::<(Size2D<u32>, Point2D<i32>)>().unwrap();
self.constellation_chan.send(ConstellationMsg::GetClientWindow(send)).unwrap();