aboutsummaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
authorBobby Holley <bobbyholley@gmail.com>2015-11-24 15:02:15 -0800
committerBobby Holley <bobbyholley@gmail.com>2015-11-28 18:01:02 -0800
commit3aeaff35deb012860fa7afa5861cc76b6c4098bb (patch)
tree09b1906189550865fa23e73514018537ce7ef531 /components
parent2cfe4de09b8efeeb5c60d718db5fb494769c6fdd (diff)
downloadservo-3aeaff35deb012860fa7afa5861cc76b6c4098bb.tar.gz
servo-3aeaff35deb012860fa7afa5861cc76b6c4098bb.zip
Switch ChildrenIterator to be an associated type.
If we use ThreadsafeLayoutNodeChildrenIterator directly as the return type of children(), we need to export the DangerousThreadSafeLayoutNode which the iterator implementation relies upon.
Diffstat (limited to 'components')
-rw-r--r--components/layout/wrapper.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/components/layout/wrapper.rs b/components/layout/wrapper.rs
index b26bd79d95d..0a31ccfc429 100644
--- a/components/layout/wrapper.rs
+++ b/components/layout/wrapper.rs
@@ -806,6 +806,7 @@ impl<T> PseudoElementType<T> {
pub trait ThreadSafeLayoutNode<'ln> : Clone + Copy + Sized {
type ConcreteThreadSafeLayoutElement: ThreadSafeLayoutElement<'ln, ConcreteThreadSafeLayoutNode = Self>;
+ type ChildrenIterator: Iterator<Item = Self> + Sized;
/// Converts self into an `OpaqueNode`.
fn opaque(&self) -> OpaqueNode;
@@ -819,7 +820,7 @@ pub trait ThreadSafeLayoutNode<'ln> : Clone + Copy + Sized {
fn flow_debug_id(self) -> usize;
/// Returns an iterator over this node's children.
- fn children(&self) -> ThreadSafeLayoutNodeChildrenIterator<'ln, Self>;
+ fn children(&self) -> Self::ChildrenIterator;
/// If this is an element, accesses the element data. Fails if this is not an element node.
#[inline]
@@ -1022,6 +1023,7 @@ impl<'ln> ServoThreadSafeLayoutNode<'ln> {
impl<'ln> ThreadSafeLayoutNode<'ln> for ServoThreadSafeLayoutNode<'ln> {
type ConcreteThreadSafeLayoutElement = ServoThreadSafeLayoutElement<'ln>;
+ type ChildrenIterator = ThreadSafeLayoutNodeChildrenIterator<'ln, Self>;
fn opaque(&self) -> OpaqueNode {
OpaqueNodeMethods::from_jsmanaged(unsafe { self.get_jsmanaged() })
@@ -1043,7 +1045,7 @@ impl<'ln> ThreadSafeLayoutNode<'ln> for ServoThreadSafeLayoutNode<'ln> {
self.node.flow_debug_id()
}
- fn children(&self) -> ThreadSafeLayoutNodeChildrenIterator<'ln, Self> {
+ fn children(&self) -> Self::ChildrenIterator {
ThreadSafeLayoutNodeChildrenIterator::new(*self)
}