-
Notifications
You must be signed in to change notification settings - Fork 676
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-grid] Note implies losing an aspect-ratio when it shouldn't? #5713
Comments
cc/ @fantasai @tabatkins |
Not sure if I'm missing something, but your testcase only has |
@Loirooriol - I think what's happened is that folks took the note too literally (and normatively). FWIW this now doesn't match what happens with flex: |
It's not just the note, though. The spec text says
where CSS 2 §10.3.3 basically ignores aspect ratios. So it's not clear to me that the spec had a different intention. Also see #5615 |
Regarding consistency with flex, I don't think your testcase is testing the proper thing. The flex item is effectively stretched in the cross axis, it's just that it's not stretched in the main axis because The interesting testcase would be https://software.hixie.ch/utilities/js/live-dom-viewer/saved/8677 In latest Chromium with experimental flags, the grid item and the flex item are identical ( |
@Loirooriol “Use the inline size calculation rules for non-replaced boxes” is supposed to apply to the sizing in the relevant axis, not in both axes, though. I agree with @bfgeek, the behavior here seems quite wrong. |
Implementations also seem to have bugs when determining track contributions, e.g. I'm planning on doing some implementation work in this area - and will add some .tentative tests referring to this issue. |
OK, so I think
|
The only concern I have is for the following case: <div style="display: block; width: 200px; border: solid;">
<div style="height: 100px; aspect-ratio: 1/1;"></div>
</div>
<div style="display: grid; width: 200px; border: solid;">
<div style="height: 100px; aspect-ratio: 1/1;"></div>
</div> Conceptually these cases are the same, both make 'auto' "stretch" in the inline-axis, and definite height in the block-axis, and an aspect-ratio. |
@bfgeek In that case the elements have
But if they had
|
It's correct for non-replaced elements. Which stretch be default. That line should probably read: normal Behavior | Behaves as stretch except for replaced elements, tables, and some form controls which are start.
I'm not sure we should make a distinction between |
What's the point of having them as different values, then? |
cc/ @BorisChiou |
My answer would be - for the default behaviour switch between replaced and non-replaced elements. So there are two clear options here.
I prefer (2) as I somewhat view a aspect-ratio with a definite size in the opposite axis the same as, a definite size in the original axis. @fantasai any thoughts? |
But with (2), how would you treat an element with aspect-ratio but CSS Grid makes it clear that then the aspect ratio will probably be distorted, we have interoperability, and being able to opt out the ratio seems useful for authors. So if |
Both "win" it gets distorted. Here both the inline-axis, and block-axis are stretched. So the default axis "wins" resulting in the image being distorted. The "full" priority list for (2) would be:
|
This block-stretching logic as: https://chromium-review.googlesource.com/c/chromium/src/+/2513771 ... did for the inline-axis. Previously we didn't have the concept of "stretching" the block-axis instead relying on the parent layout algorithm to set a fixed block-size. This allow stretching (similar to the inline-dimension). The failing tests (which I'll update in the test expectations) are due to this specification issue: w3c/csswg-drafts#5713 The changes in layout_replaced.cc are needed to transfer the stretched size through the aspect-ratio. Bug: 1045599 Change-Id: Ifdd8653d81a1ead84a0afbf5ebd31ba0b75dc8ee
IMO option (1) looks simpler this way:
|
I don't think your definition of (1) satisfies this case: <div style="display: block; width: 200px; border: solid;">
<div style="height: 100px; aspect-ratio: 1/1;"></div>
</div> As here |
But in that case |
For more clarity, when a Currently replaced, and non-replaced elements in |
How does
|
Ok so this is where we disagree and is an interesting point, I believe that we've been working under the assumption that applying an |
E.g. from: https://drafts.csswg.org/css-sizing-4/#aspect-ratio "Note: Having a preferred aspect ratio does not make a box into a replaced element; layout rules specific to replaced elements do not generally apply to non-replaced boxes with a preferred aspect ratio. " |
Yes, in that other case it doesn't have a preferred aspect ratio, it's not replaced, it's not a table, etc. Then
Doesn't make it completely replaced, but https://drafts.csswg.org/css-sizing-4/#aspect-ratio-automatic says
|
So if we change how we interpret the <div style="width: 100px; border: solid;">
<div style="aspect-ratio: 1/1; background: green;"> ...will result in a 0x0 div which I don't think is desired. |
I think in that case the stretching is not because of
Browsers already do this for <div style="display: grid; width: 100px; border: solid;">
<svg viewBox="0 0 1 1" style="background: green; justify-self: start; align-self: start"> which has |
My example has an intrinsic size, it's just [0, 0]. SVGs are special as they can have no intrinsic size as you describe. |
As discussed in w3c/csswg-drafts#5713 Change-Id: I90c8bd9c5516d11cae6798d7d7cb6c679e166994
As discussed in w3c/csswg-drafts#5713 Change-Id: I90c8bd9c5516d11cae6798d7d7cb6c679e166994
As discussed in w3c/csswg-drafts#5713 Change-Id: I90c8bd9c5516d11cae6798d7d7cb6c679e166994
As discussed in w3c/csswg-drafts#5713 Change-Id: I90c8bd9c5516d11cae6798d7d7cb6c679e166994
As discussed in w3c/csswg-drafts#5713 Change-Id: I90c8bd9c5516d11cae6798d7d7cb6c679e166994 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2651651 Commit-Queue: Christian Biesinger <[email protected]> Reviewed-by: Oriol Brufau <[email protected]> Reviewed-by: Javier Fernandez <[email protected]> Reviewed-by: Ian Kilpatrick <[email protected]> Auto-Submit: Christian Biesinger <[email protected]> Cr-Commit-Position: refs/heads/master@{#848107}
As discussed in w3c/csswg-drafts#5713 Change-Id: I90c8bd9c5516d11cae6798d7d7cb6c679e166994 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2651651 Commit-Queue: Christian Biesinger <[email protected]> Reviewed-by: Oriol Brufau <[email protected]> Reviewed-by: Javier Fernandez <[email protected]> Reviewed-by: Ian Kilpatrick <[email protected]> Auto-Submit: Christian Biesinger <[email protected]> Cr-Commit-Position: refs/heads/master@{#848107}
As discussed in w3c/csswg-drafts#5713 Change-Id: I90c8bd9c5516d11cae6798d7d7cb6c679e166994 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2651651 Commit-Queue: Christian Biesinger <[email protected]> Reviewed-by: Oriol Brufau <[email protected]> Reviewed-by: Javier Fernandez <[email protected]> Reviewed-by: Ian Kilpatrick <[email protected]> Auto-Submit: Christian Biesinger <[email protected]> Cr-Commit-Position: refs/heads/master@{#848107}
…element in both axes, a=testonly Automatic update from web-platform-tests [css-grid] Correctly stretch a replaced element in both axes As discussed in w3c/csswg-drafts#5713 Change-Id: I90c8bd9c5516d11cae6798d7d7cb6c679e166994 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2651651 Commit-Queue: Christian Biesinger <[email protected]> Reviewed-by: Oriol Brufau <[email protected]> Reviewed-by: Javier Fernandez <[email protected]> Reviewed-by: Ian Kilpatrick <[email protected]> Auto-Submit: Christian Biesinger <[email protected]> Cr-Commit-Position: refs/heads/master@{#848107} -- wpt-commits: 199d0dd07e5d5a599da70d19a702943202e3dadf wpt-pr: 27347
…element in both axes, a=testonly Automatic update from web-platform-tests [css-grid] Correctly stretch a replaced element in both axes As discussed in w3c/csswg-drafts#5713 Change-Id: I90c8bd9c5516d11cae6798d7d7cb6c679e166994 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2651651 Commit-Queue: Christian Biesinger <cbiesingerchromium.org> Reviewed-by: Oriol Brufau <obrufauigalia.com> Reviewed-by: Javier Fernandez <jfernandezigalia.com> Reviewed-by: Ian Kilpatrick <ikilpatrickchromium.org> Auto-Submit: Christian Biesinger <cbiesingerchromium.org> Cr-Commit-Position: refs/heads/master{#848107} -- wpt-commits: 199d0dd07e5d5a599da70d19a702943202e3dadf wpt-pr: 27347 UltraBlame original commit: 60d4ee523bbdc52e07b2643083a8dd139164a59a
…element in both axes, a=testonly Automatic update from web-platform-tests [css-grid] Correctly stretch a replaced element in both axes As discussed in w3c/csswg-drafts#5713 Change-Id: I90c8bd9c5516d11cae6798d7d7cb6c679e166994 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2651651 Commit-Queue: Christian Biesinger <cbiesingerchromium.org> Reviewed-by: Oriol Brufau <obrufauigalia.com> Reviewed-by: Javier Fernandez <jfernandezigalia.com> Reviewed-by: Ian Kilpatrick <ikilpatrickchromium.org> Auto-Submit: Christian Biesinger <cbiesingerchromium.org> Cr-Commit-Position: refs/heads/master{#848107} -- wpt-commits: 199d0dd07e5d5a599da70d19a702943202e3dadf wpt-pr: 27347 UltraBlame original commit: 60d4ee523bbdc52e07b2643083a8dd139164a59a
…element in both axes, a=testonly Automatic update from web-platform-tests [css-grid] Correctly stretch a replaced element in both axes As discussed in w3c/csswg-drafts#5713 Change-Id: I90c8bd9c5516d11cae6798d7d7cb6c679e166994 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2651651 Commit-Queue: Christian Biesinger <cbiesingerchromium.org> Reviewed-by: Oriol Brufau <obrufauigalia.com> Reviewed-by: Javier Fernandez <jfernandezigalia.com> Reviewed-by: Ian Kilpatrick <ikilpatrickchromium.org> Auto-Submit: Christian Biesinger <cbiesingerchromium.org> Cr-Commit-Position: refs/heads/master{#848107} -- wpt-commits: 199d0dd07e5d5a599da70d19a702943202e3dadf wpt-pr: 27347 UltraBlame original commit: 60d4ee523bbdc52e07b2643083a8dd139164a59a
…element in both axes, a=testonly Automatic update from web-platform-tests [css-grid] Correctly stretch a replaced element in both axes As discussed in w3c/csswg-drafts#5713 Change-Id: I90c8bd9c5516d11cae6798d7d7cb6c679e166994 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2651651 Commit-Queue: Christian Biesinger <[email protected]> Reviewed-by: Oriol Brufau <[email protected]> Reviewed-by: Javier Fernandez <[email protected]> Reviewed-by: Ian Kilpatrick <[email protected]> Auto-Submit: Christian Biesinger <[email protected]> Cr-Commit-Position: refs/heads/master@{#848107} -- wpt-commits: 199d0dd07e5d5a599da70d19a702943202e3dadf wpt-pr: 27347
Renaming scheme got lost, however basically: grid-item-no-aspect-ratio-stretch-4.html -> grid-item-aspect-ratio-stretch-1.html grid-item-no-aspect-ratio-stretch-5.html -> grid-item-aspect-ratio-stretch-2.html grid-item-no-aspect-ratio-stretch-6.html -> grid-item-aspect-ratio-stretch-3.html grid-item-no-aspect-ratio-stretch-7.html -> grid-item-aspect-ratio-stretch-4.html These tests all had a viewBox defining a valid aspect-ratio. Due to: w3c/csswg-drafts#6286 (comment) These tests *should* have an aspect-ratio, and when stretched in one dimension, should reflect to the other dimension (if unconstrained). See: w3c/csswg-drafts#5713 (comment) The below two tests basically just got renamed: grid-item-no-aspect-ratio-stretch-8.html -> grid-item-no-aspect-ratio-stretch-4.html grid-item-no-aspect-ratio-stretch-9.html -> grid-item-no-aspect-ratio-stretch-5.html grid-item-no-aspect-ratio-stretch-10.html -> grid-item-no-aspect-ratio-stretch-6.html But tests updated to correctly assert that the natural size would still be respected. To all these test-cases I also added "grid-template: 100% / 100%;" as there is further complexity when inside an auto row/column which is tested elsewhere. (Transferred minimum size for replaced elements with an aspect-ratio). Bug: 1114013 Change-Id: I062f67e291cc62fa63a53370595780dae16abf3b
Renaming scheme got lost, however basically: grid-item-no-aspect-ratio-stretch-4.html -> grid-item-aspect-ratio-stretch-1.html grid-item-no-aspect-ratio-stretch-5.html -> grid-item-aspect-ratio-stretch-2.html grid-item-no-aspect-ratio-stretch-6.html -> grid-item-aspect-ratio-stretch-3.html grid-item-no-aspect-ratio-stretch-7.html -> grid-item-aspect-ratio-stretch-4.html These tests all had a viewBox defining a valid aspect-ratio. Due to: w3c/csswg-drafts#6286 (comment) These tests *should* have an aspect-ratio, and when stretched in one dimension, should reflect to the other dimension (if unconstrained). See: w3c/csswg-drafts#5713 (comment) The below two tests basically just got renamed: grid-item-no-aspect-ratio-stretch-8.html -> grid-item-no-aspect-ratio-stretch-4.html grid-item-no-aspect-ratio-stretch-9.html -> grid-item-no-aspect-ratio-stretch-5.html grid-item-no-aspect-ratio-stretch-10.html -> grid-item-no-aspect-ratio-stretch-6.html But tests updated to correctly assert that the natural size would still be respected. To all these test-cases I also added "grid-template: 100% / 100%;" as there is further complexity when inside an auto row/column which is tested elsewhere. (Transferred minimum size for replaced elements with an aspect-ratio). Bug: 1114013 Change-Id: I062f67e291cc62fa63a53370595780dae16abf3b
Renaming scheme got lost, however basically: grid-item-no-aspect-ratio-stretch-4.html -> grid-item-aspect-ratio-stretch-1.html grid-item-no-aspect-ratio-stretch-5.html -> grid-item-aspect-ratio-stretch-2.html grid-item-no-aspect-ratio-stretch-6.html -> grid-item-aspect-ratio-stretch-3.html grid-item-no-aspect-ratio-stretch-7.html -> grid-item-aspect-ratio-stretch-4.html These tests all had a viewBox defining a valid aspect-ratio. Due to: w3c/csswg-drafts#6286 (comment) These tests *should* have an aspect-ratio, and when stretched in one dimension, should reflect to the other dimension (if unconstrained). See: w3c/csswg-drafts#5713 (comment) The below two tests basically just got renamed: grid-item-no-aspect-ratio-stretch-8.html -> grid-item-no-aspect-ratio-stretch-4.html grid-item-no-aspect-ratio-stretch-9.html -> grid-item-no-aspect-ratio-stretch-5.html grid-item-no-aspect-ratio-stretch-10.html -> grid-item-no-aspect-ratio-stretch-6.html But tests updated to correctly assert that the natural size would still be respected. To all these test-cases I also added "grid-template: 100% / 100%;" as there is further complexity when inside an auto row/column which is tested elsewhere. (Transferred minimum size for replaced elements with an aspect-ratio). Bug: 1114013 Change-Id: I062f67e291cc62fa63a53370595780dae16abf3b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3003564 Reviewed-by: David Grogan <[email protected]> Reviewed-by: Kurt Catti-Schmidt <[email protected]> Commit-Queue: Ian Kilpatrick <[email protected]> Cr-Commit-Position: refs/heads/master@{#898351}
Renaming scheme got lost, however basically: grid-item-no-aspect-ratio-stretch-4.html -> grid-item-aspect-ratio-stretch-1.html grid-item-no-aspect-ratio-stretch-5.html -> grid-item-aspect-ratio-stretch-2.html grid-item-no-aspect-ratio-stretch-6.html -> grid-item-aspect-ratio-stretch-3.html grid-item-no-aspect-ratio-stretch-7.html -> grid-item-aspect-ratio-stretch-4.html These tests all had a viewBox defining a valid aspect-ratio. Due to: w3c/csswg-drafts#6286 (comment) These tests *should* have an aspect-ratio, and when stretched in one dimension, should reflect to the other dimension (if unconstrained). See: w3c/csswg-drafts#5713 (comment) The below two tests basically just got renamed: grid-item-no-aspect-ratio-stretch-8.html -> grid-item-no-aspect-ratio-stretch-4.html grid-item-no-aspect-ratio-stretch-9.html -> grid-item-no-aspect-ratio-stretch-5.html grid-item-no-aspect-ratio-stretch-10.html -> grid-item-no-aspect-ratio-stretch-6.html But tests updated to correctly assert that the natural size would still be respected. To all these test-cases I also added "grid-template: 100% / 100%;" as there is further complexity when inside an auto row/column which is tested elsewhere. (Transferred minimum size for replaced elements with an aspect-ratio). Bug: 1114013 Change-Id: I062f67e291cc62fa63a53370595780dae16abf3b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3003564 Reviewed-by: David Grogan <[email protected]> Reviewed-by: Kurt Catti-Schmidt <[email protected]> Commit-Queue: Ian Kilpatrick <[email protected]> Cr-Commit-Position: refs/heads/master@{#898351}
Renaming scheme got lost, however basically: grid-item-no-aspect-ratio-stretch-4.html -> grid-item-aspect-ratio-stretch-1.html grid-item-no-aspect-ratio-stretch-5.html -> grid-item-aspect-ratio-stretch-2.html grid-item-no-aspect-ratio-stretch-6.html -> grid-item-aspect-ratio-stretch-3.html grid-item-no-aspect-ratio-stretch-7.html -> grid-item-aspect-ratio-stretch-4.html These tests all had a viewBox defining a valid aspect-ratio. Due to: w3c/csswg-drafts#6286 (comment) These tests *should* have an aspect-ratio, and when stretched in one dimension, should reflect to the other dimension (if unconstrained). See: w3c/csswg-drafts#5713 (comment) The below two tests basically just got renamed: grid-item-no-aspect-ratio-stretch-8.html -> grid-item-no-aspect-ratio-stretch-4.html grid-item-no-aspect-ratio-stretch-9.html -> grid-item-no-aspect-ratio-stretch-5.html grid-item-no-aspect-ratio-stretch-10.html -> grid-item-no-aspect-ratio-stretch-6.html But tests updated to correctly assert that the natural size would still be respected. To all these test-cases I also added "grid-template: 100% / 100%;" as there is further complexity when inside an auto row/column which is tested elsewhere. (Transferred minimum size for replaced elements with an aspect-ratio). Bug: 1114013 Change-Id: I062f67e291cc62fa63a53370595780dae16abf3b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3003564 Reviewed-by: David Grogan <[email protected]> Reviewed-by: Kurt Catti-Schmidt <[email protected]> Commit-Queue: Ian Kilpatrick <[email protected]> Cr-Commit-Position: refs/heads/master@{#898351}
…sts., a=testonly Automatic update from web-platform-tests [wpt] Fix grid-item (no) aspect-ratio tests. Renaming scheme got lost, however basically: grid-item-no-aspect-ratio-stretch-4.html -> grid-item-aspect-ratio-stretch-1.html grid-item-no-aspect-ratio-stretch-5.html -> grid-item-aspect-ratio-stretch-2.html grid-item-no-aspect-ratio-stretch-6.html -> grid-item-aspect-ratio-stretch-3.html grid-item-no-aspect-ratio-stretch-7.html -> grid-item-aspect-ratio-stretch-4.html These tests all had a viewBox defining a valid aspect-ratio. Due to: w3c/csswg-drafts#6286 (comment) These tests *should* have an aspect-ratio, and when stretched in one dimension, should reflect to the other dimension (if unconstrained). See: w3c/csswg-drafts#5713 (comment) The below two tests basically just got renamed: grid-item-no-aspect-ratio-stretch-8.html -> grid-item-no-aspect-ratio-stretch-4.html grid-item-no-aspect-ratio-stretch-9.html -> grid-item-no-aspect-ratio-stretch-5.html grid-item-no-aspect-ratio-stretch-10.html -> grid-item-no-aspect-ratio-stretch-6.html But tests updated to correctly assert that the natural size would still be respected. To all these test-cases I also added "grid-template: 100% / 100%;" as there is further complexity when inside an auto row/column which is tested elsewhere. (Transferred minimum size for replaced elements with an aspect-ratio). Bug: 1114013 Change-Id: I062f67e291cc62fa63a53370595780dae16abf3b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3003564 Reviewed-by: David Grogan <[email protected]> Reviewed-by: Kurt Catti-Schmidt <[email protected]> Commit-Queue: Ian Kilpatrick <[email protected]> Cr-Commit-Position: refs/heads/master@{#898351} -- wpt-commits: ec4e2eecc6a5bd2f21c81dbe03862c2cdf17cf8c wpt-pr: 29567
…sts., a=testonly Automatic update from web-platform-tests [wpt] Fix grid-item (no) aspect-ratio tests. Renaming scheme got lost, however basically: grid-item-no-aspect-ratio-stretch-4.html -> grid-item-aspect-ratio-stretch-1.html grid-item-no-aspect-ratio-stretch-5.html -> grid-item-aspect-ratio-stretch-2.html grid-item-no-aspect-ratio-stretch-6.html -> grid-item-aspect-ratio-stretch-3.html grid-item-no-aspect-ratio-stretch-7.html -> grid-item-aspect-ratio-stretch-4.html These tests all had a viewBox defining a valid aspect-ratio. Due to: w3c/csswg-drafts#6286 (comment) These tests *should* have an aspect-ratio, and when stretched in one dimension, should reflect to the other dimension (if unconstrained). See: w3c/csswg-drafts#5713 (comment) The below two tests basically just got renamed: grid-item-no-aspect-ratio-stretch-8.html -> grid-item-no-aspect-ratio-stretch-4.html grid-item-no-aspect-ratio-stretch-9.html -> grid-item-no-aspect-ratio-stretch-5.html grid-item-no-aspect-ratio-stretch-10.html -> grid-item-no-aspect-ratio-stretch-6.html But tests updated to correctly assert that the natural size would still be respected. To all these test-cases I also added "grid-template: 100% / 100%;" as there is further complexity when inside an auto row/column which is tested elsewhere. (Transferred minimum size for replaced elements with an aspect-ratio). Bug: 1114013 Change-Id: I062f67e291cc62fa63a53370595780dae16abf3b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3003564 Reviewed-by: David Grogan <[email protected]> Reviewed-by: Kurt Catti-Schmidt <[email protected]> Commit-Queue: Ian Kilpatrick <[email protected]> Cr-Commit-Position: refs/heads/master@{#898351} -- wpt-commits: ec4e2eecc6a5bd2f21c81dbe03862c2cdf17cf8c wpt-pr: 29567
…lignments are applied to both axes https://bugs.webkit.org/show_bug.cgi?id=227573 Reviewed by Javier Fernandez. Source/WebCore: As discussed in w3c/csswg-drafts#5713, for the replaced element as a grid item, when both axes have stretch alignments applied and there is no auto margin(s) presented, the aspect ratio should be ignored if there is any. Part of this patch is an import of Chromium CL at https://chromium-review.googlesource.com/c/chromium/src/+/2651651 * rendering/RenderBox.cpp: (WebCore::RenderBox::hasStretchedLogicalHeight const): (WebCore::RenderBox::shouldComputeLogicalWidthFromAspectRatio const): * rendering/RenderBox.h: LayoutTests: Two grid WPT tests are now passing. * TestExpectations: Canonical link: https://commits.webkit.org/239764@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280022 268f45cc-cd09-0410-ab3c-d52691b4dbfc
…t when defined to compute the logical width https://bugs.webkit.org/show_bug.cgi?id=227984 Reviewed by Javier Fernandez. LayoutTests/imported/w3c: * web-platform-tests/css/css-grid/alignment/grid-alignment-implies-size-change-011-expected.txt: * web-platform-tests/css/css-grid/alignment/grid-alignment-implies-size-change-012-expected.txt: * web-platform-tests/css/css-grid/alignment/grid-alignment-implies-size-change-013-expected.txt: * web-platform-tests/css/css-grid/alignment/grid-alignment-implies-size-change-014-expected.txt: * web-platform-tests/css/css-grid/alignment/grid-alignment-implies-size-change-017-expected.txt: * web-platform-tests/css/css-grid/alignment/grid-alignment-implies-size-change-018-expected.txt: Source/WebCore: As discussed in w3c/csswg-drafts#5713, for images as grid items, when stretch alignment is only applied in one axis we should respect aspect-ratio on the other. When computing the logical width using an intrinsic aspect ratio, RenderReplaced should use the overridingLogicalHeight whenever defined just as how it does for flex items. This change is to replace the use of intrinsic (non-stretched) logical height in current code with the overridingLogicalHeight. This allows us to pass an additional of 9 grid WPT tests. * rendering/RenderReplaced.cpp: (WebCore::RenderReplaced::computeReplacedLogicalWidth const): LayoutTests: 9 grid WPT tests are now passing. * TestExpectations: Canonical link: https://commits.webkit.org/239766@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280024 268f45cc-cd09-0410-ab3c-d52691b4dbfc
…lignments are applied to both axes https://bugs.webkit.org/show_bug.cgi?id=227573 Reviewed by Javier Fernandez. Source/WebCore: As discussed in w3c/csswg-drafts#5713, for the replaced element as a grid item, when both axes have stretch alignments applied and there is no auto margin(s) presented, the aspect ratio should be ignored if there is any. Part of this patch is an import of Chromium CL at https://chromium-review.googlesource.com/c/chromium/src/+/2651651 * rendering/RenderBox.cpp: (WebCore::RenderBox::hasStretchedLogicalHeight const): (WebCore::RenderBox::shouldComputeLogicalWidthFromAspectRatio const): * rendering/RenderBox.h: LayoutTests: Two grid WPT tests are now passing. * TestExpectations: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@280022 268f45cc-cd09-0410-ab3c-d52691b4dbfc
…t when defined to compute the logical width https://bugs.webkit.org/show_bug.cgi?id=227984 Reviewed by Javier Fernandez. LayoutTests/imported/w3c: * web-platform-tests/css/css-grid/alignment/grid-alignment-implies-size-change-011-expected.txt: * web-platform-tests/css/css-grid/alignment/grid-alignment-implies-size-change-012-expected.txt: * web-platform-tests/css/css-grid/alignment/grid-alignment-implies-size-change-013-expected.txt: * web-platform-tests/css/css-grid/alignment/grid-alignment-implies-size-change-014-expected.txt: * web-platform-tests/css/css-grid/alignment/grid-alignment-implies-size-change-017-expected.txt: * web-platform-tests/css/css-grid/alignment/grid-alignment-implies-size-change-018-expected.txt: Source/WebCore: As discussed in w3c/csswg-drafts#5713, for images as grid items, when stretch alignment is only applied in one axis we should respect aspect-ratio on the other. When computing the logical width using an intrinsic aspect ratio, RenderReplaced should use the overridingLogicalHeight whenever defined just as how it does for flex items. This change is to replace the use of intrinsic (non-stretched) logical height in current code with the overridingLogicalHeight. This allows us to pass an additional of 9 grid WPT tests. * rendering/RenderReplaced.cpp: (WebCore::RenderReplaced::computeReplacedLogicalWidth const): LayoutTests: 9 grid WPT tests are now passing. * TestExpectations: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@280024 268f45cc-cd09-0410-ab3c-d52691b4dbfc
This block-stretching logic as: https://chromium-review.googlesource.com/c/chromium/src/+/2513771 ... did for the inline-axis. Previously we didn't have the concept of "stretching" the block-axis instead relying on the parent layout algorithm to set a fixed block-size. This allow stretching (similar to the inline-dimension). The failing tests (which I'll update in the test expectations) are due to this specification issue: w3c/csswg-drafts#5713 The changes in layout_replaced.cc are needed to transfer the stretched size through the aspect-ratio. Bug: 1045599 Change-Id: Ifdd8653d81a1ead84a0afbf5ebd31ba0b75dc8ee Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2523743 Commit-Queue: Ian Kilpatrick <[email protected]> Reviewed-by: Kurt Catti-Schmidt <[email protected]> Reviewed-by: David Grogan <[email protected]> Reviewed-by: Morten Stenshorne <[email protected]> Cr-Commit-Position: refs/heads/master@{#827854} GitOrigin-RevId: eaff997ccac677831d0a3c72e638ddf6528276d7
From: w3c/csswg-drafts#5713 Basically these tests stretch an image in one axis, and previously tested that the image should lose its aspect-ratio. When stretching in one axis, and when there is no size constraint in the other axis it should respect the aspect-ratio. Change-Id: Ic1374f50b4d561b3c38b94a4f60724f950e6513e Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2611567 Reviewed-by: Christian Biesinger <[email protected]> Commit-Queue: Ian Kilpatrick <[email protected]> Cr-Commit-Position: refs/heads/master@{#841117} GitOrigin-RevId: 0eb684e1e380c65380150f4ba2de14cc0bbef5ac
As discussed in w3c/csswg-drafts#5713 Change-Id: I90c8bd9c5516d11cae6798d7d7cb6c679e166994 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2651651 Commit-Queue: Christian Biesinger <[email protected]> Reviewed-by: Oriol Brufau <[email protected]> Reviewed-by: Javier Fernandez <[email protected]> Reviewed-by: Ian Kilpatrick <[email protected]> Auto-Submit: Christian Biesinger <[email protected]> Cr-Commit-Position: refs/heads/master@{#848107} GitOrigin-RevId: 2ba07b2385593e296bb69271b4c27402a6d929c3
Renaming scheme got lost, however basically: grid-item-no-aspect-ratio-stretch-4.html -> grid-item-aspect-ratio-stretch-1.html grid-item-no-aspect-ratio-stretch-5.html -> grid-item-aspect-ratio-stretch-2.html grid-item-no-aspect-ratio-stretch-6.html -> grid-item-aspect-ratio-stretch-3.html grid-item-no-aspect-ratio-stretch-7.html -> grid-item-aspect-ratio-stretch-4.html These tests all had a viewBox defining a valid aspect-ratio. Due to: w3c/csswg-drafts#6286 (comment) These tests *should* have an aspect-ratio, and when stretched in one dimension, should reflect to the other dimension (if unconstrained). See: w3c/csswg-drafts#5713 (comment) The below two tests basically just got renamed: grid-item-no-aspect-ratio-stretch-8.html -> grid-item-no-aspect-ratio-stretch-4.html grid-item-no-aspect-ratio-stretch-9.html -> grid-item-no-aspect-ratio-stretch-5.html grid-item-no-aspect-ratio-stretch-10.html -> grid-item-no-aspect-ratio-stretch-6.html But tests updated to correctly assert that the natural size would still be respected. To all these test-cases I also added "grid-template: 100% / 100%;" as there is further complexity when inside an auto row/column which is tested elsewhere. (Transferred minimum size for replaced elements with an aspect-ratio). Bug: 1114013 Change-Id: I062f67e291cc62fa63a53370595780dae16abf3b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3003564 Reviewed-by: David Grogan <[email protected]> Reviewed-by: Kurt Catti-Schmidt <[email protected]> Commit-Queue: Ian Kilpatrick <[email protected]> Cr-Commit-Position: refs/heads/master@{#898351} NOKEYCHECK=True GitOrigin-RevId: fa1b4b99cae7291ebb66327c43bdebfaad763044
https://drafts.csswg.org/css-grid-1/#grid-item-sizing
There is a note which says "Note: This can distort the aspect ratio of the item, if it has one."
This implies that if there is 'stretch' in one dimension, it should distort the image. This note should probably say something along the lines of "Note: This can distort the aspect ratio of the item, if it has stretch in both axes." or something.
Testcase: https://www.software.hixie.ch/utilities/js/live-dom-viewer/?saved=8675
The text was updated successfully, but these errors were encountered: