mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Refactor box size computation (#34671)
in each layout logic, in order to correctly resolve sizing keywords. This patch adds a new `Sizes` struct which holds the preferred, min and max sizing values for one axis, and unifies the logic to resolve the final size into there. Signed-off-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
parent
28e330c9b6
commit
e2a0ac07ff
8 changed files with 311 additions and 343 deletions
|
@ -22,7 +22,7 @@ use crate::formatting_contexts::{
|
|||
use crate::fragment_tree::{BoxFragment, CollapsedBlockMargins, Fragment};
|
||||
use crate::geom::{
|
||||
LogicalSides, LogicalVec2, PhysicalPoint, PhysicalRect, PhysicalSides, PhysicalSize, Size,
|
||||
SizeConstraint,
|
||||
SizeConstraint, Sizes,
|
||||
};
|
||||
use crate::positioned::{AbsolutelyPositionedBox, PositioningContext, PositioningContextLength};
|
||||
use crate::sizing::{ComputeInlineContentSizes, ContentSizes, InlineContentSizesResult};
|
||||
|
@ -155,18 +155,16 @@ impl taffy::LayoutPartialTree for TaffyContainerContext<'_> {
|
|||
style,
|
||||
independent_context
|
||||
.preferred_aspect_ratio(&pbm.padding_border_sums),
|
||||
LogicalVec2 {
|
||||
inline: option_f32_to_size(content_box_known_dimensions.width),
|
||||
block: option_f32_to_size(content_box_known_dimensions.height),
|
||||
},
|
||||
LogicalVec2 {
|
||||
inline: Size::Numeric(Au::zero()),
|
||||
block: Size::Numeric(Au::zero()),
|
||||
},
|
||||
LogicalVec2 {
|
||||
inline: Size::Initial,
|
||||
block: Size::Initial,
|
||||
},
|
||||
&Sizes::new(
|
||||
option_f32_to_size(content_box_known_dimensions.height),
|
||||
Size::Initial,
|
||||
Size::Initial,
|
||||
),
|
||||
&Sizes::new(
|
||||
option_f32_to_size(content_box_known_dimensions.width),
|
||||
Size::Initial,
|
||||
Size::Initial,
|
||||
),
|
||||
pbm.padding_border_sums + pbm.margin.auto_is(Au::zero).sum(),
|
||||
)
|
||||
.to_physical_size(self.style.writing_mode);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue