diff options
Diffstat (limited to 'components/layout')
-rw-r--r-- | components/layout/animation.rs | 5 | ||||
-rw-r--r-- | components/layout/construct.rs | 4 | ||||
-rw-r--r-- | components/layout/css/matching.rs | 12 | ||||
-rw-r--r-- | components/layout/data.rs | 2 | ||||
-rw-r--r-- | components/layout/display_list_builder.rs | 3 | ||||
-rw-r--r-- | components/layout/flow.rs | 2 | ||||
-rw-r--r-- | components/layout/fragment.rs | 9 | ||||
-rw-r--r-- | components/layout/generated_content.rs | 6 | ||||
-rw-r--r-- | components/layout/incremental.rs | 3 | ||||
-rw-r--r-- | components/layout/inline.rs | 23 | ||||
-rw-r--r-- | components/layout/layout_task.rs | 7 | ||||
-rw-r--r-- | components/layout/table.rs | 13 | ||||
-rw-r--r-- | components/layout/table_colgroup.rs | 2 | ||||
-rw-r--r-- | components/layout/table_row.rs | 3 | ||||
-rw-r--r-- | components/layout/table_wrapper.rs | 3 | ||||
-rw-r--r-- | components/layout/wrapper.rs | 2 |
16 files changed, 45 insertions, 54 deletions
diff --git a/components/layout/animation.rs b/components/layout/animation.rs index a3f27267c00..f22865592c3 100644 --- a/components/layout/animation.rs +++ b/components/layout/animation.rs @@ -60,7 +60,7 @@ pub fn process_new_animations(rw_data: &mut LayoutTaskData, pipeline_id: Pipelin // Expire old running animations. let now = clock_ticks::precise_time_s(); - for (_, running_animations) in running_animations.iter_mut() { + for (_, running_animations) in &mut running_animations { running_animations.retain(|running_animation| now < running_animation.end_time); } @@ -97,7 +97,7 @@ pub fn recalc_style_for_animations(flow: &mut Flow, let mut damage = RestyleDamage::empty(); flow.mutate_fragments(&mut |fragment| { if let Some(ref animations) = animations.get(&OpaqueNode(fragment.node.id())) { - for animation in animations.iter() { + for animation in *animations { let now = clock_ticks::precise_time_s(); let mut progress = (now - animation.start_time) / animation.duration(); if progress > 1.0 { @@ -130,4 +130,3 @@ pub fn tick_all_animations(layout_task: &LayoutTask, rw_data: &mut LayoutTaskDat layout_task.script_chan.send(ConstellationControlMsg::TickAllAnimations(layout_task.id)).unwrap(); } - diff --git a/components/layout/construct.rs b/components/layout/construct.rs index e8a1167a4fc..a918e35463b 100644 --- a/components/layout/construct.rs +++ b/components/layout/construct.rs @@ -438,7 +438,7 @@ impl<'a> FlowConstructor<'a> { // Build a list of all the inline-block fragments before fragments is moved. let mut inline_block_flows = vec!(); - for fragment in fragments.fragments.iter() { + for fragment in &fragments.fragments { match fragment.specific { SpecificFragmentInfo::InlineBlock(ref info) => { inline_block_flows.push(info.flow_ref.clone()) @@ -464,7 +464,7 @@ impl<'a> FlowConstructor<'a> { node.style().writing_mode)); // Add all the inline-block fragments as children of the inline flow. - for inline_block_flow in inline_block_flows.iter() { + for inline_block_flow in &inline_block_flows { inline_flow_ref.add_new_child(inline_block_flow.clone()); } diff --git a/components/layout/css/matching.rs b/components/layout/css/matching.rs index 62315fb26e2..1392fea7067 100644 --- a/components/layout/css/matching.rs +++ b/components/layout/css/matching.rs @@ -108,7 +108,7 @@ impl<'a> PartialEq for ApplicableDeclarationsCacheQuery<'a> { if self.declarations.len() != other.declarations.len() { return false } - for (this, other) in self.declarations.iter().zip(other.declarations.iter()) { + for (this, other) in self.declarations.iter().zip(other.declarations) { if !arc_ptr_eq(&this.declarations, &other.declarations) { return false } @@ -127,7 +127,7 @@ impl<'a> PartialEq<ApplicableDeclarationsCacheEntry> for ApplicableDeclarationsC impl<'a> Hash for ApplicableDeclarationsCacheQuery<'a> { fn hash<H: Hasher>(&self, state: &mut H) { - for declaration in self.declarations.iter() { + for declaration in self.declarations { let ptr: usize = unsafe { mem::transmute_copy(declaration) }; @@ -173,7 +173,7 @@ pub struct StyleSharingCandidateCache { fn create_common_style_affecting_attributes_from_element(element: &LayoutElement) -> CommonStyleAffectingAttributes { let mut flags = CommonStyleAffectingAttributes::empty(); - for attribute_info in common_style_affecting_attributes().iter() { + for attribute_info in &common_style_affecting_attributes() { match attribute_info.mode { CommonStyleAffectingAttributeMode::IsPresent(flag) => { if element.get_attr(&ns!(""), &attribute_info.atom).is_some() { @@ -295,7 +295,7 @@ impl StyleSharingCandidate { // FIXME(pcwalton): It's probably faster to iterate over all the element's attributes and // use the {common, rare}-style-affecting-attributes tables as lookup tables. - for attribute_info in common_style_affecting_attributes().iter() { + for attribute_info in &common_style_affecting_attributes() { match attribute_info.mode { CommonStyleAffectingAttributeMode::IsPresent(flag) => { if self.common_style_affecting_attributes.contains(flag) != @@ -322,7 +322,7 @@ impl StyleSharingCandidate { } } - for attribute_name in rare_style_affecting_attributes().iter() { + for attribute_name in &rare_style_affecting_attributes() { if element.get_attr(&ns!(""), attribute_name).is_some() { return false } @@ -447,7 +447,7 @@ impl<'ln> PrivateMatchMethods for LayoutNode<'ln> { if let Some(ref mut style) = *style { let this_opaque = self.opaque(); if let Some(ref animations) = layout_context.running_animations.get(&this_opaque) { - for animation in animations.iter() { + for animation in *animations { animation.property_animation.update(&mut *Arc::make_unique(style), 1.0); } } diff --git a/components/layout/data.rs b/components/layout/data.rs index 75831d7c2ff..4b551e2fd9e 100644 --- a/components/layout/data.rs +++ b/components/layout/data.rs @@ -74,7 +74,7 @@ impl LayoutDataWrapper { ConstructionResult::ConstructionItem(ref construction_item) => { match construction_item { &ConstructionItem::InlineFragments(ref inline_fragments) => { - for fragment in inline_fragments.fragments.fragments.iter() { + for fragment in &inline_fragments.fragments.fragments { fragment.remove_compositor_layers(constellation_chan.clone()); } } diff --git a/components/layout/display_list_builder.rs b/components/layout/display_list_builder.rs index e597757fabc..06e6e004865 100644 --- a/components/layout/display_list_builder.rs +++ b/components/layout/display_list_builder.rs @@ -1771,7 +1771,7 @@ impl InlineFlowDisplayListBuilding for InlineFlow { let mut display_list = box DisplayList::new(); let mut has_stacking_context = false; - for fragment in self.fragments.fragments.iter_mut() { + for fragment in &mut self.fragments.fragments { fragment.build_display_list(&mut *display_list, layout_context, &self.base.stacking_relative_position, @@ -2026,4 +2026,3 @@ pub enum StackingContextCreationMode { OuterScrollWrapper, InnerScrollWrapper, } - diff --git a/components/layout/flow.rs b/components/layout/flow.rs index d2843b7d021..d7dab549958 100644 --- a/components/layout/flow.rs +++ b/components/layout/flow.rs @@ -1086,7 +1086,7 @@ impl BaseFlow { DisplayListBuildingResult::Normal(ref display_list) => display_list.all_display_items(), }; - for item in all_items.iter() { + for item in &all_items { let paint_bounds = item.base().clip.clone().intersect_rect(&item.base().bounds); if !paint_bounds.might_be_nonempty() { continue; diff --git a/components/layout/fragment.rs b/components/layout/fragment.rs index ffbcd1845a2..a512db3670c 100644 --- a/components/layout/fragment.rs +++ b/components/layout/fragment.rs @@ -1041,7 +1041,7 @@ impl Fragment { containing_block_inline_size).specified_or_zero(); if let Some(ref inline_context) = self.inline_context { - for node in inline_context.nodes.iter() { + for node in &inline_context.nodes { let margin = node.style.logical_margin(); self.margin.inline_start = self.margin.inline_start + MaybeAuto::from_style(margin.inline_start, @@ -1155,7 +1155,7 @@ impl Fragment { }; if let Some(ref inline_fragment_context) = self.inline_context { - for node in inline_fragment_context.nodes.iter() { + for node in &inline_fragment_context.nodes { if node.style.get_box().position == position::T::relative { rel_pos = rel_pos + from_style(&*node.style, containing_block_size); } @@ -1309,7 +1309,7 @@ impl Fragment { // Take borders and padding for parent inline fragments into account, if necessary. if self.is_primary_fragment() { if let Some(ref context) = self.inline_context { - for node in context.nodes.iter() { + for node in &context.nodes { let border_width = node.style.logical_border_width().inline_start_end(); let padding_inline_size = model::padding_from_style(&*node.style, Au(0)).inline_start_end(); @@ -2042,7 +2042,7 @@ impl Fragment { let mut overflow = border_box; // Box shadows cause us to draw outside our border box. - for box_shadow in self.style().get_effects().box_shadow.0.iter() { + for box_shadow in &self.style().get_effects().box_shadow.0 { let offset = Point2D::new(box_shadow.offset_x, box_shadow.offset_y); let inflation = box_shadow.spread_radius + box_shadow.blur_radius * BLUR_INFLATION_FACTOR; @@ -2345,4 +2345,3 @@ impl WhitespaceStrippingResult { } } } - diff --git a/components/layout/generated_content.rs b/components/layout/generated_content.rs index a125c497d80..639fa1e3cc6 100644 --- a/components/layout/generated_content.rs +++ b/components/layout/generated_content.rs @@ -261,12 +261,12 @@ impl<'a,'b> ResolveGeneratedContentFragmentMutator<'a,'b> { } // Truncate down counters. - for (_, counter) in self.traversal.counters.iter_mut() { + for (_, counter) in &mut self.traversal.counters { counter.truncate_to_level(self.level); } self.traversal.list_item.truncate_to_level(self.level); - for &(ref counter_name, value) in fragment.style().get_counters().counter_reset.0.iter() { + for &(ref counter_name, value) in &fragment.style().get_counters().counter_reset.0 { if let Some(ref mut counter) = self.traversal.counters.get_mut(counter_name) { counter.reset(self.level, value); continue @@ -386,7 +386,7 @@ impl Counter { } RenderingMode::All(separator) => { let mut first = true; - for value in self.values.iter() { + for value in &self.values { if !first { string.push_str(separator) } diff --git a/components/layout/incremental.rs b/components/layout/incremental.rs index c5f80511c5f..4b976ec6138 100644 --- a/components/layout/incremental.rs +++ b/components/layout/incremental.rs @@ -102,7 +102,7 @@ impl fmt::Display for RestyleDamage { , (RECONSTRUCT_FLOW, "ReconstructFlow") ]; - for &(damage, damage_str) in to_iter.iter() { + for &(damage, damage_str) in &to_iter { if self.contains(damage) { if !first_elem { try!(write!(f, " | ")); } try!(write!(f, "{}", damage_str)); @@ -248,4 +248,3 @@ impl<'a> LayoutDamageComputation for &'a mut (Flow + 'a) { } } } - diff --git a/components/layout/inline.rs b/components/layout/inline.rs index 22e6366cf82..89c71958289 100644 --- a/components/layout/inline.rs +++ b/components/layout/inline.rs @@ -802,7 +802,7 @@ pub struct InlineFragments { impl fmt::Debug for InlineFragments { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - for fragment in self.fragments.iter() { + for fragment in &self.fragments { try!(write!(f, "\n * {:?}", fragment)) } Ok(()) @@ -889,7 +889,7 @@ impl InlineFlow { first_line_indentation: Au(0), }; - for fragment in flow.fragments.fragments.iter() { + for fragment in &flow.fragments.fragments { if fragment.is_generated_content() { flow.base.restyle_damage.insert(RESOLVE_GENERATED_CONTENT) } @@ -1223,7 +1223,7 @@ impl InlineFlow { // According to CSS 2.1 § 10.8, `line-height` of any inline element specifies the minimal // height of line boxes within the element. - for frag in self.fragments.fragments.iter() { + for frag in &self.fragments.fragments { match frag.inline_context { Some(ref inline_context) => { for node in inline_context.nodes.iter() { @@ -1248,7 +1248,7 @@ impl InlineFlow { fn update_restyle_damage(&mut self) { let mut damage = self.base.restyle_damage; - for frag in self.fragments.fragments.iter() { + for frag in &self.fragments.fragments { damage.insert(frag.restyle_damage()); } @@ -1321,7 +1321,7 @@ impl Flow for InlineFlow { let mut intrinsic_sizes_for_flow = IntrinsicISizesContribution::new(); let mut intrinsic_sizes_for_inline_run = IntrinsicISizesContribution::new(); let mut intrinsic_sizes_for_nonbroken_run = IntrinsicISizesContribution::new(); - for fragment in self.fragments.fragments.iter_mut() { + for fragment in &mut self.fragments.fragments { let intrinsic_sizes_for_fragment = fragment.compute_intrinsic_inline_sizes().finish(); match fragment.style.get_inheritedtext().white_space { white_space::T::nowrap => { @@ -1420,7 +1420,7 @@ impl Flow for InlineFlow { // Assign the block-size and late-computed inline-sizes for the inline fragments. let containing_block_block_size = self.base.block_container_explicit_block_size; - for fragment in self.fragments.fragments.iter_mut() { + for fragment in &mut self.fragments.fragments { fragment.update_late_computed_replaced_inline_size_if_necessary(); fragment.assign_replaced_block_size_if_necessary(containing_block_block_size); } @@ -1619,7 +1619,7 @@ impl Flow for InlineFlow { // Then compute the positions of all of our fragments. let mut containing_block_positions = containing_block_positions.iter(); - for fragment in self.fragments.fragments.iter_mut() { + for fragment in &mut self.fragments.fragments { let stacking_relative_border_box = fragment.stacking_relative_border_box(&self.base.stacking_relative_position, &self.base @@ -1688,7 +1688,7 @@ impl Flow for InlineFlow { fn compute_overflow(&self) -> Rect<Au> { let mut overflow = ZERO_RECT; - for fragment in self.fragments.fragments.iter() { + for fragment in &self.fragments.fragments { overflow = overflow.union(&fragment.compute_overflow()) } overflow @@ -1699,7 +1699,7 @@ impl Flow for InlineFlow { level: i32, stacking_context_position: &Point2D<Au>) { // FIXME(#2795): Get the real container size. - for fragment in self.fragments.fragments.iter() { + for fragment in &self.fragments.fragments { if !iterator.should_process(fragment) { continue } @@ -1720,7 +1720,7 @@ impl Flow for InlineFlow { } fn mutate_fragments(&mut self, mutator: &mut FnMut(&mut Fragment)) { - for fragment in self.fragments.fragments.iter_mut() { + for fragment in &mut self.fragments.fragments { (*mutator)(fragment) } } @@ -1784,7 +1784,7 @@ impl InlineFragmentContext { if self.nodes.len() != other.nodes.len() { return false } - for (this_node, other_node) in self.nodes.iter().zip(other.nodes.iter()) { + for (this_node, other_node) in self.nodes.iter().zip(&other.nodes) { if !util::arc_ptr_eq(&this_node.style, &other_node.style) { return false } @@ -1871,4 +1871,3 @@ enum LineFlushMode { No, Flush, } - diff --git a/components/layout/layout_task.rs b/components/layout/layout_task.rs index 80403c1dca3..6028c8c3b6a 100644 --- a/components/layout/layout_task.rs +++ b/components/layout/layout_task.rs @@ -296,7 +296,7 @@ impl<'a> DerefMut for RWGuard<'a> { fn add_font_face_rules(stylesheet: &Stylesheet, device: &Device, font_cache_task: &FontCacheTask) { for font_face in stylesheet.effective_rules(&device).font_face() { - for source in font_face.sources.iter() { + for source in &font_face.sources { font_cache_task.add_web_font(font_face.family.clone(), source.clone()); } } @@ -1213,7 +1213,7 @@ impl LayoutTask { let inflation_amount = Size2D::new(rw_data.screen_size.width * DISPLAY_PORT_THRESHOLD_SIZE_FACTOR, rw_data.screen_size.height * DISPLAY_PORT_THRESHOLD_SIZE_FACTOR); - for &(ref layer_id, ref new_visible_rect) in new_visible_rects.iter() { + for &(ref layer_id, ref new_visible_rect) in &new_visible_rects { match rw_data.visible_rects.get(layer_id) { None => { old_visible_rects.insert(*layer_id, *new_visible_rect); @@ -1236,7 +1236,7 @@ impl LayoutTask { } debug!("regenerating display lists!"); - for &(ref layer_id, ref new_visible_rect) in new_visible_rects.iter() { + for &(ref layer_id, ref new_visible_rect) in &new_visible_rects { old_visible_rects.insert(*layer_id, *new_visible_rect); } rw_data.visible_rects = Arc::new(old_visible_rects); @@ -1556,4 +1556,3 @@ fn get_root_flow_background_color(flow: &mut Flow) -> AzColor { .resolve_color(kid_block_flow.fragment.style.get_background().background_color) .to_gfx_color() } - diff --git a/components/layout/table.rs b/components/layout/table.rs index 86eec90ffdd..c3c63b85762 100644 --- a/components/layout/table.rs +++ b/components/layout/table.rs @@ -87,7 +87,7 @@ impl TableFlow { -> IntrinsicISizes { let mut total_inline_sizes = IntrinsicISizes::new(); let mut column_index = 0; - for child_cell_inline_size in child_cell_inline_sizes.iter() { + for child_cell_inline_size in child_cell_inline_sizes { for _ in 0..child_cell_inline_size.column_span { if column_index < parent_inline_sizes.len() { // We already have some intrinsic size information for this column. Merge it in @@ -150,7 +150,7 @@ impl TableFlow { // // FIXME(pcwalton): This is really inefficient. We should stop after the first row! if first_row { - for cell_inline_size in row.cell_intrinsic_inline_sizes.iter() { + for cell_inline_size in &row.cell_intrinsic_inline_sizes { column_inline_sizes.push(cell_inline_size.column_size); } } @@ -289,7 +289,7 @@ impl Flow for TableFlow { }; if kid.is_table_colgroup() { - for specified_inline_size in kid.as_table_colgroup().inline_sizes.iter() { + for specified_inline_size in &kid.as_table_colgroup().inline_sizes { self.column_intrinsic_inline_sizes.push(ColumnIntrinsicInlineSize { minimum_length: match *specified_inline_size { LengthOrPercentageOrAuto::Auto | @@ -400,7 +400,7 @@ impl Flow for TableFlow { let mut num_unspecified_inline_sizes = 0; let mut total_column_inline_size = Au(0); - for column_inline_size in self.column_intrinsic_inline_sizes.iter() { + for column_inline_size in &self.column_intrinsic_inline_sizes { if column_inline_size.constrained { total_column_inline_size = total_column_inline_size + column_inline_size.minimum_length @@ -432,14 +432,14 @@ impl Flow for TableFlow { if num_unspecified_inline_sizes == 0 { let ratio = content_inline_size.to_f32_px() / total_column_inline_size.to_f32_px(); - for column_inline_size in self.column_intrinsic_inline_sizes.iter() { + for column_inline_size in &self.column_intrinsic_inline_sizes { self.column_computed_inline_sizes.push(ColumnComputedInlineSize { size: column_inline_size.minimum_length.scale_by(ratio), }); } } else if num_unspecified_inline_sizes != 0 { let extra_column_inline_size = content_inline_size - total_column_inline_size; - for column_inline_size in self.column_intrinsic_inline_sizes.iter() { + for column_inline_size in &self.column_intrinsic_inline_sizes { if !column_inline_size.constrained && column_inline_size.percentage == 0.0 { self.column_computed_inline_sizes.push(ColumnComputedInlineSize { @@ -861,4 +861,3 @@ enum NextBlockCollapsedBorders<'a> { FromTable(CollapsedBorder), NotCollapsingBorders, } - diff --git a/components/layout/table_colgroup.rs b/components/layout/table_colgroup.rs index 65990e40599..c562149d5f2 100644 --- a/components/layout/table_colgroup.rs +++ b/components/layout/table_colgroup.rs @@ -64,7 +64,7 @@ impl Flow for TableColGroupFlow { let _scope = layout_debug_scope!("table_colgroup::bubble_inline_sizes {:x}", self.base.debug_id()); - for fragment in self.cols.iter() { + for fragment in &self.cols { // Retrieve the specified value from the appropriate CSS property. let inline_size = fragment.style().content_inline_size(); let span = match fragment.specific { diff --git a/components/layout/table_row.rs b/components/layout/table_row.rs index 583749e65bb..acd537c27f7 100644 --- a/components/layout/table_row.rs +++ b/components/layout/table_row.rs @@ -325,7 +325,7 @@ impl Flow for TableRowFlow { // Spread out the completed inline sizes among columns with spans > 1. let mut computed_inline_size_for_cells = Vec::new(); let mut column_computed_inline_size_iterator = self.column_computed_inline_sizes.iter(); - for cell_intrinsic_inline_size in self.cell_intrinsic_inline_sizes.iter() { + for cell_intrinsic_inline_size in &self.cell_intrinsic_inline_sizes { // Start with the computed inline size for the first column in the span. let mut column_computed_inline_size = match column_computed_inline_size_iterator.next() { @@ -836,4 +836,3 @@ fn perform_inline_direction_border_collapse_for_row( CollapsedBorderProvenance::FromPreviousTableCell); preliminary_collapsed_borders.block_end.push_or_mutate(child_index, block_end_border); } - diff --git a/components/layout/table_wrapper.rs b/components/layout/table_wrapper.rs index 57a1a1f0b9c..459d58a4875 100644 --- a/components/layout/table_wrapper.rs +++ b/components/layout/table_wrapper.rs @@ -163,7 +163,7 @@ impl TableWrapperFlow { if excess_inline_size > Au(0) && selection == SelectedAutoLayoutCandidateGuess::UsePreferredGuessAndDistributeExcessInlineSize { let mut info = ExcessInlineSizeDistributionInfo::new(); - for column_intrinsic_inline_size in self.column_intrinsic_inline_sizes.iter() { + for column_intrinsic_inline_size in &self.column_intrinsic_inline_sizes { info.update(column_intrinsic_inline_size) } @@ -791,4 +791,3 @@ impl ISizeAndMarginsComputer for FloatedTable { FloatNonReplaced.solve_inline_size_constraints(block, input) } } - diff --git a/components/layout/wrapper.rs b/components/layout/wrapper.rs index 98826e81a28..82fe6df054a 100644 --- a/components/layout/wrapper.rs +++ b/components/layout/wrapper.rs @@ -520,7 +520,7 @@ impl<'le> ::selectors::Element for LayoutElement<'le> { match (*self.element.unsafe_get()).get_classes_for_layout() { None => {} Some(ref classes) => { - for class in classes.iter() { + for class in *classes { callback(class) } } |