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

Unified Diff: LayoutTests/fast/css-grid-layout/named-grid-lines-with-named-grid-areas-resolution.html

Issue 148293008: [CSS Grid Layout] Add support to place items using named grid lines (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Patch for landing v3. Fix for Debug bot Created 6 years, 7 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: LayoutTests/fast/css-grid-layout/named-grid-lines-with-named-grid-areas-resolution.html
diff --git a/LayoutTests/fast/css-grid-layout/named-grid-lines-with-named-grid-areas-resolution.html b/LayoutTests/fast/css-grid-layout/named-grid-lines-with-named-grid-areas-resolution.html
new file mode 100644
index 0000000000000000000000000000000000000000..06d04a4a16dcf27bec12bc33e66008e07bc4a12f
--- /dev/null
+++ b/LayoutTests/fast/css-grid-layout/named-grid-lines-with-named-grid-areas-resolution.html
@@ -0,0 +1,243 @@
+<!DOCTYPE html>
+<html>
+<head>
+<link href="resources/grid.css" rel="stylesheet">
+<style type="text/css">
+
+ .gridAreas {
+ grid-template-areas: ". a a"
+ "c a a"
+ ". . d";
+ }
+
+ .gridAreasSpecial {
+ grid-template-areas: ". a-start a-start"
+ "c a-end a-end"
+ ". . d";
+ }
+
+ .gridNoLineNames {
+ grid-template-columns: 50px 100px 200px;
+ grid-template-rows: 50px 100px 200px;
+ }
+
+ .gridUniqueNames {
+ grid-template-columns: (a) 50px (b b-start) 100px (c -start) 200px (d);
+ grid-template-rows: (e) 50px (f -end) 100px (g g-start) 200px (h);
+ }
+
+ .gridWithNamedLineBeforeGridArea {
+ grid-template-columns: (a-start c-start) 50px (d-start) 100px 200px;
+ grid-template-rows: (c-start) 50px (d-start) 100px 200px;
+ }
+
+ .gridWithNamedLineAfterGridArea {
+ grid-template-columns: 50px 100px (a-start) 200px;
+ grid-template-rows: 50px 100px (c-start) 200px;
+ }
+
+ .gridWithEndLines {
+ grid-template-columns: 50px 100px (a-end) 200px (c-end);
+ grid-template-rows: 50px (c-end) 100px (d-end) 200px;
+ }
+
+ .gridRepeatedNames {
+ grid-template-columns: (d-start) 50px (d-start) 100px (d-start) 200px;
+ grid-template-rows: 50px (c-end) 100px (c-end) 200px (c-end);
+ }
+
+</style>
+<script src="../../resources/check-layout.js"></script>
+</head>
+<body onload="checkLayout('.grid')">
+
+<p>This test checks that we resolve named grid line per the specification.</p>
+
+<!-- Check positioning using unique grid-line names -->
+<div style="position: relative">
+ <div class="grid gridUniqueNames">
+ <div class="sizedToGridArea" style="grid-column: 'b';" data-offset-x="50" data-offset-y="0" data-expected-width="100" data-expected-height="50"></div>
+ <div class="sizedToGridArea" style="grid-row: 'e';" data-offset-x="0" data-offset-y="0" data-expected-width="50" data-expected-height="50"></div>
+ <div class="sizedToGridArea" style="grid-column: 'b-start';" data-offset-x="50" data-offset-y="0" data-expected-width="100" data-expected-height="50"></div>
+ <div class="sizedToGridArea" style="grid-row: 'g-start';" data-offset-x="0" data-offset-y="150" data-expected-width="50" data-expected-height="200"></div>
+ </div>
+</div>
+
+<div style="position: relative">
+ <div class="grid gridUniqueNames">
+ <div class="sizedToGridArea" style="grid-column: 'b' / 'd';" data-offset-x="50" data-offset-y="0" data-expected-width="300" data-expected-height="50"></div>
+ <div class="sizedToGridArea" style="grid-row: 'g' / 'h';" data-offset-x="0" data-offset-y="150" data-expected-width="50" data-expected-height="200"></div>
+ <div class="sizedToGridArea" style="grid-column: 'c'; grid-row: 'f';" data-offset-x="150" data-offset-y="50" data-expected-width="200" data-expected-height="100"></div>
+ </div>
+</div>
+
+<!-- Check positioning using unique grid-line names mixed with integers -->
+<div style="position: relative">
+ <div class="grid gridUniqueNames">
+ <div class="sizedToGridArea" style="grid-column: 'b' / 4;" data-offset-x="50" data-offset-y="0" data-expected-width="300" data-expected-height="50"></div>
+ <div class="sizedToGridArea" style="grid-row: 3 / 'h';" data-offset-x="0" data-offset-y="150" data-expected-width="50" data-expected-height="200"></div>
+ <div class="sizedToGridArea" style="grid-column: 2; grid-row: 'g';" data-offset-x="50" data-offset-y="150" data-expected-width="100" data-expected-height="200"></div>
+ <div class="sizedToGridArea" style="grid-column: 'a'; grid-row: 2;" data-offset-x="0" data-offset-y="50" data-expected-width="50" data-expected-height="100"></div>
+ </div>
+</div>
+
+<!-- Check that without named gridAreas there are no implicit grid-line names defined -->
+<div style="position: relative">
+ <div class="grid gridUniqueNames">
+ <div class="sizedToGridArea" style="grid-column: 'c-start';" data-offset-x="0" data-offset-y="0" data-expected-width="50" data-expected-height="50"></div>
+ <div class="sizedToGridArea" style="grid-row: 'f-start';" data-offset-x="0" data-offset-y="0" data-expected-width="50" data-expected-height="50"></div>
+ <div class="sizedToGridArea" style="grid-column: 'c-start'; grid-row: 'f-end'" data-offset-x="0" data-offset-y="0" data-expected-width="50" data-expected-height="50"></div>
+ <div class="sizedToGridArea" style="grid-column: 'b-end'; grid-row: 'h-start'" data-offset-x="0" data-offset-y="0" data-expected-width="50" data-expected-height="50"></div>
+ </div>
+</div>
+
+<!-- Check that gridArea's implicit names are well defined -->
+<div style="position: relative">
+ <div class="grid gridAreas gridNoLineNames">
+ <div class="sizedToGridArea" style="grid-column: 'a-start'; grid-row: 'd-start';" data-offset-x="50" data-offset-y="150" data-expected-width="100" data-expected-height="200"></div>
+ <div class="sizedToGridArea" style="grid-column: 'a-start'; grid-row: d;" data-offset-x="50" data-offset-y="150" data-expected-width="100" data-expected-height="200"></div>
+ <div class="sizedToGridArea" style="grid-column: 'd-start'; grid-row: 'c-start';" data-offset-x="150" data-offset-y="50" data-expected-width="200" data-expected-height="100"></div>
+ </div>
+</div>
+
+<!-- Check positioning using grid areas -->
+<div style="position: relative">
+ <div class="grid gridAreas gridNoLineNames">
+ <div class="sizedToGridArea" style="grid-column: d;" data-offset-x="150" data-offset-y="0" data-expected-width="200" data-expected-height="50"></div>
+ <div class="sizedToGridArea" style="grid-row: d;" data-offset-x="0" data-offset-y="150" data-expected-width="50" data-expected-height="200"></div>
+ <div class="sizedToGridArea" style="grid-column: c;" data-offset-x="0" data-offset-y="0" data-expected-width="50" data-expected-height="50"></div>
+ <div class="sizedToGridArea" style="grid-row: c;" data-offset-x="0" data-offset-y="50" data-expected-width="50" data-expected-height="100"></div>
+ </div>
+</div>
+
+<div style="position: relative">
+ <div class="grid gridAreas gridNoLineNames">
+ <div class="sizedToGridArea" style="grid-column: a;" data-offset-x="50" data-offset-y="0" data-expected-width="300" data-expected-height="50"></div>
+ <div class="sizedToGridArea" style="grid-row: a;" data-offset-x="0" data-offset-y="0" data-expected-width="50" data-expected-height="150"></div>
+ <div class="sizedToGridArea" style="grid-column: a; grid-row: a;" data-offset-x="50" data-offset-y="0" data-expected-width="300" data-expected-height="150"></div>
+ </div>
+</div>
+
+<!-- Use grid area's implicit line names if defined before explicitly named grid lines -->
+<div style="position: relative">
+ <div class="grid gridAreas gridWithNamedLineAfterGridArea">
+ <div class="sizedToGridArea" style="grid-column: d;" data-offset-x="150" data-offset-y="0" data-expected-width="200" data-expected-height="50"></div>
+ <div class="sizedToGridArea" style="grid-row: d;" data-offset-x="0" data-offset-y="150" data-expected-width="50" data-expected-height="200"></div>
+ <div class="sizedToGridArea" style="grid-column: c;" data-offset-x="0" data-offset-y="0" data-expected-width="50" data-expected-height="50"></div>
+ <div class="sizedToGridArea" style="grid-row: c;" data-offset-x="0" data-offset-y="50" data-expected-width="50" data-expected-height="100"></div>
+ </div>
+</div>
+
+<div style="position: relative">
+ <div class="grid gridAreas gridWithNamedLineAfterGridArea">
+ <div class="sizedToGridArea" style="grid-column-start: 'a-start';" data-offset-x="50" data-offset-y="0" data-expected-width="100" data-expected-height="50"></div>
+ <div class="sizedToGridArea" style="grid-row-start: 'c-start';" data-offset-x="0" data-offset-y="50" data-expected-width="50" data-expected-height="100"></div>
+ </div>
+</div>
+
+<div style="position: relative">
+ <div class="grid gridAreas gridWithNamedLineAfterGridArea">
+ <div class="sizedToGridArea" style="grid-column: a;" data-offset-x="50" data-offset-y="0" data-expected-width="300" data-expected-height="50"></div>
+ <div class="sizedToGridArea" style="grid-row: d;" data-offset-x="0" data-offset-y="150" data-expected-width="50" data-expected-height="200"></div>
+ <div class="sizedToGridArea" style="grid-column: a; grid-row: d;" data-offset-x="50" data-offset-y="150" data-expected-width="300" data-expected-height="200"></div>
+ </div>
+</div>
+
+<!-- Use explicitly named grid lines if they're defined before the grid area -->
+<div style="position: relative">
+ <div class="grid gridAreas gridWithNamedLineBeforeGridArea">
+ <div class="sizedToGridArea" style="grid-column: d;" data-offset-x="50" data-offset-y="0" data-expected-width="300" data-expected-height="50"></div>
+ <div class="sizedToGridArea" style="grid-row: d;" data-offset-x="0" data-offset-y="50" data-expected-width="50" data-expected-height="300"></div>
+ <div class="sizedToGridArea" style="grid-column: c;" data-offset-x="0" data-offset-y="0" data-expected-width="50" data-expected-height="50"></div>
+ <div class="sizedToGridArea" style="grid-row: c;" data-offset-x="0" data-offset-y="0" data-expected-width="50" data-expected-height="150"></div>
+ </div>
+</div>
+
+<div style="position: relative">
+ <div class="grid gridAreas gridWithNamedLineBeforeGridArea">
+ <div class="sizedToGridArea" style="grid-column-start: 'd-start';" data-offset-x="50" data-offset-y="0" data-expected-width="100" data-expected-height="50"></div>
+ <div class="sizedToGridArea" style="grid-row-start: 'd-start';" data-offset-x="0" data-offset-y="50" data-expected-width="50" data-expected-height="100"></div>
+ </div>
+</div>
+
+<div style="position: relative">
+ <div class="grid gridAreas gridWithNamedLineBeforeGridArea">
+ <div class="sizedToGridArea" style="grid-column: a;" data-offset-x="0" data-offset-y="0" data-expected-width="350" data-expected-height="50"></div>
+ <div class="sizedToGridArea" style="grid-row: d;" data-offset-x="0" data-offset-y="50" data-expected-width="50" data-expected-height="300"></div>
+ <div class="sizedToGridArea" style="grid-column: a; grid-row: d;" data-offset-x="0" data-offset-y="50" data-expected-width="350" data-expected-height="300"></div>
+ </div>
+</div>
+
+<!-- Check that a "-start" ident in a end column or a "-end" ident in a start column is not treated as a implicit grid line of a grid area -->
+<div style="position: relative">
+ <div class="grid gridAreas gridNoLineNames">
+ <div class="sizedToGridArea" style="grid-column: a / 'a-start'; grid-row: 'd-start';" data-offset-x="50" data-offset-y="150" data-expected-width="100" data-expected-height="200"></div>
+ <div class="sizedToGridArea" style="grid-column: d / 'd-start'; grid-row: 'c-start';" data-offset-x="150" data-offset-y="50" data-expected-width="200" data-expected-height="100"></div>
+ <div class="sizedToGridArea" style="grid-column: c; grid-row: a / 'a-start';" data-offset-x="0" data-offset-y="0" data-expected-width="50" data-expected-height="50"></div>
+ <div class="sizedToGridArea" style="grid-column: d; grid-row: c / 'c-start';" data-offset-x="150" data-offset-y="50" data-expected-width="200" data-expected-height="100"></div>
+ </div>
+</div>
+
+<!-- Check that we propertly resolve explicit "-end" lines inside grid areas -->
+<div style="position: relative">
+ <div class="grid gridAreas gridWithEndLines">
+ <div class="sizedToGridArea" style="grid-column: a" data-offset-x="50" data-offset-y="0" data-expected-width="100" data-expected-height="50"></div>
+ <div class="sizedToGridArea" style="grid-column: a; grid-row: c" data-offset-x="50" data-offset-y="50" data-expected-width="100" data-expected-height="100"></div>
+ <div class="sizedToGridArea" style="grid-row: d;" data-offset-x="0" data-offset-y="150" data-expected-width="50" data-expected-height="200"></div>
+ <div class="sizedToGridArea" style="grid-column: a; grid-row: d;" data-offset-x="50" data-offset-y="150" data-expected-width="100" data-expected-height="200"></div>
+ </div>
+</div>
+
+<!-- Check that we always pick the first definition when multiple grid lines have the same name -->
+<div style="position: relative">
+ <div class="grid gridAreas gridRepeatedNames">
+ <div class="sizedToGridArea" style="grid-column: d; grid-row: c" data-offset-x="0" data-offset-y="50" data-expected-width="350" data-expected-height="100"></div>
+ <div class="sizedToGridArea" style="grid-column: 'd-start' / 'd-end'; grid-row: 'c-start' / 'c-end'" data-offset-x="0" data-offset-y="50" data-expected-width="350" data-expected-height="100"></div>
+ <div class="sizedToGridArea" style="grid-column: c; grid-row: d" data-offset-x="0" data-offset-y="150" data-expected-width="50" data-expected-height="200"></div>
+ </div>
+</div>
+
+<!-- Check behavior with areas named *-start or *-end -->
+<div style="position: relative">
+ <div class="grid gridAreasSpecial gridNoLineNames">
+ <div class="sizedToGridArea" style="grid-column: a;" data-offset-x="0" data-offset-y="0" data-expected-width="50" data-expected-height="50"></div>
+ <div class="sizedToGridArea" style="grid-row: a;" data-offset-x="0" data-offset-y="0" data-expected-width="50" data-expected-height="50"></div>
+ <div class="sizedToGridArea" style="grid-column: a; grid-row: a;" data-offset-x="0" data-offset-y="0" data-expected-width="50" data-expected-height="50"></div>
+ </div>
+</div>
+
+<div style="position: relative">
+ <div class="grid gridAreasSpecial gridNoLineNames">
+ <div class="sizedToGridArea" style="grid-column: a-start;" data-offset-x="50" data-offset-y="0" data-expected-width="300" data-expected-height="50"></div>
+ <div class="sizedToGridArea" style="grid-row: a-end;" data-offset-x="0" data-offset-y="50" data-expected-width="50" data-expected-height="100"></div>
+ <div class="sizedToGridArea" style="grid-column: a-start; grid-row: a-end;" data-offset-x="50" data-offset-y="50" data-expected-width="300" data-expected-height="100"></div>
+ </div>
+</div>
+
+<div style="position: relative">
+ <div class="grid gridAreasSpecial gridWithNamedLineBeforeGridArea">
+ <div class="sizedToGridArea" style="grid-column: a-start;" data-offset-x="50" data-offset-y="0" data-expected-width="300" data-expected-height="50"></div>
+ <div class="sizedToGridArea" style="grid-row: a-end;" data-offset-x="0" data-offset-y="50" data-expected-width="50" data-expected-height="100"></div>
+ <div class="sizedToGridArea" style="grid-column: a-start; grid-row: a-end;" data-offset-x="50" data-offset-y="50" data-expected-width="300" data-expected-height="100"></div>
+ </div>
+</div>
+
+<div style="position: relative">
+ <div class="grid gridAreasSpecial gridWithNamedLineAfterGridArea">
+ <div class="sizedToGridArea" style="grid-column: a-start;" data-offset-x="50" data-offset-y="0" data-expected-width="300" data-expected-height="50"></div>
+ <div class="sizedToGridArea" style="grid-row: d;" data-offset-x="0" data-offset-y="150" data-expected-width="50" data-expected-height="200"></div>
+ <div class="sizedToGridArea" style="grid-column: a-start; grid-row: d;" data-offset-x="50" data-offset-y="150" data-expected-width="300" data-expected-height="200"></div>
+ </div>
+</div>
+
+<!-- Check behavior with lines named *-start or *-end -->
+<div style="position: relative">
+ <div class="grid gridAreasSpecial gridUniqueNames">
+ <div class="sizedToGridArea" style="grid-column: '-start';" data-offset-x="150" data-offset-y="0" data-expected-width="200" data-expected-height="50"></div>
+ <div class="sizedToGridArea" style="grid-row: '-end';" data-offset-x="0" data-offset-y="50" data-expected-width="50" data-expected-height="100"></div>
+ <div class="sizedToGridArea" style="grid-column-end: '-start'; grid-row-start: '-end';" data-offset-x="50" data-offset-y="50" data-expected-width="100" data-expected-height="100"></div>
+ </div>
+</div>
+
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698