No subject
Mon Jan 28 08:41:14 PST 2013
9798">r149798</a> by <jchaffraix at chromium.org>
Source/WebCore:
This change adds parsing, style resolution and getComputedStyle
support for named grid lines at the grid element level
(i.e. extends our <track-list> 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 <grid-line> 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 <svillar at igalia.com>
+
+ [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 <jchaffraix at chromium.org>
+
+ * 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 <svillar at ig=
alia.com>
</span><span class=3D"cx">=20
</span><span class=3D"cx"> [CSS Grid Layout] Add support for pars=
ing <grid-line> 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 "PASS" messages, followed=
by "TEST COMPLETE".
+
+
+Test getting -webkit-grid-definition-columns and -webkit-grid-definition=
-rows set through CSS
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-columns') is "first 10px"
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-rows') is "first 15px"
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-columns') is "53% last"
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-rows') is "27% last"
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-columns') is "first auto"
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-rows') is "auto last"
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-columns') is "first minmax(10%, 15px)"
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-rows') is "minmax(20px, 50%) last"
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-columns') is "nav first 10px last"
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-rows') is "nav first 15px last"
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-columns') is "nav first 10% nav 15% last"
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-rows') is "first nav2 25% nav2 75% last"
+
+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 "first 18px"
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-rows') is "66px last"
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-columns') is "first 55%"
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-rows') is "40% last"
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-columns') is "first auto"
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-rows') is "auto last"
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-columns') is "first -webkit-min-content"
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-rows') is "-webkit-min-content last"
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-columns') is "first -webkit-max-content"
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-rows') is "-webkit-max-content last"
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-columns') is "first minmax(55%, 45px)"
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-rows') is "minmax(30px, 40%) last"
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-columns') is "first minmax(220px, -webkit-max-content)"=
;
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-rows') is "minmax(-webkit-max-content, 50px) last"
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-columns') is "first minmax(220px, -webkit-max-content)"=
;
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-rows') is "minmax(-webkit-max-content, 50px) last"
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-columns') is "first minmax(-webkit-min-content, -webkit-max=
-content)"
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-rows') is "minmax(-webkit-max-content, -webkit-min-content)=
last"
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-columns') is "nav first minmax(-webkit-min-content, -webkit=
-max-content) last"
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-rows') is "nav first minmax(-webkit-max-content, -webkit-mi=
n-content) last"
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-columns') is "nav first minmax(-webkit-min-content, -webkit=
-max-content) nav auto last"
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-rows') is "first nav2 minmax(-webkit-max-content, -webkit-m=
in-content) nav2 minmax(10px, 15px) last"
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-columns') is "foo bar auto foo auto bar"
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-rows') is "foo bar auto foo auto bar"
+
+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 "none"
+PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-de=
finition-rows') is "none"
+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>+<!DOCTYPE HTML>
+<html>
+<head>
+<script>
+if (window.testRunner)
+ testRunner.overridePreference("WebKitCSSGridLayoutEnabled"=
, 1);
+</script>
+<link href=3D"resources/grid.css" rel=3D"stylesheet&qu=
ot;>
+<style>
+.gridWithFixed {
+ -webkit-grid-definition-columns: "first" 10px;
+ -webkit-grid-definition-rows: "first" 15px;
+}
+.gridWithPercent {
+ -webkit-grid-definition-columns: 53% "last";
+ -webkit-grid-definition-rows: 27% "last";
+}
+.gridWithAuto {
+ -webkit-grid-definition-columns: "first" auto;
+ -webkit-grid-definition-rows: auto "last";
+}
+.gridWithMinMax {
+ -webkit-grid-definition-columns: "first" minmax(10%, 15px)=
;
+ -webkit-grid-definition-rows: minmax(20px, 50%) "last";
+}
+.gridWithFixedMultiple {
+ -webkit-grid-definition-columns: "first" "nav" 1=
0px "last";
+ -webkit-grid-definition-rows: "first" "nav" 15px=
"last";
+}
+.gridWithPercentageSameStringMultipleTimes {
+ -webkit-grid-definition-columns: "first" "nav" 1=
0% "nav" 15% "last";
+ -webkit-grid-definition-rows: "first" "nav2" 25%=
"nav2" 75% "last";
+}
+</style>
+<script src=3D"../js/resources/js-test-pre.js"></scri=
pt>
+</head>
+<body>
+<div class=3D"grid gridWithFixed" id=3D"gridWithFixedE=
lement"></div>
+<div class=3D"grid gridWithPercent" id=3D"gridWithPerc=
entElement"></div>
+<div class=3D"grid gridWithAuto" id=3D"gridWithAutoEle=
ment"></div>
+<div class=3D"grid gridWithMinMax" id=3D"gridWithMinMa=
x"></div>
+<div class=3D"grid gridWithFixedMultiple" id=3D"gridWi=
thFixedMultiple"></div>
+<div class=3D"grid gridWithPercentageSameStringMultipleTimes&quo=
t; id=3D"gridWithPercentageSameStringMultipleTimes"></div=
>
+<script>
+ 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("getComputedStyle(gridElement, '').ge=
tPropertyValue('-webkit-grid-definition-columns')", namedGridColumns=
);
+ shouldBeEqualToString("getComputedStyle(gridElement, '').ge=
tPropertyValue('-webkit-grid-definition-rows')", namedGridRows);
+ }
+
+ function testCSSValue(gridElementId, namedGridColumns, namedGridRows=
)
+ {
+ testValue(document.getElementById(gridElementId), namedGridColum=
ns, namedGridRows);
+ }
+
+ debug("Test getting -webkit-grid-definition-columns and -webkit=
-grid-definition-rows set through CSS");
+ testCSSValue("gridWithFixedElement", "first 10px"=
;, "first 15px");
+ testCSSValue("gridWithPercentElement", "53% last"=
;, "27% last");
+ testCSSValue("gridWithAutoElement", "first auto"=
, "auto last");
+ testCSSValue("gridWithMinMax", "first minmax(10%, 15p=
x)", "minmax(20px, 50%) last");
+ testCSSValue("gridWithFixedMultiple", "nav first 10px=
last", "nav first 15px last");
+ testCSSValue("gridWithPercentageSameStringMultipleTimes", =
"nav first 10% nav 15% last", "first nav2 25% nav2 75% las=
t");
+
+ debug("");
+ debug("Test getting and setting -webkit-grid-definition-columns=
and -webkit-grid-definition-rows through JS");
+ var element =3D document.createElement("div");
+ document.body.appendChild(element);
+ element.style.webkitGridDefinitionColumns =3D "'first' 18px&quo=
t;;
+ element.style.webkitGridDefinitionRows =3D "66px 'last'";
+ testValue(element, "first 18px", "66px last");
+
+ element =3D document.createElement("div");
+ document.body.appendChild(element);
+ element.style.webkitGridDefinitionColumns =3D "'first' 55%"=
;;
+ element.style.webkitGridDefinitionRows =3D "40% 'last'";
+ testValue(element, "first 55%", "40% last");
+
+ element =3D document.createElement("div");
+ document.body.appendChild(element);
+ element.style.webkitGridDefinitionColumns =3D "'first' auto&quo=
t;;
+ element.style.webkitGridDefinitionRows =3D "auto 'last'";
+ testValue(element, "first auto", "auto last");
+
+ element =3D document.createElement("div");
+ document.body.appendChild(element);
+ element.style.webkitGridDefinitionColumns =3D "'first' -webkit-=
min-content";
+ element.style.webkitGridDefinitionRows =3D "-webkit-min-content=
'last'";
+ testValue(element, "first -webkit-min-content", "-web=
kit-min-content last");
+
+ element =3D document.createElement("div");
+ document.body.appendChild(element);
+ element.style.webkitGridDefinitionColumns =3D "'first' -webkit-=
max-content";
+ element.style.webkitGridDefinitionRows =3D "-webkit-max-content=
'last'";
+ testValue(element, "first -webkit-max-content", "-web=
kit-max-content last");
+
+ element =3D document.createElement("div");
+ document.body.appendChild(element);
+ element.style.webkitGridDefinitionColumns =3D "'first' minmax(5=
5%, 45px)";
+ element.style.webkitGridDefinitionRows =3D "minmax(30px, 40%) '=
last'";
+ testValue(element, "first minmax(55%, 45px)", "minmax=
(30px, 40%) last");
+
+ element =3D document.createElement("div");
+ document.body.appendChild(element);
+ element.style.font =3D "10px Ahem";
+ element.style.webkitGridDefinitionColumns =3D "'first' minmax(2=
2em, -webkit-max-content)";
+ element.style.webkitGridDefinitionRows =3D "minmax(-webkit-max-=
content, 5em) 'last'";
+ testValue(element, "first minmax(220px, -webkit-max-content)&qu=
ot;, "minmax(-webkit-max-content, 50px) last");
+
+ element =3D document.createElement("div");
+ document.body.appendChild(element);
+ element.style.font =3D "10px Ahem";
+ element.style.webkitGridDefinitionColumns =3D "'first' minmax(2=
2em, -webkit-max-content)";
+ element.style.webkitGridDefinitionRows =3D "minmax(-webkit-max-=
content, 5em) 'last'";
+ testValue(element, "first minmax(220px, -webkit-max-content)&qu=
ot;, "minmax(-webkit-max-content, 50px) last");
+
+ element =3D document.createElement("div");
+ document.body.appendChild(element);
+ element.style.webkitGridDefinitionColumns =3D "'first' minmax(-=
webkit-min-content, -webkit-max-content)";
+ element.style.webkitGridDefinitionRows =3D "minmax(-webkit-max-=
content, -webkit-min-content) 'last'";
+ testValue(element, "first minmax(-webkit-min-content, -webkit-m=
ax-content)", "minmax(-webkit-max-content, -webkit-min-content)=
last");
+
+ element =3D document.createElement("div");
+ document.body.appendChild(element);
+ element.style.webkitGridDefinitionColumns =3D "'first' 'nav' mi=
nmax(-webkit-min-content, -webkit-max-content) 'last'";
+ element.style.webkitGridDefinitionRows =3D "'first' 'nav' minma=
x(-webkit-max-content, -webkit-min-content) 'last'";
+ testValue(element, "nav first minmax(-webkit-min-content, -webk=
it-max-content) last", "nav first minmax(-webkit-max-content, -=
webkit-min-content) last");
+
+ element =3D document.createElement("div");
+ document.body.appendChild(element);
+ element.style.webkitGridDefinitionColumns =3D "'first' 'nav' mi=
nmax(-webkit-min-content, -webkit-max-content) 'nav' auto 'last'";
+ element.style.webkitGridDefinitionRows =3D "'first' 'nav2' minm=
ax(-webkit-max-content, -webkit-min-content) 'nav2' minmax(10px, 15px) 'l=
ast'";
+ testValue(element, "nav first minmax(-webkit-min-content, -webk=
it-max-content) nav auto last", "first nav2 minmax(-webkit-max-=
content, -webkit-min-content) nav2 minmax(10px, 15px) last");
+
+ element =3D document.createElement("div");
+ document.body.appendChild(element);
+ element.style.webkitGridDefinitionColumns =3D "'foo' 'bar' auto=
'foo' auto 'bar'";
+ element.style.webkitGridDefinitionRows =3D "'foo' 'bar' auto 'f=
oo' auto 'bar'";
+ testValue(element, "foo bar auto foo auto bar", "foo =
bar auto foo auto bar");
+
+ debug("");
+ debug("Test getting and setting invalid -webkit-grid-definition=
-columns and -webkit-grid-definition-rows through JS");
+ element =3D document.createElement("div");
+ document.body.appendChild(element);
+ element.style.webkitGridDefinitionColumns =3D "'foo'";
+ element.style.webkitGridDefinitionRows =3D "'bar";
+ testValue(element, "none", "none");
+</script>
+<script src=3D"../js/resources/js-test-post.js"></scr=
ipt>
+</body>
+</html>
</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 <svillar at igalia.com>
+
+ [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 <jchaffraix at chromium.org>
+
+ This change adds parsing, style resolution and getComputedStyle
+ support for named grid lines at the grid element level
+ (i.e. extends our <track-list> 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 <grid-line> 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 <allan.je=
nsen at digia.com>
</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<CSSValue> valueForGridTrackList(cons=
t Vector<GridTrackSize>& trackSizes, const RenderStyle* style, =
RenderView *renderView)
</del><ins>+static void addValuesForNamedGridLinesAtIndex(const NamedGrid=
LinesMap& namedGridLines, size_t i, CSSValueList& 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<size_t>& linesIndexes =3D it->value;
+ for (size_t j =3D 0; j < linesIndexes.size(); ++j) {
+ if (linesIndexes[j] !=3D i)
+ continue;
+
+ list.append(cssValuePool().createValue(it->key, CSSPrimit=
iveValue::CSS_STRING));
+ break;
+ }
+ }
+}
+
+static PassRefPtr<CSSValue> valueForGridTrackList(const Vector<=
GridTrackSize>& trackSizes, const NamedGridLinesMap& 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<CSSValueList> list =3D CSSVal=
ueList::createSpaceSeparated();
</span><del>- for (size_t i =3D 0; i < trackSizes.size(); ++i)
</del><ins>+ for (size_t i =3D 0; i < trackSizes.size(); ++i) {
+ addValuesForNamedGridLinesAtIndex(namedGridLines, i, *list);
</ins><span class=3D"cx"> list->append(valueForGridTrackSize(t=
rackSizes[i], style, renderView));
</span><ins>+ }
+ // Those are the trailing <string>* 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=
->gridAutoRows(), style.get(), m_node->document()->renderView())=
;
</span><span class=3D"cx"> case CSSPropertyWebkitGridDefinitionCo=
lumns:
</span><del>- return valueForGridTrackList(style->gridColum=
ns(), style.get(), m_node->document()->renderView());
</del><ins>+ return valueForGridTrackList(style->gridColumn=
s(), style->namedGridColumnLines(), style.get(), m_node->document()=
->renderView());
</ins><span class=3D"cx"> case CSSPropertyWebkitGridDefinitionRow=
s:
</span><del>- return valueForGridTrackList(style->gridRows(=
), style.get(), m_node->document()->renderView());
</del><ins>+ return valueForGridTrackList(style->gridRows()=
, style->namedGridRowLines(), style.get(), m_node->document()->r=
enderView());
</ins><span class=3D"cx">=20
</span><span class=3D"cx"> case CSSPropertyWebkitGridColumnStart:
</span><span class=3D"cx"> return valueForGridPosition(style-=
>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<CSSValueList> values =3D CSSV=
alueList::createSpaceSeparated();
</span><span class=3D"cx"> while (m_valueList->current()) {
</span><ins>+ while (m_valueList->current() && m_valueL=
ist->current()->unit =3D=3D CSSPrimitiveValue::CSS_STRING) {
+ RefPtr<CSSPrimitiveValue> name =3D createPrimitiveStri=
ngValue(m_valueList->current());
+ values->append(name);
+ m_valueList->next();
+ }
+
+ // This allows trailing <string>* per the specification.
+ if (!m_valueList->current())
+ break;
+
</ins><span class=3D"cx"> RefPtr<CSSPrimitiveValue> 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<G=
ridTrackSize>& trackSizes, const StyleResolver::State& state)
</del><ins>+static bool createGridTrackList(CSSValue* value, Vector<Gr=
idTrackSize>& trackSizes, NamedGridLinesMap& namedGridLines, c=
onst StyleResolver::State& state)
</ins><span class=3D"cx"> {
</span><span class=3D"cx"> // Handle 'none'.
</span><span class=3D"cx"> if (value->isPrimitiveValue()) {
</span><span class=3D"lines">@@ -2110,14 +2110,29 @@
</span><span class=3D"cx"> if (!value->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->isPrimitiveValue()) {
+ CSSPrimitiveValue* primitiveValue =3D static_cast<CSSPrim=
itiveValue*>(currValue);
+ if (primitiveValue->isString()) {
+ NamedGridLinesMap::AddResult result =3D namedGridLines.a=
dd(primitiveValue->getStringValue(), Vector<size_t>());
+ result.iterator->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<GridTrackSize> 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()->setGridColumns(track=
Sizes);
</span><ins>+ state.style()->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<GridTrackSize> 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()->setGridRows(trackSiz=
es);
</span><ins>+ state.style()->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<GridTrackSize>& gri=
dColumns() const { return rareNonInheritedData->m_grid->m_gridColum=
ns; }
</span><span class=3D"cx"> const Vector<GridTrackSize>& gri=
dRows() const { return rareNonInheritedData->m_grid->m_gridRows; }
</span><ins>+ const NamedGridLinesMap& namedGridColumnLines() cons=
t { return rareNonInheritedData->m_grid->m_namedGridColumnLines; }
+ const NamedGridLinesMap& namedGridRowLines() const { return rare=
NonInheritedData->m_grid->m_namedGridRowLines; }
</ins><span class=3D"cx"> GridAutoFlow gridAutoFlow() const { return =
rareNonInheritedData->m_grid->m_gridAutoFlow; }
</span><span class=3D"cx"> const GridTrackSize& gridAutoColumns()=
const { return rareNonInheritedData->m_grid->m_gridAutoColumns; }
</span><span class=3D"cx"> const GridTrackSize& gridAutoRows() co=
nst { return rareNonInheritedData->m_grid->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()->m_grid, m_gridAut=
oRows, length); }
</span><span class=3D"cx"> void setGridColumns(const Vector<GridTr=
ackSize>& lengths) { SET_VAR(rareNonInheritedData.access()->m_g=
rid, m_gridColumns, lengths); }
</span><span class=3D"cx"> void setGridRows(const Vector<GridTrack=
Size>& lengths) { SET_VAR(rareNonInheritedData.access()->m_grid=
, m_gridRows, lengths); }
</span><ins>+ void setNamedGridColumnLines(const NamedGridLinesMap&=
; namedGridColumnLines) { SET_VAR(rareNonInheritedData.access()->m_gri=
d, m_namedGridColumnLines, namedGridColumnLines); }
+ void setNamedGridRowLines(const NamedGridLinesMap& namedGridRowL=
ines) { SET_VAR(rareNonInheritedData.access()->m_grid, m_namedGridRowL=
ines, namedGridRowLines); }
</ins><span class=3D"cx"> void setGridAutoFlow(GridAutoFlow flow) { S=
ET_VAR(rareNonInheritedData.access()->m_grid, m_gridAutoFlow, flow); }
</span><span class=3D"cx"> void setGridItemColumnStart(const GridPosi=
tion& columnStartPosition) { SET_VAR(rareNonInheritedData.access()-&g=
t;m_gridItem, m_gridColumnStart, columnStartPosition); }
</span><span class=3D"cx"> void setGridItemColumnEnd(const GridPositi=
on& columnEndPosition) { SET_VAR(rareNonInheritedData.access()->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<StyleGridData>()
</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 <wtf/PassRefPtr.h>
</span><span class=3D"cx"> #include <wtf/RefCounted.h>
</span><span class=3D"cx"> #include <wtf/Vector.h>
</span><ins>+#include <wtf/text/WTFString.h>
</ins><span class=3D"cx">=20
</span><span class=3D"cx"> namespace WebCore {
</span><span class=3D"cx">=20
</span><ins>+typedef HashMap<String, Vector<size_t> > NamedGr=
idLinesMap;
+
</ins><span class=3D"cx"> class StyleGridData : public RefCounted<Styl=
eGridData> {
</span><span class=3D"cx"> public:
</span><span class=3D"cx"> static PassRefPtr<StyleGridData> 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 &&am=
p; m_gridRows =3D=3D o.m_gridRows && m_gridAutoFlow =3D=3D o.m_gr=
idAutoFlow && m_gridAutoRows =3D=3D o.m_gridAutoRows && 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 && m_gridRow=
s =3D=3D o.m_gridRows && m_gridAutoFlow =3D=3D o.m_gridAutoFlow &=
amp;& m_gridAutoRows =3D=3D o.m_gridAutoRows && m_gridAutoCol=
umns =3D=3D o.m_gridAutoColumns && m_namedGridColumnLines =3D=3D =
o.m_namedGridColumnLines && 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&=
o) const
</span><span class=3D"lines">@@ -53,6 +57,9 @@
</span><span class=3D"cx"> Vector<GridTrackSize> m_gridColumns;
</span><span class=3D"cx"> Vector<GridTrackSize> 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