No subject


Mon Jan 28 08:41:14 PST 2013


9798">r149798</a> by &lt;jchaffraix at chromium.org&gt;

Source/WebCore:

This change adds parsing, style resolution and getComputedStyle
support for named grid lines at the grid element level
(i.e. extends our &lt;track-list&gt; support). Per the specification, we
allow multiple grid lines with the same name.

To fully support resolving the grid lines to a position on our
grid, we need to add the parsing at the grid item's level (which
means extending our &lt;grid-line&gt; support). This will be done in a
follow-up change.

Test: fast/css-grid-layout/named-grid-line-get-set.html

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::addValuesForNamedGridLinesAtIndex):
(WebCore::valueForGridTrackList):
(WebCore::ComputedStyleExtractor::propertyValue):
* css/CSSParser.cpp:
(WebCore::CSSParser::parseGridTrackList):
* css/StyleResolver.cpp:
(WebCore::createGridTrackList):
(WebCore::StyleResolver::applyProperty):
* rendering/style/RenderStyle.h:
* rendering/style/StyleGridData.cpp:
(WebCore::StyleGridData::StyleGridData):
* rendering/style/StyleGridData.h:
(WebCore::StyleGridData::operator=3D=3D):

LayoutTests:

* fast/css-grid-layout/named-grid-line-get-set-expected.txt: Added.
* fast/css-grid-layout/named-grid-line-get-set.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href=3D"#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a=
></li>
<li><a href=3D"#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeL=
og</a></li>
<li><a href=3D"#trunkSourceWebCorecssCSSComputedStyleDeclarationcpp">trun=
k/Source/WebCore/css/CSSComputedStyleDeclaration.cpp</a></li>
<li><a href=3D"#trunkSourceWebCorecssCSSParsercpp">trunk/Source/WebCore/c=
ss/CSSParser.cpp</a></li>
<li><a href=3D"#trunkSourceWebCorecssStyleResolvercpp">trunk/Source/WebCo=
re/css/StyleResolver.cpp</a></li>
<li><a href=3D"#trunkSourceWebCorerenderingstyleRenderStyleh">trunk/Sourc=
e/WebCore/rendering/style/RenderStyle.h</a></li>
<li><a href=3D"#trunkSourceWebCorerenderingstyleStyleGridDatacpp">trunk/S=
ource/WebCore/rendering/style/StyleGridData.cpp</a></li>
<li><a href=3D"#trunkSourceWebCorerenderingstyleStyleGridDatah">trunk/Sou=
rce/WebCore/rendering/style/StyleGridData.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href=3D"#trunkLayoutTestsfastcssgridlayoutnamedgridlinegetsetexpec=
tedtxt">trunk/LayoutTests/fast/css-grid-layout/named-grid-line-get-set-ex=
pected.txt</a></li>
<li><a href=3D"#trunkLayoutTestsfastcssgridlayoutnamedgridlinegetsethtml"=
>trunk/LayoutTests/fast/css-grid-layout/named-grid-line-get-set.html</a><=
/li>
</ul>

</div>
<div id=3D"patch">
<h3>Diff</h3>
<a id=3D"trunkLayoutTestsChangeLog"></a>
<div class=3D"modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (153751 =
=3D> 153752)</h4>
<pre class=3D"diff"><span>
<span class=3D"info">--- trunk/LayoutTests/ChangeLog	2013-08-06 13:58:39 =
UTC (rev 153751)
+++ trunk/LayoutTests/ChangeLog	2013-08-06 15:08:21 UTC (rev 153752)
</span><span class=3D"lines">@@ -1,3 +1,15 @@
</span><ins>+2013-08-06  Sergio Villar Senin  &lt;svillar at igalia.com&gt;
+
+        [CSS Grid Layout] Allow defining named grid lines on the grid el=
ement
+        https://bugs.webkit.org/show_bug.cgi?id=3D118255
+
+        Reviewed by Andreas Kling.
+
+        From Blink r149798 by &lt;jchaffraix at chromium.org&gt;
+
+        * fast/css-grid-layout/named-grid-line-get-set-expected.txt: Add=
ed.
+        * fast/css-grid-layout/named-grid-line-get-set.html: Added.
+
</ins><span class=3D"cx"> 2013-06-26  Sergio Villar Senin  &lt;svillar at ig=
alia.com&gt;
</span><span class=3D"cx">=20
</span><span class=3D"cx">         [CSS Grid Layout] Add support for pars=
ing &lt;grid-line&gt; that includes a 'span'
</span></span></pre></div>
<a id=3D"trunkLayoutTestsfastcssgridlayoutnamedgridlinegetsetexpectedtxt"=
></a>
<div class=3D"addfile"><h4>Added: trunk/LayoutTests/fast/css-grid-layout/=
named-grid-line-get-set-expected.txt (0 =3D> 153752)</h4>
<pre class=3D"diff"><span>
<span class=3D"info">--- trunk/LayoutTests/fast/css-grid-layout/named-gri=
d-line-get-set-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/css-grid-layout/named-grid-line-get-set-expect=
ed.txt	2013-08-06 15:08:21 UTC (rev 153752)
</span><span class=3D"lines">@@ -0,0 +1,52 @@
</span><ins>+Test that setting and getting grid-definition-columns and gr=
id-definition-rows works as expected
+
+On success, you will see a series of &quot;PASS&quot; messages, followed=
 by &quot;TEST COMPLETE&quot;.
+
+
+Test getting -webkit-grid-definition-columns and -webkit-grid-definition=
-rows set through CSS
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-columns') is &quot;first 10px&quot;
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-rows') is &quot;first 15px&quot;
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-columns') is &quot;53% last&quot;
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-rows') is &quot;27% last&quot;
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-columns') is &quot;first auto&quot;
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-rows') is &quot;auto last&quot;
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-columns') is &quot;first minmax(10%, 15px)&quot;
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-rows') is &quot;minmax(20px, 50%) last&quot;
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-columns') is &quot;nav first 10px last&quot;
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-rows') is &quot;nav first 15px last&quot;
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-columns') is &quot;nav first 10% nav 15% last&quot;
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-rows') is &quot;first nav2 25% nav2 75% last&quot;
+
+Test getting and setting -webkit-grid-definition-columns and -webkit-gri=
d-definition-rows through JS
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-columns') is &quot;first 18px&quot;
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-rows') is &quot;66px last&quot;
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-columns') is &quot;first 55%&quot;
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-rows') is &quot;40% last&quot;
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-columns') is &quot;first auto&quot;
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-rows') is &quot;auto last&quot;
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-columns') is &quot;first -webkit-min-content&quot;
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-rows') is &quot;-webkit-min-content last&quot;
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-columns') is &quot;first -webkit-max-content&quot;
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-rows') is &quot;-webkit-max-content last&quot;
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-columns') is &quot;first minmax(55%, 45px)&quot;
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-rows') is &quot;minmax(30px, 40%) last&quot;
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-columns') is &quot;first minmax(220px, -webkit-max-content)&quot=
;
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-rows') is &quot;minmax(-webkit-max-content, 50px) last&quot;
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-columns') is &quot;first minmax(220px, -webkit-max-content)&quot=
;
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-rows') is &quot;minmax(-webkit-max-content, 50px) last&quot;
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-columns') is &quot;first minmax(-webkit-min-content, -webkit-max=
-content)&quot;
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-rows') is &quot;minmax(-webkit-max-content, -webkit-min-content)=
 last&quot;
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-columns') is &quot;nav first minmax(-webkit-min-content, -webkit=
-max-content) last&quot;
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-rows') is &quot;nav first minmax(-webkit-max-content, -webkit-mi=
n-content) last&quot;
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-columns') is &quot;nav first minmax(-webkit-min-content, -webkit=
-max-content) nav auto last&quot;
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-rows') is &quot;first nav2 minmax(-webkit-max-content, -webkit-m=
in-content) nav2 minmax(10px, 15px) last&quot;
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-columns') is &quot;foo bar auto foo auto bar&quot;
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-rows') is &quot;foo bar auto foo auto bar&quot;
+
+Test getting and setting invalid -webkit-grid-definition-columns and -we=
bkit-grid-definition-rows through JS
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-columns') is &quot;none&quot;
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-rows') is &quot;none&quot;
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id=3D"trunkLayoutTestsfastcssgridlayoutnamedgridlinegetsethtml"></a>
<div class=3D"addfile"><h4>Added: trunk/LayoutTests/fast/css-grid-layout/=
named-grid-line-get-set.html (0 =3D> 153752)</h4>
<pre class=3D"diff"><span>
<span class=3D"info">--- trunk/LayoutTests/fast/css-grid-layout/named-gri=
d-line-get-set.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css-grid-layout/named-grid-line-get-set.html	2=
013-08-06 15:08:21 UTC (rev 153752)
</span><span class=3D"lines">@@ -0,0 +1,153 @@
</span><ins>+&lt;!DOCTYPE HTML&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script&gt;
+if (window.testRunner)
+    testRunner.overridePreference(&quot;WebKitCSSGridLayoutEnabled&quot;=
, 1);
+&lt;/script&gt;
+&lt;link href=3D&quot;resources/grid.css&quot; rel=3D&quot;stylesheet&qu=
ot;&gt;
+&lt;style&gt;
+.gridWithFixed {
+    -webkit-grid-definition-columns: &quot;first&quot; 10px;
+    -webkit-grid-definition-rows: &quot;first&quot; 15px;
+}
+.gridWithPercent {
+    -webkit-grid-definition-columns: 53% &quot;last&quot;;
+    -webkit-grid-definition-rows: 27% &quot;last&quot;;
+}
+.gridWithAuto {
+    -webkit-grid-definition-columns: &quot;first&quot; auto;
+    -webkit-grid-definition-rows: auto &quot;last&quot;;
+}
+.gridWithMinMax {
+    -webkit-grid-definition-columns: &quot;first&quot; minmax(10%, 15px)=
;
+    -webkit-grid-definition-rows: minmax(20px, 50%) &quot;last&quot;;
+}
+.gridWithFixedMultiple {
+    -webkit-grid-definition-columns: &quot;first&quot; &quot;nav&quot; 1=
0px &quot;last&quot;;
+    -webkit-grid-definition-rows: &quot;first&quot; &quot;nav&quot; 15px=
 &quot;last&quot;;
+}
+.gridWithPercentageSameStringMultipleTimes {
+    -webkit-grid-definition-columns: &quot;first&quot; &quot;nav&quot; 1=
0% &quot;nav&quot; 15% &quot;last&quot;;
+    -webkit-grid-definition-rows: &quot;first&quot; &quot;nav2&quot; 25%=
 &quot;nav2&quot; 75% &quot;last&quot;;
+}
+&lt;/style&gt;
+&lt;script src=3D&quot;../js/resources/js-test-pre.js&quot;&gt;&lt;/scri=
pt&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;div class=3D&quot;grid gridWithFixed&quot; id=3D&quot;gridWithFixedE=
lement&quot;&gt;&lt;/div&gt;
+&lt;div class=3D&quot;grid gridWithPercent&quot; id=3D&quot;gridWithPerc=
entElement&quot;&gt;&lt;/div&gt;
+&lt;div class=3D&quot;grid gridWithAuto&quot; id=3D&quot;gridWithAutoEle=
ment&quot;&gt;&lt;/div&gt;
+&lt;div class=3D&quot;grid gridWithMinMax&quot; id=3D&quot;gridWithMinMa=
x&quot;&gt;&lt;/div&gt;
+&lt;div class=3D&quot;grid gridWithFixedMultiple&quot; id=3D&quot;gridWi=
thFixedMultiple&quot;&gt;&lt;/div&gt;
+&lt;div class=3D&quot;grid gridWithPercentageSameStringMultipleTimes&quo=
t; id=3D&quot;gridWithPercentageSameStringMultipleTimes&quot;&gt;&lt;/div=
&gt;
+&lt;script&gt;
+    description('Test that setting and getting grid-definition-columns a=
nd grid-definition-rows works as expected');
+
+    function testValue(gridElement, namedGridColumns, namedGridRows)
+    {
+        this.gridElement =3D gridElement;
+        shouldBeEqualToString(&quot;getComputedStyle(gridElement, '').ge=
tPropertyValue('-webkit-grid-definition-columns')&quot;, namedGridColumns=
);
+        shouldBeEqualToString(&quot;getComputedStyle(gridElement, '').ge=
tPropertyValue('-webkit-grid-definition-rows')&quot;, namedGridRows);
+    }
+
+    function testCSSValue(gridElementId, namedGridColumns, namedGridRows=
)
+    {
+        testValue(document.getElementById(gridElementId), namedGridColum=
ns, namedGridRows);
+    }
+
+    debug(&quot;Test getting -webkit-grid-definition-columns and -webkit=
-grid-definition-rows set through CSS&quot;);
+    testCSSValue(&quot;gridWithFixedElement&quot;, &quot;first 10px&quot=
;, &quot;first 15px&quot;);
+    testCSSValue(&quot;gridWithPercentElement&quot;, &quot;53% last&quot=
;, &quot;27% last&quot;);
+    testCSSValue(&quot;gridWithAutoElement&quot;, &quot;first auto&quot;=
, &quot;auto last&quot;);
+    testCSSValue(&quot;gridWithMinMax&quot;, &quot;first minmax(10%, 15p=
x)&quot;, &quot;minmax(20px, 50%) last&quot;);
+    testCSSValue(&quot;gridWithFixedMultiple&quot;, &quot;nav first 10px=
 last&quot;, &quot;nav first 15px last&quot;);
+    testCSSValue(&quot;gridWithPercentageSameStringMultipleTimes&quot;, =
&quot;nav first 10% nav 15% last&quot;, &quot;first nav2 25% nav2 75% las=
t&quot;);
+
+    debug(&quot;&quot;);
+    debug(&quot;Test getting and setting -webkit-grid-definition-columns=
 and -webkit-grid-definition-rows through JS&quot;);
+    var element =3D document.createElement(&quot;div&quot;);
+    document.body.appendChild(element);
+    element.style.webkitGridDefinitionColumns =3D &quot;'first' 18px&quo=
t;;
+    element.style.webkitGridDefinitionRows =3D &quot;66px 'last'&quot;;
+    testValue(element, &quot;first 18px&quot;, &quot;66px last&quot;);
+
+    element =3D document.createElement(&quot;div&quot;);
+    document.body.appendChild(element);
+    element.style.webkitGridDefinitionColumns =3D &quot;'first' 55%&quot=
;;
+    element.style.webkitGridDefinitionRows =3D &quot;40% 'last'&quot;;
+    testValue(element, &quot;first 55%&quot;, &quot;40% last&quot;);
+
+    element =3D document.createElement(&quot;div&quot;);
+    document.body.appendChild(element);
+    element.style.webkitGridDefinitionColumns =3D &quot;'first' auto&quo=
t;;
+    element.style.webkitGridDefinitionRows =3D &quot;auto 'last'&quot;;
+    testValue(element, &quot;first auto&quot;, &quot;auto last&quot;);
+
+    element =3D document.createElement(&quot;div&quot;);
+    document.body.appendChild(element);
+    element.style.webkitGridDefinitionColumns =3D &quot;'first' -webkit-=
min-content&quot;;
+    element.style.webkitGridDefinitionRows =3D &quot;-webkit-min-content=
 'last'&quot;;
+    testValue(element, &quot;first -webkit-min-content&quot;, &quot;-web=
kit-min-content last&quot;);
+
+    element =3D document.createElement(&quot;div&quot;);
+    document.body.appendChild(element);
+    element.style.webkitGridDefinitionColumns =3D &quot;'first' -webkit-=
max-content&quot;;
+    element.style.webkitGridDefinitionRows =3D &quot;-webkit-max-content=
 'last'&quot;;
+    testValue(element, &quot;first -webkit-max-content&quot;, &quot;-web=
kit-max-content last&quot;);
+
+    element =3D document.createElement(&quot;div&quot;);
+    document.body.appendChild(element);
+    element.style.webkitGridDefinitionColumns =3D &quot;'first' minmax(5=
5%, 45px)&quot;;
+    element.style.webkitGridDefinitionRows =3D &quot;minmax(30px, 40%) '=
last'&quot;;
+    testValue(element, &quot;first minmax(55%, 45px)&quot;, &quot;minmax=
(30px, 40%) last&quot;);
+
+    element =3D document.createElement(&quot;div&quot;);
+    document.body.appendChild(element);
+    element.style.font =3D &quot;10px Ahem&quot;;
+    element.style.webkitGridDefinitionColumns =3D &quot;'first' minmax(2=
2em, -webkit-max-content)&quot;;
+    element.style.webkitGridDefinitionRows =3D &quot;minmax(-webkit-max-=
content, 5em) 'last'&quot;;
+    testValue(element, &quot;first minmax(220px, -webkit-max-content)&qu=
ot;, &quot;minmax(-webkit-max-content, 50px) last&quot;);
+
+    element =3D document.createElement(&quot;div&quot;);
+    document.body.appendChild(element);
+    element.style.font =3D &quot;10px Ahem&quot;;
+    element.style.webkitGridDefinitionColumns =3D &quot;'first' minmax(2=
2em, -webkit-max-content)&quot;;
+    element.style.webkitGridDefinitionRows =3D &quot;minmax(-webkit-max-=
content, 5em) 'last'&quot;;
+    testValue(element, &quot;first minmax(220px, -webkit-max-content)&qu=
ot;, &quot;minmax(-webkit-max-content, 50px) last&quot;);
+
+    element =3D document.createElement(&quot;div&quot;);
+    document.body.appendChild(element);
+    element.style.webkitGridDefinitionColumns =3D &quot;'first' minmax(-=
webkit-min-content, -webkit-max-content)&quot;;
+    element.style.webkitGridDefinitionRows =3D &quot;minmax(-webkit-max-=
content, -webkit-min-content) 'last'&quot;;
+    testValue(element, &quot;first minmax(-webkit-min-content, -webkit-m=
ax-content)&quot;, &quot;minmax(-webkit-max-content, -webkit-min-content)=
 last&quot;);
+
+    element =3D document.createElement(&quot;div&quot;);
+    document.body.appendChild(element);
+    element.style.webkitGridDefinitionColumns =3D &quot;'first' 'nav' mi=
nmax(-webkit-min-content, -webkit-max-content) 'last'&quot;;
+    element.style.webkitGridDefinitionRows =3D &quot;'first' 'nav' minma=
x(-webkit-max-content, -webkit-min-content) 'last'&quot;;
+    testValue(element, &quot;nav first minmax(-webkit-min-content, -webk=
it-max-content) last&quot;, &quot;nav first minmax(-webkit-max-content, -=
webkit-min-content) last&quot;);
+
+    element =3D document.createElement(&quot;div&quot;);
+    document.body.appendChild(element);
+    element.style.webkitGridDefinitionColumns =3D &quot;'first' 'nav' mi=
nmax(-webkit-min-content, -webkit-max-content) 'nav' auto 'last'&quot;;
+    element.style.webkitGridDefinitionRows =3D &quot;'first' 'nav2' minm=
ax(-webkit-max-content, -webkit-min-content) 'nav2' minmax(10px, 15px) 'l=
ast'&quot;;
+    testValue(element, &quot;nav first minmax(-webkit-min-content, -webk=
it-max-content) nav auto last&quot;, &quot;first nav2 minmax(-webkit-max-=
content, -webkit-min-content) nav2 minmax(10px, 15px) last&quot;);
+
+    element =3D document.createElement(&quot;div&quot;);
+    document.body.appendChild(element);
+    element.style.webkitGridDefinitionColumns =3D &quot;'foo' 'bar' auto=
 'foo' auto 'bar'&quot;;
+    element.style.webkitGridDefinitionRows =3D &quot;'foo' 'bar' auto 'f=
oo' auto 'bar'&quot;;
+    testValue(element, &quot;foo bar auto foo auto bar&quot;, &quot;foo =
bar auto foo auto bar&quot;);
+
+    debug(&quot;&quot;);
+    debug(&quot;Test getting and setting invalid -webkit-grid-definition=
-columns and -webkit-grid-definition-rows through JS&quot;);
+    element =3D document.createElement(&quot;div&quot;);
+    document.body.appendChild(element);
+    element.style.webkitGridDefinitionColumns =3D &quot;'foo'&quot;;
+    element.style.webkitGridDefinitionRows =3D &quot;'bar&quot;;
+    testValue(element, &quot;none&quot;, &quot;none&quot;);
+&lt;/script&gt;
+&lt;script src=3D&quot;../js/resources/js-test-post.js&quot;&gt;&lt;/scr=
ipt&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id=3D"trunkSourceWebCoreChangeLog"></a>
<div class=3D"modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (1537=
51 =3D> 153752)</h4>
<pre class=3D"diff"><span>
<span class=3D"info">--- trunk/Source/WebCore/ChangeLog	2013-08-06 13:58:=
39 UTC (rev 153751)
+++ trunk/Source/WebCore/ChangeLog	2013-08-06 15:08:21 UTC (rev 153752)
</span><span class=3D"lines">@@ -1,3 +1,39 @@
</span><ins>+2013-08-06  Sergio Villar Senin  &lt;svillar at igalia.com&gt;
+
+        [CSS Grid Layout] Allow defining named grid lines on the grid el=
ement
+        https://bugs.webkit.org/show_bug.cgi?id=3D118255
+
+        Reviewed by Andreas Kling.
+
+        From Blink r149798 by &lt;jchaffraix at chromium.org&gt;
+
+        This change adds parsing, style resolution and getComputedStyle
+        support for named grid lines at the grid element level
+        (i.e. extends our &lt;track-list&gt; support). Per the specifica=
tion, we
+        allow multiple grid lines with the same name.
+
+        To fully support resolving the grid lines to a position on our
+        grid, we need to add the parsing at the grid item's level (which
+        means extending our &lt;grid-line&gt; support). This will be don=
e in a
+        follow-up change.
+
+        Test: fast/css-grid-layout/named-grid-line-get-set.html
+
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::addValuesForNamedGridLinesAtIndex):
+        (WebCore::valueForGridTrackList):
+        (WebCore::ComputedStyleExtractor::propertyValue):
+        * css/CSSParser.cpp:
+        (WebCore::CSSParser::parseGridTrackList):
+        * css/StyleResolver.cpp:
+        (WebCore::createGridTrackList):
+        (WebCore::StyleResolver::applyProperty):
+        * rendering/style/RenderStyle.h:
+        * rendering/style/StyleGridData.cpp:
+        (WebCore::StyleGridData::StyleGridData):
+        * rendering/style/StyleGridData.h:
+        (WebCore::StyleGridData::operator=3D=3D):
+
</ins><span class=3D"cx"> 2013-08-06  Allan Sandfeld Jensen  &lt;allan.je=
nsen at digia.com&gt;
</span><span class=3D"cx">=20
</span><span class=3D"cx">         [Qt] Fix minimal build.
</span></span></pre></div>
<a id=3D"trunkSourceWebCorecssCSSComputedStyleDeclarationcpp"></a>
<div class=3D"modfile"><h4>Modified: trunk/Source/WebCore/css/CSSComputed=
StyleDeclaration.cpp (153751 =3D> 153752)</h4>
<pre class=3D"diff"><span>
<span class=3D"info">--- trunk/Source/WebCore/css/CSSComputedStyleDeclara=
tion.cpp	2013-08-06 13:58:39 UTC (rev 153751)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2013-08-06 1=
5:08:21 UTC (rev 153752)
</span><span class=3D"lines">@@ -1083,15 +1083,39 @@
</span><span class=3D"cx">     return 0;
</span><span class=3D"cx"> }
</span><span class=3D"cx">=20
</span><del>-static PassRefPtr&lt;CSSValue&gt; valueForGridTrackList(cons=
t Vector&lt;GridTrackSize&gt;&amp; trackSizes, const RenderStyle* style, =
RenderView *renderView)
</del><ins>+static void addValuesForNamedGridLinesAtIndex(const NamedGrid=
LinesMap&amp; namedGridLines, size_t i, CSSValueList&amp; list)
</ins><span class=3D"cx"> {
</span><ins>+    // Note that this won't return the results in the order =
specified in the style sheet,
+    // which is probably fine as we still *do* return all the expected v=
alues.
+    NamedGridLinesMap::const_iterator it =3D namedGridLines.begin();
+    NamedGridLinesMap::const_iterator end =3D namedGridLines.end();
+    for (; it !=3D end; ++it) {
+        const Vector&lt;size_t&gt;&amp; linesIndexes =3D it-&gt;value;
+        for (size_t j =3D 0; j &lt; linesIndexes.size(); ++j) {
+            if (linesIndexes[j] !=3D i)
+                continue;
+
+            list.append(cssValuePool().createValue(it-&gt;key, CSSPrimit=
iveValue::CSS_STRING));
+            break;
+        }
+    }
+}
+
+static PassRefPtr&lt;CSSValue&gt; valueForGridTrackList(const Vector&lt;=
GridTrackSize&gt;&amp; trackSizes, const NamedGridLinesMap&amp; namedGrid=
Lines, const RenderStyle* style, RenderView* renderView)
+{
</ins><span class=3D"cx">     // Handle the 'none' case here.
</span><del>-    if (!trackSizes.size())
</del><ins>+    if (!trackSizes.size()) {
+        ASSERT(namedGridLines.isEmpty());
</ins><span class=3D"cx">         return cssValuePool().createIdentifierV=
alue(CSSValueNone);
</span><ins>+    }
</ins><span class=3D"cx">=20
</span><span class=3D"cx">     RefPtr&lt;CSSValueList&gt; list =3D CSSVal=
ueList::createSpaceSeparated();
</span><del>-    for (size_t i =3D 0; i &lt; trackSizes.size(); ++i)
</del><ins>+    for (size_t i =3D 0; i &lt; trackSizes.size(); ++i) {
+        addValuesForNamedGridLinesAtIndex(namedGridLines, i, *list);
</ins><span class=3D"cx">         list-&gt;append(valueForGridTrackSize(t=
rackSizes[i], style, renderView));
</span><ins>+    }
+    // Those are the trailing &lt;string&gt;* allowed in the syntax.
+    addValuesForNamedGridLinesAtIndex(namedGridLines, trackSizes.size(),=
 *list);
</ins><span class=3D"cx">     return list.release();
</span><span class=3D"cx"> }
</span><span class=3D"cx">=20
</span><span class=3D"lines">@@ -2044,9 +2068,9 @@
</span><span class=3D"cx">         case CSSPropertyWebkitGridAutoRows:
</span><span class=3D"cx">             return valueForGridTrackSize(style=
-&gt;gridAutoRows(), style.get(), m_node-&gt;document()-&gt;renderView())=
;
</span><span class=3D"cx">         case CSSPropertyWebkitGridDefinitionCo=
lumns:
</span><del>-            return valueForGridTrackList(style-&gt;gridColum=
ns(), style.get(), m_node-&gt;document()-&gt;renderView());
</del><ins>+            return valueForGridTrackList(style-&gt;gridColumn=
s(), style-&gt;namedGridColumnLines(), style.get(), m_node-&gt;document()=
-&gt;renderView());
</ins><span class=3D"cx">         case CSSPropertyWebkitGridDefinitionRow=
s:
</span><del>-            return valueForGridTrackList(style-&gt;gridRows(=
), style.get(), m_node-&gt;document()-&gt;renderView());
</del><ins>+            return valueForGridTrackList(style-&gt;gridRows()=
, style-&gt;namedGridRowLines(), style.get(), m_node-&gt;document()-&gt;r=
enderView());
</ins><span class=3D"cx">=20
</span><span class=3D"cx">         case CSSPropertyWebkitGridColumnStart:
</span><span class=3D"cx">             return valueForGridPosition(style-=
&gt;gridItemColumnStart());
</span></span></pre></div>
<a id=3D"trunkSourceWebCorecssCSSParsercpp"></a>
<div class=3D"modfile"><h4>Modified: trunk/Source/WebCore/css/CSSParser.c=
pp (153751 =3D> 153752)</h4>
<pre class=3D"diff"><span>
<span class=3D"info">--- trunk/Source/WebCore/css/CSSParser.cpp	2013-08-0=
6 13:58:39 UTC (rev 153751)
+++ trunk/Source/WebCore/css/CSSParser.cpp	2013-08-06 15:08:21 UTC (rev 1=
53752)
</span><span class=3D"lines">@@ -4853,6 +4853,16 @@
</span><span class=3D"cx">=20
</span><span class=3D"cx">     RefPtr&lt;CSSValueList&gt; values =3D CSSV=
alueList::createSpaceSeparated();
</span><span class=3D"cx">     while (m_valueList-&gt;current()) {
</span><ins>+        while (m_valueList-&gt;current() &amp;&amp; m_valueL=
ist-&gt;current()-&gt;unit =3D=3D CSSPrimitiveValue::CSS_STRING) {
+            RefPtr&lt;CSSPrimitiveValue&gt; name =3D createPrimitiveStri=
ngValue(m_valueList-&gt;current());
+            values-&gt;append(name);
+            m_valueList-&gt;next();
+        }
+
+        // This allows trailing &lt;string&gt;* per the specification.
+        if (!m_valueList-&gt;current())
+            break;
+
</ins><span class=3D"cx">         RefPtr&lt;CSSPrimitiveValue&gt; primiti=
veValue =3D parseGridTrackSize();
</span><span class=3D"cx">         if (!primitiveValue)
</span><span class=3D"cx">             return false;
</span></span></pre></div>
<a id=3D"trunkSourceWebCorecssStyleResolvercpp"></a>
<div class=3D"modfile"><h4>Modified: trunk/Source/WebCore/css/StyleResolv=
er.cpp (153751 =3D> 153752)</h4>
<pre class=3D"diff"><span>
<span class=3D"info">--- trunk/Source/WebCore/css/StyleResolver.cpp	2013-=
08-06 13:58:39 UTC (rev 153751)
+++ trunk/Source/WebCore/css/StyleResolver.cpp	2013-08-06 15:08:21 UTC (r=
ev 153752)
</span><span class=3D"lines">@@ -2099,7 +2099,7 @@
</span><span class=3D"cx">     return true;
</span><span class=3D"cx"> }
</span><span class=3D"cx">=20
</span><del>-static bool createGridTrackList(CSSValue* value, Vector&lt;G=
ridTrackSize&gt;&amp; trackSizes, const StyleResolver::State&amp; state)
</del><ins>+static bool createGridTrackList(CSSValue* value, Vector&lt;Gr=
idTrackSize&gt;&amp; trackSizes, NamedGridLinesMap&amp; namedGridLines, c=
onst StyleResolver::State&amp; state)
</ins><span class=3D"cx"> {
</span><span class=3D"cx">     // Handle 'none'.
</span><span class=3D"cx">     if (value-&gt;isPrimitiveValue()) {
</span><span class=3D"lines">@@ -2110,14 +2110,29 @@
</span><span class=3D"cx">     if (!value-&gt;isValueList())
</span><span class=3D"cx">         return false;
</span><span class=3D"cx">=20
</span><ins>+    size_t currentNamedGridLine =3D 0;
</ins><span class=3D"cx">     for (CSSValueListIterator i =3D value; i.ha=
sMore(); i.advance()) {
</span><span class=3D"cx">         CSSValue* currValue =3D i.value();
</span><ins>+        if (currValue-&gt;isPrimitiveValue()) {
+            CSSPrimitiveValue* primitiveValue =3D static_cast&lt;CSSPrim=
itiveValue*&gt;(currValue);
+            if (primitiveValue-&gt;isString()) {
+                NamedGridLinesMap::AddResult result =3D namedGridLines.a=
dd(primitiveValue-&gt;getStringValue(), Vector&lt;size_t&gt;());
+                result.iterator-&gt;value.append(currentNamedGridLine);
+                continue;
+            }
+        }
+
+        ++currentNamedGridLine;
</ins><span class=3D"cx">         GridTrackSize trackSize;
</span><span class=3D"cx">         if (!createGridTrackSize(currValue, tr=
ackSize, state))
</span><span class=3D"cx">             return false;
</span><span class=3D"cx">=20
</span><span class=3D"cx">         trackSizes.append(trackSize);
</span><span class=3D"cx">     }
</span><ins>+
+    if (trackSizes.isEmpty())
+        return false;
+
</ins><span class=3D"cx">     return true;
</span><span class=3D"cx"> }
</span><span class=3D"cx">=20
</span><span class=3D"lines">@@ -2838,16 +2853,20 @@
</span><span class=3D"cx">     }
</span><span class=3D"cx">     case CSSPropertyWebkitGridDefinitionColumn=
s: {
</span><span class=3D"cx">         Vector&lt;GridTrackSize&gt; trackSizes=
;
</span><del>-        if (!createGridTrackList(value, trackSizes, state))
</del><ins>+        NamedGridLinesMap namedGridLines;
+        if (!createGridTrackList(value, trackSizes, namedGridLines, stat=
e))
</ins><span class=3D"cx">             return;
</span><span class=3D"cx">         state.style()-&gt;setGridColumns(track=
Sizes);
</span><ins>+        state.style()-&gt;setNamedGridColumnLines(namedGridL=
ines);
</ins><span class=3D"cx">         return;
</span><span class=3D"cx">     }
</span><span class=3D"cx">     case CSSPropertyWebkitGridDefinitionRows: =
{
</span><span class=3D"cx">         Vector&lt;GridTrackSize&gt; trackSizes=
;
</span><del>-        if (!createGridTrackList(value, trackSizes, state))
</del><ins>+        NamedGridLinesMap namedGridLines;
+        if (!createGridTrackList(value, trackSizes, namedGridLines, stat=
e))
</ins><span class=3D"cx">             return;
</span><span class=3D"cx">         state.style()-&gt;setGridRows(trackSiz=
es);
</span><ins>+        state.style()-&gt;setNamedGridRowLines(namedGridLine=
s);
</ins><span class=3D"cx">         return;
</span><span class=3D"cx">     }
</span><span class=3D"cx">=20
</span></span></pre></div>
<a id=3D"trunkSourceWebCorerenderingstyleRenderStyleh"></a>
<div class=3D"modfile"><h4>Modified: trunk/Source/WebCore/rendering/style=
/RenderStyle.h (153751 =3D> 153752)</h4>
<pre class=3D"diff"><span>
<span class=3D"info">--- trunk/Source/WebCore/rendering/style/RenderStyle=
.h	2013-08-06 13:58:39 UTC (rev 153751)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h	2013-08-06 15:08:2=
1 UTC (rev 153752)
</span><span class=3D"lines">@@ -776,6 +776,8 @@
</span><span class=3D"cx">=20
</span><span class=3D"cx">     const Vector&lt;GridTrackSize&gt;&amp; gri=
dColumns() const { return rareNonInheritedData-&gt;m_grid-&gt;m_gridColum=
ns; }
</span><span class=3D"cx">     const Vector&lt;GridTrackSize&gt;&amp; gri=
dRows() const { return rareNonInheritedData-&gt;m_grid-&gt;m_gridRows; }
</span><ins>+    const NamedGridLinesMap&amp; namedGridColumnLines() cons=
t { return rareNonInheritedData-&gt;m_grid-&gt;m_namedGridColumnLines; }
+    const NamedGridLinesMap&amp; namedGridRowLines() const { return rare=
NonInheritedData-&gt;m_grid-&gt;m_namedGridRowLines; }
</ins><span class=3D"cx">     GridAutoFlow gridAutoFlow() const { return =
rareNonInheritedData-&gt;m_grid-&gt;m_gridAutoFlow; }
</span><span class=3D"cx">     const GridTrackSize&amp; gridAutoColumns()=
 const { return rareNonInheritedData-&gt;m_grid-&gt;m_gridAutoColumns; }
</span><span class=3D"cx">     const GridTrackSize&amp; gridAutoRows() co=
nst { return rareNonInheritedData-&gt;m_grid-&gt;m_gridAutoRows; }
</span><span class=3D"lines">@@ -1298,6 +1300,8 @@
</span><span class=3D"cx">     void setGridAutoRows(const GridTrackSize&a=
mp; length) { SET_VAR(rareNonInheritedData.access()-&gt;m_grid, m_gridAut=
oRows, length); }
</span><span class=3D"cx">     void setGridColumns(const Vector&lt;GridTr=
ackSize&gt;&amp; lengths) { SET_VAR(rareNonInheritedData.access()-&gt;m_g=
rid, m_gridColumns, lengths); }
</span><span class=3D"cx">     void setGridRows(const Vector&lt;GridTrack=
Size&gt;&amp; lengths) { SET_VAR(rareNonInheritedData.access()-&gt;m_grid=
, m_gridRows, lengths); }
</span><ins>+    void setNamedGridColumnLines(const NamedGridLinesMap&amp=
; namedGridColumnLines) { SET_VAR(rareNonInheritedData.access()-&gt;m_gri=
d, m_namedGridColumnLines, namedGridColumnLines); }
+    void setNamedGridRowLines(const NamedGridLinesMap&amp; namedGridRowL=
ines) { SET_VAR(rareNonInheritedData.access()-&gt;m_grid, m_namedGridRowL=
ines, namedGridRowLines); }
</ins><span class=3D"cx">     void setGridAutoFlow(GridAutoFlow flow) { S=
ET_VAR(rareNonInheritedData.access()-&gt;m_grid, m_gridAutoFlow, flow); }
</span><span class=3D"cx">     void setGridItemColumnStart(const GridPosi=
tion&amp; columnStartPosition) { SET_VAR(rareNonInheritedData.access()-&g=
t;m_gridItem, m_gridColumnStart, columnStartPosition); }
</span><span class=3D"cx">     void setGridItemColumnEnd(const GridPositi=
on&amp; columnEndPosition) { SET_VAR(rareNonInheritedData.access()-&gt;m_=
gridItem, m_gridColumnEnd, columnEndPosition); }
</span></span></pre></div>
<a id=3D"trunkSourceWebCorerenderingstyleStyleGridDatacpp"></a>
<div class=3D"modfile"><h4>Modified: trunk/Source/WebCore/rendering/style=
/StyleGridData.cpp (153751 =3D> 153752)</h4>
<pre class=3D"diff"><span>
<span class=3D"info">--- trunk/Source/WebCore/rendering/style/StyleGridDa=
ta.cpp	2013-08-06 13:58:39 UTC (rev 153751)
+++ trunk/Source/WebCore/rendering/style/StyleGridData.cpp	2013-08-06 15:=
08:21 UTC (rev 153752)
</span><span class=3D"lines">@@ -43,6 +43,8 @@
</span><span class=3D"cx">     : RefCounted&lt;StyleGridData&gt;()
</span><span class=3D"cx">     , m_gridColumns(o.m_gridColumns)
</span><span class=3D"cx">     , m_gridRows(o.m_gridRows)
</span><ins>+    , m_namedGridColumnLines(o.m_namedGridColumnLines)
+    , m_namedGridRowLines(o.m_namedGridRowLines)
</ins><span class=3D"cx">     , m_gridAutoFlow(o.m_gridAutoFlow)
</span><span class=3D"cx">     , m_gridAutoRows(o.m_gridAutoRows)
</span><span class=3D"cx">     , m_gridAutoColumns(o.m_gridAutoColumns)
</span></span></pre></div>
<a id=3D"trunkSourceWebCorerenderingstyleStyleGridDatah"></a>
<div class=3D"modfile"><h4>Modified: trunk/Source/WebCore/rendering/style=
/StyleGridData.h (153751 =3D> 153752)</h4>
<pre class=3D"diff"><span>
<span class=3D"info">--- trunk/Source/WebCore/rendering/style/StyleGridDa=
ta.h	2013-08-06 13:58:39 UTC (rev 153751)
+++ trunk/Source/WebCore/rendering/style/StyleGridData.h	2013-08-06 15:08=
:21 UTC (rev 153752)
</span><span class=3D"lines">@@ -31,9 +31,12 @@
</span><span class=3D"cx"> #include &lt;wtf/PassRefPtr.h&gt;
</span><span class=3D"cx"> #include &lt;wtf/RefCounted.h&gt;
</span><span class=3D"cx"> #include &lt;wtf/Vector.h&gt;
</span><ins>+#include &lt;wtf/text/WTFString.h&gt;
</ins><span class=3D"cx">=20
</span><span class=3D"cx"> namespace WebCore {
</span><span class=3D"cx">=20
</span><ins>+typedef HashMap&lt;String, Vector&lt;size_t&gt; &gt; NamedGr=
idLinesMap;
+
</ins><span class=3D"cx"> class StyleGridData : public RefCounted&lt;Styl=
eGridData&gt; {
</span><span class=3D"cx"> public:
</span><span class=3D"cx">     static PassRefPtr&lt;StyleGridData&gt; cre=
ate() { return adoptRef(new StyleGridData); }
</span><span class=3D"lines">@@ -41,7 +44,8 @@
</span><span class=3D"cx">=20
</span><span class=3D"cx">     bool operator=3D=3D(const StyleGridData&am=
p; o) const
</span><span class=3D"cx">     {
</span><del>-        return m_gridColumns =3D=3D o.m_gridColumns &amp;&am=
p; m_gridRows =3D=3D o.m_gridRows &amp;&amp; m_gridAutoFlow =3D=3D o.m_gr=
idAutoFlow &amp;&amp; m_gridAutoRows =3D=3D o.m_gridAutoRows &amp;&amp; m=
_gridAutoColumns =3D=3D o.m_gridAutoColumns;
</del><ins>+        // FIXME: comparing two hashes doesn't look great for=
 performance. Something to keep in mind going forward.
+        return m_gridColumns =3D=3D o.m_gridColumns &amp;&amp; m_gridRow=
s =3D=3D o.m_gridRows &amp;&amp; m_gridAutoFlow =3D=3D o.m_gridAutoFlow &=
amp;&amp; m_gridAutoRows =3D=3D o.m_gridAutoRows &amp;&amp; m_gridAutoCol=
umns =3D=3D o.m_gridAutoColumns &amp;&amp; m_namedGridColumnLines =3D=3D =
o.m_namedGridColumnLines &amp;&amp; m_namedGridRowLines =3D=3D o.m_namedG=
ridRowLines;
</ins><span class=3D"cx">     }
</span><span class=3D"cx">=20
</span><span class=3D"cx">     bool operator!=3D(const StyleGridData&amp;=
 o) const
</span><span class=3D"lines">@@ -53,6 +57,9 @@
</span><span class=3D"cx">     Vector&lt;GridTrackSize&gt; m_gridColumns;
</span><span class=3D"cx">     Vector&lt;GridTrackSize&gt; m_gridRows;
</span><span class=3D"cx">=20
</span><ins>+    NamedGridLinesMap m_namedGridColumnLines;
+    NamedGridLinesMap m_namedGridRowLines;
+
</ins><span class=3D"cx">     GridAutoFlow m_gridAutoFlow;
</span><span class=3D"cx">=20
</span><span class=3D"cx">     GridTrackSize m_gridAutoRows;
</span></span></pre>
</div>
</div>

</body>
</html>


More information about the webkit-changes mailing list