mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +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
|
@ -255,15 +255,22 @@ impl ReplacedContent {
|
|||
&self,
|
||||
_: &LayoutContext,
|
||||
containing_block_for_children: &IndefiniteContainingBlock,
|
||||
preferred_aspect_ratio: Option<AspectRatio>,
|
||||
) -> ContentSizes {
|
||||
// FIXME: min/max-content of replaced elements is not defined in
|
||||
// https://dbaron.org/css/intrinsic/
|
||||
// This seems sensible?
|
||||
|
||||
self.flow_relative_intrinsic_size(containing_block_for_children.style)
|
||||
.inline
|
||||
.unwrap_or(Au::zero())
|
||||
.into()
|
||||
let block_size = containing_block_for_children.size.block;
|
||||
let inline_size = match (block_size, preferred_aspect_ratio) {
|
||||
(AuOrAuto::LengthPercentage(block_size), Some(ratio)) => {
|
||||
ratio.compute_dependent_size(Direction::Inline, block_size)
|
||||
},
|
||||
_ => self
|
||||
.flow_relative_intrinsic_size(containing_block_for_children.style)
|
||||
.inline
|
||||
.unwrap_or_else(Au::zero),
|
||||
};
|
||||
inline_size.into()
|
||||
}
|
||||
|
||||
pub fn make_fragments(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue