diff --git a/components/layout/flow.rs b/components/layout/flow.rs index f4c545ec730..a2a05761438 100644 --- a/components/layout/flow.rs +++ b/components/layout/flow.rs @@ -765,6 +765,10 @@ impl<'a> Iterator for AbsoluteDescendantIter<'a> { fn next(&mut self) -> Option<&'a mut Flow> { self.iter.next().map(|info| FlowRef::deref_mut(&mut info.flow)) } + + fn size_hint(&self) -> (usize, Option) { + self.iter.size_hint() + } } pub type AbsoluteDescendantOffsetIter<'a> = Zip, IterMut<'a, Au>>; diff --git a/components/layout/inline.rs b/components/layout/inline.rs index f07943fd321..c38693c3340 100644 --- a/components/layout/inline.rs +++ b/components/layout/inline.rs @@ -979,6 +979,10 @@ impl InlineFlow { self.iter.next() } } + + fn size_hint(&self) -> (usize, Option) { + self.iter.size_hint() + } } // If the bidi embedding direction is opposite the layout direction, lay out this diff --git a/components/script/dom/htmlselectelement.rs b/components/script/dom/htmlselectelement.rs index fd5a864862a..9db95316297 100755 --- a/components/script/dom/htmlselectelement.rs +++ b/components/script/dom/htmlselectelement.rs @@ -440,4 +440,12 @@ impl Iterator for Choice3 Choice3::Third(ref mut k) => k.next(), } } + + fn size_hint(&self) -> (usize, Option) { + match *self { + Choice3::First(ref i) => i.size_hint(), + Choice3::Second(ref j) => j.size_hint(), + Choice3::Third(ref k) => k.size_hint(), + } + } } diff --git a/components/script/dom/servoparser/mod.rs b/components/script/dom/servoparser/mod.rs index 241179ed624..d0e08664e73 100644 --- a/components/script/dom/servoparser/mod.rs +++ b/components/script/dom/servoparser/mod.rs @@ -487,6 +487,10 @@ impl Iterator for FragmentParsingResult next.remove_self(); Some(next) } + + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } } #[derive(HeapSizeOf, JSTraceable, PartialEq)] diff --git a/components/style/font_face.rs b/components/style/font_face.rs index c12934a3b06..30eb242a6d4 100644 --- a/components/style/font_face.rs +++ b/components/style/font_face.rs @@ -170,6 +170,10 @@ impl Iterator for EffectiveSources { fn next(&mut self) -> Option { self.0.pop() } + + fn size_hint(&self) -> (usize, Option) { + (self.0.len(), Some(self.0.len())) + } } struct FontFaceRuleParser<'a, 'b: 'a> { diff --git a/components/style/properties/declaration_block.rs b/components/style/properties/declaration_block.rs index a87b87fe9db..15573cc6aef 100644 --- a/components/style/properties/declaration_block.rs +++ b/components/style/properties/declaration_block.rs @@ -99,6 +99,10 @@ impl<'a> Iterator for DeclarationImportanceIterator<'a> { self.iter.next().map(|(decl, important)| (decl, if important { Importance::Important } else { Importance::Normal })) } + + fn size_hint(&self) -> (usize, Option) { + self.iter.size_hint() + } } impl<'a> DoubleEndedIterator for DeclarationImportanceIterator<'a> { diff --git a/components/style/stylesheet_set.rs b/components/style/stylesheet_set.rs index 328237ccbae..4b8b177b554 100644 --- a/components/style/stylesheet_set.rs +++ b/components/style/stylesheet_set.rs @@ -45,6 +45,10 @@ where fn next(&mut self) -> Option { self.0.next().map(|entry| &entry.sheet) } + + fn size_hint(&self) -> (usize, Option) { + self.0.size_hint() + } } /// An iterator over the flattened view of the stylesheet collections. diff --git a/components/style/values/computed/mod.rs b/components/style/values/computed/mod.rs index cad3db03aa7..a6c828b14b8 100644 --- a/components/style/values/computed/mod.rs +++ b/components/style/values/computed/mod.rs @@ -198,6 +198,10 @@ impl<'a, 'cx, 'cx_a: 'cx, S: ToComputedValue + 'a> Iterator for ComputedVecIter< None } } + + fn size_hint(&self) -> (usize, Option) { + (self.values.len(), Some(self.values.len())) + } } /// A trait to represent the conversion between computed and specified values.