mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
layout: Implement the fit-content()
sizing function (#36056)
Spec: https://drafts.csswg.org/css-sizing-3/#funcdef-width-fit-content It's similar to the `fit-content` keyword but, instead of clamping the stretch size between `min-content` and `max-content`, it clamps the provided argument. So now that we support `fit-content`, it's quite straightforward to add. It's just not completely clear what should happen when the argument has a cyclic percentage, so this may need some further adjustments depending on the outcome of https://github.com/w3c/csswg-drafts/issues/11805 Signed-off-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
parent
3a356ffb74
commit
8c2ac88ad0
33 changed files with 100 additions and 192 deletions
|
@ -1014,18 +1014,16 @@ impl LayoutStyle<'_> {
|
|||
depends_on_block_constraints(&max_size.block) ||
|
||||
style.depends_on_block_constraints_due_to_relative_positioning(writing_mode);
|
||||
|
||||
let box_size = box_size.maybe_percentages_relative_to_basis(&containing_block.size);
|
||||
let content_box_size = style
|
||||
.content_box_size_for_box_size(box_size, &pbm)
|
||||
.map(|v| v.map(Au::from));
|
||||
let box_size = box_size.map_with(&containing_block.size, |size, basis| {
|
||||
size.resolve_percentages_for_preferred(*basis)
|
||||
});
|
||||
let content_box_size = style.content_box_size_for_box_size(box_size, &pbm);
|
||||
let min_size = min_size.percentages_relative_to_basis(&containing_block_size_or_zero);
|
||||
let content_min_box_size = style
|
||||
.content_min_box_size_for_min_size(min_size, &pbm)
|
||||
.map(|v| v.map(Au::from));
|
||||
let max_size = max_size.maybe_percentages_relative_to_basis(&containing_block.size);
|
||||
let content_max_box_size = style
|
||||
.content_max_box_size_for_max_size(max_size, &pbm)
|
||||
.map(|v| v.map(Au::from));
|
||||
let content_min_box_size = style.content_min_box_size_for_min_size(min_size, &pbm);
|
||||
let max_size = max_size.map_with(&containing_block.size, |size, basis| {
|
||||
size.resolve_percentages_for_max(*basis)
|
||||
});
|
||||
let content_max_box_size = style.content_max_box_size_for_max_size(max_size, &pbm);
|
||||
ContentBoxSizesAndPBM {
|
||||
content_box_sizes: LogicalVec2 {
|
||||
block: Sizes::new(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue