diff options
33 files changed, 118 insertions, 80 deletions
diff --git a/components/layout/table_wrapper.rs b/components/layout/table_wrapper.rs index ecf9596f746..0fc023e668d 100644 --- a/components/layout/table_wrapper.rs +++ b/components/layout/table_wrapper.rs @@ -216,6 +216,12 @@ impl TableWrapperFlow { |accumulator, intermediate_column_inline_sizes| { accumulator + intermediate_column_inline_sizes.size }); + let preferred_width_of_all_columns = + self.column_intrinsic_inline_sizes.iter() + .fold(border_padding + spacing, + |accumulator, column_intrinsic_inline_sizes| { + accumulator + column_intrinsic_inline_sizes.preferred + }); // Delegate to the appropriate inline size computer to find the constraint inputs and write // the constraint solutions in. @@ -223,6 +229,7 @@ impl TableWrapperFlow { if self.block_flow.base.flags.is_float() { let inline_size_computer = FloatedTable { minimum_width_of_all_columns: minimum_width_of_all_columns, + preferred_width_of_all_columns: preferred_width_of_all_columns, border_collapse: border_collapse, }; let input = @@ -241,6 +248,7 @@ impl TableWrapperFlow { let inline_size_computer = Table { minimum_width_of_all_columns: minimum_width_of_all_columns, + preferred_width_of_all_columns: preferred_width_of_all_columns, border_collapse: border_collapse, }; let input = @@ -703,13 +711,14 @@ struct IntermediateColumnInlineSize { fn initial_computed_inline_size(block: &mut BlockFlow, containing_block_inline_size: Au, - minimum_width_of_all_columns: Au) + minimum_width_of_all_columns: Au, + preferred_width_of_all_columns: Au) -> MaybeAuto { let inline_size_from_style = MaybeAuto::from_style(block.fragment.style.content_inline_size(), containing_block_inline_size); match inline_size_from_style { MaybeAuto::Auto => { - MaybeAuto::Specified(max(containing_block_inline_size, minimum_width_of_all_columns)) + MaybeAuto::Specified(min(containing_block_inline_size, preferred_width_of_all_columns)) } MaybeAuto::Specified(inline_size_from_style) => { MaybeAuto::Specified(max(inline_size_from_style, minimum_width_of_all_columns)) @@ -719,6 +728,7 @@ fn initial_computed_inline_size(block: &mut BlockFlow, struct Table { minimum_width_of_all_columns: Au, + preferred_width_of_all_columns: Au, border_collapse: border_collapse::T, } @@ -739,7 +749,8 @@ impl ISizeAndMarginsComputer for Table { layout_context); initial_computed_inline_size(block, containing_block_inline_size, - self.minimum_width_of_all_columns) + self.minimum_width_of_all_columns, + self.preferred_width_of_all_columns) } fn solve_inline_size_constraints(&self, @@ -752,6 +763,7 @@ impl ISizeAndMarginsComputer for Table { struct FloatedTable { minimum_width_of_all_columns: Au, + preferred_width_of_all_columns: Au, border_collapse: border_collapse::T, } @@ -772,7 +784,8 @@ impl ISizeAndMarginsComputer for FloatedTable { layout_context); initial_computed_inline_size(block, containing_block_inline_size, - self.minimum_width_of_all_columns) + self.minimum_width_of_all_columns, + self.preferred_width_of_all_columns) } fn solve_inline_size_constraints(&self, diff --git a/tests/ref/basic.list b/tests/ref/basic.list index b84de8320a1..76f4786540d 100644 --- a/tests/ref/basic.list +++ b/tests/ref/basic.list @@ -284,6 +284,7 @@ flaky_cpu == linebreak_simple_a.html linebreak_simple_b.html == table_caption_bottom_a.html table_caption_bottom_ref.html == table_caption_top_a.html table_caption_top_ref.html == table_cell_float_a.html table_cell_float_ref.html +== table_center_a.html table_center_ref.html == table_colspan_fixed_a.html table_colspan_fixed_ref.html == table_colspan_simple_a.html table_colspan_simple_ref.html == table_containing_block_a.html table_containing_block_ref.html @@ -294,6 +295,7 @@ flaky_cpu == linebreak_simple_a.html linebreak_simple_b.html == table_padding_a.html table_padding_ref.html == table_percentage_capping_a.html table_percentage_capping_ref.html == table_percentage_width_a.html table_percentage_width_ref.html +== table_preferred_width_a.html table_preferred_width_ref.html == table_row_direction_a.html table_row_direction_ref.html == table_width_attribute_a.html table_width_attribute_ref.html == text_align_complex_a.html text_align_complex_ref.html diff --git a/tests/ref/table_center_a.html b/tests/ref/table_center_a.html new file mode 100644 index 00000000000..8f7af8a8fa6 --- /dev/null +++ b/tests/ref/table_center_a.html @@ -0,0 +1,12 @@ +<!DOCTYPE html> +<html> +<style> +body, html { + margin: 0; +} +</style> +<body> +<center><table border=0 cellspacing=0><tr><td style="border: none; padding: 0; height: 100px; width: 100px; background: green"></td></tr></table></center> +</body> +</html> + diff --git a/tests/ref/table_center_ref.html b/tests/ref/table_center_ref.html new file mode 100644 index 00000000000..27e3f34bfdc --- /dev/null +++ b/tests/ref/table_center_ref.html @@ -0,0 +1,13 @@ +<!DOCTYPE html> +<html> +<style> +body, html { + margin: 0; +} +</style> +<body> +<center><div style="height: 100px; width: 100px; background: green"></div></center> +</body> +</html> + + diff --git a/tests/ref/table_preferred_width_a.html b/tests/ref/table_preferred_width_a.html new file mode 100644 index 00000000000..e6815826831 --- /dev/null +++ b/tests/ref/table_preferred_width_a.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<style> +#a { + width: 500px; +} +table, table * { + border: none; + border-spacing: 0; + padding: 0; +} +</style> +<div id=a><table><td> + Hello hello hello hello + hello hello hello hello + hello hello hello hello + hello hello hello hello + hello hello hello hello + hello hello hello hello + hello hello hello hello + hello hello hello hello + hello hello hello hello + hello hello hello hello + hello hello hello hello + hello hello hello hello + hello hello hello hello + hello hello hello hello + hello hello hello hello + hello hello hello hello + hello hello hello hello + hello hello hello hello + hello hello hello hello + hello hello hello hello + hello hello hello hello +</td></table></div> + diff --git a/tests/ref/table_preferred_width_ref.html b/tests/ref/table_preferred_width_ref.html new file mode 100644 index 00000000000..06e9dd66943 --- /dev/null +++ b/tests/ref/table_preferred_width_ref.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<style> +#a { + width: 500px; +} +table, table * { + border: none; + border-spacing: 0; + padding: 0; +} +</style> +<div id=a> + Hello hello hello hello + hello hello hello hello + hello hello hello hello + hello hello hello hello + hello hello hello hello + hello hello hello hello + hello hello hello hello + hello hello hello hello + hello hello hello hello + hello hello hello hello + hello hello hello hello + hello hello hello hello + hello hello hello hello + hello hello hello hello + hello hello hello hello + hello hello hello hello + hello hello hello hello + hello hello hello hello + hello hello hello hello + hello hello hello hello + hello hello hello hello +</div> + diff --git a/tests/wpt/metadata-css/css21_dev/html4/background-attachment-applies-to-001.htm.ini b/tests/wpt/metadata-css/css21_dev/html4/background-attachment-applies-to-001.htm.ini deleted file mode 100644 index d6fb8356981..00000000000 --- a/tests/wpt/metadata-css/css21_dev/html4/background-attachment-applies-to-001.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[background-attachment-applies-to-001.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css21_dev/html4/background-attachment-applies-to-002.htm.ini b/tests/wpt/metadata-css/css21_dev/html4/background-attachment-applies-to-002.htm.ini deleted file mode 100644 index 77fd440b3fd..00000000000 --- a/tests/wpt/metadata-css/css21_dev/html4/background-attachment-applies-to-002.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[background-attachment-applies-to-002.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css21_dev/html4/background-attachment-applies-to-003.htm.ini b/tests/wpt/metadata-css/css21_dev/html4/background-attachment-applies-to-003.htm.ini deleted file mode 100644 index a69aa79a8e9..00000000000 --- a/tests/wpt/metadata-css/css21_dev/html4/background-attachment-applies-to-003.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[background-attachment-applies-to-003.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css21_dev/html4/background-attachment-applies-to-004.htm.ini b/tests/wpt/metadata-css/css21_dev/html4/background-attachment-applies-to-004.htm.ini deleted file mode 100644 index eda16b797a0..00000000000 --- a/tests/wpt/metadata-css/css21_dev/html4/background-attachment-applies-to-004.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[background-attachment-applies-to-004.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css21_dev/html4/background-attachment-applies-to-007.htm.ini b/tests/wpt/metadata-css/css21_dev/html4/background-attachment-applies-to-007.htm.ini deleted file mode 100644 index 9cd0f006e84..00000000000 --- a/tests/wpt/metadata-css/css21_dev/html4/background-attachment-applies-to-007.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[background-attachment-applies-to-007.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css21_dev/html4/background-attachment-applies-to-013.htm.ini b/tests/wpt/metadata-css/css21_dev/html4/background-attachment-applies-to-013.htm.ini deleted file mode 100644 index a8f2f01595f..00000000000 --- a/tests/wpt/metadata-css/css21_dev/html4/background-attachment-applies-to-013.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[background-attachment-applies-to-013.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css21_dev/html4/background-repeat-applies-to-007.htm.ini b/tests/wpt/metadata-css/css21_dev/html4/background-repeat-applies-to-007.htm.ini deleted file mode 100644 index b4db6fc0ec5..00000000000 --- a/tests/wpt/metadata-css/css21_dev/html4/background-repeat-applies-to-007.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[background-repeat-applies-to-007.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css21_dev/html4/c5525-fltmult-000.htm.ini b/tests/wpt/metadata-css/css21_dev/html4/c5525-fltmult-000.htm.ini deleted file mode 100644 index 701559c9ddc..00000000000 --- a/tests/wpt/metadata-css/css21_dev/html4/c5525-fltmult-000.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[c5525-fltmult-000.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css21_dev/html4/line-height-applies-to-001.htm.ini b/tests/wpt/metadata-css/css21_dev/html4/line-height-applies-to-001.htm.ini deleted file mode 100644 index b5dbe2c9c8d..00000000000 --- a/tests/wpt/metadata-css/css21_dev/html4/line-height-applies-to-001.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[line-height-applies-to-001.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css21_dev/html4/line-height-applies-to-002.htm.ini b/tests/wpt/metadata-css/css21_dev/html4/line-height-applies-to-002.htm.ini deleted file mode 100644 index b815b8d3b20..00000000000 --- a/tests/wpt/metadata-css/css21_dev/html4/line-height-applies-to-002.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[line-height-applies-to-002.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css21_dev/html4/line-height-applies-to-003.htm.ini b/tests/wpt/metadata-css/css21_dev/html4/line-height-applies-to-003.htm.ini deleted file mode 100644 index 2d3b43a67e0..00000000000 --- a/tests/wpt/metadata-css/css21_dev/html4/line-height-applies-to-003.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[line-height-applies-to-003.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css21_dev/html4/line-height-applies-to-004.htm.ini b/tests/wpt/metadata-css/css21_dev/html4/line-height-applies-to-004.htm.ini deleted file mode 100644 index 8cf58ec5d56..00000000000 --- a/tests/wpt/metadata-css/css21_dev/html4/line-height-applies-to-004.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[line-height-applies-to-004.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css21_dev/html4/line-height-applies-to-006.htm.ini b/tests/wpt/metadata-css/css21_dev/html4/line-height-applies-to-006.htm.ini deleted file mode 100644 index cd7a766a003..00000000000 --- a/tests/wpt/metadata-css/css21_dev/html4/line-height-applies-to-006.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[line-height-applies-to-006.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css21_dev/html4/line-height-applies-to-007.htm.ini b/tests/wpt/metadata-css/css21_dev/html4/line-height-applies-to-007.htm.ini deleted file mode 100644 index 9b43e802cf5..00000000000 --- a/tests/wpt/metadata-css/css21_dev/html4/line-height-applies-to-007.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[line-height-applies-to-007.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css21_dev/html4/line-height-applies-to-013.htm.ini b/tests/wpt/metadata-css/css21_dev/html4/line-height-applies-to-013.htm.ini deleted file mode 100644 index a3c2b0d532d..00000000000 --- a/tests/wpt/metadata-css/css21_dev/html4/line-height-applies-to-013.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[line-height-applies-to-013.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css21_dev/html4/margin-bottom-applies-to-001.htm.ini b/tests/wpt/metadata-css/css21_dev/html4/margin-bottom-applies-to-001.htm.ini deleted file mode 100644 index b73ad8554ee..00000000000 --- a/tests/wpt/metadata-css/css21_dev/html4/margin-bottom-applies-to-001.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[margin-bottom-applies-to-001.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css21_dev/html4/margin-bottom-applies-to-002.htm.ini b/tests/wpt/metadata-css/css21_dev/html4/margin-bottom-applies-to-002.htm.ini deleted file mode 100644 index b13cce3b5c4..00000000000 --- a/tests/wpt/metadata-css/css21_dev/html4/margin-bottom-applies-to-002.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[margin-bottom-applies-to-002.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css21_dev/html4/margin-bottom-applies-to-003.htm.ini b/tests/wpt/metadata-css/css21_dev/html4/margin-bottom-applies-to-003.htm.ini deleted file mode 100644 index 25bc328010c..00000000000 --- a/tests/wpt/metadata-css/css21_dev/html4/margin-bottom-applies-to-003.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[margin-bottom-applies-to-003.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css21_dev/html4/margin-bottom-applies-to-004.htm.ini b/tests/wpt/metadata-css/css21_dev/html4/margin-bottom-applies-to-004.htm.ini deleted file mode 100644 index e11b53653d5..00000000000 --- a/tests/wpt/metadata-css/css21_dev/html4/margin-bottom-applies-to-004.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[margin-bottom-applies-to-004.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css21_dev/html4/margin-bottom-applies-to-006.htm.ini b/tests/wpt/metadata-css/css21_dev/html4/margin-bottom-applies-to-006.htm.ini deleted file mode 100644 index f02a0f1d3cf..00000000000 --- a/tests/wpt/metadata-css/css21_dev/html4/margin-bottom-applies-to-006.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[margin-bottom-applies-to-006.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css21_dev/html4/margin-bottom-applies-to-007.htm.ini b/tests/wpt/metadata-css/css21_dev/html4/margin-bottom-applies-to-007.htm.ini deleted file mode 100644 index d86b9f9d430..00000000000 --- a/tests/wpt/metadata-css/css21_dev/html4/margin-bottom-applies-to-007.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[margin-bottom-applies-to-007.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css21_dev/html4/run-in-basic-017.htm.ini b/tests/wpt/metadata-css/css21_dev/html4/run-in-basic-017.htm.ini index c7e1e1f65d2..9e2f33bfcec 100644 --- a/tests/wpt/metadata-css/css21_dev/html4/run-in-basic-017.htm.ini +++ b/tests/wpt/metadata-css/css21_dev/html4/run-in-basic-017.htm.ini @@ -1,3 +1,3 @@ [run-in-basic-017.htm] type: reftest - expected: FAIL
\ No newline at end of file + expected: FAIL diff --git a/tests/wpt/metadata-css/css21_dev/html4/table-visual-layout-026a.htm.ini b/tests/wpt/metadata-css/css21_dev/html4/table-visual-layout-026a.htm.ini deleted file mode 100644 index f9e74fd4bca..00000000000 --- a/tests/wpt/metadata-css/css21_dev/html4/table-visual-layout-026a.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[table-visual-layout-026a.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css21_dev/html4/table-visual-layout-026b.htm.ini b/tests/wpt/metadata-css/css21_dev/html4/table-visual-layout-026b.htm.ini deleted file mode 100644 index 1c58d7bd885..00000000000 --- a/tests/wpt/metadata-css/css21_dev/html4/table-visual-layout-026b.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[table-visual-layout-026b.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css21_dev/html4/table-visual-layout-026c.htm.ini b/tests/wpt/metadata-css/css21_dev/html4/table-visual-layout-026c.htm.ini deleted file mode 100644 index 953aff57cd8..00000000000 --- a/tests/wpt/metadata-css/css21_dev/html4/table-visual-layout-026c.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[table-visual-layout-026c.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css21_dev/html4/table-visual-layout-026d.htm.ini b/tests/wpt/metadata-css/css21_dev/html4/table-visual-layout-026d.htm.ini deleted file mode 100644 index 3dd07a1e74b..00000000000 --- a/tests/wpt/metadata-css/css21_dev/html4/table-visual-layout-026d.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[table-visual-layout-026d.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css21_dev/html4/vertical-align-baseline-009.htm.ini b/tests/wpt/metadata-css/css21_dev/html4/vertical-align-baseline-009.htm.ini new file mode 100644 index 00000000000..e851b181977 --- /dev/null +++ b/tests/wpt/metadata-css/css21_dev/html4/vertical-align-baseline-009.htm.ini @@ -0,0 +1,3 @@ +[vertical-align-baseline-009.htm] + type: reftest + expected: FAIL |