From cec37a492a8e27ed8c0c8e00157190a0a87cb882 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Tue, 27 Feb 2018 14:47:22 -0800 Subject: [PATCH] Unconditionally layout rows when laying out tables If the reflow flag is set on a row it will be on the table anyway --- components/layout/table.rs | 16 ++++------------ components/layout/table_row.rs | 5 +---- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/components/layout/table.rs b/components/layout/table.rs index 2e0df9f4c7e..2f5de2aa1e4 100644 --- a/components/layout/table.rs +++ b/components/layout/table.rs @@ -840,26 +840,18 @@ impl TableLikeFlow for BlockFlow { // [expensive: iterates over cells] // At this point, `current_block_offset` is at the content edge of our box. Now iterate // over children. - let mut effects_rows = 0; let mut i = 0; for kid in self.base.child_iter_mut() { if kid.is_table_row() { has_rows = true; let row = kid.as_mut_table_row(); - if row.mut_base().restyle_damage.contains(ServoRestyleDamage::REFLOW) || - effects_rows != 0 { - row.assign_block_size_to_self_and_children(&sizes, i, &mut effects_rows); - row.mut_base().restyle_damage - .remove(ServoRestyleDamage::REFLOW_OUT_OF_FLOW | - ServoRestyleDamage::REFLOW); - } + row.assign_block_size_to_self_and_children(&sizes, i); + row.mut_base().restyle_damage + .remove(ServoRestyleDamage::REFLOW_OUT_OF_FLOW | + ServoRestyleDamage::REFLOW); current_block_offset = current_block_offset + border_spacing_for_row(&self.fragment, row, block_direction_spacing); - // may happen for empty rows - if effects_rows != 0 { - effects_rows -= 1; - } i += 1; } diff --git a/components/layout/table_row.rs b/components/layout/table_row.rs index 0d779ac8f2f..dbe0bf7b665 100644 --- a/components/layout/table_row.rs +++ b/components/layout/table_row.rs @@ -115,8 +115,6 @@ impl TableRowFlow { incoming_rowspan_data: &mut Vec, border_info: &[(Au, Au)], // (_, cumulative_border_size) row_index: usize) -> (Au, Au) { - // XXXManishearth skip this when the REFLOW flag is unset if it is not affected by other - // rows fn include_sizes_from_previous_rows(col: &mut usize, incoming_rowspan: &[u32], incoming_rowspan_data: &mut Vec, @@ -208,13 +206,12 @@ impl TableRowFlow { (block_size, largest_leftover_incoming_size) } - pub fn assign_block_size_to_self_and_children(&mut self, sizes: &[(Au, Au)], index: usize, effects_rows: &mut u32) { + pub fn assign_block_size_to_self_and_children(&mut self, sizes: &[(Au, Au)], index: usize) { // Assign the block-size of kid fragments, which is the same value as own block-size. let block_size = sizes[index].0; for kid in self.block_flow.base.child_iter_mut() { let child_table_cell = kid.as_mut_table_cell(); let block_size = if child_table_cell.row_span > 1 { - *effects_rows = max(*effects_rows, child_table_cell.row_span); let row_sizes = sizes[index..].iter() .take(child_table_cell.row_span as usize) .fold(Au(0), |accum, size| accum + size.0);