Index: LayoutTests/fast/css-grid-layout/resources/grid-item-column-row-parsing-utils.js |
diff --git a/LayoutTests/fast/css-grid-layout/resources/grid-item-column-row-parsing-utils.js b/LayoutTests/fast/css-grid-layout/resources/grid-item-column-row-parsing-utils.js |
index d337acc015f9224a5b29b6318c3e8464a4f41740..93bb9448e8c6bb613c4e93bde6097dfa5a6059c5 100644 |
--- a/LayoutTests/fast/css-grid-layout/resources/grid-item-column-row-parsing-utils.js |
+++ b/LayoutTests/fast/css-grid-layout/resources/grid-item-column-row-parsing-utils.js |
@@ -76,4 +76,122 @@ window.testColumnRowInvalidJSParsing = function(columnValue, rowValue) |
document.body.removeChild(gridItem); |
} |
+var placeholderParentStartValueForInherit = "6"; |
+var placeholderParentEndValueForInherit = "span 2"; |
+var placeholderParentColumnValueForInherit = placeholderParentStartValueForInherit + " / " + placeholderParentEndValueForInherit; |
+var placeholderParentBeforeValueForInherit = "span 1"; |
+var placeholderParentAfterValueForInherit = "7"; |
+var placeholderParentRowValueForInherit = placeholderParentBeforeValueForInherit + " / " + placeholderParentAfterValueForInherit; |
+ |
+var placeholderStartValueForInitial = "1"; |
+var placeholderEndValueForInitial = "span 2"; |
+var placeholderColumnValueForInitial = placeholderStartValueForInitial + " / " + placeholderEndValueForInitial; |
+var placeholderBeforeValueForInitial = "span 3"; |
+var placeholderAfterValueForInitial = "5"; |
+var placeholderRowValueForInitial = placeholderBeforeValueForInitial + " / " + placeholderAfterValueForInitial; |
+ |
+function setupInheritTest() |
+{ |
+ var parentElement = document.createElement("div"); |
+ document.body.appendChild(parentElement); |
+ parentElement.style.webkitGridColumn = placeholderParentColumnValueForInherit; |
+ parentElement.style.webkitGridRow = placeholderParentRowValueForInherit; |
+ |
+ var gridItem = document.createElement("div"); |
+ parentElement.appendChild(gridItem); |
+ return parentElement; |
+} |
+ |
+function setupInitialTest() |
+{ |
+ var gridItem = document.createElement("div"); |
+ document.body.appendChild(gridItem); |
+ gridItem.style.webkitGridColumn = placeholderColumnValueForInitial; |
+ gridItem.style.webkitGridRow = placeholderRowValueForInitial; |
+ |
+ checkColumnRowValues(gridItem, placeholderColumnValueForInitial, placeholderRowValueForInitial); |
+ return gridItem; |
+} |
+ |
+window.testColumnRowInheritJSParsing = function(columnValue, rowValue) |
+{ |
+ var parentElement = setupInheritTest(); |
+ var gridItem = parentElement.firstChild; |
+ gridItem.style.webkitGridColumn = columnValue; |
+ gridItem.style.webkitGridRow = rowValue; |
+ |
+ checkColumnRowValues(gridItem, columnValue !== "inherit" ? columnValue : placeholderParentColumnValueForInherit, rowValue !== "inherit" ? rowValue : placeholderParentRowValueForInherit); |
+ |
+ document.body.removeChild(parentElement); |
+} |
+ |
+window.testStartBeforeInheritJSParsing = function(startValue, beforeValue) |
+{ |
+ var parentElement = setupInheritTest(); |
+ var gridItem = parentElement.firstChild; |
+ gridItem.style.webkitGridStart = startValue; |
+ gridItem.style.webkitGridBefore = beforeValue; |
+ |
+ // Initial value is 'auto' but we shouldn't touch the opposite grid line. |
+ var columnValueForInherit = (startValue !== "inherit" ? startValue : placeholderParentStartValueForInherit) + " / auto"; |
+ var rowValueForInherit = (beforeValue !== "inherit" ? beforeValue : placeholderParentBeforeValueForInherit) + " / auto"; |
+ checkColumnRowValues(parentElement.firstChild, columnValueForInherit, rowValueForInherit); |
+ |
+ document.body.removeChild(parentElement); |
+} |
+ |
+window.testEndAfterInheritJSParsing = function(endValue, afterValue) |
+{ |
+ var parentElement = setupInheritTest(); |
+ var gridItem = parentElement.firstChild; |
+ gridItem.style.webkitGridEnd = endValue; |
+ gridItem.style.webkitGridAfter = afterValue; |
+ |
+ // Initial value is 'auto' but we shouldn't touch the opposite grid line. |
+ var columnValueForInherit = "auto / " + (endValue !== "inherit" ? endValue : placeholderParentEndValueForInherit); |
+ var rowValueForInherit = "auto / " + (afterValue !== "inherit" ? afterValue : placeholderParentAfterValueForInherit); |
+ checkColumnRowValues(parentElement.firstChild, columnValueForInherit, rowValueForInherit); |
+ |
+ document.body.removeChild(parentElement); |
+} |
+ |
+window.testColumnRowInitialJSParsing = function() |
+{ |
+ var gridItem = setupInitialTest(); |
+ |
+ gridItem.style.webkitGridColumn = "initial"; |
+ checkColumnRowValues(gridItem, "auto / auto", placeholderRowValueForInitial); |
+ |
+ gridItem.style.webkitGridRow = "initial"; |
+ checkColumnRowValues(gridItem, "auto / auto", "auto / auto"); |
+ |
+ document.body.removeChild(gridItem); |
+} |
+ |
+window.testStartBeforeInitialJSParsing = function() |
+{ |
+ var gridItem = setupInitialTest(); |
+ |
+ gridItem.style.webkitGridStart = "initial"; |
+ checkColumnRowValues(gridItem, "auto / " + placeholderEndValueForInitial, placeholderRowValueForInitial); |
+ |
+ gridItem.style.webkitGridBefore = "initial"; |
+ checkColumnRowValues(gridItem, "auto / " + placeholderEndValueForInitial, "auto / " + placeholderAfterValueForInitial); |
+ |
+ document.body.removeChild(gridItem); |
+} |
+ |
+window.testEndAfterInitialJSParsing = function() |
+{ |
+ var gridItem = setupInitialTest(); |
+ |
+ gridItem.style.webkitGridEnd = "initial"; |
+ checkColumnRowValues(gridItem, placeholderStartValueForInitial + " / auto", placeholderRowValueForInitial); |
+ |
+ gridItem.style.webkitGridAfter = "initial"; |
+ checkColumnRowValues(gridItem, placeholderStartValueForInitial + " / auto", placeholderBeforeValueForInitial + " / auto"); |
+ |
+ document.body.removeChild(gridItem); |
+} |
+ |
})(); |