mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Handle aspect ratios in ReplacedContent::inline_content_sizes
(#33240)
We were only handling the aspect ratio of a replaced element when computing its min/max-content contribution, but not when computing the min/max-content size. Now both cases will take it into account. Signed-off-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
parent
3f93de7f54
commit
0643aa4708
13 changed files with 39 additions and 59 deletions
|
@ -5,7 +5,6 @@
|
|||
use app_units::Au;
|
||||
use serde::Serialize;
|
||||
use servo_arc::Arc;
|
||||
use style::logical_geometry::Direction;
|
||||
use style::properties::ComputedValues;
|
||||
use style::selector_parser::PseudoElement;
|
||||
use style::values::specified::text::TextDecorationLine;
|
||||
|
@ -180,14 +179,17 @@ impl IndependentFormattingContext {
|
|||
&mut self,
|
||||
layout_context: &LayoutContext,
|
||||
containing_block_for_children: &IndefiniteContainingBlock,
|
||||
containing_block: &IndefiniteContainingBlock,
|
||||
) -> ContentSizes {
|
||||
match self {
|
||||
Self::NonReplaced(inner) => {
|
||||
inner.inline_content_sizes(layout_context, containing_block_for_children)
|
||||
},
|
||||
Self::Replaced(inner) => inner
|
||||
.contents
|
||||
.inline_content_sizes(layout_context, containing_block_for_children),
|
||||
Self::Replaced(inner) => inner.contents.inline_content_sizes(
|
||||
layout_context,
|
||||
containing_block_for_children,
|
||||
inner.preferred_aspect_ratio(containing_block),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -211,20 +213,11 @@ impl IndependentFormattingContext {
|
|||
containing_block,
|
||||
auto_minimum,
|
||||
|containing_block_for_children| {
|
||||
match (
|
||||
containing_block_for_children.size.block,
|
||||
replaced.contents.inline_content_sizes(
|
||||
layout_context,
|
||||
containing_block_for_children,
|
||||
replaced.preferred_aspect_ratio(containing_block),
|
||||
) {
|
||||
(AuOrAuto::LengthPercentage(block_size), Some(ratio)) => {
|
||||
return ratio
|
||||
.compute_dependent_size(Direction::Inline, block_size)
|
||||
.into();
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
replaced
|
||||
.contents
|
||||
.inline_content_sizes(layout_context, containing_block_for_children)
|
||||
)
|
||||
},
|
||||
),
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue