aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/layout/flow.rs4
-rw-r--r--components/layout/flow_list.rs32
-rw-r--r--components/layout/lib.rs1
3 files changed, 7 insertions, 30 deletions
diff --git a/components/layout/flow.rs b/components/layout/flow.rs
index 29102690a4d..2b42957826e 100644
--- a/components/layout/flow.rs
+++ b/components/layout/flow.rs
@@ -31,7 +31,7 @@ use context::LayoutContext;
use display_list_builder::DisplayListBuildState;
use euclid::{Point2D, Rect, Size2D};
use floats::{Floats, SpeculatedFloatPlacement};
-use flow_list::{FlowList, FlowListIterator, MutFlowListIterator};
+use flow_list::{FlowList, MutFlowListIterator};
use flow_ref::{self, FlowRef, WeakFlowRef};
use fragment::{Fragment, FragmentBorderBoxIterator, Overflow, SpecificFragmentInfo};
use gfx::display_list::{ClippingRegion, StackingContext};
@@ -432,7 +432,7 @@ pub fn base<T: ?Sized + Flow>(this: &T) -> &BaseFlow {
}
/// Iterates over the children of this immutable flow.
-pub fn child_iter<'a>(flow: &'a Flow) -> FlowListIterator<'a> {
+pub fn child_iter<'a>(flow: &'a Flow) -> impl Iterator<Item = &'a Flow> {
base(flow).children.iter()
}
diff --git a/components/layout/flow_list.rs b/components/layout/flow_list.rs
index c9bbe0d7cd8..5a5e2281d80 100644
--- a/components/layout/flow_list.rs
+++ b/components/layout/flow_list.rs
@@ -13,10 +13,6 @@ pub struct FlowList {
flows: LinkedList<FlowRef>,
}
-pub struct FlowListIterator<'a> {
- it: linked_list::Iter<'a, FlowRef>,
-}
-
pub struct MutFlowListIterator<'a> {
it: linked_list::IterMut<'a, FlowRef>,
}
@@ -58,10 +54,8 @@ impl FlowList {
/// Provide a forward iterator
#[inline]
- pub fn iter(&self) -> FlowListIterator {
- FlowListIterator {
- it: self.flows.iter(),
- }
+ pub fn iter<'a>(&'a self) -> impl DoubleEndedIterator<Item = &'a Flow> {
+ self.flows.iter().map(|flow| &**flow)
}
/// Provide a forward iterator with mutable references
@@ -74,7 +68,8 @@ impl FlowList {
/// Provide a forward iterator with FlowRef items
#[inline]
- pub fn iter_flow_ref_mut<'a>(&'a mut self) -> linked_list::IterMut<'a, FlowRef> {
+ pub fn iter_flow_ref_mut<'a>(&'a mut self)
+ -> impl DoubleEndedIterator<Item = &'a mut FlowRef> {
self.flows.iter_mut()
}
@@ -98,25 +93,6 @@ impl FlowList {
}
}
-impl<'a> Iterator for FlowListIterator<'a> {
- type Item = &'a Flow;
- #[inline]
- fn next(&mut self) -> Option<&'a Flow> {
- self.it.next().map(|x| &**x)
- }
-
- #[inline]
- fn size_hint(&self) -> (usize, Option<usize>) {
- self.it.size_hint()
- }
-}
-
-impl<'a> DoubleEndedIterator for FlowListIterator<'a> {
- fn next_back(&mut self) -> Option<&'a Flow> {
- self.it.next_back().map(|x| &**x)
- }
-}
-
impl<'a> DoubleEndedIterator for MutFlowListIterator<'a> {
fn next_back(&mut self) -> Option<&'a mut Flow> {
self.it.next_back().map(flow_ref::deref_mut)
diff --git a/components/layout/lib.rs b/components/layout/lib.rs
index 65066b638e0..5991c769b2f 100644
--- a/components/layout/lib.rs
+++ b/components/layout/lib.rs
@@ -4,6 +4,7 @@
#![feature(box_patterns)]
#![feature(box_syntax)]
+#![feature(conservative_impl_trait)]
#![feature(custom_derive)]
#![feature(nonzero)]
#![feature(plugin)]