From 06f9a2bc34836bee1cf8376ac8f8c1e985f00971 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Sun, 25 Oct 2015 11:13:56 +0100 Subject: [PATCH] Implement a LayoutNode::new function. --- components/layout/wrapper.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/components/layout/wrapper.rs b/components/layout/wrapper.rs index 61bd20204bb..9a936433d79 100644 --- a/components/layout/wrapper.rs +++ b/components/layout/wrapper.rs @@ -54,6 +54,7 @@ use script::dom::htmltextareaelement::{HTMLTextAreaElement, LayoutHTMLTextAreaEl use script::dom::node::{HAS_CHANGED, HAS_DIRTY_DESCENDANTS, IS_DIRTY}; use script::dom::node::{LayoutNodeHelpers, Node, SharedLayoutData}; use script::dom::text::Text; +use script::layout_interface::TrustedNodeAddress; use selectors::matching::DeclarationBlock; use selectors::parser::{AttrSelector, NamespaceConstraint}; use smallvec::VecLike; @@ -92,6 +93,14 @@ impl<'a> PartialEq for LayoutNode<'a> { } impl<'ln> LayoutNode<'ln> { + pub unsafe fn new(address: &TrustedNodeAddress) -> LayoutNode { + let node = LayoutJS::from_trusted_node_address(*address); + LayoutNode { + node: node, + chain: PhantomData, + } + } + /// Creates a new layout node with the same lifetime as this layout node. pub unsafe fn new_with_this_lifetime(&self, node: &LayoutJS) -> LayoutNode<'ln> { LayoutNode {