Re: [csswg-drafts] [css-sizing-4] Expected size of replaced element with aspect-ratio but width/height auto (#5721)

So upon reviewing this issue and the suggested edits, Elika and I realized that the text was very confusing and didn't actually clearly define which axis was ratio-dependent in various cases. After a lot of attempted edits to fix it, we finally settled on a simplifying strategy that groups size constraints into categories of varying strength, and then does a strength comparison to see which one wins and which one becomes ratio-dependent.

Here's the old text we're augmenting:

> The axis in which the preferred size calculation depends on this aspect ratio is called the ratio-dependent axis, and the resulting size is definite if its input sizes are also definite. The opposite axis (on which the ratio-dependent axis size depends) is the ratio-determining axis.

Here's the suggested new text (rough spec text):

> When a box has a preferred aspect ratio,
> the aspect ratio can inform calculations
> of its [=automatic sizes=] and [=intrinsic sizes=].
> The axis in which the <a>preferred size</a> calculation
> depends on this aspect ratio
> is called the <dfn export>ratio-dependent axis</dfn>,
> and the resulting size is <a>definite</a>
> if its input sizes are also <a>definite</a>.
> The opposite axis (on which the [=ratio-dependent axis=] size depends)
> is the <dfn export>ratio-determining axis</dfn>.
> 
> Sizing constraints in CSS are classified into three categories:
>    : <dfn export>strong size constraint</dfn>
>    :: * `<<length>>`s
>       * resolvable `<<percentage>>` values
>       * explicit [=intrinsic sizes=] 
>         (e.g. ''min-content'', ''max-content'')
>         on [=non-replaced elements=]
>       * certain [=automatic sizes=]
>         (e.g. stretched [=automatic sizes=] in [=grid layout=]),
>         as defined by the layout model
>    : <dfn export>weak size constraint</dfn>
>    :: Everything not defined as
>       [=strong size constraint|strong=] or [=null size constraint|null=].
>       (Individual layout models can define multiple weak categories
>       with a specific ordering between them.)
>    : <dfn export>null size constraint</dfn>
>    :: An essentially missing size: specifically,
>       the [=intrinsic size=] of a [=replaced element=] with no [=natural size=].
> 
> When both dimensions have a [=strong size constraint=],
> such as a `<<length>>` or resolvable `<<percentage>>`,
> then the [=preferred aspect ratio=] is ignored
> in favor of these constraints.
> In all other cases
> when both dimensions have equally weak size constraints,
> the [=block axis=] is the [=ratio-dependent axis=].
> 
> When one dimension has a weaker size constraint,
> then the weaker dimension is the [=ratio-dependent axis=];
> unless the stronger size constraint is an 
> the [=intrinsic size|intrinsic=] [=block size=] of a [=non-replaced element=],
> in which case the [=preferred aspect ratio=] is ignored.


TODO:
    * Flex and Grid define precisely what stretch situations give a strong size constraint (details omitted here just bc they're a little complex to drop inline)
    * Position defines the *two* weak categories that arise from abspos layout (an axis with both input properties non-auto is stronger than one with at least one auto inset)
    * Double-check that the resulting text is consistent with what's already defined.

We still need to draft text to replace

> When a box has a preferred aspect ratio, its automatic sizes are calculated the same as for a replaced element with a natural aspect ratio and no natural size in that axis, see e.g. CSS2 § 10 and CSS Flexible Box Model Level 1 § 9.2.

We probably need to pull all of the replaced element size calculations from CSS2 into CSS Sizing 4 to do this though. :(

@bfgeek @BorisChiou @cbiesinger Does what we have make sense to you so far?

-- 
GitHub Notification of comment by tabatkins
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/5721#issuecomment-781702159 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Thursday, 18 February 2021 23:26:18 UTC