diff options
Diffstat (limited to 'components/script')
-rw-r--r-- | components/script/dom/document.rs | 6 | ||||
-rw-r--r-- | components/script/dom/window.rs | 23 |
2 files changed, 12 insertions, 17 deletions
diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index bce898e6347..e44de8be727 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -1955,12 +1955,8 @@ impl Document { } pub fn nodes_from_point(&self, client_point: &Point2D<f32>) -> Vec<UntrustedNodeAddress> { - let page_point = - Point2D::new(client_point.x + self.window.PageXOffset() as f32, - client_point.y + self.window.PageYOffset() as f32); - if !self.window.reflow(ReflowGoal::ForScriptQuery, - ReflowQueryType::NodesFromPoint(page_point, *client_point), + ReflowQueryType::NodesFromPoint(*client_point), ReflowReason::Query) { return vec!(); }; diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs index 4317d2890b7..65d1a591adc 100644 --- a/components/script/dom/window.rs +++ b/components/script/dom/window.rs @@ -75,11 +75,11 @@ use script_layout_interface::rpc::{ContentBoxResponse, ContentBoxesResponse, Lay use script_layout_interface::rpc::{MarginStyleResponse, NodeScrollRootIdResponse}; use script_layout_interface::rpc::{ResolvedStyleResponse, TextIndexResponse}; use script_runtime::{CommonScriptMsg, ScriptChan, ScriptPort, ScriptThreadEventCategory}; -use script_thread::{MainThreadScriptChan, MainThreadScriptMsg, Runnable, RunnableWrapper}; -use script_thread::{SendableMainThreadScriptChan, ImageCacheMsg, ScriptThread}; -use script_traits::{ConstellationControlMsg, LoadData, MozBrowserEvent, UntrustedNodeAddress}; -use script_traits::{DocumentState, TimerEvent, TimerEventId}; -use script_traits::{ScriptMsg as ConstellationMsg, TimerSchedulerMsg, WindowSizeData, WindowSizeType}; +use script_thread::{ImageCacheMsg, MainThreadScriptChan, MainThreadScriptMsg, Runnable}; +use script_thread::{RunnableWrapper, ScriptThread, SendableMainThreadScriptChan}; +use script_traits::{ConstellationControlMsg, DocumentState, LoadData, MozBrowserEvent}; +use script_traits::{ScriptMsg as ConstellationMsg, ScrollState, TimerEvent, TimerEventId}; +use script_traits::{TimerSchedulerMsg, UntrustedNodeAddress, WindowSizeData, WindowSizeType}; use script_traits::webdriver_msg::{WebDriverJSError, WebDriverJSResult}; use servo_atoms::Atom; use servo_config::opts; @@ -1111,6 +1111,11 @@ impl Window { ScrollBehavior::Smooth => true }; + self.layout_chan.send(Msg::UpdateScrollStateFromScript(ScrollState { + scroll_root_id: scroll_root_id, + scroll_offset: Point2D::new(-x, -y), + })).unwrap(); + // TODO (farodin91): Raise an event to stop the current_viewport self.update_viewport_for_scroll(x, y); @@ -1372,14 +1377,8 @@ impl Window { client_point: Point2D<f32>, update_cursor: bool) -> Option<UntrustedNodeAddress> { - let translated_point = - Point2D::new(client_point.x + self.PageXOffset() as f32, - client_point.y + self.PageYOffset() as f32); - if !self.reflow(ReflowGoal::ForScriptQuery, - ReflowQueryType::HitTestQuery(translated_point, - client_point, - update_cursor), + ReflowQueryType::HitTestQuery(client_point, update_cursor), ReflowReason::Query) { return None } |