diff options
-rw-r--r-- | components/layout/block.rs | 13 | ||||
-rw-r--r-- | components/layout/construct.rs | 6 | ||||
-rw-r--r-- | components/layout/flow.rs | 122 | ||||
-rw-r--r-- | components/layout/fragment.rs | 8 | ||||
-rw-r--r-- | components/layout/inline.rs | 10 | ||||
-rw-r--r-- | components/layout/layout_task.rs | 2 | ||||
-rw-r--r-- | components/layout/list_item.rs | 5 | ||||
-rw-r--r-- | components/layout/multicol.rs | 6 | ||||
-rw-r--r-- | components/layout/table.rs | 26 | ||||
-rw-r--r-- | components/layout/table_caption.rs | 7 | ||||
-rw-r--r-- | components/layout/table_cell.rs | 9 | ||||
-rw-r--r-- | components/layout/table_colgroup.rs | 2 | ||||
-rw-r--r-- | components/layout/table_row.rs | 24 | ||||
-rw-r--r-- | components/layout/table_rowgroup.rs | 10 | ||||
-rw-r--r-- | components/layout/table_wrapper.rs | 10 |
15 files changed, 125 insertions, 135 deletions
diff --git a/components/layout/block.rs b/components/layout/block.rs index c73f97a821b..420802bed43 100644 --- a/components/layout/block.rs +++ b/components/layout/block.rs @@ -451,7 +451,7 @@ impl<'a> PreorderFlowTraversal for AbsoluteAssignBSizesTraversal<'a> { } } - let block = flow.as_block(); + let block = flow.as_mut_block(); debug_assert!(block.base.flags.contains(IS_ABSOLUTELY_POSITIONED)); if !block.base.restyle_damage.intersects(REFLOW_OUT_OF_FLOW | REFLOW) { return @@ -845,7 +845,7 @@ impl BlockFlow { if flow::base(kid).flags.is_float() { flow::mut_base(kid).position.start.b = cur_b; { - let kid_block = kid.as_block(); + let kid_block = kid.as_mut_block(); kid_block.float.as_mut().unwrap().float_ceiling = margin_collapse_info.current_float_ceiling(); } @@ -1384,7 +1384,7 @@ impl BlockFlow { } if kid.is_block_flow() { - let kid_block = kid.as_block(); + let kid_block = kid.as_mut_block(); kid_block.inline_size_of_preceding_left_floats = inline_size_of_preceding_left_floats; kid_block.inline_size_of_preceding_right_floats = @@ -1409,7 +1409,7 @@ impl BlockFlow { // necessary because any percentages are relative to the containing block, which only // we know. if kid.is_inline_flow() { - kid.as_inline().first_line_indentation = + kid.as_mut_inline().first_line_indentation = specified(self.fragment.style().get_inheritedtext().text_indent, containing_block_size); } @@ -1501,11 +1501,11 @@ impl Flow for BlockFlow { FlowClass::Block } - fn as_block<'a>(&'a mut self) -> &'a mut BlockFlow { + fn as_mut_block<'a>(&'a mut self) -> &'a mut BlockFlow { self } - fn as_immutable_block<'a>(&'a self) -> &'a BlockFlow { + fn as_block<'a>(&'a self) -> &'a BlockFlow { self } @@ -2839,4 +2839,3 @@ impl ISizeAndMarginsComputer for FloatReplaced { MaybeAuto::Specified(fragment.content_inline_size()) } } - diff --git a/components/layout/construct.rs b/components/layout/construct.rs index 658a88a0296..e90d46a00ca 100644 --- a/components/layout/construct.rs +++ b/components/layout/construct.rs @@ -480,7 +480,7 @@ impl<'a> FlowConstructor<'a> { absolute_descendants.push_descendants(fragments.absolute_descendants); { - let inline_flow = inline_flow_ref.as_inline(); + let inline_flow = inline_flow_ref.as_mut_inline(); let (ascent, descent) = @@ -802,7 +802,7 @@ impl<'a> FlowConstructor<'a> { } match kid.swap_out_construction_result() { ConstructionResult::None => {} - ConstructionResult::Flow(mut flow, kid_abs_descendants) => { + ConstructionResult::Flow(flow, kid_abs_descendants) => { if !flow::base(&*flow).flags.contains(IS_ABSOLUTELY_POSITIONED) { // {ib} split. Flush the accumulator to our new split and make a new // accumulator to hold any subsequent fragments we come across. @@ -1015,7 +1015,7 @@ impl<'a> FlowConstructor<'a> { // Only flows that are table captions are matched here. for kid in node.children() { match kid.swap_out_construction_result() { - ConstructionResult::Flow(mut kid_flow, _) => { + ConstructionResult::Flow(kid_flow, _) => { if kid_flow.is_table_caption() && kid_flow.as_block() .fragment diff --git a/components/layout/flow.rs b/components/layout/flow.rs index 21af4e9e3ee..95866d04b5f 100644 --- a/components/layout/flow.rs +++ b/components/layout/flow.rs @@ -76,95 +76,97 @@ pub trait Flow: fmt::Debug + Sync { /// Returns the class of flow that this is. fn class(&self) -> FlowClass; - /// If this is a block flow, returns the underlying object, borrowed immutably. Fails - /// otherwise. - fn as_immutable_block<'a>(&'a self) -> &'a BlockFlow { - panic!("called as_immutable_block() on a non-block flow") - } - /// If this is a block flow, returns the underlying object. Fails otherwise. - fn as_block<'a>(&'a mut self) -> &'a mut BlockFlow { - debug!("called as_block() on a flow of type {:?}", self.class()); + fn as_block<'a>(&'a self) -> &'a BlockFlow { panic!("called as_block() on a non-block flow") } - /// If this is an inline flow, returns the underlying object, borrowed immutably. Fails - /// otherwise. - fn as_immutable_inline<'a>(&'a self) -> &'a InlineFlow { - panic!("called as_immutable_inline() on a non-inline flow") + /// If this is a block flow, returns the underlying object, borrowed mutably. Fails otherwise. + fn as_mut_block<'a>(&'a mut self) -> &'a mut BlockFlow { + debug!("called as_mut_block() on a flow of type {:?}", self.class()); + panic!("called as_mut_block() on a non-block flow") } /// If this is an inline flow, returns the underlying object. Fails otherwise. - fn as_inline<'a>(&'a mut self) -> &'a mut InlineFlow { + fn as_inline<'a>(&'a self) -> &'a InlineFlow { panic!("called as_inline() on a non-inline flow") } + /// If this is an inline flow, returns the underlying object, borrowed mutably. Fails + /// otherwise. + fn as_mut_inline<'a>(&'a mut self) -> &'a mut InlineFlow { + panic!("called as_mut_inline() on a non-inline flow") + } + + /// If this is a table wrapper flow, returns the underlying object, borrowed mutably. Fails + /// otherwise. + fn as_mut_table_wrapper<'a>(&'a mut self) -> &'a mut TableWrapperFlow { + panic!("called as_mut_table_wrapper() on a non-tablewrapper flow") + } + /// If this is a table wrapper flow, returns the underlying object. Fails otherwise. - fn as_table_wrapper<'a>(&'a mut self) -> &'a mut TableWrapperFlow { + fn as_table_wrapper<'a>(&'a self) -> &'a TableWrapperFlow { panic!("called as_table_wrapper() on a non-tablewrapper flow") } - /// If this is a table wrapper flow, returns the underlying object, borrowed immutably. Fails - /// otherwise. - fn as_immutable_table_wrapper<'a>(&'a self) -> &'a TableWrapperFlow { - panic!("called as_immutable_table_wrapper() on a non-tablewrapper flow") + /// If this is a table flow, returns the underlying object, borrowed mutably. Fails otherwise. + fn as_mut_table<'a>(&'a mut self) -> &'a mut TableFlow { + panic!("called as_mut_table() on a non-table flow") } /// If this is a table flow, returns the underlying object. Fails otherwise. - fn as_table<'a>(&'a mut self) -> &'a mut TableFlow { + fn as_table<'a>(&'a self) -> &'a TableFlow { panic!("called as_table() on a non-table flow") } - /// If this is a table flow, returns the underlying object, borrowed immutably. Fails otherwise. - fn as_immutable_table<'a>(&'a self) -> &'a TableFlow { - panic!("called as_table() on a non-table flow") + /// If this is a table colgroup flow, returns the underlying object, borrowed mutably. Fails + /// otherwise. + fn as_mut_table_colgroup<'a>(&'a mut self) -> &'a mut TableColGroupFlow { + panic!("called as_mut_table_colgroup() on a non-tablecolgroup flow") } - /// If this is a table colgroup flow, returns the underlying object. Fails otherwise. - fn as_table_colgroup<'a>(&'a mut self) -> &'a mut TableColGroupFlow { - panic!("called as_table_colgroup() on a non-tablecolgroup flow") + /// If this is a table rowgroup flow, returns the underlying object, borrowed mutably. Fails + /// otherwise. + fn as_mut_table_rowgroup<'a>(&'a mut self) -> &'a mut TableRowGroupFlow { + panic!("called as_mut_table_rowgroup() on a non-tablerowgroup flow") } /// If this is a table rowgroup flow, returns the underlying object. Fails otherwise. - fn as_table_rowgroup<'a>(&'a mut self) -> &'a mut TableRowGroupFlow { + fn as_table_rowgroup<'a>(&'a self) -> &'a TableRowGroupFlow { panic!("called as_table_rowgroup() on a non-tablerowgroup flow") } - /// If this is a table rowgroup flow, returns the underlying object, borrowed immutably. Fails + /// If this is a table row flow, returns the underlying object, borrowed mutably. Fails /// otherwise. - fn as_immutable_table_rowgroup<'a>(&'a self) -> &'a TableRowGroupFlow { - panic!("called as_table_rowgroup() on a non-tablerowgroup flow") + fn as_mut_table_row<'a>(&'a mut self) -> &'a mut TableRowFlow { + panic!("called as_mut_table_row() on a non-tablerow flow") } /// If this is a table row flow, returns the underlying object. Fails otherwise. - fn as_table_row<'a>(&'a mut self) -> &'a mut TableRowFlow { + fn as_table_row<'a>(&'a self) -> &'a TableRowFlow { panic!("called as_table_row() on a non-tablerow flow") } - /// If this is a table row flow, returns the underlying object, borrowed immutably. Fails + /// If this is a table cell flow, returns the underlying object, borrowed mutably. Fails /// otherwise. - fn as_immutable_table_row<'a>(&'a self) -> &'a TableRowFlow { - panic!("called as_table_row() on a non-tablerow flow") - } - - /// If this is a table cell flow, returns the underlying object. Fails otherwise. - fn as_table_caption<'a>(&'a mut self) -> &'a mut TableCaptionFlow { - panic!("called as_table_caption() on a non-tablecaption flow") + fn as_mut_table_caption<'a>(&'a mut self) -> &'a mut TableCaptionFlow { + panic!("called as_mut_table_caption() on a non-tablecaption flow") } - /// If this is a table cell flow, returns the underlying object. Fails otherwise. - fn as_table_cell<'a>(&'a mut self) -> &'a mut TableCellFlow { - panic!("called as_table_cell() on a non-tablecell flow") + /// If this is a table cell flow, returns the underlying object, borrowed mutably. Fails + /// otherwise. + fn as_mut_table_cell<'a>(&'a mut self) -> &'a mut TableCellFlow { + panic!("called as_mut_table_cell() on a non-tablecell flow") } - /// If this is a multicol flow, returns the underlying object. Fails otherwise. - fn as_multicol<'a>(&'a mut self) -> &'a mut MulticolFlow { - panic!("called as_multicol() on a non-multicol flow") + /// If this is a multicol flow, returns the underlying object, borrowed mutably. Fails + /// otherwise. + fn as_mut_multicol<'a>(&'a mut self) -> &'a mut MulticolFlow { + panic!("called as_mut_multicol() on a non-multicol flow") } - /// If this is a table cell flow, returns the underlying object, borrowed immutably. Fails - /// otherwise. - fn as_immutable_table_cell<'a>(&'a self) -> &'a TableCellFlow { + /// If this is a table cell flow, returns the underlying object. Fails otherwise. + fn as_table_cell<'a>(&'a self) -> &'a TableCellFlow { panic!("called as_table_cell() on a non-tablecell flow") } @@ -938,21 +940,13 @@ impl Encodable for BaseFlow { try!(e.emit_struct_field("class", 0, |e| c.class().encode(e))); e.emit_struct_field("data", 1, |e| { match c.class() { - FlowClass::Block => c.as_immutable_block().encode(e), - FlowClass::Inline => c.as_immutable_inline().encode(e), - FlowClass::Table => c.as_immutable_table().encode(e), - FlowClass::TableWrapper => { - c.as_immutable_table_wrapper().encode(e) - } - FlowClass::TableRowGroup => { - c.as_immutable_table_rowgroup().encode(e) - } - FlowClass::TableRow => { - c.as_immutable_table_row().encode(e) - } - FlowClass::TableCell => { - c.as_immutable_table_cell().encode(e) - } + FlowClass::Block => c.as_block().encode(e), + FlowClass::Inline => c.as_inline().encode(e), + FlowClass::Table => c.as_table().encode(e), + FlowClass::TableWrapper => c.as_table_wrapper().encode(e), + FlowClass::TableRowGroup => c.as_table_rowgroup().encode(e), + FlowClass::TableRow => c.as_table_row().encode(e), + FlowClass::TableCell => c.as_table_cell().encode(e), _ => { Ok(()) } // TODO: Support captions } }) @@ -1452,9 +1446,9 @@ impl ContainingBlockLink { Some(ref link) => { let flow = link.upgrade().unwrap(); if flow.is_block_like() { - flow.as_immutable_block().explicit_block_containing_size(layout_context) + flow.as_block().explicit_block_containing_size(layout_context) } else if flow.is_inline_flow() { - Some(flow.as_immutable_inline().minimum_block_size_above_baseline) + Some(flow.as_inline().minimum_block_size_above_baseline) } else { None } diff --git a/components/layout/fragment.rs b/components/layout/fragment.rs index 60b340195d7..568ebf50657 100644 --- a/components/layout/fragment.rs +++ b/components/layout/fragment.rs @@ -1637,7 +1637,7 @@ impl Fragment { match self.specific { SpecificFragmentInfo::InlineAbsoluteHypothetical(ref mut info) => { - let block_flow = info.flow_ref.as_block(); + let block_flow = info.flow_ref.as_mut_block(); block_flow.base.position.size.inline = block_flow.base.intrinsic_inline_sizes.preferred_inline_size; @@ -1645,7 +1645,7 @@ impl Fragment { self.border_box.size.inline = Au(0); } SpecificFragmentInfo::InlineBlock(ref mut info) => { - let block_flow = info.flow_ref.as_block(); + let block_flow = info.flow_ref.as_mut_block(); self.border_box.size.inline = max(block_flow.base.intrinsic_inline_sizes.minimum_inline_size, block_flow.base.intrinsic_inline_sizes.preferred_inline_size); @@ -1653,7 +1653,7 @@ impl Fragment { block_flow.base.block_container_writing_mode = self.style.writing_mode; } SpecificFragmentInfo::InlineAbsolute(ref mut info) => { - let block_flow = info.flow_ref.as_block(); + let block_flow = info.flow_ref.as_mut_block(); self.border_box.size.inline = max(block_flow.base.intrinsic_inline_sizes.minimum_inline_size, block_flow.base.intrinsic_inline_sizes.preferred_inline_size); @@ -1810,7 +1810,7 @@ impl Fragment { } SpecificFragmentInfo::InlineBlock(ref info) => { // See CSS 2.1 § 10.8.1. - let block_flow = info.flow_ref.as_immutable_block(); + let block_flow = info.flow_ref.as_block(); let font_style = self.style.get_font_arc(); let font_metrics = text::font_metrics_for_style(&mut layout_context.font_context(), font_style); diff --git a/components/layout/inline.rs b/components/layout/inline.rs index ecb06a0b8e8..d06489ea3bd 100644 --- a/components/layout/inline.rs +++ b/components/layout/inline.rs @@ -1298,11 +1298,11 @@ impl Flow for InlineFlow { FlowClass::Inline } - fn as_immutable_inline<'a>(&'a self) -> &'a InlineFlow { + fn as_inline<'a>(&'a self) -> &'a InlineFlow { self } - fn as_inline<'a>(&'a mut self) -> &'a mut InlineFlow { + fn as_mut_inline<'a>(&'a mut self) -> &'a mut InlineFlow { self } @@ -1658,7 +1658,7 @@ impl Flow for InlineFlow { SpecificFragmentInfo::InlineBlock(ref mut info) => { flow::mut_base(&mut *info.flow_ref).clip = clip; - let block_flow = info.flow_ref.as_block(); + let block_flow = info.flow_ref.as_mut_block(); block_flow.base.absolute_position_info = self.base.absolute_position_info; let stacking_relative_position = self.base.stacking_relative_position; @@ -1678,7 +1678,7 @@ impl Flow for InlineFlow { SpecificFragmentInfo::InlineAbsoluteHypothetical(ref mut info) => { flow::mut_base(&mut *info.flow_ref).clip = clip; - let block_flow = info.flow_ref.as_block(); + let block_flow = info.flow_ref.as_mut_block(); block_flow.base.absolute_position_info = self.base.absolute_position_info; block_flow.base.stacking_relative_position = @@ -1689,7 +1689,7 @@ impl Flow for InlineFlow { SpecificFragmentInfo::InlineAbsolute(ref mut info) => { flow::mut_base(&mut *info.flow_ref).clip = clip; - let block_flow = info.flow_ref.as_block(); + let block_flow = info.flow_ref.as_mut_block(); block_flow.base.absolute_position_info = self.base.absolute_position_info; let stacking_relative_position = self.base.stacking_relative_position; diff --git a/components/layout/layout_task.rs b/components/layout/layout_task.rs index 01f99285e9c..4c982ec9661 100644 --- a/components/layout/layout_task.rs +++ b/components/layout/layout_task.rs @@ -1541,7 +1541,7 @@ fn get_root_flow_background_color(flow: &mut Flow) -> AzColor { return color::transparent() } - let block_flow = flow.as_block(); + let block_flow = flow.as_mut_block(); let kid = match block_flow.base.children.iter_mut().next() { None => return color::transparent(), Some(kid) => kid, diff --git a/components/layout/list_item.rs b/components/layout/list_item.rs index c449406f448..a81f1f2e623 100644 --- a/components/layout/list_item.rs +++ b/components/layout/list_item.rs @@ -68,11 +68,11 @@ impl Flow for ListItemFlow { FlowClass::ListItem } - fn as_block<'a>(&'a mut self) -> &'a mut BlockFlow { + fn as_mut_block<'a>(&'a mut self) -> &'a mut BlockFlow { &mut self.block_flow } - fn as_immutable_block<'a>(&'a self) -> &'a BlockFlow { + fn as_block<'a>(&'a self) -> &'a BlockFlow { &self.block_flow } @@ -228,4 +228,3 @@ impl ListStyleTypeContent { } } } - diff --git a/components/layout/multicol.rs b/components/layout/multicol.rs index 438b8b18830..784df3d0ba7 100644 --- a/components/layout/multicol.rs +++ b/components/layout/multicol.rs @@ -36,15 +36,15 @@ impl Flow for MulticolFlow { FlowClass::Multicol } - fn as_multicol<'a>(&'a mut self) -> &'a mut MulticolFlow { + fn as_mut_multicol<'a>(&'a mut self) -> &'a mut MulticolFlow { self } - fn as_block<'a>(&'a mut self) -> &'a mut BlockFlow { + fn as_mut_block<'a>(&'a mut self) -> &'a mut BlockFlow { &mut self.block_flow } - fn as_immutable_block<'a>(&'a self) -> &'a BlockFlow { + fn as_block<'a>(&'a self) -> &'a BlockFlow { &self.block_flow } diff --git a/components/layout/table.rs b/components/layout/table.rs index d9d65604c10..4b1a0ceda20 100644 --- a/components/layout/table.rs +++ b/components/layout/table.rs @@ -191,19 +191,19 @@ impl Flow for TableFlow { FlowClass::Table } - fn as_table<'a>(&'a mut self) -> &'a mut TableFlow { + fn as_mut_table<'a>(&'a mut self) -> &'a mut TableFlow { self } - fn as_immutable_table<'a>(&'a self) -> &'a TableFlow { + fn as_table<'a>(&'a self) -> &'a TableFlow { self } - fn as_block<'a>(&'a mut self) -> &'a mut BlockFlow { + fn as_mut_block<'a>(&'a mut self) -> &'a mut BlockFlow { &mut self.block_flow } - fn as_immutable_block(&self) -> &BlockFlow { + fn as_block(&self) -> &BlockFlow { &self.block_flow } @@ -263,7 +263,7 @@ impl Flow for TableFlow { let mut iterator = self.block_flow.base.child_iter().peekable(); while let Some(kid) = iterator.next() { if kid.is_table_colgroup() { - for specified_inline_size in &kid.as_table_colgroup().inline_sizes { + for specified_inline_size in &kid.as_mut_table_colgroup().inline_sizes { self.column_intrinsic_inline_sizes.push(ColumnIntrinsicInlineSize { minimum_length: match *specified_inline_size { LengthOrPercentageOrAuto::Auto | @@ -293,12 +293,12 @@ impl Flow for TableFlow { Some(next_sibling) => { if next_sibling.is_table_rowgroup() { NextBlockCollapsedBorders::FromNextRow( - &next_sibling.as_immutable_table_rowgroup() + &next_sibling.as_table_rowgroup() .preliminary_collapsed_borders .block_start) } else { NextBlockCollapsedBorders::FromNextRow( - &next_sibling.as_immutable_table_row() + &next_sibling.as_table_row() .preliminary_collapsed_borders .block_start) } @@ -310,7 +310,7 @@ impl Flow for TableFlow { } }; perform_border_collapse_for_row( - kid.as_table_row(), + kid.as_mut_table_row(), table_inline_collapsed_borders.as_ref().unwrap(), previous_collapsed_block_end_borders, next_collapsed_borders_in_block_direction, @@ -330,12 +330,12 @@ impl Flow for TableFlow { Some(grandkid_next_sibling) => { if grandkid_next_sibling.is_table_rowgroup() { NextBlockCollapsedBorders::FromNextRow( - &grandkid_next_sibling.as_immutable_table_rowgroup() + &grandkid_next_sibling.as_table_rowgroup() .preliminary_collapsed_borders .block_start) } else { NextBlockCollapsedBorders::FromNextRow( - &grandkid_next_sibling.as_immutable_table_row() + &grandkid_next_sibling.as_table_row() .preliminary_collapsed_borders .block_start) } @@ -359,7 +359,7 @@ impl Flow for TableFlow { self.table_layout); if collapsing_borders { perform_border_collapse_for_row( - grandkid.as_table_row(), + grandkid.as_mut_table_row(), table_inline_collapsed_borders.as_ref().unwrap(), previous_collapsed_block_end_borders, next_collapsed_borders_in_block_direction, @@ -480,12 +480,12 @@ impl Flow for TableFlow { column_computed_inline_sizes, &spacing_per_cell); if child_flow.is_table_row() { - let child_table_row = child_flow.as_table_row(); + let child_table_row = child_flow.as_mut_table_row(); child_table_row.populate_collapsed_border_spacing( collapsed_inline_direction_border_widths_for_table, &mut collapsed_block_direction_border_widths_for_table); } else if child_flow.is_table_rowgroup() { - let child_table_rowgroup = child_flow.as_table_rowgroup(); + let child_table_rowgroup = child_flow.as_mut_table_rowgroup(); child_table_rowgroup.populate_collapsed_border_spacing( collapsed_inline_direction_border_widths_for_table, &mut collapsed_block_direction_border_widths_for_table); diff --git a/components/layout/table_caption.rs b/components/layout/table_caption.rs index 24cc912af66..5cd35f5be99 100644 --- a/components/layout/table_caption.rs +++ b/components/layout/table_caption.rs @@ -36,15 +36,15 @@ impl Flow for TableCaptionFlow { FlowClass::TableCaption } - fn as_table_caption<'a>(&'a mut self) -> &'a mut TableCaptionFlow { + fn as_mut_table_caption<'a>(&'a mut self) -> &'a mut TableCaptionFlow { self } - fn as_block<'a>(&'a mut self) -> &'a mut BlockFlow { + fn as_mut_block<'a>(&'a mut self) -> &'a mut BlockFlow { &mut self.block_flow } - fn as_immutable_block(&self) -> &BlockFlow { + fn as_block(&self) -> &BlockFlow { &self.block_flow } @@ -108,4 +108,3 @@ impl fmt::Debug for TableCaptionFlow { write!(f, "TableCaptionFlow: {:?}", self.block_flow) } } - diff --git a/components/layout/table_cell.rs b/components/layout/table_cell.rs index fea0fb61263..92ce3d98ceb 100644 --- a/components/layout/table_cell.rs +++ b/components/layout/table_cell.rs @@ -84,19 +84,19 @@ impl Flow for TableCellFlow { FlowClass::TableCell } - fn as_table_cell<'a>(&'a mut self) -> &'a mut TableCellFlow { + fn as_mut_table_cell<'a>(&'a mut self) -> &'a mut TableCellFlow { self } - fn as_immutable_table_cell<'a>(&'a self) -> &'a TableCellFlow { + fn as_table_cell<'a>(&'a self) -> &'a TableCellFlow { self } - fn as_block<'a>(&'a mut self) -> &'a mut BlockFlow { + fn as_mut_block<'a>(&'a mut self) -> &'a mut BlockFlow { &mut self.block_flow } - fn as_immutable_block(&self) -> &BlockFlow { + fn as_block(&self) -> &BlockFlow { &self.block_flow } @@ -354,4 +354,3 @@ impl CollapsedBordersForCell { *border_styles = logical_border_styles.to_physical(writing_mode); } } - diff --git a/components/layout/table_colgroup.rs b/components/layout/table_colgroup.rs index c562149d5f2..7e8d2976823 100644 --- a/components/layout/table_colgroup.rs +++ b/components/layout/table_colgroup.rs @@ -56,7 +56,7 @@ impl Flow for TableColGroupFlow { FlowClass::TableColGroup } - fn as_table_colgroup<'a>(&'a mut self) -> &'a mut TableColGroupFlow { + fn as_mut_table_colgroup<'a>(&'a mut self) -> &'a mut TableColGroupFlow { self } diff --git a/components/layout/table_row.rs b/components/layout/table_row.rs index 1d5d34d0e36..4dc732ff922 100644 --- a/components/layout/table_row.rs +++ b/components/layout/table_row.rs @@ -119,7 +119,7 @@ impl TableRowFlow { } { - let child_fragment = kid.as_table_cell().fragment(); + let child_fragment = kid.as_mut_table_cell().fragment(); // TODO: Percentage block-size let child_specified_block_size = MaybeAuto::from_style(child_fragment.style().content_block_size(), @@ -153,7 +153,7 @@ impl TableRowFlow { // Assign the block-size of kid fragments, which is the same value as own block-size. for kid in self.block_flow.base.child_iter() { - let child_table_cell = kid.as_table_cell(); + let child_table_cell = kid.as_mut_table_cell(); { let kid_fragment = child_table_cell.mut_fragment(); let mut position = kid_fragment.border_box; @@ -194,19 +194,19 @@ impl Flow for TableRowFlow { FlowClass::TableRow } - fn as_table_row<'a>(&'a mut self) -> &'a mut TableRowFlow { + fn as_mut_table_row<'a>(&'a mut self) -> &'a mut TableRowFlow { self } - fn as_immutable_table_row<'a>(&'a self) -> &'a TableRowFlow { + fn as_table_row<'a>(&'a self) -> &'a TableRowFlow { self } - fn as_block<'a>(&'a mut self) -> &'a mut BlockFlow { + fn as_mut_block<'a>(&'a mut self) -> &'a mut BlockFlow { &mut self.block_flow } - fn as_immutable_block(&self) -> &BlockFlow { + fn as_block(&self) -> &BlockFlow { &self.block_flow } @@ -249,7 +249,7 @@ impl Flow for TableRowFlow { let child_specified_inline_size; let child_column_span; { - let child_table_cell = kid.as_table_cell(); + let child_table_cell = kid.as_mut_table_cell(); child_specified_inline_size = child_table_cell.block_flow .fragment .style @@ -685,18 +685,18 @@ pub fn propagate_column_inline_sizes_to_child( // FIXME(pcwalton): This seems inefficient. Reference count it instead? match child_flow.class() { FlowClass::Table => { - let child_table_flow = child_flow.as_table(); + let child_table_flow = child_flow.as_mut_table(); child_table_flow.column_computed_inline_sizes = column_computed_inline_sizes.to_vec(); } FlowClass::TableRowGroup => { - let child_table_rowgroup_flow = child_flow.as_table_rowgroup(); + let child_table_rowgroup_flow = child_flow.as_mut_table_rowgroup(); child_table_rowgroup_flow.column_computed_inline_sizes = column_computed_inline_sizes.to_vec(); child_table_rowgroup_flow.spacing = *border_spacing; child_table_rowgroup_flow.table_writing_mode = table_writing_mode; } FlowClass::TableRow => { - let child_table_row_flow = child_flow.as_table_row(); + let child_table_row_flow = child_flow.as_mut_table_row(); child_table_row_flow.column_computed_inline_sizes = column_computed_inline_sizes.to_vec(); child_table_row_flow.spacing = *border_spacing; @@ -725,7 +725,7 @@ fn set_inline_position_of_child_flow( let reverse_column_order = table_writing_mode.is_bidi_ltr() != row_writing_mode.is_bidi_ltr(); // Handle border collapsing, if necessary. - let child_table_cell = child_flow.as_table_cell(); + let child_table_cell = child_flow.as_mut_table_cell(); match *border_collapse_info { Some(ref border_collapse_info) => { // Write in the child's border collapse state. @@ -821,7 +821,7 @@ fn perform_inline_direction_border_collapse_for_row( CollapsedBorderProvenance::FromPreviousTableCell)); if let Some(&(_, ref next_child_flow)) = iterator.peek() { - let next_child_flow = next_child_flow.as_immutable_block(); + let next_child_flow = next_child_flow.as_block(); inline_collapsed_border.combine( &CollapsedBorder::inline_start(&*next_child_flow.fragment.style, CollapsedBorderProvenance::FromNextTableCell)) diff --git a/components/layout/table_rowgroup.rs b/components/layout/table_rowgroup.rs index 0b98a37c794..a085cd173fe 100644 --- a/components/layout/table_rowgroup.rs +++ b/components/layout/table_rowgroup.rs @@ -112,19 +112,19 @@ impl Flow for TableRowGroupFlow { FlowClass::TableRowGroup } - fn as_table_rowgroup<'a>(&'a mut self) -> &'a mut TableRowGroupFlow { + fn as_mut_table_rowgroup<'a>(&'a mut self) -> &'a mut TableRowGroupFlow { self } - fn as_immutable_table_rowgroup<'a>(&'a self) -> &'a TableRowGroupFlow { + fn as_table_rowgroup<'a>(&'a self) -> &'a TableRowGroupFlow { self } - fn as_block<'a>(&'a mut self) -> &'a mut BlockFlow { + fn as_mut_block<'a>(&'a mut self) -> &'a mut BlockFlow { &mut self.block_flow } - fn as_immutable_block(&self) -> &BlockFlow { + fn as_block(&self) -> &BlockFlow { &self.block_flow } @@ -187,7 +187,7 @@ impl Flow for TableRowGroupFlow { &border_spacing); if border_collapse == border_collapse::T::collapse { - let child_table_row = child_flow.as_table_row(); + let child_table_row = child_flow.as_mut_table_row(); child_table_row.populate_collapsed_border_spacing( collapsed_inline_direction_border_widths_for_table, &mut collapsed_block_direction_border_widths_for_table); diff --git a/components/layout/table_wrapper.rs b/components/layout/table_wrapper.rs index 459d58a4875..4beb11e76d7 100644 --- a/components/layout/table_wrapper.rs +++ b/components/layout/table_wrapper.rs @@ -99,7 +99,7 @@ impl TableWrapperFlow { continue } - let kid_table = kid.as_table(); + let kid_table = kid.as_mut_table(); let kid_block_flow = &mut kid_table.block_flow; kid_block_flow.fragment .compute_border_and_padding(available_inline_size, @@ -265,19 +265,19 @@ impl Flow for TableWrapperFlow { FlowClass::TableWrapper } - fn as_table_wrapper<'a>(&'a mut self) -> &'a mut TableWrapperFlow { + fn as_mut_table_wrapper<'a>(&'a mut self) -> &'a mut TableWrapperFlow { self } - fn as_immutable_table_wrapper<'a>(&'a self) -> &'a TableWrapperFlow { + fn as_table_wrapper<'a>(&'a self) -> &'a TableWrapperFlow { self } - fn as_block<'a>(&'a mut self) -> &'a mut BlockFlow { + fn as_mut_block<'a>(&'a mut self) -> &'a mut BlockFlow { &mut self.block_flow } - fn as_immutable_block<'a>(&'a self) -> &'a BlockFlow { + fn as_block<'a>(&'a self) -> &'a BlockFlow { &self.block_flow } |