diff options
author | Fernando Jiménez Moreno <ferjmoreno@gmail.com> | 2019-01-30 17:15:20 +0100 |
---|---|---|
committer | Fernando Jiménez Moreno <ferjmoreno@gmail.com> | 2019-04-26 10:17:46 +0200 |
commit | be06f1e9b346d16538ddac5dea468f346cb1f18c (patch) | |
tree | 865d3bd1a9566f094c8ca7136a313392f02ba2d4 /components/script/dom/documentorshadowroot.rs | |
parent | 2e5c0584637079889f4ed490b98afe07445f26d5 (diff) | |
download | servo-be06f1e9b346d16538ddac5dea468f346cb1f18c.tar.gz servo-be06f1e9b346d16538ddac5dea468f346cb1f18c.zip |
Always get browsing context from document
Diffstat (limited to 'components/script/dom/documentorshadowroot.rs')
-rw-r--r-- | components/script/dom/documentorshadowroot.rs | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/components/script/dom/documentorshadowroot.rs b/components/script/dom/documentorshadowroot.rs index 91ce83af659..5e413c5cc89 100644 --- a/components/script/dom/documentorshadowroot.rs +++ b/components/script/dom/documentorshadowroot.rs @@ -13,7 +13,6 @@ use crate::dom::htmlelement::HTMLElement; use crate::dom::node; use crate::dom::shadowroot::ShadowRoot; use crate::dom::window::Window; -use crate::dom::windowproxy::WindowProxy; use euclid::Point2D; use js::jsapi::JS_GetRuntime; use script_layout_interface::message::{NodesFromPointQueryType, QueryMsg}; @@ -55,28 +54,16 @@ impl DocumentOrShadowRoot { #[must_root] #[derive(JSTraceable, MallocSizeOf)] pub struct DocumentOrShadowRootImpl { - has_browsing_context: bool, window: Dom<Window>, } impl DocumentOrShadowRootImpl { - pub fn new(window: &Window, has_browsing_context: bool) -> Self { + pub fn new(window: &Window) -> Self { Self { - has_browsing_context, window: Dom::from_ref(window), } } - /// <https://html.spec.whatwg.org/multipage/#concept-document-bc> - #[inline] - pub fn browsing_context(&self) -> Option<DomRoot<WindowProxy>> { - if self.has_browsing_context { - self.window.undiscarded_window_proxy() - } else { - None - } - } - pub fn nodes_from_point( &self, client_point: &Point2D<f32>, @@ -99,13 +86,14 @@ impl DocumentOrShadowRootImpl { x: Finite<f64>, y: Finite<f64>, document_element: Option<DomRoot<Element>>, + has_browsing_context: bool, ) -> Option<DomRoot<Element>> { let x = *x as f32; let y = *y as f32; let point = &Point2D::new(x, y); let viewport = self.window.window_size().initial_viewport; - if self.browsing_context().is_none() { + if has_browsing_context { return None; } @@ -138,13 +126,14 @@ impl DocumentOrShadowRootImpl { x: Finite<f64>, y: Finite<f64>, document_element: Option<DomRoot<Element>>, + has_browsing_context: bool, ) -> Vec<DomRoot<Element>> { let x = *x as f32; let y = *y as f32; let point = &Point2D::new(x, y); let viewport = self.window.window_size().initial_viewport; - if self.browsing_context().is_none() { + if has_browsing_context { return vec![]; } |