diff options
author | Bobby Holley <bobbyholley@gmail.com> | 2016-09-20 16:51:48 -0700 |
---|---|---|
committer | Bobby Holley <bobbyholley@gmail.com> | 2016-09-20 17:16:27 -0700 |
commit | e6bbff110a017019ac31cf0700b1e722d8a1c61b (patch) | |
tree | efb5493ebd4a202c1c53b40bf785b8b00becfc16 /components/script_layout_interface | |
parent | 66c736194d1a6d3af1303a070aa96fec4534187c (diff) | |
download | servo-e6bbff110a017019ac31cf0700b1e722d8a1c61b.tar.gz servo-e6bbff110a017019ac31cf0700b1e722d8a1c61b.zip |
Split out is_element and is_text_node into a helper trait.
Diffstat (limited to 'components/script_layout_interface')
-rw-r--r-- | components/script_layout_interface/wrapper_traits.rs | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/components/script_layout_interface/wrapper_traits.rs b/components/script_layout_interface/wrapper_traits.rs index 20ddca94cf4..51133fc2daf 100644 --- a/components/script_layout_interface/wrapper_traits.rs +++ b/components/script_layout_interface/wrapper_traits.rs @@ -15,7 +15,7 @@ use std::sync::Arc; use string_cache::{Atom, Namespace}; use style::computed_values::display; use style::context::SharedStyleContext; -use style::dom::{PresentationalHintsSynthetizer, TNode}; +use style::dom::{NodeInfo, PresentationalHintsSynthetizer, TNode}; use style::dom::OpaqueNode; use style::properties::ServoComputedValues; use style::refcell::{Ref, RefCell}; @@ -137,7 +137,7 @@ impl<ConcreteNode> Iterator for TreeIterator<ConcreteNode> /// A thread-safe version of `LayoutNode`, used during flow construction. This type of layout /// node does not allow any parents or siblings of nodes to be accessed, to avoid races. -pub trait ThreadSafeLayoutNode: Clone + Copy + Sized + PartialEq { +pub trait ThreadSafeLayoutNode: Clone + Copy + NodeInfo + PartialEq + Sized { type ConcreteThreadSafeLayoutElement: ThreadSafeLayoutElement<ConcreteThreadSafeLayoutNode = Self> + ::selectors::Element<Impl=ServoSelectorImpl>; @@ -171,9 +171,6 @@ pub trait ThreadSafeLayoutNode: Clone + Copy + Sized + PartialEq { /// Returns an iterator over this node's children. fn children(&self) -> Self::ChildrenIterator; - #[inline] - fn is_element(&self) -> bool { if let Some(LayoutNodeType::Element(_)) = self.type_id() { true } else { false } } - /// If this is an element, accesses the element data. Fails if this is not an element node. #[inline] fn as_element(&self) -> Self::ConcreteThreadSafeLayoutElement; |