mirror of
https://github.com/servo/servo.git
synced 2025-08-08 15:05:35 +01:00
Layout: use Au
in ContentSizes
(#31135)
* use app_units * resolve errors in table layout * fmt * add back current_line.min_content * update expectation * review fix
This commit is contained in:
parent
bd25c07b22
commit
45af1198aa
8 changed files with 60 additions and 50 deletions
|
@ -95,7 +95,7 @@ impl<'a> TableLayout<'a> {
|
|||
|
||||
// https://drafts.csswg.org/css-tables/#used-min-width-of-table
|
||||
// > The used min-width of a table is the greater of the resolved min-width, CAPMIN, and GRIDMIN.
|
||||
let used_min_width_of_table = grid_min_inline_size.max(min_content_sizes.inline);
|
||||
let used_min_width_of_table = grid_min_inline_size.max(min_content_sizes.inline.into());
|
||||
|
||||
// https://drafts.csswg.org/css-tables/#used-width-of-table
|
||||
// > The used width of a table depends on the columns and captions widths as follows:
|
||||
|
@ -105,10 +105,13 @@ impl<'a> TableLayout<'a> {
|
|||
// > * If the table-root has 'width: auto', the used width is the greater of min(GRIDMAX,
|
||||
// > the table’s containing block width), the used min-width of the table.
|
||||
let used_width_of_table = match content_box_size.inline {
|
||||
LengthPercentage(length_percentage) => length_percentage.max(used_min_width_of_table),
|
||||
LengthPercentage(length_percentage) => {
|
||||
length_percentage.max(used_min_width_of_table.into())
|
||||
},
|
||||
Auto => grid_max_inline_size
|
||||
.min(containing_block.inline_size)
|
||||
.max(used_min_width_of_table),
|
||||
.min(containing_block.inline_size.into())
|
||||
.max(used_min_width_of_table)
|
||||
.into(),
|
||||
};
|
||||
|
||||
self.assignable_width = used_width_of_table.into();
|
||||
|
@ -185,8 +188,11 @@ impl<'a> TableLayout<'a> {
|
|||
max_content_sizing_guess,
|
||||
) = match inline_size {
|
||||
LengthPercentage(length_percentage) if length_percentage.has_percentage() => {
|
||||
let percent_guess = min_content_width
|
||||
.max(length_percentage.resolve(self.assignable_width.into()));
|
||||
let percent_guess = min_content_width.max(
|
||||
length_percentage
|
||||
.resolve(self.assignable_width.into())
|
||||
.into(),
|
||||
);
|
||||
(percent_guess, percent_guess, percent_guess)
|
||||
},
|
||||
LengthPercentage(_) => (min_content_width, max_content_width, max_content_width),
|
||||
|
@ -450,7 +456,7 @@ impl Table {
|
|||
};
|
||||
|
||||
let sizes = cell.inline_content_sizes(layout_context, writing_mode);
|
||||
sizes.map(|size| size / cell.colspan as f32)
|
||||
sizes.map(|size| size.scale_by(1.0 / cell.colspan as f32))
|
||||
}
|
||||
|
||||
pub(crate) fn compute_inline_content_sizes(
|
||||
|
@ -520,8 +526,8 @@ impl TableSlotCell {
|
|||
.contents
|
||||
.contents
|
||||
.inline_content_sizes(layout_context, writing_mode);
|
||||
sizes.min_content += border_padding_sum;
|
||||
sizes.max_content += border_padding_sum;
|
||||
sizes.min_content += border_padding_sum.into();
|
||||
sizes.max_content += border_padding_sum.into();
|
||||
sizes
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue