зеркало из https://github.com/mozilla/gecko-dev.git
servo: Merge #5885 - Ignore border-spacing for tables with zero cells (from mbrubeck:empty-table); r=pcwalton
r? @pcwalton Source-Repo: https://github.com/servo/servo Source-Revision: b5beebbc6280f5ff6397b6a9154b705d42d000e7
This commit is contained in:
Родитель
cb206c9929
Коммит
3e5f72c2ba
|
@ -202,6 +202,14 @@ impl TableFlow {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn total_horizontal_spacing(&self) -> Au {
|
||||
let num_columns = self.column_intrinsic_inline_sizes.len();
|
||||
if num_columns == 0 {
|
||||
return Au(0);
|
||||
}
|
||||
self.spacing().horizontal * (num_columns as i32 + 1)
|
||||
}
|
||||
}
|
||||
|
||||
impl Flow for TableFlow {
|
||||
|
@ -396,9 +404,8 @@ impl Flow for TableFlow {
|
|||
}
|
||||
}
|
||||
|
||||
let spacing = self.spacing().horizontal *
|
||||
(self.column_intrinsic_inline_sizes.len() as i32 + 1);
|
||||
computation.surrounding_size = computation.surrounding_size + spacing;
|
||||
computation.surrounding_size = computation.surrounding_size +
|
||||
self.total_horizontal_spacing();
|
||||
|
||||
self.block_flow.base.intrinsic_inline_sizes = computation.finish()
|
||||
}
|
||||
|
@ -435,8 +442,7 @@ impl Flow for TableFlow {
|
|||
let inline_end_content_edge = self.block_flow.fragment.border_padding.inline_end;
|
||||
let padding_and_borders = self.block_flow.fragment.border_padding.inline_start_end();
|
||||
let spacing_per_cell = self.spacing();
|
||||
let spacing = spacing_per_cell.horizontal *
|
||||
(self.column_intrinsic_inline_sizes.len() as i32 + 1);
|
||||
let spacing = self.total_horizontal_spacing();
|
||||
let content_inline_size =
|
||||
self.block_flow.fragment.border_box.size.inline - padding_and_borders - spacing;
|
||||
|
||||
|
@ -785,6 +791,7 @@ impl TableLikeFlow for BlockFlow {
|
|||
// Our current border-box position.
|
||||
let block_start_border_padding = self.fragment.border_padding.block_start;
|
||||
let mut current_block_offset = block_start_border_padding;
|
||||
let mut has_rows = false;
|
||||
|
||||
// At this point, `current_block_offset` is at the content edge of our box. Now iterate
|
||||
// over children.
|
||||
|
@ -795,6 +802,7 @@ impl TableLikeFlow for BlockFlow {
|
|||
|
||||
// Account for spacing or collapsed borders.
|
||||
if kid.is_table_row() {
|
||||
has_rows = true;
|
||||
let child_table_row = kid.as_table_row();
|
||||
current_block_offset = current_block_offset +
|
||||
match self.fragment.style.get_inheritedtable().border_collapse {
|
||||
|
@ -843,7 +851,7 @@ impl TableLikeFlow for BlockFlow {
|
|||
|
||||
// Take border, padding, and spacing into account.
|
||||
let block_end_offset = self.fragment.border_padding.block_end +
|
||||
block_direction_spacing;
|
||||
if has_rows { block_direction_spacing } else { Au(0) };
|
||||
current_block_offset = current_block_offset + block_end_offset;
|
||||
|
||||
// Now that `current_block_offset` is at the block-end of the border box, compute the
|
||||
|
|
|
@ -95,8 +95,7 @@ impl TableWrapperFlow {
|
|||
for kid in self.block_flow.base.child_iter() {
|
||||
if kid.is_table() {
|
||||
let kid_table = kid.as_table();
|
||||
let spacing_per_cell = kid_table.spacing().horizontal;
|
||||
spacing = spacing_per_cell * (self.column_intrinsic_inline_sizes.len() as i32 + 1);
|
||||
spacing = kid_table.total_horizontal_spacing();
|
||||
table_border_padding =
|
||||
kid_table.block_flow.fragment.border_padding.inline_start_end();
|
||||
break
|
||||
|
|
Загрузка…
Ссылка в новой задаче