diff options
author | Oriol Brufau <obrufau@igalia.com> | 2024-11-29 12:40:52 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-29 11:40:52 +0000 |
commit | 19a7e95a6a4cc4e6aa187f2fe2302c4707401e34 (patch) | |
tree | b288e002160b1dd9c07ecf29eba22df9cf8e59e5 /components/layout_2020/table/layout.rs | |
parent | 16da1c2721d471277c3981795d8d6000e8876cea (diff) | |
download | servo-19a7e95a6a4cc4e6aa187f2fe2302c4707401e34.tar.gz servo-19a7e95a6a4cc4e6aa187f2fe2302c4707401e34.zip |
Refactor computation of preferred aspect ratios (#34416)
* Refactor computation of preferred aspect ratios
Computing min/max-content sizes required a ContainingBlock in order to
resolve the padding and border when determining the preferred aspect
ratio. However, all callers already knew the padding and border, so they
can compute the ratio themselves, and pass it directly instead of
the ContainingBlock.
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
* Put preferred aspect ratio into ConstraintSpace
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
---------
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Diffstat (limited to 'components/layout_2020/table/layout.rs')
-rw-r--r-- | components/layout_2020/table/layout.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/components/layout_2020/table/layout.rs b/components/layout_2020/table/layout.rs index e3c9ca79233..673beb604ae 100644 --- a/components/layout_2020/table/layout.rs +++ b/components/layout_2020/table/layout.rs @@ -296,12 +296,13 @@ impl<'a> TableLayout<'a> { let mut inline_content_sizes = if is_in_fixed_mode { ContentSizes::zero() } else { + let constraint_space = ConstraintSpace::new_for_style_and_ratio( + &cell.style, + None, /* TODO: support preferred aspect ratios on non-replaced boxes */ + ); cell.contents .contents - .inline_content_sizes( - layout_context, - &ConstraintSpace::new_for_style(&cell.style), - ) + .inline_content_sizes(layout_context, &constraint_space) .sizes }; inline_content_sizes.min_content += padding_border_sums.inline; |