diff options
author | Anthony Ramine <nox@nox.paris> | 2020-04-07 13:13:33 +0200 |
---|---|---|
committer | Anthony Ramine <nox@nox.paris> | 2020-04-07 14:34:47 +0200 |
commit | c10e8399246e5254a080c2dc809d1c180f06cc93 (patch) | |
tree | 886801861030bfd2ff6f4f5ac146f61526d1d28f /components/script/devtools.rs | |
parent | 030a1cf8fb040155ca4c5a414f6e2ca01f7574ad (diff) | |
download | servo-c10e8399246e5254a080c2dc809d1c180f06cc93.tar.gz servo-c10e8399246e5254a080c2dc809d1c180f06cc93.zip |
Don't go through the layout thread to retrieve a node's primary style
Diffstat (limited to 'components/script/devtools.rs')
-rw-r--r-- | components/script/devtools.rs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/components/script/devtools.rs b/components/script/devtools.rs index 2298883c555..49d855ff20f 100644 --- a/components/script/devtools.rs +++ b/components/script/devtools.rs @@ -15,7 +15,6 @@ use crate::dom::document::AnimationFrameCallback; use crate::dom::element::Element; use crate::dom::globalscope::GlobalScope; use crate::dom::node::{window_from_node, Node, ShadowIncluding}; -use crate::dom::window::Window; use crate::realms::enter_realm; use crate::script_thread::Documents; use devtools_traits::{AutoMargins, ComputedNodeLayout, TimelineMarkerType}; @@ -150,7 +149,7 @@ pub fn handle_get_layout( position: String::from(computed_style.Position()), zIndex: String::from(computed_style.ZIndex()), boxSizing: String::from(computed_style.BoxSizing()), - autoMargins: determine_auto_margins(&window, &*node), + autoMargins: determine_auto_margins(&node), marginTop: String::from(computed_style.MarginTop()), marginRight: String::from(computed_style.MarginRight()), marginBottom: String::from(computed_style.MarginBottom()), @@ -169,8 +168,8 @@ pub fn handle_get_layout( .unwrap(); } -fn determine_auto_margins(window: &Window, node: &Node) -> AutoMargins { - let style = window.style_query(node.to_trusted_node_address()).unwrap(); +fn determine_auto_margins(node: &Node) -> AutoMargins { + let style = node.style().unwrap(); let margin = style.get_margin(); AutoMargins { top: margin.margin_top.is_auto(), |