Skip to content

Commit

Permalink
[css-grid] Migrate grid-tracks-stretched-with-different-flex-factors-…
Browse files Browse the repository at this point in the history
…sum.html to WPT

BUG=767015, 1063749
R=jfernandez@igalia.com

Change-Id: I4f88f5540f9d3999081718501399465920d36ec3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2144993
Commit-Queue: Antonio Gomes <tonikitoo@igalia.com>
Reviewed-by: Javier Fernandez <jfernandez@igalia.com>
Cr-Commit-Position: refs/heads/master@{#758526}
  • Loading branch information
tonikitoo authored and chromium-wpt-export-bot committed Apr 14, 2020
1 parent e5fd4ca commit d3f6367
Showing 1 changed file with 57 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<!DOCTYPE html>
<title>CSS Grid: 'stretch' content alignment on flex tracks.</title>
<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com">
<link rel="help" href="https://drafts.csswg.org/css-align-3/#content-distribution">
<link rel="help" href="https://drafts.csswg.org/css-align-3/#valdef-align-content-stretch">
<meta name="assert" content="This test ensures that using flex tracks and 'stretch' value for the content alignment css properties work properly."/>
<link href="/css/support/grid.css" rel="stylesheet"/>
<link href="/css/support/alignment.css" rel="stylesheet"/>

<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/check-layout-th.js"></script>
<style>
body {
margin: 0;
}

.grid {
position: relative;
width: 200px;
height: 300px;
}

.fractionFlexTracks {
grid-template-columns: auto 0.25fr;
grid-template-rows: 0.2fr auto;
}

.flexTracks {
grid-template-columns: auto 1fr;
grid-template-rows: 1.5fr auto;
}

</style>
</head>
<body onload="checkLayout('.grid')">

<div style="position: relative">
<p>When the sum of all track's flex factor is < 1, they don't exhaust the available space, which is used to stretch the 'auto' sized tracks.</p>
<div class="grid fractionFlexTracks contentStretch" data-expected-width="200" data-expected-height="300">
<div class="firstRowFirstColumn" data-offset-x="0" data-offset-y="0" data-expected-width="150" data-expected-height="60"></div>
<div class="firstRowSecondColumn" data-offset-x="150" data-offset-y="0" data-expected-width="50" data-expected-height="60"></div>
<div class="secondRowFirstColumn" data-offset-x="0" data-offset-y="60" data-expected-width="150" data-expected-height="240"></div>
<div class="secondRowSecondColumn" data-offset-x="150" data-offset-y="60" data-expected-width="50" data-expected-height="240"></div>
</div>
</div>

<div style="position: relative">
<p>When the sum of all track's flex factor is >= 1, they exhaust the available space, hence the 'stretch' alignment is not applied to the 'auto' sized tracks.</p>
<div class="grid flexTracks contentStretch" data-expected-width="200" data-expected-height="300">
<div class="firstRowFirstColumn" data-offset-x="0" data-offset-y="0" data-expected-width="0" data-expected-height="300"></div>
<div class="firstRowSecondColumn" data-offset-x="0" data-offset-y="0" data-expected-width="200" data-expected-height="300"></div>
<div class="secondRowFirstColumn" data-offset-x="0" data-offset-y="300" data-expected-width="0" data-expected-height="0"></div>
<div class="secondRowSecondColumn" data-offset-x="0" data-offset-y="300" data-expected-width="200" data-expected-height="0"></div>
</div>
</div>
</body>

0 comments on commit d3f6367

Please sign in to comment.