Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(26)

Unified Diff: third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-gutters-and-alignment.html

Issue 1309513008: [css-grid] Implement grid gutters (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebased patch for landing Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-gutters-and-alignment.html
diff --git a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-gutters-and-alignment.html b/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-gutters-and-alignment.html
new file mode 100644
index 0000000000000000000000000000000000000000..4938969910c9d1ee2b1c9d9866d4b846c5f80c87
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-gutters-and-alignment.html
@@ -0,0 +1,297 @@
+<!DOCTYPE html>
+<link href="resources/grid.css" rel="stylesheet">
+<link href="resources/grid-alignment.css" rel="stylesheet">
+<link href="../css-intrinsic-dimensions/resources/width-keyword-classes.css" rel=stylesheet>
+<script src="../../resources/check-layout.js"></script>
+<script src="../../resources/js-test.js"></script>
+<style>
+body { margin: 0px; }
+
+.grid100And200 {
+ grid-template-columns: 100px 100px;
+ grid-template-rows: 200px 200px;
+ width: -webkit-fit-content;
+ position: relative; /* For the <p> comments */
+}
+
+.grid50And100 {
+ grid: 50px 50px / 100px 100px;
+ width: 200px;
+ height: 300px;
+ position: relative; /* For the <p> comments */
+}
+
+.gridAuto20And40 {
+ grid-auto-columns: 20px;
+ grid-auto-rows: 40px;
+ width: 400px;
+ height: 300px;
+ position: relative; /* For the <p> comments */
+}
+
+.gridWithPaddingBorder {
+ grid-template-columns: 100px 200px;
+ grid-template-rows: 200px 200px;
+ padding: 10px 15px 20px 30px;
+ border-width: 5px 10px 15px 20px;
+ border-style: dotted;
+ border-color: blue;
+ width: -webkit-fit-content;
+ position: relative; /* For the <p> comments */
+}
+
+.stretch {
+ align-self: stretch;
+ justify-self: stretch;
+}
+
+.stretchedGrid { grid-auto-columns: auto; }
+
+.gridRowColumnGaps {
+ grid-row-gap: 17px;
+ grid-column-gap: 21px;
+}
+
+div.grid > div { font: 10px/1 Ahem; }
+
+.cell {
+ width: 20px;
+ height: 40px;
+}
+
+div.gridWithPaddingBorder > div.cell {
+ margin: 4px 8px 12px 16px;
+}
+
+
+.container {
+ position: relative;
+}
+
+</style>
+
+<body onload="checkLayout('.grid')">
+
+<!-- Check that gutters do not interfere with self alignment computation. -->
+<div class="container">
+ <div class="grid grid100And200 alignItemsCenter gridRowColumnGaps" data-expected-width="221" data-expected-height="417">
+ <div class="cell alignSelfAuto firstRowFirstColumn" data-offset-x="0" data-offset-y="80" data-expected-width="20" data-expected-height="40"></div>
+ <div class="cell firstRowSecondColumn" data-offset-x="121" data-offset-y="80" data-expected-width="20" data-expected-height="40"></div>
+ <div class="cell alignSelfSelfStart secondRowFirstColumn" data-offset-x="0" data-offset-y="217" data-expected-width="20" data-expected-height="40"></div>
+ <div class="cell alignSelfSelfEnd secondRowSecondColumn" data-offset-x="121" data-offset-y="377" data-expected-width="20" data-expected-height="40"></div>
+ </div>
+</div>
+
+<div class="container">
+ <div class="grid grid100And200 verticalLR gridRowColumnGaps" data-expected-width="417" data-expected-height="221">
+ <div class="alignSelfStretch firstRowFirstColumn verticalRL" data-offset-x="0" data-offset-y="0" data-expected-width="200" data-expected-height="100">
+ </div>
+ <div class="cell alignSelfStart firstRowSecondColumn verticalRL" data-offset-x="0" data-offset-y="121" data-expected-width="20" data-expected-height="40">
+ <div class="item"></div>
+ </div>
+ <div class="cell alignSelfEnd firstRowSecondColumn verticalRL" data-offset-x="180" data-offset-y="121" data-expected-width="20" data-expected-height="40">
+ <div class="item"></div>
+ </div>
+ <div class="cell alignSelfCenter secondRowFirstColumn verticalRL" data-offset-x="307" data-offset-y="0" data-expected-width="20" data-expected-height="40">
+ <div class="item"></div>
+ </div>
+ <div class="cell alignSelfRight secondRowSecondColumn verticalRL" data-offset-x="217" data-offset-y="121" data-expected-width="20" data-expected-height="40">
+ <div class="item"></div>
+ </div>
+ <div class="cell alignSelfLeft secondRowSecondColumn verticalRL" data-offset-x="217" data-offset-y="121" data-expected-width="20" data-expected-height="40">
+ <div class="item"></div>
+ </div>
+ </div>
+</div>
+
+<div class="container">
+ <div class="grid grid100And200 directionRTL gridRowColumnGaps" data-expected-width="221" data-expected-height="417">
+ <div class="alignSelfStretch firstRowFirstColumn" data-offset-x="121" data-offset-y="0" data-expected-width="100" data-expected-height="200"></div>
+ <div class="cell alignSelfStart firstRowSecondColumn" data-offset-x="80" data-offset-y="0" data-expected-width="20" data-expected-height="40"></div>
+ <div class="cell alignSelfEnd firstRowSecondColumn" data-offset-x="80" data-offset-y="160" data-expected-width="20" data-expected-height="40"></div>
+ <div class="cell alignSelfCenter secondRowFirstColumn" data-offset-x="201" data-offset-y="297" data-expected-width="20" data-expected-height="40"></div>
+ <div class="cell alignSelfRight secondRowSecondColumn" data-offset-x="80" data-offset-y="217" data-expected-width="20" data-expected-height="40"></div>
+ <div class="cell alignSelfLeft secondRowSecondColumn" data-offset-x="80" data-offset-y="217" data-expected-width="20" data-expected-height="40"></div>
+ </div>
+</div>
+
+<!-- Check that gutters do not interfere with align-content computation. -->
+<div class="container">
+ <p>direction: LTR | align-content: 'center'</p>
+ <div class="grid grid50And100 alignContentCenter gridRowColumnGaps" data-expected-width="200" data-expected-height="300">
+ <div class="cell firstRowFirstColumn" data-offset-x="0" data-offset-y="42" data-expected-width="20" data-expected-height="40"></div>
+ <div class="firstRowSecondColumn" data-offset-x="71" data-offset-y="42" data-expected-width="50" data-expected-height="100"></div>
+ <div class="secondRowFirstColumn" data-offset-x="0" data-offset-y="159" data-expected-width="50" data-expected-height="100"></div>
+ <div class="cell secondRowSecondColumn" data-offset-x="71" data-offset-y="159" data-expected-width="20" data-expected-height="40"></div>
+ </div>
+</div>
+
+<div class="container">
+ <p>direction: LTR | align-content: 'right'</p>
+ <div class="grid grid50And100 alignContentRight gridRowColumnGaps" data-expected-width="200" data-expected-height="300">
+ <div class="cell firstRowFirstColumn" data-offset-x="0" data-offset-y="0" data-expected-width="20" data-expected-height="40"></div>
+ <div class="firstRowSecondColumn" data-offset-x="71" data-offset-y="0" data-expected-width="50" data-expected-height="100"></div>
+ <div class="secondRowFirstColumn" data-offset-x="0" data-offset-y="117" data-expected-width="50" data-expected-height="100"></div>
+ <div class="cell secondRowSecondColumn" data-offset-x="71" data-offset-y="117" data-expected-width="20" data-expected-height="40"></div>
+ </div>
+</div>
+
+<div class="container">
+ <p>direction: RTL | align-content: 'right'</p>
+ <div class="grid grid50And100 directionRTL alignContentRight gridRowColumnGaps" data-expected-width="200" data-expected-height="300">
+ <div class="cell firstRowFirstColumn" data-offset-x="180" data-offset-y="0" data-expected-width="20" data-expected-height="40"></div>
+ <div class="firstRowSecondColumn" data-offset-x="79" data-offset-y="0" data-expected-width="50" data-expected-height="100"></div>
+ <div class="secondRowFirstColumn" data-offset-x="150" data-offset-y="117" data-expected-width="50" data-expected-height="100"></div>
+ <div class="cell secondRowSecondColumn" data-offset-x="109" data-offset-y="117" data-expected-width="20" data-expected-height="40"></div>
+ </div>
+</div>
+
+<div class="container">
+ <p>direction: RTL | align-content: 'start'</p>
+ <div class="grid grid50And100 directionRTL alignContentStart gridRowColumnGaps" data-expected-width="200" data-expected-height="300">
+ <div class="cell firstRowFirstColumn" data-offset-x="180" data-offset-y="0" data-expected-width="20" data-expected-height="40"></div>
+ <div class="firstRowSecondColumn" data-offset-x="79" data-offset-y="0" data-expected-width="50" data-expected-height="100"></div>
+ <div class="secondRowFirstColumn" data-offset-x="150" data-offset-y="117" data-expected-width="50" data-expected-height="100"></div>
+ <div class="cell secondRowSecondColumn" data-offset-x="109" data-offset-y="117" data-expected-width="20" data-expected-height="40"></div>
+ </div>
+</div>
+
+<!-- Check that gutters do not interfere with justify-content computation. -->
+<div class="container">
+ <p>direction: LTR | justify-content: 'center'</p>
+ <div class="grid grid50And100 justifyContentCenter gridRowColumnGaps" data-expected-width="200" data-expected-height="300">
+ <div class="cell firstRowFirstColumn" data-offset-x="40" data-offset-y="0" data-expected-width="20" data-expected-height="40"></div>
+ <div class="firstRowSecondColumn" data-offset-x="111" data-offset-y="0" data-expected-width="50" data-expected-height="100"></div>
+ <div class="secondRowFirstColumn" data-offset-x="40" data-offset-y="117" data-expected-width="50" data-expected-height="100"></div>
+ <div class="cell secondRowSecondColumn" data-offset-x="111" data-offset-y="117" data-expected-width="20" data-expected-height="40"></div>
+ </div>
+</div>
+
+<div class="container">
+ <p>direction: LTR | justify-content: 'end'</p>
+ <div class="grid grid50And100 justifyContentEnd gridRowColumnGaps" data-expected-width="200" data-expected-height="300">
+ <div class="cell firstRowFirstColumn" data-offset-x="79" data-offset-y="0" data-expected-width="20" data-expected-height="40"></div>
+ <div class="firstRowSecondColumn" data-offset-x="150" data-offset-y="0" data-expected-width="50" data-expected-height="100"></div>
+ <div class="secondRowFirstColumn" data-offset-x="79" data-offset-y="117" data-expected-width="50" data-expected-height="100"></div>
+ <div class="cell secondRowSecondColumn" data-offset-x="150" data-offset-y="117" data-expected-width="20" data-expected-height="40"></div>
+ </div>
+</div>
+
+<div class="container">
+ <p>direction: RTL | justify-content: 'end'</p>
+ <div class="grid grid50And100 directionRTL justifyContentRight gridRowColumnGaps" data-expected-width="200" data-expected-height="300">
+ <div class="cell firstRowFirstColumn" data-offset-x="180" data-offset-y="0" data-expected-width="20" data-expected-height="40"></div>
+ <div class="firstRowSecondColumn" data-offset-x="79" data-offset-y="0" data-expected-width="50" data-expected-height="100"></div>
+ <div class="secondRowFirstColumn" data-offset-x="150" data-offset-y="117" data-expected-width="50" data-expected-height="100"></div>
+ <div class="cell secondRowSecondColumn" data-offset-x="109" data-offset-y="117" data-expected-width="20" data-expected-height="40"></div>
+ </div>
+</div>
+
+<div class="container">
+ <p>direction: RTL | justify-content: 'start'</p>
+ <div class="grid grid50And100 directionRTL justifyContentStart gridRowColumnGaps" data-expected-width="200" data-expected-height="300">
+ <div class="cell firstRowFirstColumn" data-offset-x="180" data-offset-y="0" data-expected-width="20" data-expected-height="40"></div>
+ <div class="firstRowSecondColumn" data-offset-x="79" data-offset-y="0" data-expected-width="50" data-expected-height="100"></div>
+ <div class="secondRowFirstColumn" data-offset-x="150" data-offset-y="117" data-expected-width="50" data-expected-height="100"></div>
+ <div class="cell secondRowSecondColumn" data-offset-x="109" data-offset-y="117" data-expected-width="20" data-expected-height="40"></div>
+ </div>
+</div>
+
+<!-- Check that gutters do not interfere with vertical justify-content computation. -->
+
+<div class="container">
+ <p>direction: RTL | justify-content: 'stretch'</p>
+ <div class="grid gridAuto20And40 stretchedGrid justifyContentStretch verticalLR directionRTL gridRowColumnGaps" data-expected-width="400" data-expected-height="300">
+ <div class="firstRowFirstColumn" data-offset-x="0" data-offset-y="241" data-expected-width="40" data-expected-height="59"></div>
+ <div class="firstRowSecondColumn" data-offset-x="0" data-offset-y="161" data-expected-width="40" data-expected-height="59"></div>
+ <div class="firstRowThirdColumn" data-offset-x="0" data-offset-y="80" data-expected-width="40" data-expected-height="60"></div>
+ <div class="firstRowFourthColumn" data-offset-x="0" data-offset-y="0" data-expected-width="40" data-expected-height="59"></div>
+ <div class="secondRowFirstColumn" data-offset-x="57" data-offset-y="241" data-expected-width="40" data-expected-height="59"></div>
+ <div class="secondRowSecondColumn" data-offset-x="57" data-offset-y="161" data-expected-width="40" data-expected-height="59"></div>
+ <div class="secondRowThirdColumn" data-offset-x="57" data-offset-y="80" data-expected-width="40" data-expected-height="60"></div>
+ <div class="secondRowFourthColumn" data-offset-x="57" data-offset-y="0" data-expected-width="40" data-expected-height="59"></div>
+ </div>
+</div>
+
+<div class="container">
+ <p>direction: LTR | justify-content: 'space-evenly'</p>
+ <div class="grid gridAuto20And40 justifyContentSpaceEvenly verticalLR directionRTL gridRowColumnGaps" data-expected-width="400" data-expected-height="300">
+ <div class="firstRowFirstColumn" data-offset-x="0" data-offset-y="231" data-expected-width="40" data-expected-height="20"></div>
+ <div class="firstRowSecondColumn" data-offset-x="0" data-offset-y="140" data-expected-width="40" data-expected-height="20"></div>
+ <div class="firstRowThirdColumn" data-offset-x="0" data-offset-y="50" data-expected-width="40" data-expected-height="20"></div>
+ <div class="secondRowFirstColumn" data-offset-x="57" data-offset-y="231" data-expected-width="40" data-expected-height="20"></div>
+ <div class="secondRowSecondColumn" data-offset-x="57" data-offset-y="140" data-expected-width="40" data-expected-height="20"></div>
+ <div class="secondRowThirdColumn" data-offset-x="57" data-offset-y="50" data-expected-width="40" data-expected-height="20"></div>
+ </div>
+</div>
+
+<div class="container">
+ <p>direction: LTR | justify-content: 'space-between'</p>
+ <div class="grid gridAuto20And40 justifyContentSpaceBetween verticalRL directionRTL gridRowColumnGaps" data-expected-width="400" data-expected-height="300">
+ <div class="firstRowFirstColumn" data-offset-x="360" data-offset-y="280" data-expected-width="40" data-expected-height="20"></div>
+ <div class="firstRowSecondColumn" data-offset-x="360" data-offset-y="187" data-expected-width="40" data-expected-height="20"></div>
+ <div class="firstRowThirdColumn" data-offset-x="360" data-offset-y="93" data-expected-width="40" data-expected-height="20"></div>
+ <div class="firstRowFourthColumn" data-offset-x="360" data-offset-y="0" data-expected-width="40" data-expected-height="20"></div>
+ <div class="secondRowFirstColumn" data-offset-x="303" data-offset-y="280" data-expected-width="40" data-expected-height="20"></div>
+ <div class="secondRowSecondColumn" data-offset-x="303" data-offset-y="187" data-expected-width="40" data-expected-height="20"></div>
+ <div class="secondRowThirdColumn" data-offset-x="303" data-offset-y="93" data-expected-width="40" data-expected-height="20"></div>
+ <div class="secondRowFourthColumn" data-offset-x="303" data-offset-y="0" data-expected-width="40" data-expected-height="20"></div>
+ </div>
+</div>
+
+<div class="container">
+ <p>direction: LTR | justify-content: 'space-around'</p>
+ <div class="grid gridAuto20And40 justifyContentSpaceAround verticalRL directionRTL gridRowColumnGaps" data-expected-width="400" data-expected-height="300">
+ <div class="firstRowFirstColumn" data-offset-x="360" data-offset-y="220" data-expected-width="40" data-expected-height="20"></div>
+ <div class="firstRowSecondColumn" data-offset-x="360" data-offset-y="60" data-expected-width="40" data-expected-height="20"></div>
+ <div class="secondRowFirstColumn" data-offset-x="303" data-offset-y="220" data-expected-width="40" data-expected-height="20"></div>
+ <div class="secondRowSecondColumn" data-offset-x="303" data-offset-y="60" data-expected-width="40" data-expected-height="20"></div>
+ </div>
+</div>
+
+<!-- Check that gutters do not interfere with align&justify computation when having border, padding and margins. -->
+<div class="container">
+ <p>border: 5px 10px 15px 20px | padding: 10px 15px 20px 30px | margin: 4px 8px 12px 16px<br>
+ direction: LTR (parall) | align-items: 'self-start' | justify-items: 'self-start'</p>
+ <div class="grid gridWithPaddingBorder directionLTR itemsSelfStart gridRowColumnGaps" data-expected-width="396" data-expected-height="467">
+ <div class="directionLTR cell firstRowFirstColumn" data-offset-x="46" data-offset-y="14" data-expected-width="20" data-expected-height="40"></div>
+ <div class="directionLTR stretch firstRowSecondColumn" data-offset-x="151" data-offset-y="10" data-expected-width="200" data-expected-height="200"></div>
+ <div class="directionLTR stretch secondRowFirstColumn" data-offset-x="30" data-offset-y="227" data-expected-width="100" data-expected-height="200"></div>
+ <div class="directionLTR cell secondRowSecondColumn" data-offset-x="167" data-offset-y="231" data-expected-width="20" data-expected-height="40"></div>
+ </div>
+</div>
+
+<div class="container">
+ <p>border: 5px 10px 15px 20px | padding: 10px 15px 20px 30px | margin: 4px 8px 12px 16px<br>
+ direction: LTR (ortho) | align-items: 'self-end' | justify-items: 'self-end'</p>
+ <div class="grid gridWithPaddingBorder directionLTR itemsSelfEnd gridRowColumnGaps" data-expected-width="396" data-expected-height="467">
+ <div class="directionRTL cell firstRowFirstColumn" data-offset-x="46" data-offset-y="158" data-expected-width="20" data-expected-height="40"></div>
+ <div class="directionRTL stretch firstRowSecondColumn" data-offset-x="151" data-offset-y="10" data-expected-width="200" data-expected-height="200"></div>
+ <div class="directionRTL stretch secondRowFirstColumn" data-offset-x="30" data-offset-y="227" data-expected-width="100" data-expected-height="200"></div>
+ <div class="directionRTL cell secondRowSecondColumn" data-offset-x="167" data-offset-y="375" data-expected-width="20" data-expected-height="40"></div>
+ </div>
+</div>
+
+<div class="container">
+ <p>border: 5px 10px 15px 20px | padding: 10px 15px 20px 30px | margin: 4px 8px 12px 16px<br>
+ direction: RTL | align-items: 'right' | justify-items: 'right'</p>
+ <div class="grid gridWithPaddingBorder directionRTL itemsRight gridRowColumnGaps" data-expected-width="396" data-expected-height="467">
+ <div class="cell firstRowFirstColumn" data-offset-x="323" data-offset-y="14" data-expected-width="20" data-expected-height="40"></div>
+ <div class="stretch firstRowSecondColumn" data-offset-x="30" data-offset-y="10" data-expected-width="200" data-expected-height="200"></div>
+ <div class="stretch secondRowFirstColumn" data-offset-x="251" data-offset-y="227" data-expected-width="100" data-expected-height="200"></div>
+ <div class="cell secondRowSecondColumn" data-offset-x="202" data-offset-y="231" data-expected-width="20" data-expected-height="40"></div>
+ </div>
+</div>
+
+<div class="container">
+ <p>border: 5px 10px 15px 20px | padding: 10px 15px 20px 30px | margin: 4px 8px 12px 16px<br>
+ direction: RTL (parall) | align-items: 'self-start' | justify-items: 'self-start'</p>
+ <div class="grid gridWithPaddingBorder directionRTL itemsSelfStart gridRowColumnGaps" data-expected-width="396" data-expected-height="467">
+ <div class="directionRTL cell firstRowFirstColumn" data-offset-x="323" data-offset-y="14" data-expected-width="20" data-expected-height="40"></div>
+ <div class="directionRTL stretch firstRowSecondColumn" data-offset-x="30" data-offset-y="10" data-expected-width="200" data-expected-height="200"></div>
+ <div class="directionRTL stretch secondRowFirstColumn" data-offset-x="251" data-offset-y="227" data-expected-width="100" data-expected-height="200"></div>
+ <div class="directionRTL cell secondRowSecondColumn" data-offset-x="202" data-offset-y="231" data-expected-width="20" data-expected-height="40"></div>
+ </div>
+</div>
+
+</body>

Powered by Google App Engine
This is Rietveld 408576698