mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
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.
This commit is contained in:
parent
2cfe4de09b
commit
3aeaff35de
1 changed files with 4 additions and 2 deletions
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue