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

Side by Side Diff: LayoutTests/fast/css-grid-layout/resources/grid-item-column-row-parsing-utils.js

Issue 14493016: Fix handling of 'inherit' and 'initial' for grid lines (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Take 2: Forgot the code Created 7 years, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 (function() { 1 (function() {
2 2
3 function checkColumnRowValues(gridItem, columnValue, rowValue) 3 function checkColumnRowValues(gridItem, columnValue, rowValue)
4 { 4 {
5 this.gridItem = gridItem; 5 this.gridItem = gridItem;
6 this.gridColumnValue = columnValue; 6 this.gridColumnValue = columnValue;
7 this.gridRowValue = rowValue; 7 this.gridRowValue = rowValue;
8 8
9 var gridStartEndValues = columnValue.split("/") 9 var gridStartEndValues = columnValue.split("/")
10 this.gridStartValue = gridStartEndValues[0].trim(); 10 this.gridStartValue = gridStartEndValues[0].trim();
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 var gridItem = document.createElement("div"); 69 var gridItem = document.createElement("div");
70 document.body.appendChild(gridItem); 70 document.body.appendChild(gridItem);
71 gridItem.style.webkitGridColumn = columnValue; 71 gridItem.style.webkitGridColumn = columnValue;
72 gridItem.style.webkitGridRow = rowValue; 72 gridItem.style.webkitGridRow = rowValue;
73 73
74 checkColumnRowValues(gridItem, "auto / auto", "auto / auto"); 74 checkColumnRowValues(gridItem, "auto / auto", "auto / auto");
75 75
76 document.body.removeChild(gridItem); 76 document.body.removeChild(gridItem);
77 } 77 }
78 78
79 var placeholderParentStartValueForInherit = "6";
80 var placeholderParentEndValueForInherit = "span 2";
81 var placeholderParentColumnValueForInherit = placeholderParentStartValueForInher it + " / " + placeholderParentEndValueForInherit;
82 var placeholderParentBeforeValueForInherit = "span 1";
83 var placeholderParentAfterValueForInherit = "7";
84 var placeholderParentRowValueForInherit = placeholderParentBeforeValueForInherit + " / " + placeholderParentAfterValueForInherit;
85
86 var placeholderStartValueForInitial = "1";
87 var placeholderEndValueForInitial = "span 2";
88 var placeholderColumnValueForInitial = placeholderStartValueForInitial + " / " + placeholderEndValueForInitial;
89 var placeholderBeforeValueForInitial = "span 3";
90 var placeholderAfterValueForInitial = "5";
91 var placeholderRowValueForInitial = placeholderBeforeValueForInitial + " / " + p laceholderAfterValueForInitial;
92
93 function setupInheritTest()
94 {
95 var parentElement = document.createElement("div");
96 document.body.appendChild(parentElement);
97 parentElement.style.webkitGridColumn = placeholderParentColumnValueForInheri t;
98 parentElement.style.webkitGridRow = placeholderParentRowValueForInherit;
99
100 var gridItem = document.createElement("div");
101 parentElement.appendChild(gridItem);
102 return parentElement;
103 }
104
105 function setupInitialTest()
106 {
107 var gridItem = document.createElement("div");
108 document.body.appendChild(gridItem);
109 gridItem.style.webkitGridColumn = placeholderColumnValueForInitial;
110 gridItem.style.webkitGridRow = placeholderRowValueForInitial;
111
112 checkColumnRowValues(gridItem, placeholderColumnValueForInitial, placeholder RowValueForInitial);
113 return gridItem;
114 }
115
116 window.testColumnRowInheritJSParsing = function(columnValue, rowValue)
117 {
118 var parentElement = setupInheritTest();
119 var gridItem = parentElement.firstChild;
120 gridItem.style.webkitGridColumn = columnValue;
121 gridItem.style.webkitGridRow = rowValue;
122
123 checkColumnRowValues(gridItem, columnValue !== "inherit" ? columnValue : pla ceholderParentColumnValueForInherit, rowValue !== "inherit" ? rowValue : placeho lderParentRowValueForInherit);
124
125 document.body.removeChild(parentElement);
126 }
127
128 window.testStartBeforeInheritJSParsing = function(startValue, beforeValue)
129 {
130 var parentElement = setupInheritTest();
131 var gridItem = parentElement.firstChild;
132 gridItem.style.webkitGridStart = startValue;
133 gridItem.style.webkitGridBefore = beforeValue;
134
135 // Initial value is 'auto' but we shouldn't touch the opposite grid line.
136 var columnValueForInherit = (startValue !== "inherit" ? startValue : placeho lderParentStartValueForInherit) + " / auto";
137 var rowValueForInherit = (beforeValue !== "inherit" ? beforeValue : placehol derParentBeforeValueForInherit) + " / auto";
138 checkColumnRowValues(parentElement.firstChild, columnValueForInherit, rowVal ueForInherit);
139
140 document.body.removeChild(parentElement);
141 }
142
143 window.testEndAfterInheritJSParsing = function(endValue, afterValue)
144 {
145 var parentElement = setupInheritTest();
146 var gridItem = parentElement.firstChild;
147 gridItem.style.webkitGridEnd = endValue;
148 gridItem.style.webkitGridAfter = afterValue;
149
150 // Initial value is 'auto' but we shouldn't touch the opposite grid line.
151 var columnValueForInherit = "auto / " + (endValue !== "inherit" ? endValue : placeholderParentEndValueForInherit);
152 var rowValueForInherit = "auto / " + (afterValue !== "inherit" ? afterValue : placeholderParentAfterValueForInherit);
153 checkColumnRowValues(parentElement.firstChild, columnValueForInherit, rowVal ueForInherit);
154
155 document.body.removeChild(parentElement);
156 }
157
158 window.testColumnRowInitialJSParsing = function()
159 {
160 var gridItem = setupInitialTest();
161
162 gridItem.style.webkitGridColumn = "initial";
163 checkColumnRowValues(gridItem, "auto / auto", placeholderRowValueForInitial) ;
164
165 gridItem.style.webkitGridRow = "initial";
166 checkColumnRowValues(gridItem, "auto / auto", "auto / auto");
167
168 document.body.removeChild(gridItem);
169 }
170
171 window.testStartBeforeInitialJSParsing = function()
172 {
173 var gridItem = setupInitialTest();
174
175 gridItem.style.webkitGridStart = "initial";
176 checkColumnRowValues(gridItem, "auto / " + placeholderEndValueForInitial, pl aceholderRowValueForInitial);
177
178 gridItem.style.webkitGridBefore = "initial";
179 checkColumnRowValues(gridItem, "auto / " + placeholderEndValueForInitial, " auto / " + placeholderAfterValueForInitial);
180
181 document.body.removeChild(gridItem);
182 }
183
184 window.testEndAfterInitialJSParsing = function()
185 {
186 var gridItem = setupInitialTest();
187
188 gridItem.style.webkitGridEnd = "initial";
189 checkColumnRowValues(gridItem, placeholderStartValueForInitial + " / auto", placeholderRowValueForInitial);
190
191 gridItem.style.webkitGridAfter = "initial";
192 checkColumnRowValues(gridItem, placeholderStartValueForInitial + " / auto", placeholderBeforeValueForInitial + " / auto");
193
194 document.body.removeChild(gridItem);
195 }
196
79 })(); 197 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698