Diff
Modified: trunk/LayoutTests/ChangeLog (245797 => 245798)
--- trunk/LayoutTests/ChangeLog 2019-05-27 21:21:40 UTC (rev 245797)
+++ trunk/LayoutTests/ChangeLog 2019-05-27 21:27:15 UTC (rev 245798)
@@ -1,3 +1,19 @@
+2019-05-27 Oriol Brufau <[email protected]>
+
+ [css-grid] Preserve repeat() notation when serializing declared values
+ https://bugs.webkit.org/show_bug.cgi?id=197840
+
+ Reviewed by Manuel Rego Casasnovas.
+
+ Update test expectations.
+
+ * fast/css-grid-layout/grid-element-auto-repeat-get-set-expected.txt:
+ * fast/css-grid-layout/grid-element-auto-repeat-get-set.html:
+ * fast/css-grid-layout/grid-repeat-calc-expected.txt:
+ * fast/css-grid-layout/grid-repeat-calc.html:
+ * fast/css-grid-layout/named-grid-line-get-set-expected.txt:
+ * fast/css-grid-layout/named-grid-line-get-set.html:
+
2019-05-27 Carlos Garcia Campos <[email protected]>
Touch support is reported even when the device doesn't have a touch screen
Modified: trunk/LayoutTests/fast/css-grid-layout/grid-element-auto-repeat-get-set-expected.txt (245797 => 245798)
--- trunk/LayoutTests/fast/css-grid-layout/grid-element-auto-repeat-get-set-expected.txt 2019-05-27 21:21:40 UTC (rev 245797)
+++ trunk/LayoutTests/fast/css-grid-layout/grid-element-auto-repeat-get-set-expected.txt 2019-05-27 21:27:15 UTC (rev 245798)
@@ -13,9 +13,9 @@
PASS getComputedStyle(element, '').getPropertyValue('grid-template-rows') is "[foo] 175px [bar foo] 175px [bar foo] 175px [bar]"
PASS element.style.gridTemplateRows is "repeat(auto-fill, [foo] minmax(175px, max-content) [bar])"
PASS getComputedStyle(element, '').getPropertyValue('grid-template-columns') is "100px 100px 100px 250px 250px"
-PASS element.style.gridTemplateColumns is "repeat(auto-fill, minmax(50px, 100px)) 250px 250px"
+PASS element.style.gridTemplateColumns is "repeat(auto-fill, minmax(50px, 100px)) repeat(2, 250px)"
PASS getComputedStyle(element, '').getPropertyValue('grid-template-rows') is "450px 50px [bar] 50px [bar foo] 10px [foo] 10px"
-PASS element.style.gridTemplateRows is "450px repeat(auto-fill, minmax(max-content, 5em) [bar]) [foo] 1em [foo] 1em"
+PASS element.style.gridTemplateRows is "repeat(1, 450px) repeat(auto-fill, minmax(max-content, 5em) [bar]) repeat(2, [foo] 1em)"
PASS getComputedStyle(element, '').getPropertyValue('grid-template-columns') is "[start] 80px [foo bar] 200px [foo bar] 200px [foo bar] 200px [end]"
PASS element.style.gridTemplateColumns is "[start] 10% repeat(auto-fill, [foo bar] 200px) [end]"
PASS getComputedStyle(element, '').getPropertyValue('grid-template-rows') is "75px [prev] 200px [foo bar next] 150px [last end]"
@@ -33,15 +33,15 @@
PASS getComputedStyle(element, '').getPropertyValue('grid-template-rows') is "[foo] 0px [bar foo] 0px [bar foo] 0px [bar]"
PASS element.style.gridTemplateRows is "repeat(auto-fit, [foo] minmax(20em, max-content) [bar])"
PASS getComputedStyle(element, '').getPropertyValue('grid-template-columns') is "0px 0px 20px 20px"
-PASS element.style.gridTemplateColumns is "repeat(auto-fit, minmax(300px, min-content)) 20px 20px"
+PASS element.style.gridTemplateColumns is "repeat(auto-fit, minmax(300px, min-content)) repeat(2, 20px)"
PASS getComputedStyle(element, '').getPropertyValue('grid-template-rows') is "60px 0px [bar foo] 10px [foo] 10px"
-PASS element.style.gridTemplateRows is "10% repeat(auto-fit, minmax(30em, max-content) [bar]) [foo] 1em [foo] 1em"
+PASS element.style.gridTemplateRows is "repeat(1, 10%) repeat(auto-fit, minmax(30em, max-content) [bar]) repeat(2, [foo] 1em)"
PASS getComputedStyle(element, '').getPropertyValue('grid-template-columns') is "[a z] 0px [y z] 0px [y z] 0px [y z] 0px [y z] 0px [y z] 0px [y z] 0px [y b] 30px [c d] 20px [e]"
PASS element.style.gridTemplateColumns is "[a] repeat(auto-fit, [z] 100px [y]) [b] 30px [c d] 20px [e]"
PASS getComputedStyle(element, '').getPropertyValue('grid-template-rows') is "[z] 0px [y z] 0px [y z] 0px [y z] 0px [y z] 0px [y a b] 30px [c d] 20px [e]"
PASS element.style.gridTemplateRows is "repeat(auto-fit, [z] 100px [y]) [a b] 30px [c d] 20px [e]"
PASS getComputedStyle(element, '').getPropertyValue('grid-template-columns') is "[a z] 0px [y z] 0px [y z] 0px [y z] 0px [y z] 0px [y z] 0px [y z] 0px [y b] 30px [c] 20px [e]"
-PASS element.style.gridTemplateColumns is "[a] repeat(auto-fit, [z] 100px [y]) [b] 30px [c] 20px [e]"
+PASS element.style.gridTemplateColumns is "[a] repeat(auto-fit, [z] 100px [y]) repeat(1, [b] 30px [c]) 20px [e]"
PASS getComputedStyle(element, '').getPropertyValue('grid-template-rows') is "[a b] 30px [c d] 20px [e z] 0px [y z] 0px [y z] 0px [y z] 0px [y z] 0px [y]"
PASS element.style.gridTemplateRows is "[a b] 30px [c d] 20px [e] repeat(auto-fit, [z] 100px [y])"
PASS getComputedStyle(element, '').getPropertyValue('grid-template-columns') is "[start] 0px 0px [end start] 0px 0px [end]"
Modified: trunk/LayoutTests/fast/css-grid-layout/grid-element-auto-repeat-get-set.html (245797 => 245798)
--- trunk/LayoutTests/fast/css-grid-layout/grid-element-auto-repeat-get-set.html 2019-05-27 21:21:40 UTC (rev 245797)
+++ trunk/LayoutTests/fast/css-grid-layout/grid-element-auto-repeat-get-set.html 2019-05-27 21:27:15 UTC (rev 245798)
@@ -13,14 +13,14 @@
debug("Test auto-repeat syntax.");
testGridTemplatesSetJSValues("repeat(auto-fill, [foo bar] 200px)", "repeat(auto-fill, 20em [foo bar])", "[foo bar] 200px [foo bar] 200px [foo bar] 200px [foo bar] 200px", "200px [foo bar] 200px [foo bar] 200px [foo bar]");
testGridTemplatesSetJSValues("repeat(auto-fill, [foo bar] minmax(300px, 1fr))", "repeat(auto-fill, [foo] minmax(175px, max-content) [bar])", "[foo bar] 400px [foo bar] 400px", "[foo] 175px [bar foo] 175px [bar foo] 175px [bar]");
- testGridTemplatesSetJSValues("repeat(auto-fill, minmax(50px, 100px)) repeat(2, 250px)", "repeat(1, 450px) repeat(auto-fill, minmax(max-content, 5em) [bar]) repeat(2, [foo] 1em)", "100px 100px 100px 250px 250px", "450px 50px [bar] 50px [bar foo] 10px [foo] 10px", "repeat(auto-fill, minmax(50px, 100px)) 250px 250px", "450px repeat(auto-fill, minmax(max-content, 5em) [bar]) [foo] 1em [foo] 1em");
+ testGridTemplatesSetJSValues("repeat(auto-fill, minmax(50px, 100px)) repeat(2, 250px)", "repeat(1, 450px) repeat(auto-fill, minmax(max-content, 5em) [bar]) repeat(2, [foo] 1em)", "100px 100px 100px 250px 250px", "450px 50px [bar] 50px [bar foo] 10px [foo] 10px", "repeat(auto-fill, minmax(50px, 100px)) repeat(2, 250px)", "repeat(1, 450px) repeat(auto-fill, minmax(max-content, 5em) [bar]) repeat(2, [foo] 1em)");
testGridTemplatesSetJSValues("[start] 10% repeat(auto-fill, [foo bar] 200px) [end]", "75px [prev] repeat(auto-fill, 20em [foo bar]) [next] 15em [last end]", "[start] 80px [foo bar] 200px [foo bar] 200px [foo bar] 200px [end]", "75px [prev] 200px [foo bar next] 150px [last end]");
testGridTemplatesSetJSValues("repeat(auto-fit, [foo bar] 150px)", "repeat(auto-fit, 24em [foo bar])", "[foo bar] 0px [foo bar] 0px [foo bar] 0px [foo bar] 0px [foo bar] 0px", "0px [foo bar] 0px [foo bar]");
testGridTemplatesSetJSValues("repeat(auto-fill, [start] 200px 100px [end])", "100px [foo] repeat(auto-fill, [a] 2em [b] 10% [c]) [bar] 3em", "[start] 200px 100px [end start] 200px 100px [end]", "100px [foo a] 20px [b] 60px [c a] 20px [b] 60px [c a] 20px [b] 60px [c a] 20px [b] 60px [c a] 20px [b] 60px [c bar] 30px");
testGridTemplatesSetJSValues("repeat(auto-fit, [foo bar] minmax(270px, 1fr))", "repeat(auto-fit, [foo] minmax(20em, max-content) [bar])", "[foo bar] 0px [foo bar] 0px", "[foo] 0px [bar foo] 0px [bar foo] 0px [bar]");
- testGridTemplatesSetJSValues("repeat(auto-fit, minmax(300px, min-content)) repeat(2, 20px)", "repeat(1, 10%) repeat(auto-fit, minmax(30em, max-content) [bar]) repeat(2, [foo] 1em)", "0px 0px 20px 20px", "60px 0px [bar foo] 10px [foo] 10px", "repeat(auto-fit, minmax(300px, min-content)) 20px 20px", "10% repeat(auto-fit, minmax(30em, max-content) [bar]) [foo] 1em [foo] 1em");
+ testGridTemplatesSetJSValues("repeat(auto-fit, minmax(300px, min-content)) repeat(2, 20px)", "repeat(1, 10%) repeat(auto-fit, minmax(30em, max-content) [bar]) repeat(2, [foo] 1em)", "0px 0px 20px 20px", "60px 0px [bar foo] 10px [foo] 10px", "repeat(auto-fit, minmax(300px, min-content)) repeat(2, 20px)", "repeat(1, 10%) repeat(auto-fit, minmax(30em, max-content) [bar]) repeat(2, [foo] 1em)");
testGridTemplatesSetJSValues("[a] repeat(auto-fit, [z] 100px [y]) [b] 30px [c d] 20px [e]", "repeat(auto-fit, [z] 100px [y]) [a b] 30px [c d] 20px [e]", "[a z] 0px [y z] 0px [y z] 0px [y z] 0px [y z] 0px [y z] 0px [y z] 0px [y b] 30px [c d] 20px [e]", "[z] 0px [y z] 0px [y z] 0px [y z] 0px [y z] 0px [y a b] 30px [c d] 20px [e]");
- testGridTemplatesSetJSValues("[a] repeat(auto-fit, [z] 100px [y]) repeat(1, [b] 30px [c]) 20px [e]", "[a b] 30px [c d] 20px [e] repeat(auto-fit, [z] 100px [y])", "[a z] 0px [y z] 0px [y z] 0px [y z] 0px [y z] 0px [y z] 0px [y z] 0px [y b] 30px [c] 20px [e]", "[a b] 30px [c d] 20px [e z] 0px [y z] 0px [y z] 0px [y z] 0px [y z] 0px [y]", "[a] repeat(auto-fit, [z] 100px [y]) [b] 30px [c] 20px [e]");
+ testGridTemplatesSetJSValues("[a] repeat(auto-fit, [z] 100px [y]) repeat(1, [b] 30px [c]) 20px [e]", "[a b] 30px [c d] 20px [e] repeat(auto-fit, [z] 100px [y])", "[a z] 0px [y z] 0px [y z] 0px [y z] 0px [y z] 0px [y z] 0px [y z] 0px [y b] 30px [c] 20px [e]", "[a b] 30px [c d] 20px [e z] 0px [y z] 0px [y z] 0px [y z] 0px [y z] 0px [y]", "[a] repeat(auto-fit, [z] 100px [y]) repeat(1, [b] 30px [c]) 20px [e]");
testGridTemplatesSetJSValues("repeat(auto-fit, [start] 200px 100px [end])", "100px [foo] repeat(auto-fit, [a] 2em [b] 10% [c]) [bar] 3em", "[start] 0px 0px [end start] 0px 0px [end]", "100px [foo a] 0px [b] 0px [c a] 0px [b] 0px [c a] 0px [b] 0px [c a] 0px [b] 0px [c a] 0px [b] 0px [c bar] 30px");
debug("");
Modified: trunk/LayoutTests/fast/css-grid-layout/grid-repeat-calc-expected.txt (245797 => 245798)
--- trunk/LayoutTests/fast/css-grid-layout/grid-repeat-calc-expected.txt 2019-05-27 21:21:40 UTC (rev 245797)
+++ trunk/LayoutTests/fast/css-grid-layout/grid-repeat-calc-expected.txt 2019-05-27 21:27:15 UTC (rev 245798)
@@ -5,7 +5,7 @@
PASS testDiv.style['grid-template-rows'] is ""
testDiv.style['grid-template-rows'] = 'repeat(calc(1 + 1), 18px)'
-PASS testDiv.style['grid-template-rows'] is "18px 18px"
+PASS testDiv.style['grid-template-rows'] is "repeat(2, 18px)"
PASS window.getComputedStyle(testDiv).getPropertyValue('grid-template-rows') is "18px 18px"
PASS successfullyParsed is true
Modified: trunk/LayoutTests/fast/css-grid-layout/grid-repeat-calc.html (245797 => 245798)
--- trunk/LayoutTests/fast/css-grid-layout/grid-repeat-calc.html 2019-05-27 21:21:40 UTC (rev 245797)
+++ trunk/LayoutTests/fast/css-grid-layout/grid-repeat-calc.html 2019-05-27 21:27:15 UTC (rev 245798)
@@ -10,7 +10,7 @@
// grid-template-columns: repeat(1, 15%);
shouldBeEmptyString("testDiv.style['grid-template-rows']");
evalAndLog("testDiv.style['grid-template-rows'] = 'repeat(calc(1 + 1), 18px)'");
-shouldBeEqualToString("testDiv.style['grid-template-rows']", "18px 18px");
+shouldBeEqualToString("testDiv.style['grid-template-rows']", "repeat(2, 18px)");
shouldBeEqualToString("window.getComputedStyle(testDiv).getPropertyValue('grid-template-rows')", "18px 18px");
</script>
Modified: trunk/LayoutTests/fast/css-grid-layout/named-grid-line-get-set-expected.txt (245797 => 245798)
--- trunk/LayoutTests/fast/css-grid-layout/named-grid-line-get-set-expected.txt 2019-05-27 21:21:40 UTC (rev 245797)
+++ trunk/LayoutTests/fast/css-grid-layout/named-grid-line-get-set-expected.txt 2019-05-27 21:27:15 UTC (rev 245798)
@@ -77,9 +77,9 @@
PASS getComputedStyle(element, '').getPropertyValue('grid-template-rows') is "[foo bar] 0px [foo] 0px [bar]"
PASS element.style.gridTemplateRows is "[foo bar] auto [foo] auto [bar]"
PASS getComputedStyle(element, '').getPropertyValue('grid-template-columns') is "[first] 0px [foo bar] 20px [foo bar] 20px"
-PASS element.style.gridTemplateColumns is "[first] auto [foo bar] 20px [foo bar] 20px"
+PASS element.style.gridTemplateColumns is "[first] auto repeat(2, [foo bar] 20px)"
PASS getComputedStyle(element, '').getPropertyValue('grid-template-rows') is "220px [foo] 300px [baz]"
-PASS element.style.gridTemplateRows is "220px [foo] 50% [baz]"
+PASS element.style.gridTemplateRows is "220px [foo] repeat(1, 50% [baz])"
Test getting invalid grid-template-columns and grid-template-rows set through CSS
PASS window.getComputedStyle(gridWithoutBrackets, '').getPropertyValue('grid-template-columns') is "none"
Modified: trunk/LayoutTests/fast/css-grid-layout/named-grid-line-get-set.html (245797 => 245798)
--- trunk/LayoutTests/fast/css-grid-layout/named-grid-line-get-set.html 2019-05-27 21:21:40 UTC (rev 245797)
+++ trunk/LayoutTests/fast/css-grid-layout/named-grid-line-get-set.html 2019-05-27 21:27:15 UTC (rev 245798)
@@ -124,7 +124,7 @@
testGridTemplatesSetJSValues("[first nav] minmax(min-content, max-content) [last]", "[first nav] minmax(max-content, min-content) [last]", "[first nav] 0px [last]", "[first nav] 0px [last]", "[first nav] minmax(min-content, max-content) [last]", "[first nav] minmax(max-content, min-content) [last]");
testGridTemplatesSetJSValues("[first nav] minmax(min-content, max-content) [nav] auto [last]", "[first nav2] minmax(max-content, min-content) [nav2] minmax(10px, 15px) [last]", "[first nav] 0px [nav] 0px [last]", "[first nav2] 0px [nav2] 15px [last]", "[first nav] minmax(min-content, max-content) [nav] auto [last]", "[first nav2] minmax(max-content, min-content) [nav2] minmax(10px, 15px) [last]");
testGridTemplatesSetJSValues("[foo bar] auto [foo] auto [bar]", "[foo bar] auto [foo] auto [bar]", "[foo bar] 0px [foo] 0px [bar]", "[foo bar] 0px [foo] 0px [bar]", "[foo bar] auto [foo] auto [bar]", "[foo bar] auto [foo] auto [bar]");
- testGridTemplatesSetJSValues("[first] auto repeat(2, [foo bar] 20px)", "220px [foo] repeat(1, 50% [baz])", "[first] 0px [foo bar] 20px [foo bar] 20px", "220px [foo] 300px [baz]", "[first] auto [foo bar] 20px [foo bar] 20px", "220px [foo] 50% [baz]");
+ testGridTemplatesSetJSValues("[first] auto repeat(2, [foo bar] 20px)", "220px [foo] repeat(1, 50% [baz]", "[first] 0px [foo bar] 20px [foo bar] 20px", "220px [foo] 300px [baz]", "[first] auto repeat(2, [foo bar] 20px)", "220px [foo] repeat(1, 50% [baz])");
debug("");
debug("Test getting invalid grid-template-columns and grid-template-rows set through CSS");
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (245797 => 245798)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2019-05-27 21:21:40 UTC (rev 245797)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2019-05-27 21:27:15 UTC (rev 245798)
@@ -1,3 +1,16 @@
+2019-05-27 Oriol Brufau <[email protected]>
+
+ [css-grid] Preserve repeat() notation when serializing declared values
+ https://bugs.webkit.org/show_bug.cgi?id=197840
+
+ Reviewed by Manuel Rego Casasnovas.
+
+ Import WPT test.
+
+ * web-platform-tests/css/css-grid/grid-definition/grid-support-repeat-002-expected.txt: Added.
+ * web-platform-tests/css/css-grid/grid-definition/grid-support-repeat-002.html: Added.
+ * web-platform-tests/css/css-grid/grid-definition/w3c-import.log:
+
2019-05-24 Joonghun Park <[email protected]>
Make computed width of non-replaced inline return computed style.
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-support-repeat-002-expected.txt (0 => 245798)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-support-repeat-002-expected.txt (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-support-repeat-002-expected.txt 2019-05-27 21:27:15 UTC (rev 245798)
@@ -0,0 +1,22 @@
+
+PASS grid-template-columns: repeat(1, auto); and grid-template-rows: repeat(1, auto);
+PASS grid-template-columns: repeat(2, auto); and grid-template-rows: repeat(2, auto);
+PASS grid-template-columns: repeat(2, minmax(50px, calc(50% + 50px))); and grid-template-rows: repeat(2, minmax(50px, calc(50% + 50px)));
+PASS grid-template-columns: repeat(5, 10%); and grid-template-rows: repeat(5, 10%);
+PASS grid-template-columns: max-content repeat(2, 25%) 1fr; and grid-template-rows: max-content repeat(2, 25%) 1fr;
+PASS grid-template-columns: repeat(2, min-content 50px); and grid-template-rows: repeat(2, min-content 50px);
+PASS grid-template-columns: repeat(2, [a] minmax(50px, 100px) [b] 25em [c]); and grid-template-rows: repeat(2, [a] minmax(50px, 100px) [b] 25em [c]);
+PASS grid-template-columns: [a] repeat(2, auto [b] 100px) [c]; and grid-template-rows: [a] repeat(2, auto [b] 100px) [c];
+PASS grid-template-columns: [a] auto repeat(2, [b] 100px) [c]; and grid-template-rows: [a] auto repeat(2, [b] 100px) [c];
+PASS grid-template-columns: [a] repeat(2, auto [b]) 100px [c]; and grid-template-rows: [a] repeat(2, auto [b]) 100px [c];
+PASS grid-template-columns: [a] repeat(2, [b] 100px); and grid-template-rows: [a] repeat(2, [b] 100px);
+PASS grid-template-columns: [a] repeat(2, [b] auto [c]) [d]; and grid-template-rows: [a] repeat(2, [b] auto [c]) [d];
+PASS grid-template-columns: [a] min-content repeat(2, [b] 1fr [c] calc(10% + 20px)) [d] minmax(30em, 50em) [e]; and grid-template-rows: [a] min-content repeat(2, [b] 1fr [c] calc(10% + 20px)) [d] minmax(30em, 50em) [e];
+PASS grid-template-columns: repeat(-1, auto); and grid-template-rows: repeat(-1, auto);
+PASS grid-template-columns: repeat(auto, 2); and grid-template-rows: repeat(auto, 2);
+PASS grid-template-columns: repeat 2, auto; and grid-template-rows: repeat 2, auto;
+PASS grid-template-columns: repeat(2 auto); and grid-template-rows: repeat(2 auto);
+PASS grid-template-columns: 100px (repeat 2, auto); and grid-template-rows: 100px (repeat 2, auto);
+PASS grid-template-columns: repeat(2, 50px repeat(2, 100px)); and grid-template-rows: repeat(2, 50px repeat(2, 100px));
+PASS grid-template-columns: 100px repeat(2, [a]); and grid-template-rows: 100px repeat(2, [a]);
+GRID ITEM
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-support-repeat-002.html (0 => 245798)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-support-repeat-002.html (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-support-repeat-002.html 2019-05-27 21:27:15 UTC (rev 245798)
@@ -0,0 +1,65 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Grid Layout Test: Support 'repeat()' notation for 'grid-template-columns' and 'grid-template-rows' properties</title>
+<link rel="author" title="Oriol Brufau" href=""
+<link rel="help" href="" title="5.1.2 Repeating Rows and Columns: the 'repeat()' notation">
+<meta name="assert" content="This test checks that 'grid-template-columns' and 'grid-template-rows' properties support 'repeat()' notation, and that their declared value serializes correctly.">
+<style>
+#grid {
+ display: grid;
+ width: 800px;
+ height: 600px;
+ font: 10px/1 Ahem;
+ justify-content: start;
+ align-content: start;
+}
+</style>
+
+<div id="log"></div>
+
+<div id="grid">
+ <div>GRID ITEM</div>
+</div>
+
+<script src=""
+<script src=""
+<script>
+var {style} = document.getElementById("grid");
+
+function testGridTemplateColumnsRows(assignedValue, expectedValue = assignedValue) {
+ test(function() {
+ style.gridTemplateColumns = assignedValue;
+ style.gridTemplateRows = assignedValue;
+ assert_equals(style.gridTemplateColumns, expectedValue, "gridTemplateColumns");
+ assert_equals(style.gridTemplateRows, expectedValue, "gridTemplateRows");
+ }, `grid-template-columns: ${assignedValue}; and grid-template-rows: ${assignedValue};`);
+}
+
+// Valid values.
+testGridTemplateColumnsRows("repeat(1, auto)");
+testGridTemplateColumnsRows("repeat(2, auto)");
+testGridTemplateColumnsRows("repeat(2, minmax(50px, calc(50% + 50px)))");
+testGridTemplateColumnsRows("repeat(5, 10%)");
+testGridTemplateColumnsRows("max-content repeat(2, 25%) 1fr");
+testGridTemplateColumnsRows("repeat(2, min-content 50px)");
+testGridTemplateColumnsRows("repeat(2, [a] minmax(50px, 100px) [b] 25em [c])");
+testGridTemplateColumnsRows("[a] repeat(2, auto [b] 100px) [c]");
+testGridTemplateColumnsRows("[a] auto repeat(2, [b] 100px) [c]");
+testGridTemplateColumnsRows("[a] repeat(2, auto [b]) 100px [c]");
+testGridTemplateColumnsRows("[a] repeat(2, [b] 100px)");
+testGridTemplateColumnsRows("[a] repeat(2, [b] auto [c]) [d]");
+testGridTemplateColumnsRows("[a] min-content repeat(2, [b] 1fr [c] calc(10% + 20px)) [d] minmax(30em, 50em) [e]");
+
+// Reset values.
+style.gridTemplateColumns = "";
+style.gridTemplateRows = "";
+
+// Wrong values.
+testGridTemplateColumnsRows("repeat(-1, auto)", "");
+testGridTemplateColumnsRows("repeat(auto, 2)", "");
+testGridTemplateColumnsRows("repeat 2, auto", "");
+testGridTemplateColumnsRows("repeat(2 auto)", "");
+testGridTemplateColumnsRows("100px (repeat 2, auto)", "");
+testGridTemplateColumnsRows("repeat(2, 50px repeat(2, 100px))", "");
+testGridTemplateColumnsRows("100px repeat(2, [a])", "");
+</script>
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-definition/w3c-import.log (245797 => 245798)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-definition/w3c-import.log 2019-05-27 21:21:40 UTC (rev 245797)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-definition/w3c-import.log 2019-05-27 21:27:15 UTC (rev 245798)
@@ -46,6 +46,7 @@
/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-support-grid-template-columns-rows-001.html
/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-support-named-grid-lines-001.html
/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-support-repeat-001.html
+/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-support-repeat-002.html
/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-template-columns-fit-content-001-expected.html
/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-template-columns-fit-content-001.html
/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-template-columns-rows-resolved-values-001.html
Modified: trunk/Source/WebCore/ChangeLog (245797 => 245798)
--- trunk/Source/WebCore/ChangeLog 2019-05-27 21:21:40 UTC (rev 245797)
+++ trunk/Source/WebCore/ChangeLog 2019-05-27 21:27:15 UTC (rev 245798)
@@ -1,3 +1,43 @@
+2019-05-27 Oriol Brufau <[email protected]>
+
+ [css-grid] Preserve repeat() notation when serializing declared values
+ https://bugs.webkit.org/show_bug.cgi?id=197840
+
+ Reviewed by Manuel Rego Casasnovas.
+
+ Tests: fast/css-grid-layout/grid-element-auto-repeat-get-set.html
+ fast/css-grid-layout/grid-repeat-calc.html
+ fast/css-grid-layout/named-grid-line-get-set.html
+ imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-support-repeat-002.html
+
+ Before this change, a repeat() notation with an integral number of
+ repetitions was expanded at parse time. This was observable when reading
+ declared values using JS APIs.
+
+ This patch makes the parser preserve that notation, like it was already
+ happening when the number of repetitions was automatic and not integral.
+
+ The resolved value in getComputedStyle() will still be expanded, though,
+ as required by the spec.
+
+ * Sources.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+ * css/CSSGridIntegerRepeatValue.cpp: Added.
+ (WebCore::CSSGridIntegerRepeatValue::customCSSText const):
+ (WebCore::CSSGridIntegerRepeatValue::equals const):
+ * css/CSSGridIntegerRepeatValue.h: Added.
+ * css/CSSValue.cpp:
+ (WebCore::CSSValue::equals const):
+ (WebCore::CSSValue::cssText const):
+ (WebCore::CSSValue::destroy):
+ * css/CSSValue.h:
+ (WebCore::CSSValue::isGridIntegerRepeatValue const):
+ * css/StyleBuilderConverter.h:
+ (WebCore::StyleBuilderConverter::createGridTrackList):
+ (WebCore::StyleBuilderConverter::convertGridTrackSizeList):
+ * css/parser/CSSPropertyParser.cpp:
+ (WebCore::consumeGridTrackRepeatFunction):
+
2019-05-27 Chris Dumez <[email protected]>
Use a strongly-typed identifier for pages
Modified: trunk/Source/WebCore/Headers.cmake (245797 => 245798)
--- trunk/Source/WebCore/Headers.cmake 2019-05-27 21:21:40 UTC (rev 245797)
+++ trunk/Source/WebCore/Headers.cmake 2019-05-27 21:27:15 UTC (rev 245798)
@@ -288,6 +288,7 @@
css/CSSCustomPropertyValue.h
css/CSSFontFaceRule.h
css/CSSFontFamily.h
+ css/CSSGridIntegerRepeatValue.h
css/CSSGroupingRule.h
css/CSSImportRule.h
css/CSSLineBoxContainValue.h
Modified: trunk/Source/WebCore/Sources.txt (245797 => 245798)
--- trunk/Source/WebCore/Sources.txt 2019-05-27 21:21:40 UTC (rev 245797)
+++ trunk/Source/WebCore/Sources.txt 2019-05-27 21:27:15 UTC (rev 245798)
@@ -672,6 +672,7 @@
css/CSSFunctionValue.cpp
css/CSSGradientValue.cpp
css/CSSGridAutoRepeatValue.cpp
+css/CSSGridIntegerRepeatValue.cpp
css/CSSGridLineNamesValue.cpp
css/CSSGridTemplateAreasValue.cpp
css/CSSGroupingRule.cpp
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (245797 => 245798)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2019-05-27 21:21:40 UTC (rev 245797)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2019-05-27 21:27:15 UTC (rev 245798)
@@ -983,6 +983,7 @@
33503C9A10179A74003B47E1 /* NotificationClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 33503C9910179A74003B47E1 /* NotificationClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
33503CA410179AD7003B47E1 /* JSNotification.h in Headers */ = {isa = PBXBuildFile; fileRef = 33503CA010179AD7003B47E1 /* JSNotification.h */; settings = {ATTRIBUTES = (Private, ); }; };
33D0212D131DB37B004091A8 /* CookieStorage.h in Headers */ = {isa = PBXBuildFile; fileRef = E13F01EA1270E10D00DFBA71 /* CookieStorage.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 35C74FDB228A1EF6000C21A0 /* CSSGridIntegerRepeatValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 35C74FD7228A19A6000C21A0 /* CSSGridIntegerRepeatValue.h */; settings = {ATTRIBUTES = (Private, ); }; };
3717D7E817ECC591003C276D /* extract-localizable-strings.pl in Copy Scripts */ = {isa = PBXBuildFile; fileRef = 3717D7E517ECC3A6003C276D /* extract-localizable-strings.pl */; };
371E65CC13661EDC00BEEDB0 /* PageSerializer.h in Headers */ = {isa = PBXBuildFile; fileRef = 371E65CB13661EDC00BEEDB0 /* PageSerializer.h */; };
371F4FFC0D25E7F300ECE0D5 /* FontRanges.h in Headers */ = {isa = PBXBuildFile; fileRef = 371F4FFA0D25E7F300ECE0D5 /* FontRanges.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -7100,6 +7101,8 @@
33503C9F10179AD7003B47E1 /* JSNotification.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSNotification.cpp; sourceTree = "<group>"; };
33503CA010179AD7003B47E1 /* JSNotification.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSNotification.h; sourceTree = "<group>"; };
33503CC61017A1B1003B47E1 /* Notification.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Notification.cpp; sourceTree = "<group>"; };
+ 35C74FD3228A1912000C21A0 /* CSSGridIntegerRepeatValue.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CSSGridIntegerRepeatValue.cpp; sourceTree = "<group>"; };
+ 35C74FD7228A19A6000C21A0 /* CSSGridIntegerRepeatValue.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CSSGridIntegerRepeatValue.h; sourceTree = "<group>"; };
3662F984047CEDBE5DDDAFAA /* RenderMathMLMenclose.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderMathMLMenclose.cpp; sourceTree = "<group>"; };
37119A7920CCB610002C6DC9 /* WebKitTargetConditionals.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = WebKitTargetConditionals.xcconfig; sourceTree = "<group>"; };
3717D7E517ECC3A6003C276D /* extract-localizable-strings.pl */ = {isa = PBXFileReference; lastKnownFileType = text.script.perl; name = "extract-localizable-strings.pl"; path = "Scripts/extract-localizable-strings.pl"; sourceTree = "<group>"; };
@@ -26591,6 +26594,8 @@
BC53C6910DA591140021EB5D /* CSSGradientValue.h */,
E110032E1C9AC3DE00412DD0 /* CSSGridAutoRepeatValue.cpp */,
E110032F1C9AC3DE00412DD0 /* CSSGridAutoRepeatValue.h */,
+ 35C74FD3228A1912000C21A0 /* CSSGridIntegerRepeatValue.cpp */,
+ 35C74FD7228A19A6000C21A0 /* CSSGridIntegerRepeatValue.h */,
CD7DBB2618CA11FF00C11066 /* CSSGridLineNamesValue.cpp */,
CD7DBB2718CA11FF00C11066 /* CSSGridLineNamesValue.h */,
CD3E252118046BCD00E27F56 /* CSSGridTemplateAreasValue.cpp */,
@@ -28656,6 +28661,7 @@
BC02A63C0E09A9CF004B6D2B /* CSSFunctionValue.h in Headers */,
BC53C6920DA591140021EB5D /* CSSGradientValue.h in Headers */,
E11003311C9AC3DE00412DD0 /* CSSGridAutoRepeatValue.h in Headers */,
+ 35C74FDB228A1EF6000C21A0 /* CSSGridIntegerRepeatValue.h in Headers */,
CD7DBB2918CA19C600C11066 /* CSSGridLineNamesValue.h in Headers */,
CD3E252418046BCD00E27F56 /* CSSGridTemplateAreasValue.h in Headers */,
FB3056C2169E5DAC0096A232 /* CSSGroupingRule.h in Headers */,
Added: trunk/Source/WebCore/css/CSSGridIntegerRepeatValue.cpp (0 => 245798)
--- trunk/Source/WebCore/css/CSSGridIntegerRepeatValue.cpp (rev 0)
+++ trunk/Source/WebCore/css/CSSGridIntegerRepeatValue.cpp 2019-05-27 21:27:15 UTC (rev 245798)
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2019 Igalia S.L.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "CSSGridIntegerRepeatValue.h"
+
+#include <wtf/text/StringBuilder.h>
+
+namespace WebCore {
+
+String CSSGridIntegerRepeatValue::customCSSText() const
+{
+ StringBuilder result;
+ result.append("repeat(");
+ result.append(String::number(repetitions()));
+ result.append(", ");
+ result.append(CSSValueList::customCSSText());
+ result.append(')');
+ return result.toString();
+}
+
+bool CSSGridIntegerRepeatValue::equals(const CSSGridIntegerRepeatValue& other) const
+{
+ return m_repetitions == other.m_repetitions && CSSValueList::equals(other);
+}
+
+} // namespace WebCore
Added: trunk/Source/WebCore/css/CSSGridIntegerRepeatValue.h (0 => 245798)
--- trunk/Source/WebCore/css/CSSGridIntegerRepeatValue.h (rev 0)
+++ trunk/Source/WebCore/css/CSSGridIntegerRepeatValue.h 2019-05-27 21:27:15 UTC (rev 245798)
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2019 Igalia S.L.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "CSSValueKeywords.h"
+#include "CSSValueList.h"
+
+namespace WebCore {
+
+// CSSGridIntegerRepeatValue stores the track sizes and line numbers when the
+// integer-repeat syntax is used.
+//
+// Right now the integer-repeat syntax is as follows:
+// <track-repeat> = repeat( [ <positive-integer> ],
+// [ <line-names>? <track-size> ]+ <line-names>? )
+// <fixed-repeat> = repeat( [ <positive-integer> ],
+// [ <line-names>? <fixed-size> ]+ <line-names>? )
+class CSSGridIntegerRepeatValue final : public CSSValueList {
+public:
+ static Ref<CSSGridIntegerRepeatValue> create(size_t repetitions)
+ {
+ return adoptRef(*new CSSGridIntegerRepeatValue(repetitions));
+ }
+
+ String customCSSText() const;
+ bool equals(const CSSGridIntegerRepeatValue&) const;
+
+ size_t repetitions() const { return m_repetitions; }
+
+private:
+ CSSGridIntegerRepeatValue(size_t repetitions)
+ : CSSValueList(GridIntegerRepeatClass, SpaceSeparator)
+ , m_repetitions(repetitions)
+ {
+ ASSERT(repetitions > 0);
+ }
+
+ const size_t m_repetitions;
+};
+
+} // namespace WebCore
+
+SPECIALIZE_TYPE_TRAITS_CSS_VALUE(CSSGridIntegerRepeatValue, isGridIntegerRepeatValue());
Modified: trunk/Source/WebCore/css/CSSValue.cpp (245797 => 245798)
--- trunk/Source/WebCore/css/CSSValue.cpp 2019-05-27 21:21:40 UTC (rev 245797)
+++ trunk/Source/WebCore/css/CSSValue.cpp 2019-05-27 21:27:15 UTC (rev 245798)
@@ -65,6 +65,7 @@
#include "CSSVariableReferenceValue.h"
#include "CSSGridAutoRepeatValue.h"
+#include "CSSGridIntegerRepeatValue.h"
#include "CSSGridLineNamesValue.h"
#include "CSSGridTemplateAreasValue.h"
@@ -188,6 +189,8 @@
return compareCSSValues<CSSRevertValue>(*this, other);
case GridAutoRepeatClass:
return compareCSSValues<CSSGridAutoRepeatValue>(*this, other);
+ case GridIntegerRepeatClass:
+ return compareCSSValues<CSSGridIntegerRepeatValue>(*this, other);
case GridLineNamesClass:
return compareCSSValues<CSSGridLineNamesValue>(*this, other);
case GridTemplateAreasClass:
@@ -288,6 +291,8 @@
return downcast<CSSRevertValue>(*this).customCSSText();
case GridAutoRepeatClass:
return downcast<CSSGridAutoRepeatValue>(*this).customCSSText();
+ case GridIntegerRepeatClass:
+ return downcast<CSSGridIntegerRepeatValue>(*this).customCSSText();
case GridLineNamesClass:
return downcast<CSSGridLineNamesValue>(*this).customCSSText();
case GridTemplateAreasClass:
@@ -399,6 +404,9 @@
case GridAutoRepeatClass:
delete downcast<CSSGridAutoRepeatValue>(this);
return;
+ case GridIntegerRepeatClass:
+ delete downcast<CSSGridIntegerRepeatValue>(this);
+ return;
case GridLineNamesClass:
delete downcast<CSSGridLineNamesValue>(this);
return;
Modified: trunk/Source/WebCore/css/CSSValue.h (245797 => 245798)
--- trunk/Source/WebCore/css/CSSValue.h 2019-05-27 21:21:40 UTC (rev 245797)
+++ trunk/Source/WebCore/css/CSSValue.h 2019-05-27 21:27:15 UTC (rev 245798)
@@ -111,6 +111,7 @@
#endif
bool isContentDistributionValue() const { return m_classType == CSSContentDistributionClass; }
bool isGridAutoRepeatValue() const { return m_classType == GridAutoRepeatClass; }
+ bool isGridIntegerRepeatValue() const { return m_classType == GridIntegerRepeatClass; }
bool isGridTemplateAreasValue() const { return m_classType == GridTemplateAreasClass; }
bool isGridLineNamesValue() const { return m_classType == GridLineNamesClass; }
bool isUnicodeRangeValue() const { return m_classType == UnicodeRangeClass; }
@@ -200,6 +201,7 @@
ImageSetClass,
GridLineNamesClass,
GridAutoRepeatClass,
+ GridIntegerRepeatClass,
// Do not append non-list class types here.
};
Modified: trunk/Source/WebCore/css/StyleBuilderConverter.h (245797 => 245798)
--- trunk/Source/WebCore/css/StyleBuilderConverter.h 2019-05-27 21:21:40 UTC (rev 245797)
+++ trunk/Source/WebCore/css/StyleBuilderConverter.h 2019-05-27 21:27:15 UTC (rev 245798)
@@ -34,6 +34,7 @@
#include "CSSFontVariationValue.h"
#include "CSSFunctionValue.h"
#include "CSSGridAutoRepeatValue.h"
+#include "CSSGridIntegerRepeatValue.h"
#include "CSSGridLineNamesValue.h"
#include "CSSImageGeneratorValue.h"
#include "CSSImageSetValue.h"
@@ -989,12 +990,16 @@
return false;
unsigned currentNamedGridLine = 0;
- for (auto& currentValue : downcast<CSSValueList>(value)) {
- if (is<CSSGridLineNamesValue>(currentValue)) {
- createGridLineNamesList(currentValue.get(), currentNamedGridLine, tracksData.m_namedGridLines, tracksData.m_orderedNamedGridLines);
- continue;
+ auto handleLineNameOrTrackSize = [&](const CSSValue& currentValue) {
+ if (is<CSSGridLineNamesValue>(currentValue))
+ createGridLineNamesList(currentValue, currentNamedGridLine, tracksData.m_namedGridLines, tracksData.m_orderedNamedGridLines);
+ else {
+ ++currentNamedGridLine;
+ tracksData.m_trackSizes.append(createGridTrackSize(currentValue, styleResolver));
}
+ };
+ for (auto& currentValue : downcast<CSSValueList>(value)) {
if (is<CSSGridAutoRepeatValue>(currentValue)) {
ASSERT(tracksData.m_autoRepeatTrackSizes.isEmpty());
unsigned autoRepeatIndex = 0;
@@ -1013,8 +1018,16 @@
continue;
}
- ++currentNamedGridLine;
- tracksData.m_trackSizes.append(createGridTrackSize(currentValue, styleResolver));
+ if (is<CSSGridIntegerRepeatValue>(currentValue)) {
+ size_t repetitions = downcast<CSSGridIntegerRepeatValue>(currentValue.get()).repetitions();
+ for (size_t i = 0; i < repetitions; ++i) {
+ for (auto& integerRepeatValue : downcast<CSSValueList>(currentValue.get()))
+ handleLineNameOrTrackSize(integerRepeatValue);
+ }
+ continue;
+ }
+
+ handleLineNameOrTrackSize(currentValue);
}
// The parser should have rejected any <track-list> without any <track-size> as
@@ -1099,6 +1112,7 @@
for (auto& currValue : valueList) {
ASSERT(!currValue->isGridLineNamesValue());
ASSERT(!currValue->isGridAutoRepeatValue());
+ ASSERT(!currValue->isGridIntegerRepeatValue());
trackSizes.uncheckedAppend(convertGridTrackSize(styleResolver, currValue));
}
return trackSizes;
Modified: trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp (245797 => 245798)
--- trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp 2019-05-27 21:21:40 UTC (rev 245797)
+++ trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp 2019-05-27 21:27:15 UTC (rev 245798)
@@ -47,6 +47,7 @@
#include "CSSFontStyleValue.h"
#include "CSSFunctionValue.h"
#include "CSSGridAutoRepeatValue.h"
+#include "CSSGridIntegerRepeatValue.h"
#include "CSSGridLineNamesValue.h"
#include "CSSGridTemplateAreasValue.h"
#include "CSSLineBoxContainValue.h"
@@ -3404,10 +3405,10 @@
else {
// We clamp the repetitions to a multiple of the repeat() track list's size, while staying below the max grid size.
repetitions = std::min(repetitions, GridPosition::max() / numberOfTracks);
- for (size_t i = 0; i < repetitions; ++i) {
- for (size_t j = 0; j < repeatedValues->length(); ++j)
- list.append(*repeatedValues->itemWithoutBoundsCheck(j));
- }
+ RefPtr<CSSValueList> integerRepeatedValues = CSSGridIntegerRepeatValue::create(repetitions);
+ for (size_t i = 0; i < repeatedValues->length(); ++i)
+ integerRepeatedValues->append(*repeatedValues->itemWithoutBoundsCheck(i));
+ list.append(integerRepeatedValues.releaseNonNull());
}
return true;
}
Modified: trunk/Tools/ChangeLog (245797 => 245798)
--- trunk/Tools/ChangeLog 2019-05-27 21:21:40 UTC (rev 245797)
+++ trunk/Tools/ChangeLog 2019-05-27 21:27:15 UTC (rev 245798)
@@ -1,3 +1,15 @@
+2019-05-27 Oriol Brufau <[email protected]>
+
+ [css-grid] Preserve repeat() notation when serializing declared values
+ https://bugs.webkit.org/show_bug.cgi?id=197840
+
+ Reviewed by Manuel Rego Casasnovas.
+
+ Adapt CSSPropertyParserTest to CSSGridIntegerRepeatValue.
+
+ * TestWebKitAPI/Tests/WebCore/CSSParser.cpp:
+ (TestWebKitAPI::computeNumberOfTracks):
+
2019-05-26 Wenson Hsieh <[email protected]>
[iOS] Dropped text, attachments, and images should animate into place
Modified: trunk/Tools/TestWebKitAPI/Tests/WebCore/CSSParser.cpp (245797 => 245798)
--- trunk/Tools/TestWebKitAPI/Tests/WebCore/CSSParser.cpp 2019-05-27 21:21:40 UTC (rev 245797)
+++ trunk/Tools/TestWebKitAPI/Tests/WebCore/CSSParser.cpp 2019-05-27 21:27:15 UTC (rev 245798)
@@ -25,6 +25,7 @@
#include "config.h"
+#include <WebCore/CSSGridIntegerRepeatValue.h>
#include <WebCore/CSSParser.h>
#include <WebCore/CSSValueList.h>
#include <WebCore/StyleProperties.h>
@@ -39,6 +40,11 @@
for (const auto& value : valueList) {
if (value->isGridLineNamesValue())
continue;
+ if (is<CSSGridIntegerRepeatValue>(value)) {
+ auto& repeatValue = downcast<CSSGridIntegerRepeatValue>(value.get());
+ numberOfTracks += repeatValue.repetitions() * computeNumberOfTracks(repeatValue);
+ continue;
+ }
++numberOfTracks;
}
return numberOfTracks;