diff options
Diffstat (limited to 'components/script')
-rw-r--r-- | components/script/dom/document.rs | 6 | ||||
-rw-r--r-- | components/script/dom/element.rs | 4 | ||||
-rw-r--r-- | components/script/dom/window.rs | 23 | ||||
-rw-r--r-- | components/script/layout_wrapper.rs | 6 |
4 files changed, 17 insertions, 22 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/element.rs b/components/script/dom/element.rs index aa32370127c..91ea1435302 100644 --- a/components/script/dom/element.rs +++ b/components/script/dom/element.rs @@ -85,7 +85,7 @@ use net_traits::request::CorsSettings; use ref_filter_map::ref_filter_map; use script_layout_interface::message::ReflowQueryType; use script_thread::Runnable; -use selectors::matching::{ElementSelectorFlags, StyleRelations, matches_selector_list}; +use selectors::matching::{ElementSelectorFlags, MatchingContext, matches_selector_list}; use selectors::matching::{HAS_EDGE_CHILD_SELECTOR, HAS_SLOW_SELECTOR, HAS_SLOW_SELECTOR_LATER_SIBLINGS}; use selectors::parser::{AttrSelector, NamespaceConstraint}; use servo_atoms::Atom; @@ -2414,7 +2414,7 @@ impl<'a> ::selectors::Element for Root<Element> { fn match_non_ts_pseudo_class<F>(&self, pseudo_class: &NonTSPseudoClass, - _: &mut StyleRelations, + _: &mut MatchingContext, _: &mut F) -> bool where F: FnMut(&Self, ElementSelectorFlags), 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 } diff --git a/components/script/layout_wrapper.rs b/components/script/layout_wrapper.rs index 3d4b90eaeab..5cea48786e3 100644 --- a/components/script/layout_wrapper.rs +++ b/components/script/layout_wrapper.rs @@ -50,7 +50,7 @@ use script_layout_interface::{HTMLCanvasData, LayoutNodeType, SVGSVGData, Truste use script_layout_interface::{OpaqueStyleAndLayoutData, PartialPersistentLayoutData}; use script_layout_interface::wrapper_traits::{DangerousThreadSafeLayoutNode, GetLayoutData, LayoutNode}; use script_layout_interface::wrapper_traits::{PseudoElementType, ThreadSafeLayoutElement, ThreadSafeLayoutNode}; -use selectors::matching::{ElementSelectorFlags, StyleRelations}; +use selectors::matching::{ElementSelectorFlags, MatchingContext}; use selectors::parser::{AttrSelector, NamespaceConstraint}; use servo_atoms::Atom; use servo_url::ServoUrl; @@ -654,7 +654,7 @@ impl<'le> ::selectors::Element for ServoLayoutElement<'le> { fn match_non_ts_pseudo_class<F>(&self, pseudo_class: &NonTSPseudoClass, - _: &mut StyleRelations, + _: &mut MatchingContext, _: &mut F) -> bool where F: FnMut(&Self, ElementSelectorFlags), @@ -1152,7 +1152,7 @@ impl<'le> ::selectors::Element for ServoThreadSafeLayoutElement<'le> { fn match_non_ts_pseudo_class<F>(&self, _: &NonTSPseudoClass, - _: &mut StyleRelations, + _: &mut MatchingContext, _: &mut F) -> bool where F: FnMut(&Self, ElementSelectorFlags), |