Introduce the LayoutIterator newtype and return it for all children() methods in style and layout.

This commit is contained in:
Bobby Holley 2016-09-20 17:25:38 -07:00
parent e6bbff110a
commit 4aa3e589c0
4 changed files with 25 additions and 16 deletions

View file

@ -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::{NodeInfo, PresentationalHintsSynthetizer, TNode};
use style::dom::{LayoutIterator, NodeInfo, PresentationalHintsSynthetizer, TNode};
use style::dom::OpaqueNode;
use style::properties::ServoComputedValues;
use style::refcell::{Ref, RefCell};
@ -81,10 +81,10 @@ pub trait LayoutNode: TNode {
fn init_style_and_layout_data(&self, data: OpaqueStyleAndLayoutData);
fn get_style_and_layout_data(&self) -> Option<OpaqueStyleAndLayoutData>;
fn rev_children(self) -> ReverseChildrenIterator<Self> {
ReverseChildrenIterator {
fn rev_children(self) -> LayoutIterator<ReverseChildrenIterator<Self>> {
LayoutIterator(ReverseChildrenIterator {
current: self.last_child(),
}
})
}
fn traverse_preorder(self) -> TreeIterator<Self> {
@ -169,7 +169,7 @@ pub trait ThreadSafeLayoutNode: Clone + Copy + NodeInfo + PartialEq + Sized {
fn debug_id(self) -> usize;
/// Returns an iterator over this node's children.
fn children(&self) -> Self::ChildrenIterator;
fn children(&self) -> LayoutIterator<Self::ChildrenIterator>;
/// If this is an element, accesses the element data. Fails if this is not an element node.
#[inline]