[go: up one dir, main page]

Skip to content
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-4] How does a max-height affect the inline size computed through an aspect ratio #5257

Open
cbiesinger opened this issue Jun 24, 2020 · 6 comments

Comments

@cbiesinger
Copy link

https://drafts.csswg.org/css-sizing-4/#aspect-ratio

The title is not very descriptive, sorry -- I couldn't think of a succinct way to describe the issue. Basically:

  <div style="aspect-ratio: 1/1; max-height: 50px; font: 10px/1 Ahem; float: left;">
    XX XXX <!-- max-size 60px, min-size: 30px -->
  </div>

So we have shrink-to-fit sizing in the inline axis and an aspect ratio size in the block axis. Since we have a lot of space, inline size is 60px (max intrinsic size), and height is 60px.

BUT, max-height is 50px. Should we:

Additional question if we do option one: Should min-block-size be taken into account too? If yes, auto should probably resolve to 0 for the purpose of inline sizing.

cc @bfgeek @fantasai

@tabatkins
Copy link
Member

Yes, the max-height is definite, so it should get transferred across the ratio, and give a max-width of 50px, exactly like the image example. Unfortunately the current aspect ratio constraint rules are written with the assumption that the aspect ratio of the actual content and the used aspect ratio are identical... so we need to write up some explicit rules about this. :/ (Whereas in this example, the AR of the actual content is 6 / 1, different from the desired ratio of 1 / 1.)

If we don't transfer this, then max-size properties basically don't interact with aspect-ratio at all, which sucks.

@fantasai
Copy link
Collaborator

OK, added some prose to the spec to describe the transfer of sizing constraints. Let us know if it looks correct? :)

chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Jun 30, 2020
…ck size

This tests the behavior as specced in
w3c/csswg-drafts#5257

R=ikilpatrick@chromium.org

Bug: 1045668
Change-Id: I75b945a008b9039b751fc7de54da86cbf399a7ee
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Jun 30, 2020
…ck size

This tests the behavior as specced in
w3c/csswg-drafts#5257

R=ikilpatrick@chromium.org

Bug: 1045668
Change-Id: I75b945a008b9039b751fc7de54da86cbf399a7ee
@cbiesinger
Copy link
Author

@fantasai I added some comments on ede56bd

chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Jul 1, 2020
…ck size

This tests the behavior as specced in
w3c/csswg-drafts#5257

R=ikilpatrick@chromium.org

Bug: 1045668
Change-Id: I75b945a008b9039b751fc7de54da86cbf399a7ee
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Jul 1, 2020
…ck size

This tests the behavior as specced in
w3c/csswg-drafts#5257

R=ikilpatrick@chromium.org

Bug: 1045668
Change-Id: I75b945a008b9039b751fc7de54da86cbf399a7ee
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2274255
Commit-Queue: Christian Biesinger <cbiesinger@chromium.org>
Reviewed-by: Ian Kilpatrick <ikilpatrick@chromium.org>
Auto-Submit: Christian Biesinger <cbiesinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#784523}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Jul 1, 2020
…ck size

This tests the behavior as specced in
w3c/csswg-drafts#5257

R=ikilpatrick@chromium.org

Bug: 1045668
Change-Id: I75b945a008b9039b751fc7de54da86cbf399a7ee
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2274255
Commit-Queue: Christian Biesinger <cbiesinger@chromium.org>
Reviewed-by: Ian Kilpatrick <ikilpatrick@chromium.org>
Auto-Submit: Christian Biesinger <cbiesinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#784523}
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue Jul 3, 2020
…ine size with constrained block size, a=testonly

Automatic update from web-platform-tests
[AspectRatio] Add test for computing inline size with constrained block size

This tests the behavior as specced in
w3c/csswg-drafts#5257

R=ikilpatrick@chromium.org

Bug: 1045668
Change-Id: I75b945a008b9039b751fc7de54da86cbf399a7ee
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2274255
Commit-Queue: Christian Biesinger <cbiesinger@chromium.org>
Reviewed-by: Ian Kilpatrick <ikilpatrick@chromium.org>
Auto-Submit: Christian Biesinger <cbiesinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#784523}

--

wpt-commits: b363daeddf3374072306c4f9ccf919261489aa13
wpt-pr: 24391
xeonchen pushed a commit to xeonchen/gecko that referenced this issue Jul 6, 2020
…ine size with constrained block size, a=testonly

Automatic update from web-platform-tests
[AspectRatio] Add test for computing inline size with constrained block size

This tests the behavior as specced in
w3c/csswg-drafts#5257

R=ikilpatrick@chromium.org

Bug: 1045668
Change-Id: I75b945a008b9039b751fc7de54da86cbf399a7ee
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2274255
Commit-Queue: Christian Biesinger <cbiesinger@chromium.org>
Reviewed-by: Ian Kilpatrick <ikilpatrick@chromium.org>
Auto-Submit: Christian Biesinger <cbiesinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#784523}

--

wpt-commits: b363daeddf3374072306c4f9ccf919261489aa13
wpt-pr: 24391
@fantasai
Copy link
Collaborator

@cbiesinger Replied in ede56bd#commitcomment-40570230 and added a6fc47e

@cbiesinger
Copy link
Author

fwiw, I did add a test for this in web-platform-tests/wpt@5938e67; I would appreciate a spec editor reviewing it but I'm not sure this needs the WPT label.

I also added another comment on the commit.

@fantasai
Copy link
Collaborator

@cbiesinger Commented on the changeset... the test seems really off?

chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Jul 22, 2020
Implements the spec change in
w3c/csswg-drafts#5257

This allows respecting the aspect-ratio even when we're computing the
block size from an aspect ratio with a max-height specified.

Bug: 1104360
Change-Id: Ibdff4bf4a67aa0897fd24416fed67bbb2f1ef9ea
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Aug 1, 2020
Implements the spec change in
w3c/csswg-drafts#5257

This allows respecting the aspect-ratio even when we're computing the
block size from an aspect ratio with a max-height specified.

Bug: 1104360
Change-Id: Ibdff4bf4a67aa0897fd24416fed67bbb2f1ef9ea
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Aug 6, 2020
Implements the spec change in
w3c/csswg-drafts#5257

This allows respecting the aspect-ratio even when we're computing the
block size from an aspect ratio with a max-height specified.

Bug: 1104360
Change-Id: Ibdff4bf4a67aa0897fd24416fed67bbb2f1ef9ea
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Aug 7, 2020
Implements the spec change in
w3c/csswg-drafts#5257

This allows respecting the aspect-ratio even when we're computing the
block size from an aspect ratio with a max-height specified.

Bug: 1104360
Change-Id: Ibdff4bf4a67aa0897fd24416fed67bbb2f1ef9ea
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Aug 7, 2020
Implements the spec change in
w3c/csswg-drafts#5257

This allows respecting the aspect-ratio even when we're computing the
block size from an aspect ratio with a max-height specified.

Bug: 1104360
Change-Id: Ibdff4bf4a67aa0897fd24416fed67bbb2f1ef9ea
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Aug 7, 2020
Implements the spec change in
w3c/csswg-drafts#5257

This allows respecting the aspect-ratio even when we're computing the
block size from an aspect ratio with a max-height specified.

Bug: 1104360
Change-Id: Ibdff4bf4a67aa0897fd24416fed67bbb2f1ef9ea
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Aug 11, 2020
Implements the spec change in
w3c/csswg-drafts#5257

This allows respecting the aspect-ratio even when we're computing the
block size from an aspect ratio with a max-height specified.

Bug: 1104360
Change-Id: Ibdff4bf4a67aa0897fd24416fed67bbb2f1ef9ea
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Aug 11, 2020
Implements the spec change in
w3c/csswg-drafts#5257

This allows respecting the aspect-ratio even when we're computing the
block size from an aspect ratio with a max-height specified.

Bug: 1104360
Change-Id: Ibdff4bf4a67aa0897fd24416fed67bbb2f1ef9ea
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Aug 11, 2020
Implements the spec change in
w3c/csswg-drafts#5257

This allows respecting the aspect-ratio even when we're computing the
block size from an aspect ratio with a max-height specified.

Bug: 1104360
Change-Id: Ibdff4bf4a67aa0897fd24416fed67bbb2f1ef9ea
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Aug 11, 2020
Implements the spec change in
w3c/csswg-drafts#5257

This allows respecting the aspect-ratio even when we're computing the
block size from an aspect ratio with a max-height specified.

Bug: 1104360
Change-Id: Ibdff4bf4a67aa0897fd24416fed67bbb2f1ef9ea
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Aug 12, 2020
Implements the spec change in
w3c/csswg-drafts#5257

This allows respecting the aspect-ratio even when we're computing the
block size from an aspect ratio with a max-height specified.

Bug: 1104360
Change-Id: Ibdff4bf4a67aa0897fd24416fed67bbb2f1ef9ea
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2308999
Commit-Queue: Christian Biesinger <cbiesinger@chromium.org>
Reviewed-by: Ian Kilpatrick <ikilpatrick@chromium.org>
Auto-Submit: Christian Biesinger <cbiesinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#797043}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Aug 12, 2020
Implements the spec change in
w3c/csswg-drafts#5257

This allows respecting the aspect-ratio even when we're computing the
block size from an aspect ratio with a max-height specified.

Bug: 1104360
Change-Id: Ibdff4bf4a67aa0897fd24416fed67bbb2f1ef9ea
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2308999
Commit-Queue: Christian Biesinger <cbiesinger@chromium.org>
Reviewed-by: Ian Kilpatrick <ikilpatrick@chromium.org>
Auto-Submit: Christian Biesinger <cbiesinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#797043}
blueboxd pushed a commit to blueboxd/chromium-legacy that referenced this issue Aug 12, 2020
Implements the spec change in
w3c/csswg-drafts#5257

This allows respecting the aspect-ratio even when we're computing the
block size from an aspect ratio with a max-height specified.

Bug: 1104360
Change-Id: Ibdff4bf4a67aa0897fd24416fed67bbb2f1ef9ea
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2308999
Commit-Queue: Christian Biesinger <cbiesinger@chromium.org>
Reviewed-by: Ian Kilpatrick <ikilpatrick@chromium.org>
Auto-Submit: Christian Biesinger <cbiesinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#797043}
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue Aug 25, 2020
…max-block-size, a=testonly

Automatic update from web-platform-tests
[AspectRatio] Implement transferred min/max-block-size

Implements the spec change in
w3c/csswg-drafts#5257

This allows respecting the aspect-ratio even when we're computing the
block size from an aspect ratio with a max-height specified.

Bug: 1104360
Change-Id: Ibdff4bf4a67aa0897fd24416fed67bbb2f1ef9ea
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2308999
Commit-Queue: Christian Biesinger <cbiesinger@chromium.org>
Reviewed-by: Ian Kilpatrick <ikilpatrick@chromium.org>
Auto-Submit: Christian Biesinger <cbiesinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#797043}

--

wpt-commits: 50f5942fdeeac06695959d27e0c1a52379a13eda
wpt-pr: 24693
ambroff pushed a commit to ambroff/gecko that referenced this issue Nov 4, 2020
…max-block-size, a=testonly

Automatic update from web-platform-tests
[AspectRatio] Implement transferred min/max-block-size

Implements the spec change in
w3c/csswg-drafts#5257

This allows respecting the aspect-ratio even when we're computing the
block size from an aspect ratio with a max-height specified.

Bug: 1104360
Change-Id: Ibdff4bf4a67aa0897fd24416fed67bbb2f1ef9ea
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2308999
Commit-Queue: Christian Biesinger <cbiesinger@chromium.org>
Reviewed-by: Ian Kilpatrick <ikilpatrick@chromium.org>
Auto-Submit: Christian Biesinger <cbiesinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#797043}

--

wpt-commits: 50f5942fdeeac06695959d27e0c1a52379a13eda
wpt-pr: 24693
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue Nov 5, 2020
…nite {min|max} block-size and aspect-ratio for non-replaced elements. r=TYLin

This addressed w3c/csswg-drafts#5257.
The min-block-size or max-block-size should affect the inline size computed
through an aspect ratio.

I intentionally don't implement this for transferred {min|max}
block-size because
1. This is useful only if block-size is indefinite.
2. If block-size is indefinite, we may use the inline-size and aspect-ratio to
   get the block-size, which makes block-size definite.
3. This means it is useful when both inline-size and block-size are
   indefinite (e.g. auto).
   In this case, we still resolve a possible inline-size by clamping it
   between specified (and transferred) min and max inline-sizes. Then
   we map this inline-size to block-size through aspect-ratio. This
   transferred block-size should also be between specified (and
   transferred) min and max block-sizes.

Differential Revision: https://phabricator.services.mozilla.com/D94911
jamienicol pushed a commit to jamienicol/gecko that referenced this issue Nov 5, 2020
…nite {min|max} block-size and aspect-ratio for non-replaced elements. r=TYLin

This addressed w3c/csswg-drafts#5257.
The min-block-size or max-block-size should affect the inline size computed
through an aspect ratio.

I intentionally don't implement this for transferred {min|max}
block-size because
1. This is useful only if block-size is indefinite.
2. If block-size is indefinite, we may use the inline-size and aspect-ratio to
   get the block-size, which makes block-size definite.
3. This means it is useful when both inline-size and block-size are
   indefinite (e.g. auto).
   In this case, we still resolve a possible inline-size by clamping it
   between specified (and transferred) min and max inline-sizes. Then
   we map this inline-size to block-size through aspect-ratio. This
   transferred block-size should also be between specified (and
   transferred) min and max block-sizes.

Differential Revision: https://phabricator.services.mozilla.com/D94911
mjfroman pushed a commit to mjfroman/moz-libwebrtc-third-party that referenced this issue Oct 14, 2022
…ck size

This tests the behavior as specced in
w3c/csswg-drafts#5257

R=ikilpatrick@chromium.org

Bug: 1045668
Change-Id: I75b945a008b9039b751fc7de54da86cbf399a7ee
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2274255
Commit-Queue: Christian Biesinger <cbiesinger@chromium.org>
Reviewed-by: Ian Kilpatrick <ikilpatrick@chromium.org>
Auto-Submit: Christian Biesinger <cbiesinger@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#784523}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: aa401dd01f1ee9e704b2380286d707912f0dde60
mjfroman pushed a commit to mjfroman/moz-libwebrtc-third-party that referenced this issue Oct 14, 2022
Implements the spec change in
w3c/csswg-drafts#5257

This allows respecting the aspect-ratio even when we're computing the
block size from an aspect ratio with a max-height specified.

Bug: 1104360
Change-Id: Ibdff4bf4a67aa0897fd24416fed67bbb2f1ef9ea
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2308999
Commit-Queue: Christian Biesinger <cbiesinger@chromium.org>
Reviewed-by: Ian Kilpatrick <ikilpatrick@chromium.org>
Auto-Submit: Christian Biesinger <cbiesinger@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#797043}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 5da05071ef8366fce0495b60bee0f336f9e96f4c
i3roly pushed a commit to i3roly/firefox-dynasty that referenced this issue Jun 1, 2024
…ine size with constrained block size, a=testonly

Automatic update from web-platform-tests
[AspectRatio] Add test for computing inline size with constrained block size

This tests the behavior as specced in
w3c/csswg-drafts#5257

R=ikilpatrick@chromium.org

Bug: 1045668
Change-Id: I75b945a008b9039b751fc7de54da86cbf399a7ee
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2274255
Commit-Queue: Christian Biesinger <cbiesinger@chromium.org>
Reviewed-by: Ian Kilpatrick <ikilpatrick@chromium.org>
Auto-Submit: Christian Biesinger <cbiesinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#784523}

--

wpt-commits: b363daeddf3374072306c4f9ccf919261489aa13
wpt-pr: 24391
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants