mirror of
https://github.com/servo/servo.git
synced 2025-08-04 05:00:08 +01:00
Fix the measures of a table cell (#31513)
The spec doesn't make much sense, this seems to match Gecko and Blink.
This commit is contained in:
parent
3a3e76a935
commit
dea416eec9
2 changed files with 24 additions and 24 deletions
|
@ -144,36 +144,38 @@ impl<'a> TableLayout<'a> {
|
||||||
};
|
};
|
||||||
|
|
||||||
let (size, min_size, max_size) = get_sizes_from_style(&cell.style, writing_mode);
|
let (size, min_size, max_size) = get_sizes_from_style(&cell.style, writing_mode);
|
||||||
let inline_content_sizes = cell
|
let mut inline_content_sizes = cell
|
||||||
.contents
|
.contents
|
||||||
.contents
|
.contents
|
||||||
.inline_content_sizes(layout_context, writing_mode);
|
.inline_content_sizes(layout_context, writing_mode);
|
||||||
|
|
||||||
|
// TODO: the max-content size should never be smaller than the min-content size!
|
||||||
|
inline_content_sizes.max_content = inline_content_sizes
|
||||||
|
.max_content
|
||||||
|
.max(inline_content_sizes.min_content);
|
||||||
|
|
||||||
let percentage_contribution =
|
let percentage_contribution =
|
||||||
get_size_percentage_contribution_from_style(&cell.style, writing_mode);
|
get_size_percentage_contribution_from_style(&cell.style, writing_mode);
|
||||||
|
|
||||||
// > The outer min-content width of a table-cell is max(min-width, min-content width)
|
// These formulas differ from the spec, but seem to match Gecko and Blink.
|
||||||
// > adjusted by the cell intrinsic offsets.
|
let mut outer_min_content_width = inline_content_sizes
|
||||||
let mut outer_min_content_width =
|
.min_content
|
||||||
inline_content_sizes.min_content.max(min_size.inline);
|
.min(max_size.inline)
|
||||||
let mut outer_max_content_width = if !self.columns[column_index].constrained {
|
.max(min_size.inline);
|
||||||
// > The outer max-content width of a table-cell in a non-constrained column is
|
let mut outer_max_content_width = if self.columns[column_index].constrained {
|
||||||
// > max(min-width, width, min-content width, min(max-width, max-content width))
|
inline_content_sizes
|
||||||
// > adjusted by the cell intrinsic offsets.
|
.min_content
|
||||||
min_size
|
|
||||||
.inline
|
|
||||||
.max(size.inline)
|
.max(size.inline)
|
||||||
.max(inline_content_sizes.min_content)
|
.min(max_size.inline)
|
||||||
.max(max_size.inline.min(inline_content_sizes.max_content))
|
.max(min_size.inline)
|
||||||
} else {
|
} else {
|
||||||
// > The outer max-content width of a table-cell in a constrained column is
|
inline_content_sizes
|
||||||
// > max(min-width, width, min-content width, min(max-width, width)) adjusted by the
|
.max_content
|
||||||
// > cell intrinsic offsets.
|
|
||||||
min_size
|
|
||||||
.inline
|
|
||||||
.max(size.inline)
|
.max(size.inline)
|
||||||
.max(inline_content_sizes.min_content)
|
.min(max_size.inline)
|
||||||
.max(max_size.inline.min(size.inline))
|
.max(min_size.inline)
|
||||||
};
|
};
|
||||||
|
assert!(outer_min_content_width <= outer_max_content_width);
|
||||||
|
|
||||||
let padding = cell
|
let padding = cell
|
||||||
.style
|
.style
|
||||||
|
@ -286,8 +288,8 @@ impl<'a> TableLayout<'a> {
|
||||||
.box_size(writing_mode)
|
.box_size(writing_mode)
|
||||||
.inline
|
.inline
|
||||||
.non_auto()
|
.non_auto()
|
||||||
.map(|length_percentage| length_percentage.to_length().is_some())
|
.and_then(|length_percentage| length_percentage.to_length())
|
||||||
.unwrap_or(false),
|
.is_some(),
|
||||||
_ => false,
|
_ => false,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
[table-cell-overflow-auto.html]
|
|
||||||
expected: FAIL
|
|
Loading…
Add table
Add a link
Reference in a new issue