-
Notifications
You must be signed in to change notification settings - Fork 689
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[css-sizing] How to transfer intrinsic keywords via aspect ratio? #11236
Comments
Actually, there is interoperability in the non-replaced case: <!DOCTYPE html>
<style>
div { background: cyan; aspect-ratio: 1; vertical-align: top }
div::before { content: ""; display: block; width: 20px; height: 10px }
</style>
<table><tr>
<td><div style="height: auto; width: auto"></div></td>
<td><div style="height: auto; width: min-content"></div></td>
<td><div style="height: auto; width: fit-content"></div></td>
<td><div style="height: auto; width: max-content"></div></td>
</tr><tr>
<td><div style="height: min-content; width: auto"></div></td>
<td><div style="height: min-content; width: min-content"></div></td>
<td><div style="height: min-content; width: fit-content"></div></td>
<td><div style="height: min-content; width: max-content"></div></td>
</tr><tr>
<td><div style="height: fit-content; width: auto"></div></td>
<td><div style="height: fit-content; width: min-content"></div></td>
<td><div style="height: fit-content; width: fit-content"></div></td>
<td><div style="height: fit-content; width: max-content"></div></td>
</tr><tr>
<td><div style="height: max-content; width: auto"></div></td>
<td><div style="height: max-content; width: min-content"></div></td>
<td><div style="height: max-content; width: fit-content"></div></td>
<td><div style="height: max-content; width: max-content"></div></td>
</tr></table> So I propose to so the same in the replaced case. |
So the reason browsers have the left column behaviour is likely due to SVG. This issue is more about how to derive the aspect-ratio, which can come from many places. E.g. Here (conceptually) the SVG has an aspect-ratio of 1:1, but then takes the aspect-ratio from the natural-width/height instead. A rule could be: The aspect-ratio is derived from:
|
I don't get it, |
pretend that width/height via. style are set to auto. |
Do people frequently do that? If the behavior can't change, consider <!DOCTYPE html>
<style>svg { background: cyan; height: auto }</style>
<svg width=20 height=10 viewBox="0 0 1 1" style="aspect-ratio: auto; width: auto"></svg>
<svg width=20 height=10 viewBox="0 0 1 1" style="aspect-ratio: auto; width: 20px"></svg>
<svg width=20 height=10 viewBox="0 0 1 1" style="aspect-ratio: 1; width: auto"></svg>
<svg width=20 height=10 viewBox="0 0 1 1" style="aspect-ratio: 1; width: 20px"></svg> I'm getting the same on Gecko, Blink and WebKit: Given that |
After further discussion with @emilio , it turns out that |
When computing the intrinsic block size of a replaced element with a computed preferred inline size of `auto`, instead of transferring the final inline size through the aspect ratio, we were only transferring the min and max constraints. We did this to match other browsers, but Ian Kilpatrick agreed that this is a bug and plans to change Blink. CSSWG issue: w3c/csswg-drafts#11236 Signed-off-by: Oriol Brufau <[email protected]>
When computing the intrinsic block size of a replaced element with a computed preferred inline size of `auto`, instead of transferring the final inline size through the aspect ratio, we were only transferring the min and max constraints. We did this to match other browsers, but Ian Kilpatrick agreed that this is a bug and plans to change Blink. CSSWG issue: w3c/csswg-drafts#11236 Signed-off-by: Oriol Brufau <[email protected]>
Are these canvases supposed to have different heights? How/why?
For Servo it would be simpler to treat
width: auto
asfit-content
and make them all 20x20.But having an exception to avoid transferring an
auto
preferred inline size isn't a big deal.I don't understand what Gecko is doing. Is it trying to be consistent with
table-layout
, which handlesauto
andmax-content
different than the others?Webkit seems to transfer the natural block size when the preferred block size is intrinsic but not
auto
. Seems a bit weird since typically the inline intrinsic sizes only depend on extrinsic block sizes, not intrinsic block sizes.The text was updated successfully, but these errors were encountered: