Skip to content

Commit

Permalink
[css-grid] Correctly stretch a replaced element in both axes
Browse files Browse the repository at this point in the history
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 <cbiesinger@chromium.org>
Reviewed-by: Oriol Brufau <obrufau@igalia.com>
Reviewed-by: Javier Fernandez <jfernandez@igalia.com>
Reviewed-by: Ian Kilpatrick <ikilpatrick@chromium.org>
Auto-Submit: Christian Biesinger <cbiesinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#848107}
  • Loading branch information
cbiesinger authored and chromium-wpt-export-bot committed Jan 28, 2021
1 parent 9ff620b commit f4e27a1
Show file tree
Hide file tree
Showing 9 changed files with 63 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<link rel="match" href="../../reference/ref-filled-green-100px-square.xht">
<link rel="help" href="https://github.com/w3c/csswg-drafts/issues/5713">
<meta name="assert" content="If stretch alignment is applied to both axis the aspect-ratio of a replaced element is ignored.">

<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>

<div style="display: grid; grid-template: 100px / 100px; width: 100px; height: 100px; background: red;">
<img src="support/25x50-green.png" width=25 height=50 style="background: green; align-self: stretch; justify-self: stretch; width: auto; height: auto;"></img>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<link rel="match" href="../../reference/ref-filled-green-100px-square.xht">
<link rel="help" href="https://github.com/w3c/csswg-drafts/issues/5713">
<meta name="assert" content="If stretch alignment is applied to both axis the aspect-ratio of a replaced element is ignored.">

<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>

<div style="display: grid; grid-template: 100px / 100px; width: 100px; height: 100px; background: red;">
<img src="support/25x50-green.png" width=25 height=50 style="background: green; align-self: stretch; justify-self: stretch; width: auto; height: auto; writing-mode: vertical-lr;"></img>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<link rel="match" href="../../reference/ref-filled-green-100px-square.xht">
<link rel="help" href="https://github.com/w3c/csswg-drafts/issues/5713">
<meta name="assert" content="If stretch alignment is applied to both axis the aspect-ratio of a replaced element is ignored, but not when auto margins are present.">

<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>

<div style="display: grid; grid-template: 100px / 500px; width: 100px; height: 100px; background: red;">
<img src="support/50x50-green.png" width=50 height=50 style="background: green; align-self: stretch; justify-self: stretch; width: auto; height: auto; margin-right: auto;"></img>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<link rel="match" href="../../reference/ref-filled-green-100px-square.xht">
<link rel="help" href="https://github.com/w3c/csswg-drafts/issues/5713">
<meta name="assert" content="If stretch alignment is applied to both axis the aspect-ratio of a replaced element is ignored, but not when auto margins are present.">

<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>

<div style="display: grid; grid-template: 500px / 100px; width: 100px; height: 100px; background: red;">
<img src="support/50x50-green.png" width=50 height=50 style="background: green; align-self: stretch; justify-self: stretch; width: auto; height: auto; margin-bottom: auto;"></img>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<link rel="match" href="../../reference/ref-filled-green-100px-square.xht">
<link rel="help" href="https://github.com/w3c/csswg-drafts/issues/5713">
<meta name="assert" content="Stretch alignment in one axis should apply aspect-ratio in the other">

<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>

<div style="display: grid; grid-template: 100px / 100px; width: 100px; height: 100px; background: red;">
<img src="support/50x50-green.png" width=50 height=50 style="background: green; justify-self: stretch; width: auto; height: auto;"></img>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<link rel="match" href="../../reference/ref-filled-green-100px-square.xht">
<link rel="help" href="https://github.com/w3c/csswg-drafts/issues/5713">
<meta name="assert" content="Stretch alignment in one axis should apply aspect-ratio in the other">

<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>

<div style="display: grid; grid-template: 100px / 100px; width: 100px; height: 100px; background: red;">
<img src="support/50x50-green.png" width=50 height=50 style="background: green; align-self: stretch; width: auto; height: auto;"></img>
</div>
Binary file added css/css-grid/alignment/support/25x50-green.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added css/css-grid/alignment/support/50x50-green.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions lint.ignore
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,9 @@ CSS-COLLIDING-SUPPORT-NAME: css/css-backgrounds/support/50x50-green.png
CSS-COLLIDING-SUPPORT-NAME: css/css-grid/grid-items/support/50x50-green.png
CSS-COLLIDING-SUPPORT-NAME: css/CSS2/support/50x50-green.png
CSS-COLLIDING-SUPPORT-NAME: css/CSS2/ui/support/animated.gif
CSS-COLLIDING-SUPPORT-NAME: css/css-grid/alignment/support/50x50-green.png
CSS-COLLIDING-SUPPORT-NAME: css/css-grid/alignment/support/25x50-green.png
CSS-COLLIDING-SUPPORT-NAME: css/css-grid/grid-items/support/25x50-green.png
CSS-COLLIDING-SUPPORT-NAME: css/CSS2/backgrounds/support/animated.gif
CSS-COLLIDING-SUPPORT-NAME: css/css-shapes/shape-outside/shape-image/support/animated.gif
CSS-COLLIDING-SUPPORT-NAME: css/css-display/support/util.js
Expand Down

0 comments on commit f4e27a1

Please sign in to comment.