mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Fix various issues with replaced elements in flex layout (#33263)
In particular, this takes into account that flex items may be stretched, and if they have an aspect ratio, we ma6y need to convert the stretched size through the ratio. Signed-off-by: Oriol Brufau <obrufau@igalia.com> Co-authored-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
4ae2610c24
commit
3acc9edd82
43 changed files with 334 additions and 481 deletions
|
@ -198,12 +198,14 @@ impl IndependentFormattingContext {
|
|||
layout_context: &LayoutContext,
|
||||
containing_block: &IndefiniteContainingBlock,
|
||||
auto_minimum: &LogicalVec2<Au>,
|
||||
auto_block_size_stretches_to_containing_block: bool,
|
||||
) -> ContentSizes {
|
||||
match self {
|
||||
Self::NonReplaced(non_replaced) => sizing::outer_inline(
|
||||
&non_replaced.style.clone(),
|
||||
containing_block,
|
||||
auto_minimum,
|
||||
auto_block_size_stretches_to_containing_block,
|
||||
|containing_block_for_children| {
|
||||
non_replaced.inline_content_sizes(layout_context, containing_block_for_children)
|
||||
},
|
||||
|
@ -212,6 +214,7 @@ impl IndependentFormattingContext {
|
|||
&replaced.style,
|
||||
containing_block,
|
||||
auto_minimum,
|
||||
auto_block_size_stretches_to_containing_block,
|
||||
|containing_block_for_children| {
|
||||
replaced.contents.inline_content_sizes(
|
||||
layout_context,
|
||||
|
@ -222,6 +225,16 @@ impl IndependentFormattingContext {
|
|||
),
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn preferred_aspect_ratio(
|
||||
&self,
|
||||
containing_block: &IndefiniteContainingBlock,
|
||||
) -> Option<AspectRatio> {
|
||||
match self {
|
||||
Self::NonReplaced(_) => None,
|
||||
Self::Replaced(replaced) => replaced.preferred_aspect_ratio(containing_block),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl NonReplacedFormattingContext {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue