mirror of
https://github.com/servo/servo.git
synced 2025-08-02 12:10:29 +01:00
Add support for table-layout: fixed
(#33384)
More details might be needed to fully support the feature, but this covers the basic functionality. Signed-off-by: Oriol Brufau <obrufau@igalia.com> Co-authored-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
52e495c1a6
commit
dc018b5f9f
20 changed files with 56 additions and 130 deletions
|
@ -12,6 +12,7 @@ use style::computed_values::border_collapse::T as BorderCollapse;
|
||||||
use style::computed_values::box_sizing::T as BoxSizing;
|
use style::computed_values::box_sizing::T as BoxSizing;
|
||||||
use style::computed_values::caption_side::T as CaptionSide;
|
use style::computed_values::caption_side::T as CaptionSide;
|
||||||
use style::computed_values::empty_cells::T as EmptyCells;
|
use style::computed_values::empty_cells::T as EmptyCells;
|
||||||
|
use style::computed_values::table_layout::T as TableLayoutMode;
|
||||||
use style::computed_values::visibility::T as Visibility;
|
use style::computed_values::visibility::T as Visibility;
|
||||||
use style::logical_geometry::WritingMode;
|
use style::logical_geometry::WritingMode;
|
||||||
use style::properties::ComputedValues;
|
use style::properties::ComputedValues;
|
||||||
|
@ -172,6 +173,9 @@ impl<'a> TableLayout<'a> {
|
||||||
layout_context: &LayoutContext,
|
layout_context: &LayoutContext,
|
||||||
writing_mode: WritingMode,
|
writing_mode: WritingMode,
|
||||||
) {
|
) {
|
||||||
|
let is_in_fixed_mode = self.table.style.get_table().clone_table_layout() ==
|
||||||
|
TableLayoutMode::Fixed &&
|
||||||
|
!self.table.style.box_size(writing_mode).inline.is_auto();
|
||||||
let row_measures = vec![LogicalVec2::zero(); self.table.size.width];
|
let row_measures = vec![LogicalVec2::zero(); self.table.size.width];
|
||||||
self.cell_measures = vec![row_measures; self.table.size.height];
|
self.cell_measures = vec![row_measures; self.table.size.height];
|
||||||
|
|
||||||
|
@ -201,10 +205,24 @@ impl<'a> TableLayout<'a> {
|
||||||
|
|
||||||
let (size, min_size, max_size) =
|
let (size, min_size, max_size) =
|
||||||
get_outer_sizes_from_style(&cell.style, writing_mode, &padding_border_sums);
|
get_outer_sizes_from_style(&cell.style, writing_mode, &padding_border_sums);
|
||||||
let mut inline_content_sizes = cell.contents.contents.inline_content_sizes(
|
let percentage_contribution =
|
||||||
|
get_size_percentage_contribution_from_style(&cell.style, writing_mode);
|
||||||
|
|
||||||
|
// <https://drafts.csswg.org/css-tables/#in-fixed-mode>
|
||||||
|
// > When a table-root is laid out in fixed mode, the content of its table-cells is ignored
|
||||||
|
// > for the purpose of width computation, the aggregation algorithm for column sizing considers
|
||||||
|
// > only table-cells belonging to the first row track
|
||||||
|
let inline_measure = if is_in_fixed_mode && row_index > 0 {
|
||||||
|
CellOrTrackMeasure::zero()
|
||||||
|
} else {
|
||||||
|
let mut inline_content_sizes = if is_in_fixed_mode {
|
||||||
|
ContentSizes::zero()
|
||||||
|
} else {
|
||||||
|
cell.contents.contents.inline_content_sizes(
|
||||||
layout_context,
|
layout_context,
|
||||||
&IndefiniteContainingBlock::new_for_style(&cell.style),
|
&IndefiniteContainingBlock::new_for_style(&cell.style),
|
||||||
);
|
)
|
||||||
|
};
|
||||||
inline_content_sizes.min_content += padding_border_sums.inline;
|
inline_content_sizes.min_content += padding_border_sums.inline;
|
||||||
inline_content_sizes.max_content += padding_border_sums.inline;
|
inline_content_sizes.max_content += padding_border_sums.inline;
|
||||||
|
|
||||||
|
@ -213,14 +231,15 @@ impl<'a> TableLayout<'a> {
|
||||||
.max_content
|
.max_content
|
||||||
.max(inline_content_sizes.min_content);
|
.max(inline_content_sizes.min_content);
|
||||||
|
|
||||||
let percentage_contribution =
|
|
||||||
get_size_percentage_contribution_from_style(&cell.style, writing_mode);
|
|
||||||
|
|
||||||
// These formulas differ from the spec, but seem to match Gecko and Blink.
|
// These formulas differ from the spec, but seem to match Gecko and Blink.
|
||||||
let outer_min_content_width = inline_content_sizes
|
let outer_min_content_width = if is_in_fixed_mode {
|
||||||
|
size.inline.min(max_size.inline).max(min_size.inline)
|
||||||
|
} else {
|
||||||
|
inline_content_sizes
|
||||||
.min_content
|
.min_content
|
||||||
.min(max_size.inline)
|
.min(max_size.inline)
|
||||||
.max(min_size.inline);
|
.max(min_size.inline)
|
||||||
|
};
|
||||||
let outer_max_content_width = if self.columns[column_index].constrained {
|
let outer_max_content_width = if self.columns[column_index].constrained {
|
||||||
inline_content_sizes
|
inline_content_sizes
|
||||||
.min_content
|
.min_content
|
||||||
|
@ -236,12 +255,13 @@ impl<'a> TableLayout<'a> {
|
||||||
};
|
};
|
||||||
assert!(outer_min_content_width <= outer_max_content_width);
|
assert!(outer_min_content_width <= outer_max_content_width);
|
||||||
|
|
||||||
let inline_measure = CellOrTrackMeasure {
|
CellOrTrackMeasure {
|
||||||
content_sizes: ContentSizes {
|
content_sizes: ContentSizes {
|
||||||
min_content: outer_min_content_width,
|
min_content: outer_min_content_width,
|
||||||
max_content: outer_max_content_width,
|
max_content: outer_max_content_width,
|
||||||
},
|
},
|
||||||
percentage: percentage_contribution.inline,
|
percentage: percentage_contribution.inline,
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// This measure doesn't take into account the `min-content` and `max-content` sizes.
|
// This measure doesn't take into account the `min-content` and `max-content` sizes.
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
[direction-applies-to-001.xht]
|
|
||||||
expected: FAIL
|
|
|
@ -1,2 +0,0 @@
|
||||||
[direction-applies-to-002.xht]
|
|
||||||
expected: FAIL
|
|
|
@ -1,2 +0,0 @@
|
||||||
[direction-applies-to-003.xht]
|
|
||||||
expected: FAIL
|
|
|
@ -1,2 +0,0 @@
|
||||||
[direction-applies-to-004.xht]
|
|
||||||
expected: FAIL
|
|
|
@ -1,2 +0,0 @@
|
||||||
[fixed-table-layout-002a.xht]
|
|
||||||
expected: FAIL
|
|
|
@ -1,2 +0,0 @@
|
||||||
[separated-border-model-004c.xht]
|
|
||||||
expected: FAIL
|
|
|
@ -1,2 +0,0 @@
|
||||||
[separated-border-model-004d.xht]
|
|
||||||
expected: FAIL
|
|
|
@ -1,2 +0,0 @@
|
||||||
[overflow-applies-to-007.xht]
|
|
||||||
expected: FAIL
|
|
|
@ -1,2 +0,0 @@
|
||||||
[overflow-applies-to-013.xht]
|
|
||||||
expected: FAIL
|
|
|
@ -1,2 +0,0 @@
|
||||||
[overflow-applies-to-014.xht]
|
|
||||||
expected: FAIL
|
|
|
@ -1,2 +0,0 @@
|
||||||
[overflow-applies-to-001.xht]
|
|
||||||
expected: FAIL
|
|
|
@ -1,2 +0,0 @@
|
||||||
[flexbox_flex-formatting-interop.html]
|
|
||||||
expected: FAIL
|
|
|
@ -1,2 +0,0 @@
|
||||||
[flexbox_table-fixed-layout.html]
|
|
||||||
expected: FAIL
|
|
|
@ -5,9 +5,6 @@
|
||||||
[main table 4]
|
[main table 4]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[main table 5]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[main table 10]
|
[main table 10]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
[fixed-layout-1.html]
|
|
||||||
[Table-layout:fixed grows the table if needed for minimum-width]
|
|
||||||
expected: FAIL
|
|
|
@ -1,2 +0,0 @@
|
||||||
[table-cell-overflow-auto-scrolled.html]
|
|
||||||
expected: FAIL
|
|
|
@ -1,7 +1,4 @@
|
||||||
[column-widths.html]
|
[column-widths.html]
|
||||||
[table 3]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[table 14]
|
[table 14]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
|
|
@ -1,19 +1,7 @@
|
||||||
[table-width-redistribution-fixed-padding.html]
|
[table-width-redistribution-fixed-padding.html]
|
||||||
[table 1]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[table 4]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[table 5]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[table 6]
|
[table 6]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[table 9]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[table 10]
|
[table 10]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
@ -26,9 +14,6 @@
|
||||||
[table 13]
|
[table 13]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[table 14]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[table 15]
|
[table 15]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
|
|
@ -2,53 +2,11 @@
|
||||||
[table 3]
|
[table 3]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[table 4]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[table 7]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[table 8]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[table 9]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[table 10]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[table 11]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[table 14]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[table 15]
|
[table 15]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[table 16]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[table 17]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[table 18]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[table 19]
|
[table 19]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[table 22]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[table 24]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[table 25]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[table 26]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[table 12]
|
[table 12]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue