mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Refactor computation of preferred aspect ratios (#34416)
* Refactor computation of preferred aspect ratios Computing min/max-content sizes required a ContainingBlock in order to resolve the padding and border when determining the preferred aspect ratio. However, all callers already knew the padding and border, so they can compute the ratio themselves, and pass it directly instead of the ContainingBlock. Signed-off-by: Oriol Brufau <obrufau@igalia.com> * Put preferred aspect ratio into ConstraintSpace Signed-off-by: Oriol Brufau <obrufau@igalia.com> --------- Signed-off-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
parent
16da1c2721
commit
19a7e95a6a
11 changed files with 133 additions and 113 deletions
|
@ -13,7 +13,7 @@ use style::properties::ComputedValues;
|
|||
use style::Zero;
|
||||
|
||||
use crate::geom::Size;
|
||||
use crate::style_ext::{Clamp, ComputedValuesExt, ContentBoxSizesAndPBM};
|
||||
use crate::style_ext::{AspectRatio, Clamp, ComputedValuesExt, ContentBoxSizesAndPBM};
|
||||
use crate::{ConstraintSpace, IndefiniteContainingBlock, LogicalVec2, SizeConstraint};
|
||||
|
||||
#[derive(PartialEq)]
|
||||
|
@ -113,6 +113,7 @@ pub(crate) fn outer_inline(
|
|||
containing_block: &IndefiniteContainingBlock,
|
||||
auto_minimum: &LogicalVec2<Au>,
|
||||
auto_block_size_stretches_to_containing_block: bool,
|
||||
get_preferred_aspect_ratio: impl FnOnce(&LogicalVec2<Au>) -> Option<AspectRatio>,
|
||||
get_content_size: impl FnOnce(&ConstraintSpace) -> InlineContentSizesResult,
|
||||
) -> InlineContentSizesResult {
|
||||
let ContentBoxSizesAndPBM {
|
||||
|
@ -153,6 +154,7 @@ pub(crate) fn outer_inline(
|
|||
get_content_size(&ConstraintSpace::new(
|
||||
SizeConstraint::new(preferred_block_size, min_block_size, max_block_size),
|
||||
style.writing_mode,
|
||||
get_preferred_aspect_ratio(&pbm.padding_border_sums),
|
||||
))
|
||||
});
|
||||
let resolve_non_initial = |inline_size| {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue