diff options
author | Oriol Brufau <obrufau@igalia.com> | 2024-09-27 10:16:07 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-27 17:16:07 +0000 |
commit | 057dd1e9eb46749f3e38bf7fbbf05392d8fbe1fd (patch) | |
tree | 3aa851a9f2b523596efbb3cf69912d8a484ad3cd /components/layout_2020/flow | |
parent | c7ef974968c32d58e6fdd3213965c0f88ee6e4a5 (diff) | |
download | servo-057dd1e9eb46749f3e38bf7fbbf05392d8fbe1fd.tar.gz servo-057dd1e9eb46749f3e38bf7fbbf05392d8fbe1fd.zip |
Make ComputedValuesExt expose keywords for the sizing properties (#33558)
This will allow callers to start obeying `min-content`, `max-content`,
`fit-content` and `stretch` in follow-up patches.
The old functionality is kept as deprecated methods that we should
eventually remove.
This patch has very little impact on the existing behavior, just some
very minimal implementation of the keywords for css tables.
This also overhauls fixed-layout-2.html since:
- It had code that wasn't doing anything
- It had wrong expecations in prose
- The logic seemed broken in general
- All browsers were failing one testcase
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Diffstat (limited to 'components/layout_2020/flow')
-rw-r--r-- | components/layout_2020/flow/float.rs | 6 | ||||
-rw-r--r-- | components/layout_2020/flow/inline/mod.rs | 6 | ||||
-rw-r--r-- | components/layout_2020/flow/mod.rs | 22 |
3 files changed, 19 insertions, 15 deletions
diff --git a/components/layout_2020/flow/float.rs b/components/layout_2020/flow/float.rs index 73e12ac2298..b4d77b35e80 100644 --- a/components/layout_2020/flow/float.rs +++ b/components/layout_2020/flow/float.rs @@ -915,13 +915,13 @@ impl FloatBox { // https://drafts.csswg.org/css2/#float-width let style = non_replaced.style.clone(); let box_size = style - .content_box_size(containing_block, &pbm) + .content_box_size_deprecated(containing_block, &pbm) .map(|v| v.map(Au::from)); let max_box_size = style - .content_max_box_size(containing_block, &pbm) + .content_max_box_size_deprecated(containing_block, &pbm) .map(|v| v.map(Au::from)); let min_box_size = style - .content_min_box_size(containing_block, &pbm) + .content_min_box_size_deprecated(containing_block, &pbm) .map(|v| v.map(Au::from)) .auto_is(Au::zero); diff --git a/components/layout_2020/flow/inline/mod.rs b/components/layout_2020/flow/inline/mod.rs index 8a26e38a466..56d17bd54b9 100644 --- a/components/layout_2020/flow/inline/mod.rs +++ b/components/layout_2020/flow/inline/mod.rs @@ -1929,15 +1929,15 @@ impl IndependentFormattingContext { IndependentFormattingContext::NonReplaced(non_replaced) => { let box_size = non_replaced .style - .content_box_size(layout.containing_block, &pbm) + .content_box_size_deprecated(layout.containing_block, &pbm) .map(|v| v.map(Au::from)); let max_box_size = non_replaced .style - .content_max_box_size(layout.containing_block, &pbm) + .content_max_box_size_deprecated(layout.containing_block, &pbm) .map(|v| v.map(Au::from)); let min_box_size = non_replaced .style - .content_min_box_size(layout.containing_block, &pbm) + .content_min_box_size_deprecated(layout.containing_block, &pbm) .map(|v| v.map(Au::from)) .auto_is(Au::zero); let block_size = box_size diff --git a/components/layout_2020/flow/mod.rs b/components/layout_2020/flow/mod.rs index 9c469650d48..09c4d0e2a16 100644 --- a/components/layout_2020/flow/mod.rs +++ b/components/layout_2020/flow/mod.rs @@ -135,10 +135,10 @@ impl BlockLevelBox { } let min_size = style - .content_min_box_size(containing_block, &pbm) + .content_min_box_size_deprecated(containing_block, &pbm) .auto_is(Au::zero); - let max_size = style.content_max_box_size(containing_block, &pbm); - let prefered_size = style.content_box_size(containing_block, &pbm); + let max_size = style.content_max_box_size_deprecated(containing_block, &pbm); + let prefered_size = style.content_box_size_deprecated(containing_block, &pbm); let inline_size = prefered_size .inline .auto_is(|| { @@ -1048,11 +1048,15 @@ impl NonReplacedFormattingContext { sequential_layout_state: &mut SequentialLayoutState, ) -> BoxFragment { let pbm = self.style.padding_border_margin(containing_block); - let box_size = self.style.content_box_size(containing_block, &pbm); - let max_box_size = self.style.content_max_box_size(containing_block, &pbm); + let box_size = self + .style + .content_box_size_deprecated(containing_block, &pbm); + let max_box_size = self + .style + .content_max_box_size_deprecated(containing_block, &pbm); let min_box_size = self .style - .content_min_box_size(containing_block, &pbm) + .content_min_box_size_deprecated(containing_block, &pbm) .auto_is(Au::zero); let block_size = box_size.block.map(|block_size| { block_size.clamp_between_extremums(min_box_size.block, max_box_size.block) @@ -1424,10 +1428,10 @@ fn solve_containing_block_padding_and_border_for_in_flow_box<'a>( style: &'a Arc<ComputedValues>, ) -> ContainingBlockPaddingAndBorder<'a> { let pbm = style.padding_border_margin(containing_block); - let box_size = style.content_box_size(containing_block, &pbm); - let max_box_size = style.content_max_box_size(containing_block, &pbm); + let box_size = style.content_box_size_deprecated(containing_block, &pbm); + let max_box_size = style.content_max_box_size_deprecated(containing_block, &pbm); let min_box_size = style - .content_min_box_size(containing_block, &pbm) + .content_min_box_size_deprecated(containing_block, &pbm) .auto_is(Au::zero); // https://drafts.csswg.org/css2/#the-width-property |