mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Improve performance of column flexboxes (#34346)
If a flex item in a single-line column flex container stretches, then we can know its final size. So instead of first laying it out using its intrinsic inline size, and then stretching it later, we can use the correct size from the very beginning. Signed-off-by: Oriol Brufau <obrufau@igalia.com> Co-authored-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
524c54640d
commit
f943ba023a
1 changed files with 10 additions and 2 deletions
|
@ -1901,8 +1901,16 @@ impl FlexItem<'_> {
|
|||
self.content_max_size.cross,
|
||||
)
|
||||
});
|
||||
content_contributions
|
||||
.shrink_to_fit(containing_block.inline_size - self.pbm_auto_is_zero.cross)
|
||||
let stretch_size = containing_block.inline_size - self.pbm_auto_is_zero.cross;
|
||||
let style = self.box_.style();
|
||||
if flex_context
|
||||
.config
|
||||
.item_with_auto_cross_size_stretches_to_container_size(style, &self.margin)
|
||||
{
|
||||
stretch_size
|
||||
} else {
|
||||
content_contributions.shrink_to_fit(stretch_size)
|
||||
}
|
||||
}),
|
||||
// The main size of a flex item is considered to be definite if its flex basis is definite
|
||||
// or the flex container has a definite main size.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue