<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[198207] trunk/Source/WebCore</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/198207">198207</a></dd>
<dt>Author</dt> <dd>rego@igalia.com</dd>
<dt>Date</dt> <dd>2016-03-15 03:38:43 -0700 (Tue, 15 Mar 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>[css-grid] Rename GridResolvedPosition to GridPositionsResolver
https://bugs.webkit.org/show_bug.cgi?id=155486

Reviewed by Sergio Villar Senin.

GridResolvedPosition is not storing a position (track or line) anymore.
Currently it's just a class wrapping the methods to resolve
grid positions from style.
Renamed the class to avoid confusions.

No new tests, no change of behavior.

* CMakeLists.txt:
* WebCore.xcodeproj/project.pbxproj:
* rendering/RenderGrid.cpp:
(WebCore::RenderGrid::placeItemsOnGrid):
(WebCore::RenderGrid::populateExplicitGridAndOrderIterator):
(WebCore::RenderGrid::createEmptyGridAreaAtSpecifiedPositionsOutsideGrid):
(WebCore::RenderGrid::placeSpecifiedMajorAxisItemsOnGrid):
(WebCore::RenderGrid::placeAutoMajorAxisItemOnGrid):
(WebCore::RenderGrid::offsetAndBreadthForPositionedChild):
* rendering/RenderGrid.h:
* rendering/style/GridCoordinate.h:
* rendering/style/GridPositionsResolver.cpp: Renamed from Source/WebCore/rendering/style/GridResolvedPosition.cpp.
(WebCore::isColumnSide):
(WebCore::isStartSide):
(WebCore::initialPositionSide):
(WebCore::finalPositionSide):
(WebCore::gridLinesForSide):
(WebCore::implicitNamedGridLineForSide):
(WebCore::GridPositionsResolver::isNonExistentNamedLineOrArea):
(WebCore::adjustGridPositionsFromStyle):
(WebCore::GridPositionsResolver::explicitGridColumnCount):
(WebCore::GridPositionsResolver::explicitGridRowCount):
(WebCore::explicitGridSizeForSide):
(WebCore::lookAheadForNamedGridLine):
(WebCore::lookBackForNamedGridLine):
(WebCore::resolveNamedGridLinePositionFromStyle):
(WebCore::definiteGridSpanWithNamedLineSpanAgainstOpposite):
(WebCore::resolveNamedGridLinePositionAgainstOppositePosition):
(WebCore::resolveGridPositionAgainstOppositePosition):
(WebCore::GridPositionsResolver::spanSizeForAutoPlacedItem):
(WebCore::resolveGridPositionFromStyle):
(WebCore::GridPositionsResolver::resolveGridPositionsFromStyle):
* rendering/style/GridPositionsResolver.h: Renamed from Source/WebCore/rendering/style/GridResolvedPosition.h.
* rendering/style/StyleAllInOne.cpp:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreCMakeListstxt">trunk/Source/WebCore/CMakeLists.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderGridcpp">trunk/Source/WebCore/rendering/RenderGrid.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderGridh">trunk/Source/WebCore/rendering/RenderGrid.h</a></li>
<li><a href="#trunkSourceWebCorerenderingstyleGridCoordinateh">trunk/Source/WebCore/rendering/style/GridCoordinate.h</a></li>
<li><a href="#trunkSourceWebCorerenderingstyleStyleAllInOnecpp">trunk/Source/WebCore/rendering/style/StyleAllInOne.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCorerenderingstyleGridPositionsResolvercpp">trunk/Source/WebCore/rendering/style/GridPositionsResolver.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingstyleGridPositionsResolverh">trunk/Source/WebCore/rendering/style/GridPositionsResolver.h</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceWebCorerenderingstyleGridResolvedPositioncpp">trunk/Source/WebCore/rendering/style/GridResolvedPosition.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingstyleGridResolvedPositionh">trunk/Source/WebCore/rendering/style/GridResolvedPosition.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/CMakeLists.txt (198206 => 198207)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/CMakeLists.txt        2016-03-15 08:59:01 UTC (rev 198206)
+++ trunk/Source/WebCore/CMakeLists.txt        2016-03-15 10:38:43 UTC (rev 198207)
</span><span class="lines">@@ -2540,7 +2540,7 @@
</span><span class="cx">     rendering/style/ContentData.cpp
</span><span class="cx">     rendering/style/CounterDirectives.cpp
</span><span class="cx">     rendering/style/FillLayer.cpp
</span><del>-    rendering/style/GridResolvedPosition.cpp
</del><ins>+    rendering/style/GridPositionsResolver.cpp
</ins><span class="cx">     rendering/style/KeyframeList.cpp
</span><span class="cx">     rendering/style/NinePieceImage.cpp
</span><span class="cx">     rendering/style/QuotesData.cpp
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (198206 => 198207)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-03-15 08:59:01 UTC (rev 198206)
+++ trunk/Source/WebCore/ChangeLog        2016-03-15 10:38:43 UTC (rev 198207)
</span><span class="lines">@@ -1,3 +1,52 @@
</span><ins>+2016-03-15  Manuel Rego Casasnovas  &lt;rego@igalia.com&gt;
+
+        [css-grid] Rename GridResolvedPosition to GridPositionsResolver
+        https://bugs.webkit.org/show_bug.cgi?id=155486
+
+        Reviewed by Sergio Villar Senin.
+
+        GridResolvedPosition is not storing a position (track or line) anymore.
+        Currently it's just a class wrapping the methods to resolve
+        grid positions from style.
+        Renamed the class to avoid confusions.
+
+        No new tests, no change of behavior.
+
+        * CMakeLists.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * rendering/RenderGrid.cpp:
+        (WebCore::RenderGrid::placeItemsOnGrid):
+        (WebCore::RenderGrid::populateExplicitGridAndOrderIterator):
+        (WebCore::RenderGrid::createEmptyGridAreaAtSpecifiedPositionsOutsideGrid):
+        (WebCore::RenderGrid::placeSpecifiedMajorAxisItemsOnGrid):
+        (WebCore::RenderGrid::placeAutoMajorAxisItemOnGrid):
+        (WebCore::RenderGrid::offsetAndBreadthForPositionedChild):
+        * rendering/RenderGrid.h:
+        * rendering/style/GridCoordinate.h:
+        * rendering/style/GridPositionsResolver.cpp: Renamed from Source/WebCore/rendering/style/GridResolvedPosition.cpp.
+        (WebCore::isColumnSide):
+        (WebCore::isStartSide):
+        (WebCore::initialPositionSide):
+        (WebCore::finalPositionSide):
+        (WebCore::gridLinesForSide):
+        (WebCore::implicitNamedGridLineForSide):
+        (WebCore::GridPositionsResolver::isNonExistentNamedLineOrArea):
+        (WebCore::adjustGridPositionsFromStyle):
+        (WebCore::GridPositionsResolver::explicitGridColumnCount):
+        (WebCore::GridPositionsResolver::explicitGridRowCount):
+        (WebCore::explicitGridSizeForSide):
+        (WebCore::lookAheadForNamedGridLine):
+        (WebCore::lookBackForNamedGridLine):
+        (WebCore::resolveNamedGridLinePositionFromStyle):
+        (WebCore::definiteGridSpanWithNamedLineSpanAgainstOpposite):
+        (WebCore::resolveNamedGridLinePositionAgainstOppositePosition):
+        (WebCore::resolveGridPositionAgainstOppositePosition):
+        (WebCore::GridPositionsResolver::spanSizeForAutoPlacedItem):
+        (WebCore::resolveGridPositionFromStyle):
+        (WebCore::GridPositionsResolver::resolveGridPositionsFromStyle):
+        * rendering/style/GridPositionsResolver.h: Renamed from Source/WebCore/rendering/style/GridResolvedPosition.h.
+        * rendering/style/StyleAllInOne.cpp:
+
</ins><span class="cx"> 2016-03-15  Miguel Gomez  &lt;magomez@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Leak: Accelerated ImageBufferCairo doesn't destroy the used textures
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (198206 => 198207)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-03-15 08:59:01 UTC (rev 198206)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-03-15 10:38:43 UTC (rev 198207)
</span><span class="lines">@@ -6190,8 +6190,8 @@
</span><span class="cx">                 CDF2B0191820540700F2B424 /* MockTracks.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF2B00F1820540600F2B424 /* MockTracks.h */; };
</span><span class="cx">                 CDF65CC8145B1E7500C4C7AA /* MediaController.h in Headers */ = {isa = PBXBuildFile; fileRef = CD27F6E4145767870078207D /* MediaController.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 CDF65CCA145B448800C4C7AA /* MediaControllerInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF65CC9145B43A700C4C7AA /* MediaControllerInterface.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><del>-                CDF7483E18FEBCEC0006ECC0 /* GridResolvedPosition.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CDF7483C18FEBCEC0006ECC0 /* GridResolvedPosition.cpp */; };
-                CDF7483F18FEBCEC0006ECC0 /* GridResolvedPosition.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF7483D18FEBCEC0006ECC0 /* GridResolvedPosition.h */; settings = {ATTRIBUTES = (Private, ); }; };
</del><ins>+                CDF7483E18FEBCEC0006ECC0 /* GridPositionsResolver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CDF7483C18FEBCEC0006ECC0 /* GridPositionsResolver.cpp */; };
+                CDF7483F18FEBCEC0006ECC0 /* GridPositionsResolver.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF7483D18FEBCEC0006ECC0 /* GridPositionsResolver.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 CDFC360518CA61C20026E56F /* RemoteCommandListener.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CDFC360318CA61C20026E56F /* RemoteCommandListener.cpp */; };
</span><span class="cx">                 CDFC360618CA61C20026E56F /* RemoteCommandListener.h in Headers */ = {isa = PBXBuildFile; fileRef = CDFC360418CA61C20026E56F /* RemoteCommandListener.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 CDFC360718CA696C0026E56F /* RemoteCommandListenerIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = CDFC360218CA61630026E56F /* RemoteCommandListenerIOS.mm */; };
</span><span class="lines">@@ -14209,8 +14209,8 @@
</span><span class="cx">                 CDF419991AB0DA14004E64E1 /* missingImage@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = &quot;missingImage@3x.png&quot;; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 CDF65CC9145B43A700C4C7AA /* MediaControllerInterface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaControllerInterface.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 CDF65CCC145B6AFE00C4C7AA /* JSHTMLMediaElementCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLMediaElementCustom.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><del>-                CDF7483C18FEBCEC0006ECC0 /* GridResolvedPosition.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GridResolvedPosition.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
-                CDF7483D18FEBCEC0006ECC0 /* GridResolvedPosition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GridResolvedPosition.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</del><ins>+                CDF7483C18FEBCEC0006ECC0 /* GridPositionsResolver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GridPositionsResolver.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                CDF7483D18FEBCEC0006ECC0 /* GridPositionsResolver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GridPositionsResolver.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 CDFC360118CA61630026E56F /* RemoteCommandListenerIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoteCommandListenerIOS.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 CDFC360218CA61630026E56F /* RemoteCommandListenerIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RemoteCommandListenerIOS.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 CDFC360318CA61C20026E56F /* RemoteCommandListener.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RemoteCommandListener.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -22563,8 +22563,8 @@
</span><span class="cx">                                 CD3E251B18046B0600E27F56 /* GridCoordinate.h */,
</span><span class="cx">                                 CDEF4FD617E85C8F00AEE24B /* GridLength.h */,
</span><span class="cx">                                 A12705C21656BD6500C2E27C /* GridPosition.h */,
</span><del>-                                CDF7483C18FEBCEC0006ECC0 /* GridResolvedPosition.cpp */,
-                                CDF7483D18FEBCEC0006ECC0 /* GridResolvedPosition.h */,
</del><ins>+                                CDF7483C18FEBCEC0006ECC0 /* GridPositionsResolver.cpp */,
+                                CDF7483D18FEBCEC0006ECC0 /* GridPositionsResolver.h */,
</ins><span class="cx">                                 A12A104E166444DC008FA311 /* GridTrackSize.h */,
</span><span class="cx">                                 BC5EBA0E0E823E4700B25965 /* KeyframeList.cpp */,
</span><span class="cx">                                 BC5EBA0F0E823E4700B25965 /* KeyframeList.h */,
</span><span class="lines">@@ -26149,7 +26149,7 @@
</span><span class="cx">                                 CD3E251C18046B0600E27F56 /* GridCoordinate.h in Headers */,
</span><span class="cx">                                 CDEF4FD717E85C8F00AEE24B /* GridLength.h in Headers */,
</span><span class="cx">                                 A12705C31656BD6500C2E27C /* GridPosition.h in Headers */,
</span><del>-                                CDF7483F18FEBCEC0006ECC0 /* GridResolvedPosition.h in Headers */,
</del><ins>+                                CDF7483F18FEBCEC0006ECC0 /* GridPositionsResolver.h in Headers */,
</ins><span class="cx">                                 A12A1050166444FD008FA311 /* GridTrackSize.h in Headers */,
</span><span class="cx">                                 26EA89A71B4F2B75008C5FD2 /* HashableActionList.h in Headers */,
</span><span class="cx">                                 8482B7461198C35400BFB005 /* HashChangeEvent.h in Headers */,
</span><span class="lines">@@ -29841,7 +29841,7 @@
</span><span class="cx">                                 499B3ED6128CD31400E726C2 /* GraphicsLayerCA.cpp in Sources */,
</span><span class="cx">                                 0FA24D79162DF91900A3F4C0 /* GraphicsLayerUpdater.cpp in Sources */,
</span><span class="cx">                                 B2A015AA0AF6CD53006BCE0E /* GraphicsTypes.cpp in Sources */,
</span><del>-                                CDF7483E18FEBCEC0006ECC0 /* GridResolvedPosition.cpp in Sources */,
</del><ins>+                                CDF7483E18FEBCEC0006ECC0 /* GridPositionsResolver.cpp in Sources */,
</ins><span class="cx">                                 F55B3DBF1251F12D003EF269 /* HiddenInputType.cpp in Sources */,
</span><span class="cx">                                 51A9D9F3195B9503001B2B5C /* HIDGamepad.cpp in Sources */,
</span><span class="cx">                                 5179CE36195CAC7E0019C198 /* HIDGamepadProvider.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderGridcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderGrid.cpp (198206 => 198207)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderGrid.cpp        2016-03-15 08:59:01 UTC (rev 198206)
+++ trunk/Source/WebCore/rendering/RenderGrid.cpp        2016-03-15 10:38:43 UTC (rev 198207)
</span><span class="lines">@@ -30,7 +30,7 @@
</span><span class="cx"> #if ENABLE(CSS_GRID_LAYOUT)
</span><span class="cx"> 
</span><span class="cx"> #include &quot;GridCoordinate.h&quot;
</span><del>-#include &quot;GridResolvedPosition.h&quot;
</del><ins>+#include &quot;GridPositionsResolver.h&quot;
</ins><span class="cx"> #include &quot;LayoutRepainter.h&quot;
</span><span class="cx"> #include &quot;RenderLayer.h&quot;
</span><span class="cx"> #include &quot;RenderView.h&quot;
</span><span class="lines">@@ -1182,8 +1182,8 @@
</span><span class="cx">         insertItemIntoGrid(*child, GridCoordinate(coordinate.rows, coordinate.columns));
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    ASSERT(gridRowCount() &gt;= GridResolvedPosition::explicitGridRowCount(style()));
-    ASSERT(gridColumnCount() &gt;= GridResolvedPosition::explicitGridColumnCount(style()));
</del><ins>+    ASSERT(gridRowCount() &gt;= GridPositionsResolver::explicitGridRowCount(style()));
+    ASSERT(gridColumnCount() &gt;= GridPositionsResolver::explicitGridColumnCount(style()));
</ins><span class="cx"> 
</span><span class="cx">     placeSpecifiedMajorAxisItemsOnGrid(specifiedMajorAxisAutoGridItems);
</span><span class="cx">     placeAutoMajorAxisItemsOnGrid(autoMajorAxisAutoGridItems);
</span><span class="lines">@@ -1203,8 +1203,8 @@
</span><span class="cx"> {
</span><span class="cx">     OrderIteratorPopulator populator(m_orderIterator);
</span><span class="cx">     m_smallestRowStart = m_smallestColumnStart = 0;
</span><del>-    unsigned maximumRowIndex = std::max&lt;unsigned&gt;(1, GridResolvedPosition::explicitGridRowCount(style()));
-    unsigned maximumColumnIndex = std::max&lt;unsigned&gt;(1, GridResolvedPosition::explicitGridColumnCount(style()));
</del><ins>+    unsigned maximumRowIndex = std::max&lt;unsigned&gt;(1, GridPositionsResolver::explicitGridRowCount(style()));
+    unsigned maximumColumnIndex = std::max&lt;unsigned&gt;(1, GridPositionsResolver::explicitGridColumnCount(style()));
</ins><span class="cx"> 
</span><span class="cx">     for (RenderBox* child = firstChildBox(); child; child = child-&gt;nextSiblingBox()) {
</span><span class="cx">         if (child-&gt;isOutOfFlowPositioned())
</span><span class="lines">@@ -1212,23 +1212,23 @@
</span><span class="cx"> 
</span><span class="cx">         populator.collectChild(*child);
</span><span class="cx"> 
</span><del>-        GridSpan rowPositions = GridResolvedPosition::resolveGridPositionsFromStyle(style(), *child, ForRows);
</del><ins>+        GridSpan rowPositions = GridPositionsResolver::resolveGridPositionsFromStyle(style(), *child, ForRows);
</ins><span class="cx">         if (!rowPositions.isIndefinite()) {
</span><span class="cx">             m_smallestRowStart = std::min(m_smallestRowStart, rowPositions.untranslatedResolvedInitialPosition());
</span><span class="cx">             maximumRowIndex = std::max&lt;int&gt;(maximumRowIndex, rowPositions.untranslatedResolvedFinalPosition());
</span><span class="cx">         } else {
</span><span class="cx">             // Grow the grid for items with a definite row span, getting the largest such span.
</span><del>-            unsigned spanSize = GridResolvedPosition::spanSizeForAutoPlacedItem(style(), *child, ForRows);
</del><ins>+            unsigned spanSize = GridPositionsResolver::spanSizeForAutoPlacedItem(style(), *child, ForRows);
</ins><span class="cx">             maximumRowIndex = std::max(maximumRowIndex, spanSize);
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        GridSpan columnPositions = GridResolvedPosition::resolveGridPositionsFromStyle(style(), *child, ForColumns);
</del><ins>+        GridSpan columnPositions = GridPositionsResolver::resolveGridPositionsFromStyle(style(), *child, ForColumns);
</ins><span class="cx">         if (!columnPositions.isIndefinite()) {
</span><span class="cx">             m_smallestColumnStart = std::min(m_smallestColumnStart, columnPositions.untranslatedResolvedInitialPosition());
</span><span class="cx">             maximumColumnIndex = std::max&lt;int&gt;(maximumColumnIndex, columnPositions.untranslatedResolvedFinalPosition());
</span><span class="cx">         } else {
</span><span class="cx">             // Grow the grid for items with a definite column span, getting the largest such span.
</span><del>-            unsigned spanSize = GridResolvedPosition::spanSizeForAutoPlacedItem(style(), *child, ForColumns);
</del><ins>+            unsigned spanSize = GridPositionsResolver::spanSizeForAutoPlacedItem(style(), *child, ForColumns);
</ins><span class="cx">             maximumColumnIndex = std::max(maximumColumnIndex, spanSize);
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="lines">@@ -1244,7 +1244,7 @@
</span><span class="cx"> {
</span><span class="cx">     GridTrackSizingDirection crossDirection = specifiedDirection == ForColumns ? ForRows : ForColumns;
</span><span class="cx">     const unsigned endOfCrossDirection = crossDirection == ForColumns ? gridColumnCount() : gridRowCount();
</span><del>-    unsigned crossDirectionSpanSize = GridResolvedPosition::spanSizeForAutoPlacedItem(style(), gridItem, crossDirection);
</del><ins>+    unsigned crossDirectionSpanSize = GridPositionsResolver::spanSizeForAutoPlacedItem(style(), gridItem, crossDirection);
</ins><span class="cx">     GridSpan crossDirectionPositions = GridSpan::translatedDefiniteGridSpan(endOfCrossDirection, endOfCrossDirection + crossDirectionSpanSize);
</span><span class="cx">     return std::make_unique&lt;GridCoordinate&gt;(specifiedDirection == ForColumns ? crossDirectionPositions : specifiedPositions, specifiedDirection == ForColumns ? specifiedPositions : crossDirectionPositions);
</span><span class="cx"> }
</span><span class="lines">@@ -1263,7 +1263,7 @@
</span><span class="cx">         GridSpan majorAxisPositions = cachedGridSpan(*autoGridItem, autoPlacementMajorAxisDirection());
</span><span class="cx">         ASSERT(majorAxisPositions.isTranslatedDefinite());
</span><span class="cx">         ASSERT(cachedGridSpan(*autoGridItem, autoPlacementMinorAxisDirection()).isIndefinite());
</span><del>-        unsigned minorAxisSpanSize = GridResolvedPosition::spanSizeForAutoPlacedItem(style(), *autoGridItem, autoPlacementMinorAxisDirection());
</del><ins>+        unsigned minorAxisSpanSize = GridPositionsResolver::spanSizeForAutoPlacedItem(style(), *autoGridItem, autoPlacementMinorAxisDirection());
</ins><span class="cx">         unsigned majorAxisInitialPosition = majorAxisPositions.resolvedInitialPosition();
</span><span class="cx"> 
</span><span class="cx">         GridIterator iterator(m_grid, autoPlacementMajorAxisDirection(), majorAxisPositions.resolvedInitialPosition(), isGridAutoFlowDense ? 0 : minorAxisCursors.get(majorAxisInitialPosition));
</span><span class="lines">@@ -1297,7 +1297,7 @@
</span><span class="cx"> void RenderGrid::placeAutoMajorAxisItemOnGrid(RenderBox&amp; gridItem, AutoPlacementCursor&amp; autoPlacementCursor)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(cachedGridSpan(gridItem, autoPlacementMajorAxisDirection()).isIndefinite());
</span><del>-    unsigned majorAxisSpanSize = GridResolvedPosition::spanSizeForAutoPlacedItem(style(), gridItem, autoPlacementMajorAxisDirection());
</del><ins>+    unsigned majorAxisSpanSize = GridPositionsResolver::spanSizeForAutoPlacedItem(style(), gridItem, autoPlacementMajorAxisDirection());
</ins><span class="cx"> 
</span><span class="cx">     const unsigned endOfMajorAxis = (autoPlacementMajorAxisDirection() == ForColumns) ? gridColumnCount() : gridRowCount();
</span><span class="cx">     unsigned majorAxisAutoPlacementCursor = autoPlacementMajorAxisDirection() == ForColumns ? autoPlacementCursor.second : autoPlacementCursor.first;
</span><span class="lines">@@ -1318,7 +1318,7 @@
</span><span class="cx">         if (!emptyGridArea)
</span><span class="cx">             emptyGridArea = createEmptyGridAreaAtSpecifiedPositionsOutsideGrid(gridItem, autoPlacementMinorAxisDirection(), minorAxisPositions);
</span><span class="cx">     } else {
</span><del>-        unsigned minorAxisSpanSize = GridResolvedPosition::spanSizeForAutoPlacedItem(style(), gridItem, autoPlacementMinorAxisDirection());
</del><ins>+        unsigned minorAxisSpanSize = GridPositionsResolver::spanSizeForAutoPlacedItem(style(), gridItem, autoPlacementMinorAxisDirection());
</ins><span class="cx"> 
</span><span class="cx">         for (unsigned majorAxisIndex = majorAxisAutoPlacementCursor; majorAxisIndex &lt; endOfMajorAxis; ++majorAxisIndex) {
</span><span class="cx">             GridIterator iterator(m_grid, autoPlacementMajorAxisDirection(), majorAxisIndex, minorAxisAutoPlacementCursor);
</span><span class="lines">@@ -1486,7 +1486,7 @@
</span><span class="cx">     ASSERT(child.isHorizontalWritingMode() == isHorizontalWritingMode());
</span><span class="cx">     bool isRowAxis = direction == ForColumns;
</span><span class="cx"> 
</span><del>-    GridSpan positions = GridResolvedPosition::resolveGridPositionsFromStyle(style(), child, direction);
</del><ins>+    GridSpan positions = GridPositionsResolver::resolveGridPositionsFromStyle(style(), child, direction);
</ins><span class="cx">     if (positions.isIndefinite()) {
</span><span class="cx">         offset = LayoutUnit();
</span><span class="cx">         breadth = isRowAxis ? clientLogicalWidth() : clientLogicalHeight();
</span><span class="lines">@@ -1501,14 +1501,14 @@
</span><span class="cx">     GridPosition startPosition = isRowAxis ? child.style().gridItemColumnStart() : child.style().gridItemRowStart();
</span><span class="cx">     GridPosition endPosition = isRowAxis ? child.style().gridItemColumnEnd() : child.style().gridItemRowEnd();
</span><span class="cx">     int firstExplicitLine = smallestStart;
</span><del>-    int lastExplicitLine = (isRowAxis ? GridResolvedPosition::explicitGridColumnCount(style()) : GridResolvedPosition::explicitGridRowCount(style())) + smallestStart;
</del><ins>+    int lastExplicitLine = (isRowAxis ? GridPositionsResolver::explicitGridColumnCount(style()) : GridPositionsResolver::explicitGridRowCount(style())) + smallestStart;
</ins><span class="cx"> 
</span><span class="cx">     bool startIsAuto = startPosition.isAuto()
</span><del>-        || (startPosition.isNamedGridArea() &amp;&amp; GridResolvedPosition::isNonExistentNamedLineOrArea(startPosition.namedGridLine(), style(), (direction == ForColumns) ? ColumnStartSide : RowStartSide))
</del><ins>+        || (startPosition.isNamedGridArea() &amp;&amp; GridPositionsResolver::isNonExistentNamedLineOrArea(startPosition.namedGridLine(), style(), (direction == ForColumns) ? ColumnStartSide : RowStartSide))
</ins><span class="cx">         || (resolvedInitialPosition &lt; firstExplicitLine)
</span><span class="cx">         || (resolvedInitialPosition &gt; lastExplicitLine);
</span><span class="cx">     bool endIsAuto = endPosition.isAuto()
</span><del>-        || (endPosition.isNamedGridArea() &amp;&amp; GridResolvedPosition::isNonExistentNamedLineOrArea(endPosition.namedGridLine(), style(), (direction == ForColumns) ? ColumnEndSide : RowEndSide))
</del><ins>+        || (endPosition.isNamedGridArea() &amp;&amp; GridPositionsResolver::isNonExistentNamedLineOrArea(endPosition.namedGridLine(), style(), (direction == ForColumns) ? ColumnEndSide : RowEndSide))
</ins><span class="cx">         || (resolvedFinalPosition &lt; firstExplicitLine)
</span><span class="cx">         || (resolvedFinalPosition &gt; lastExplicitLine);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderGridh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderGrid.h (198206 => 198207)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderGrid.h        2016-03-15 08:59:01 UTC (rev 198206)
+++ trunk/Source/WebCore/rendering/RenderGrid.h        2016-03-15 10:38:43 UTC (rev 198207)
</span><span class="lines">@@ -29,7 +29,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(CSS_GRID_LAYOUT)
</span><span class="cx"> 
</span><del>-#include &quot;GridResolvedPosition.h&quot;
</del><ins>+#include &quot;GridPositionsResolver.h&quot;
</ins><span class="cx"> #include &quot;OrderIterator.h&quot;
</span><span class="cx"> #include &quot;RenderBlock.h&quot;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingstyleGridCoordinateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/style/GridCoordinate.h (198206 => 198207)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/style/GridCoordinate.h        2016-03-15 08:59:01 UTC (rev 198206)
+++ trunk/Source/WebCore/rendering/style/GridCoordinate.h        2016-03-15 10:38:43 UTC (rev 198207)
</span><span class="lines">@@ -34,7 +34,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(CSS_GRID_LAYOUT)
</span><span class="cx"> 
</span><del>-#include &quot;GridResolvedPosition.h&quot;
</del><ins>+#include &quot;GridPositionsResolver.h&quot;
</ins><span class="cx"> #include &lt;wtf/HashMap.h&gt;
</span><span class="cx"> #include &lt;wtf/text/WTFString.h&gt;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingstyleGridPositionsResolvercppfromrev198206trunkSourceWebCorerenderingstyleGridResolvedPositioncpp"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/rendering/style/GridPositionsResolver.cpp (from rev 198206, trunk/Source/WebCore/rendering/style/GridResolvedPosition.cpp) (0 => 198207)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/style/GridPositionsResolver.cpp                                (rev 0)
+++ trunk/Source/WebCore/rendering/style/GridPositionsResolver.cpp        2016-03-15 10:38:43 UTC (rev 198207)
</span><span class="lines">@@ -0,0 +1,334 @@
</span><ins>+/*
+ * Copyright (C) 2014-2016 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
+ * &quot;AS IS&quot; 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 &quot;config.h&quot;
+#include &quot;GridPositionsResolver.h&quot;
+
+#if ENABLE(CSS_GRID_LAYOUT)
+
+#include &quot;GridCoordinate.h&quot;
+#include &quot;RenderBox.h&quot;
+#include &lt;cstdlib&gt;
+
+namespace WebCore {
+
+static inline bool isColumnSide(GridPositionSide side)
+{
+    return side == ColumnStartSide || side == ColumnEndSide;
+}
+
+static inline bool isStartSide(GridPositionSide side)
+{
+    return side == ColumnStartSide || side == RowStartSide;
+}
+
+static inline GridPositionSide initialPositionSide(GridTrackSizingDirection direction)
+{
+    return direction == ForColumns ? ColumnStartSide : RowStartSide;
+}
+
+static inline GridPositionSide finalPositionSide(GridTrackSizingDirection direction)
+{
+    return direction == ForColumns ? ColumnEndSide : RowEndSide;
+}
+
+static const NamedGridLinesMap&amp; gridLinesForSide(const RenderStyle&amp; style, GridPositionSide side)
+{
+    return isColumnSide(side) ? style.namedGridColumnLines() : style.namedGridRowLines();
+}
+
+static const String implicitNamedGridLineForSide(const String&amp; lineName, GridPositionSide side)
+{
+    return lineName + (isStartSide(side) ? &quot;-start&quot; : &quot;-end&quot;);
+}
+
+bool GridPositionsResolver::isNonExistentNamedLineOrArea(const String&amp; lineName, const RenderStyle&amp; style, GridPositionSide side)
+{
+    const NamedGridLinesMap&amp; gridLineNames = gridLinesForSide(style, side);
+    return !gridLineNames.contains(implicitNamedGridLineForSide(lineName, side)) &amp;&amp; !gridLineNames.contains(lineName);
+}
+
+static void adjustGridPositionsFromStyle(const RenderStyle&amp; gridContainerStyle, const RenderBox&amp; gridItem, GridTrackSizingDirection direction, GridPosition&amp; initialPosition, GridPosition&amp; finalPosition)
+{
+    bool isForColumns = direction == ForColumns;
+    initialPosition = isForColumns ? gridItem.style().gridItemColumnStart() : gridItem.style().gridItemRowStart();
+    finalPosition = isForColumns ? gridItem.style().gridItemColumnEnd() : gridItem.style().gridItemRowEnd();
+
+    // We must handle the placement error handling code here instead of in the StyleAdjuster because we don't want to
+    // overwrite the specified values.
+    if (initialPosition.isSpan() &amp;&amp; finalPosition.isSpan())
+        finalPosition.setAutoPosition();
+
+    if (gridItem.isOutOfFlowPositioned()) {
+        // Early detect the case of non existing named grid lines for positioned items.
+        if (initialPosition.isNamedGridArea() &amp;&amp; GridPositionsResolver::isNonExistentNamedLineOrArea(initialPosition.namedGridLine(), gridContainerStyle, initialPositionSide(direction)))
+            initialPosition.setAutoPosition();
+
+        if (finalPosition.isNamedGridArea() &amp;&amp; GridPositionsResolver::isNonExistentNamedLineOrArea(finalPosition.namedGridLine(), gridContainerStyle, finalPositionSide(direction)))
+            finalPosition.setAutoPosition();
+    }
+
+    // If the grid item has an automatic position and a grid span for a named line in a given dimension, instead treat the grid span as one.
+    if (initialPosition.isAuto() &amp;&amp; finalPosition.isSpan() &amp;&amp; !finalPosition.namedGridLine().isNull())
+        finalPosition.setSpanPosition(1, String());
+    if (finalPosition.isAuto() &amp;&amp; initialPosition.isSpan() &amp;&amp; !initialPosition.namedGridLine().isNull())
+        initialPosition.setSpanPosition(1, String());
+}
+
+unsigned GridPositionsResolver::explicitGridColumnCount(const RenderStyle&amp; gridContainerStyle)
+{
+    return std::min&lt;unsigned&gt;(gridContainerStyle.gridColumns().size(), kGridMaxTracks);
+}
+
+unsigned GridPositionsResolver::explicitGridRowCount(const RenderStyle&amp; gridContainerStyle)
+{
+    return std::min&lt;unsigned&gt;(gridContainerStyle.gridRows().size(), kGridMaxTracks);
+}
+
+static unsigned explicitGridSizeForSide(const RenderStyle&amp; gridContainerStyle, GridPositionSide side)
+{
+    return isColumnSide(side) ? GridPositionsResolver::explicitGridColumnCount(gridContainerStyle) : GridPositionsResolver::explicitGridRowCount(gridContainerStyle);
+}
+
+static unsigned lookAheadForNamedGridLine(int start, unsigned numberOfLines, const Vector&lt;unsigned&gt;* namedGridLinesIndexes, unsigned gridLastLine)
+{
+    ASSERT(numberOfLines);
+
+    // Only implicit lines on the search direction are assumed to have the given name, so we can start to look from first line.
+    // See: https://drafts.csswg.org/css-grid/#grid-placement-span-int
+    unsigned end = std::max(start, 0);
+
+    if (!namedGridLinesIndexes)
+        return std::max(end, gridLastLine + 1) + numberOfLines - 1;
+
+    for (; numberOfLines; ++end) {
+        if (end &gt; gridLastLine || namedGridLinesIndexes-&gt;contains(end))
+            numberOfLines--;
+    }
+
+    ASSERT(end);
+    return end - 1;
+}
+
+static int lookBackForNamedGridLine(int end, unsigned numberOfLines, const Vector&lt;unsigned&gt;* namedGridLinesIndexes, int gridLastLine)
+{
+    ASSERT(numberOfLines);
+
+    // Only implicit lines on the search direction are assumed to have the given name, so we can start to look from last line.
+    // See: https://drafts.csswg.org/css-grid/#grid-placement-span-int
+    int start = std::min(end, gridLastLine);
+
+    if (!namedGridLinesIndexes)
+        return std::min(start, -1) - numberOfLines + 1;
+
+    for (; numberOfLines; --start) {
+        if (start &lt; 0 || namedGridLinesIndexes-&gt;contains(static_cast&lt;size_t&gt;(start)))
+            numberOfLines--;
+    }
+
+    return start + 1;
+}
+
+static int resolveNamedGridLinePositionFromStyle(const RenderStyle&amp; gridContainerStyle, const GridPosition&amp; position, GridPositionSide side)
+{
+    ASSERT(!position.namedGridLine().isNull());
+
+    const NamedGridLinesMap&amp; gridLinesNames = isColumnSide(side) ? gridContainerStyle.namedGridColumnLines() : gridContainerStyle.namedGridRowLines();
+    auto iterator = gridLinesNames.find(position.namedGridLine());
+    const Vector&lt;unsigned&gt;* gridLines = iterator == gridLinesNames.end() ? nullptr : &amp;iterator-&gt;value;
+    unsigned lastLine = explicitGridSizeForSide(gridContainerStyle, side);
+    if (position.isPositive())
+        return lookAheadForNamedGridLine(0, std::abs(position.integerPosition()), gridLines, lastLine);
+    return lookBackForNamedGridLine(lastLine, std::abs(position.integerPosition()), gridLines, lastLine);
+}
+
+static GridSpan definiteGridSpanWithNamedLineSpanAgainstOpposite(int resolvedOppositePosition, const GridPosition&amp; position, GridPositionSide side, const Vector&lt;unsigned&gt;* gridLines, unsigned lastLine)
+{
+    int start, end;
+
+    if (side == RowStartSide || side == ColumnStartSide) {
+        start = lookBackForNamedGridLine(resolvedOppositePosition - 1, position.spanPosition(), gridLines, lastLine);
+        end = resolvedOppositePosition;
+    } else {
+        start = resolvedOppositePosition;
+        end = lookAheadForNamedGridLine(resolvedOppositePosition + 1, position.spanPosition(), gridLines, lastLine);
+    }
+
+    return GridSpan::untranslatedDefiniteGridSpan(start, end);
+}
+
+static GridSpan resolveNamedGridLinePositionAgainstOppositePosition(const RenderStyle&amp; gridContainerStyle, int resolvedOppositePosition, const GridPosition&amp; position, GridPositionSide side)
+{
+    ASSERT(position.isSpan());
+    ASSERT(!position.namedGridLine().isNull());
+    // Negative positions are not allowed per the specification and should have been handled during parsing.
+    ASSERT(position.spanPosition() &gt; 0);
+
+    const NamedGridLinesMap&amp; gridLinesNames = isColumnSide(side) ? gridContainerStyle.namedGridColumnLines() : gridContainerStyle.namedGridRowLines();
+    auto iterator = gridLinesNames.find(position.namedGridLine());
+    const Vector&lt;unsigned&gt;* gridLines = iterator == gridLinesNames.end() ? nullptr : &amp;iterator-&gt;value;
+    unsigned lastLine = explicitGridSizeForSide(gridContainerStyle, side);
+
+    return definiteGridSpanWithNamedLineSpanAgainstOpposite(resolvedOppositePosition, position, side, gridLines, lastLine);
+}
+
+static GridSpan resolveGridPositionAgainstOppositePosition(const RenderStyle&amp; gridContainerStyle, int resolvedOppositePosition, const GridPosition&amp; position, GridPositionSide side)
+{
+    if (position.isAuto()) {
+        if (isStartSide(side))
+            return GridSpan::untranslatedDefiniteGridSpan(resolvedOppositePosition - 1, resolvedOppositePosition);
+        return GridSpan::untranslatedDefiniteGridSpan(resolvedOppositePosition, resolvedOppositePosition + 1);
+    }
+
+    ASSERT(position.isSpan());
+    ASSERT(position.spanPosition() &gt; 0);
+
+    if (!position.namedGridLine().isNull()) {
+        // span 2 'c' -&gt; we need to find the appropriate grid line before / after our opposite position.
+        return resolveNamedGridLinePositionAgainstOppositePosition(gridContainerStyle, resolvedOppositePosition, position, side);
+    }
+
+    // 'span 1' is contained inside a single grid track regardless of the direction.
+    // That's why the CSS span value is one more than the offset we apply.
+    unsigned positionOffset = position.spanPosition();
+    if (isStartSide(side))
+        return GridSpan::untranslatedDefiniteGridSpan(resolvedOppositePosition - positionOffset, resolvedOppositePosition);
+
+    return GridSpan::untranslatedDefiniteGridSpan(resolvedOppositePosition, resolvedOppositePosition + positionOffset);
+}
+
+unsigned GridPositionsResolver::spanSizeForAutoPlacedItem(const RenderStyle&amp; gridContainerStyle, const RenderBox&amp; gridItem, GridTrackSizingDirection direction)
+{
+    GridPosition initialPosition, finalPosition;
+    adjustGridPositionsFromStyle(gridContainerStyle, gridItem, direction, initialPosition, finalPosition);
+
+    // This method will only be used when both positions need to be resolved against the opposite one.
+    ASSERT(initialPosition.shouldBeResolvedAgainstOppositePosition() &amp;&amp; finalPosition.shouldBeResolvedAgainstOppositePosition());
+
+    if (initialPosition.isAuto() &amp;&amp; finalPosition.isAuto())
+        return 1;
+
+    GridPosition position = initialPosition.isSpan() ? initialPosition : finalPosition;
+    ASSERT(position.isSpan());
+
+    ASSERT(position.spanPosition());
+    return position.spanPosition();
+}
+
+static int resolveGridPositionFromStyle(const RenderStyle&amp; gridContainerStyle, const GridPosition&amp; position, GridPositionSide side)
+{
+    switch (position.type()) {
+    case ExplicitPosition: {
+        ASSERT(position.integerPosition());
+
+        if (!position.namedGridLine().isNull())
+            return resolveNamedGridLinePositionFromStyle(gridContainerStyle, position, side);
+
+        // Handle &lt;integer&gt; explicit position.
+        if (position.isPositive())
+            return position.integerPosition() - 1;
+
+        unsigned resolvedPosition = std::abs(position.integerPosition()) - 1;
+        const unsigned endOfTrack = explicitGridSizeForSide(gridContainerStyle, side);
+
+        return endOfTrack - resolvedPosition;
+    }
+    case NamedGridAreaPosition:
+    {
+        // First attempt to match the grid area's edge to a named grid area: if there is a named line with the name
+        // ''&lt;custom-ident&gt;-start (for grid-*-start) / &lt;custom-ident&gt;-end'' (for grid-*-end), contributes the first such
+        // line to the grid item's placement.
+        String namedGridLine = position.namedGridLine();
+        ASSERT(!position.namedGridLine().isNull());
+
+        const NamedGridLinesMap&amp; gridLineNames = gridLinesForSide(gridContainerStyle, side);
+        auto implicitLine = gridLineNames.find(implicitNamedGridLineForSide(namedGridLine, side));
+        if (implicitLine != gridLineNames.end())
+            return implicitLine-&gt;value[0];
+
+        // Otherwise, if there is a named line with the specified name, contributes the first such line to the grid
+        // item's placement.
+        auto explicitLine = gridLineNames.find(namedGridLine);
+        if (explicitLine != gridLineNames.end())
+            return explicitLine-&gt;value[0];
+
+        ASSERT(GridPositionsResolver::isNonExistentNamedLineOrArea(namedGridLine, gridContainerStyle, side));
+        // If none of the above works specs mandate to assume that all the lines in the implicit grid have this name.
+        unsigned lastLine = explicitGridSizeForSide(gridContainerStyle, side);
+        return lastLine + 1;
+    }
+    case AutoPosition:
+    case SpanPosition:
+        // 'auto' and span depend on the opposite position for resolution (e.g. grid-row: auto / 1 or grid-column: span 3 / &quot;myHeader&quot;).
+        ASSERT_NOT_REACHED();
+        return 0;
+    }
+    ASSERT_NOT_REACHED();
+    return 0;
+}
+
+GridSpan GridPositionsResolver::resolveGridPositionsFromStyle(const RenderStyle&amp; gridContainerStyle, const RenderBox&amp; gridItem, GridTrackSizingDirection direction)
+{
+    GridPosition initialPosition, finalPosition;
+    adjustGridPositionsFromStyle(gridContainerStyle, gridItem, direction, initialPosition, finalPosition);
+
+    GridPositionSide initialSide = initialPositionSide(direction);
+    GridPositionSide finalSide = finalPositionSide(direction);
+
+    // We can't get our grid positions without running the auto placement algorithm.
+    if (initialPosition.shouldBeResolvedAgainstOppositePosition() &amp;&amp; finalPosition.shouldBeResolvedAgainstOppositePosition())
+        return GridSpan::indefiniteGridSpan();
+
+    if (initialPosition.shouldBeResolvedAgainstOppositePosition()) {
+        // Infer the position from the final position ('auto / 1' or 'span 2 / 3' case).
+        auto finalResolvedPosition = resolveGridPositionFromStyle(gridContainerStyle, finalPosition, finalSide);
+        return resolveGridPositionAgainstOppositePosition(gridContainerStyle, finalResolvedPosition, initialPosition, initialSide);
+    }
+
+    if (finalPosition.shouldBeResolvedAgainstOppositePosition()) {
+        // Infer our position from the initial position ('1 / auto' or '3 / span 2' case).
+        auto initialResolvedPosition = resolveGridPositionFromStyle(gridContainerStyle, initialPosition, initialSide);
+        return resolveGridPositionAgainstOppositePosition(gridContainerStyle, initialResolvedPosition, finalPosition, finalSide);
+    }
+
+    int resolvedInitialPosition = resolveGridPositionFromStyle(gridContainerStyle, initialPosition, initialSide);
+    int resolvedFinalPosition = resolveGridPositionFromStyle(gridContainerStyle, finalPosition, finalSide);
+
+    if (resolvedInitialPosition &gt; resolvedFinalPosition)
+        std::swap(resolvedInitialPosition, resolvedFinalPosition);
+    else if (resolvedInitialPosition == resolvedFinalPosition)
+        resolvedFinalPosition = resolvedInitialPosition + 1;
+
+    return GridSpan::untranslatedDefiniteGridSpan(resolvedInitialPosition, std::max(resolvedInitialPosition, resolvedFinalPosition));
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(CSS_GRID_LAYOUT)
</ins></span></pre></div>
<a id="trunkSourceWebCorerenderingstyleGridPositionsResolverhfromrev198206trunkSourceWebCorerenderingstyleGridResolvedPositionh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/rendering/style/GridPositionsResolver.h (from rev 198206, trunk/Source/WebCore/rendering/style/GridResolvedPosition.h) (0 => 198207)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/style/GridPositionsResolver.h                                (rev 0)
+++ trunk/Source/WebCore/rendering/style/GridPositionsResolver.h        2016-03-15 10:38:43 UTC (rev 198207)
</span><span class="lines">@@ -0,0 +1,63 @@
</span><ins>+/*
+ * Copyright (C) 2014-2016 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
+ * &quot;AS IS&quot; 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.
+ */
+
+#ifndef GridPositionsResolver_h
+#define GridPositionsResolver_h
+
+#if ENABLE(CSS_GRID_LAYOUT)
+
+#include &quot;GridPosition.h&quot;
+
+namespace WebCore {
+
+class GridSpan;
+class RenderBox;
+class RenderStyle;
+
+enum GridTrackSizingDirection {
+    ForColumns,
+    ForRows
+};
+
+// Class with all the code related to grid items positions resolution.
+class GridPositionsResolver {
+public:
+    static unsigned spanSizeForAutoPlacedItem(const RenderStyle&amp;, const RenderBox&amp;, GridTrackSizingDirection);
+    static GridSpan resolveGridPositionsFromStyle(const RenderStyle&amp;, const RenderBox&amp;, GridTrackSizingDirection);
+    static unsigned explicitGridColumnCount(const RenderStyle&amp;);
+    static unsigned explicitGridRowCount(const RenderStyle&amp;);
+    static bool isNonExistentNamedLineOrArea(const String&amp; lineName, const RenderStyle&amp;, GridPositionSide);
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(CSS_GRID_LAYOUT)
+
+#endif // GridPositionsResolver_h
</ins></span></pre></div>
<a id="trunkSourceWebCorerenderingstyleGridResolvedPositioncpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/rendering/style/GridResolvedPosition.cpp (198206 => 198207)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/style/GridResolvedPosition.cpp        2016-03-15 08:59:01 UTC (rev 198206)
+++ trunk/Source/WebCore/rendering/style/GridResolvedPosition.cpp        2016-03-15 10:38:43 UTC (rev 198207)
</span><span class="lines">@@ -1,334 +0,0 @@
</span><del>-/*
- * Copyright (C) 2014 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
- * &quot;AS IS&quot; 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 &quot;config.h&quot;
-#include &quot;GridResolvedPosition.h&quot;
-
-#if ENABLE(CSS_GRID_LAYOUT)
-
-#include &quot;GridCoordinate.h&quot;
-#include &quot;RenderBox.h&quot;
-#include &lt;cstdlib&gt;
-
-namespace WebCore {
-
-static inline bool isColumnSide(GridPositionSide side)
-{
-    return side == ColumnStartSide || side == ColumnEndSide;
-}
-
-static inline bool isStartSide(GridPositionSide side)
-{
-    return side == ColumnStartSide || side == RowStartSide;
-}
-
-static inline GridPositionSide initialPositionSide(GridTrackSizingDirection direction)
-{
-    return direction == ForColumns ? ColumnStartSide : RowStartSide;
-}
-
-static inline GridPositionSide finalPositionSide(GridTrackSizingDirection direction)
-{
-    return direction == ForColumns ? ColumnEndSide : RowEndSide;
-}
-
-static const NamedGridLinesMap&amp; gridLinesForSide(const RenderStyle&amp; style, GridPositionSide side)
-{
-    return isColumnSide(side) ? style.namedGridColumnLines() : style.namedGridRowLines();
-}
-
-static const String implicitNamedGridLineForSide(const String&amp; lineName, GridPositionSide side)
-{
-    return lineName + (isStartSide(side) ? &quot;-start&quot; : &quot;-end&quot;);
-}
-
-bool GridResolvedPosition::isNonExistentNamedLineOrArea(const String&amp; lineName, const RenderStyle&amp; style, GridPositionSide side)
-{
-    const NamedGridLinesMap&amp; gridLineNames = gridLinesForSide(style, side);
-    return !gridLineNames.contains(implicitNamedGridLineForSide(lineName, side)) &amp;&amp; !gridLineNames.contains(lineName);
-}
-
-static void adjustGridPositionsFromStyle(const RenderStyle&amp; gridContainerStyle, const RenderBox&amp; gridItem, GridTrackSizingDirection direction, GridPosition&amp; initialPosition, GridPosition&amp; finalPosition)
-{
-    bool isForColumns = direction == ForColumns;
-    initialPosition = isForColumns ? gridItem.style().gridItemColumnStart() : gridItem.style().gridItemRowStart();
-    finalPosition = isForColumns ? gridItem.style().gridItemColumnEnd() : gridItem.style().gridItemRowEnd();
-
-    // We must handle the placement error handling code here instead of in the StyleAdjuster because we don't want to
-    // overwrite the specified values.
-    if (initialPosition.isSpan() &amp;&amp; finalPosition.isSpan())
-        finalPosition.setAutoPosition();
-
-    if (gridItem.isOutOfFlowPositioned()) {
-        // Early detect the case of non existing named grid lines for positioned items.
-        if (initialPosition.isNamedGridArea() &amp;&amp; GridResolvedPosition::isNonExistentNamedLineOrArea(initialPosition.namedGridLine(), gridContainerStyle, initialPositionSide(direction)))
-            initialPosition.setAutoPosition();
-
-        if (finalPosition.isNamedGridArea() &amp;&amp; GridResolvedPosition::isNonExistentNamedLineOrArea(finalPosition.namedGridLine(), gridContainerStyle, finalPositionSide(direction)))
-            finalPosition.setAutoPosition();
-    }
-
-    // If the grid item has an automatic position and a grid span for a named line in a given dimension, instead treat the grid span as one.
-    if (initialPosition.isAuto() &amp;&amp; finalPosition.isSpan() &amp;&amp; !finalPosition.namedGridLine().isNull())
-        finalPosition.setSpanPosition(1, String());
-    if (finalPosition.isAuto() &amp;&amp; initialPosition.isSpan() &amp;&amp; !initialPosition.namedGridLine().isNull())
-        initialPosition.setSpanPosition(1, String());
-}
-
-unsigned GridResolvedPosition::explicitGridColumnCount(const RenderStyle&amp; gridContainerStyle)
-{
-    return std::min&lt;unsigned&gt;(gridContainerStyle.gridColumns().size(), kGridMaxTracks);
-}
-
-unsigned GridResolvedPosition::explicitGridRowCount(const RenderStyle&amp; gridContainerStyle)
-{
-    return std::min&lt;unsigned&gt;(gridContainerStyle.gridRows().size(), kGridMaxTracks);
-}
-
-static unsigned explicitGridSizeForSide(const RenderStyle&amp; gridContainerStyle, GridPositionSide side)
-{
-    return isColumnSide(side) ? GridResolvedPosition::explicitGridColumnCount(gridContainerStyle) : GridResolvedPosition::explicitGridRowCount(gridContainerStyle);
-}
-
-static unsigned lookAheadForNamedGridLine(int start, unsigned numberOfLines, const Vector&lt;unsigned&gt;* namedGridLinesIndexes, unsigned gridLastLine)
-{
-    ASSERT(numberOfLines);
-
-    // Only implicit lines on the search direction are assumed to have the given name, so we can start to look from first line.
-    // See: https://drafts.csswg.org/css-grid/#grid-placement-span-int
-    unsigned end = std::max(start, 0);
-
-    if (!namedGridLinesIndexes)
-        return std::max(end, gridLastLine + 1) + numberOfLines - 1;
-
-    for (; numberOfLines; ++end) {
-        if (end &gt; gridLastLine || namedGridLinesIndexes-&gt;contains(end))
-            numberOfLines--;
-    }
-
-    ASSERT(end);
-    return end - 1;
-}
-
-static int lookBackForNamedGridLine(int end, unsigned numberOfLines, const Vector&lt;unsigned&gt;* namedGridLinesIndexes, int gridLastLine)
-{
-    ASSERT(numberOfLines);
-
-    // Only implicit lines on the search direction are assumed to have the given name, so we can start to look from last line.
-    // See: https://drafts.csswg.org/css-grid/#grid-placement-span-int
-    int start = std::min(end, gridLastLine);
-
-    if (!namedGridLinesIndexes)
-        return std::min(start, -1) - numberOfLines + 1;
-
-    for (; numberOfLines; --start) {
-        if (start &lt; 0 || namedGridLinesIndexes-&gt;contains(static_cast&lt;size_t&gt;(start)))
-            numberOfLines--;
-    }
-
-    return start + 1;
-}
-
-static int resolveNamedGridLinePositionFromStyle(const RenderStyle&amp; gridContainerStyle, const GridPosition&amp; position, GridPositionSide side)
-{
-    ASSERT(!position.namedGridLine().isNull());
-
-    const NamedGridLinesMap&amp; gridLinesNames = isColumnSide(side) ? gridContainerStyle.namedGridColumnLines() : gridContainerStyle.namedGridRowLines();
-    auto iterator = gridLinesNames.find(position.namedGridLine());
-    const Vector&lt;unsigned&gt;* gridLines = iterator == gridLinesNames.end() ? nullptr : &amp;iterator-&gt;value;
-    unsigned lastLine = explicitGridSizeForSide(gridContainerStyle, side);
-    if (position.isPositive())
-        return lookAheadForNamedGridLine(0, std::abs(position.integerPosition()), gridLines, lastLine);
-    return lookBackForNamedGridLine(lastLine, std::abs(position.integerPosition()), gridLines, lastLine);
-}
-
-static GridSpan definiteGridSpanWithNamedLineSpanAgainstOpposite(int resolvedOppositePosition, const GridPosition&amp; position, GridPositionSide side, const Vector&lt;unsigned&gt;* gridLines, unsigned lastLine)
-{
-    int start, end;
-
-    if (side == RowStartSide || side == ColumnStartSide) {
-        start = lookBackForNamedGridLine(resolvedOppositePosition - 1, position.spanPosition(), gridLines, lastLine);
-        end = resolvedOppositePosition;
-    } else {
-        start = resolvedOppositePosition;
-        end = lookAheadForNamedGridLine(resolvedOppositePosition + 1, position.spanPosition(), gridLines, lastLine);
-    }
-
-    return GridSpan::untranslatedDefiniteGridSpan(start, end);
-}
-
-static GridSpan resolveNamedGridLinePositionAgainstOppositePosition(const RenderStyle&amp; gridContainerStyle, int resolvedOppositePosition, const GridPosition&amp; position, GridPositionSide side)
-{
-    ASSERT(position.isSpan());
-    ASSERT(!position.namedGridLine().isNull());
-    // Negative positions are not allowed per the specification and should have been handled during parsing.
-    ASSERT(position.spanPosition() &gt; 0);
-
-    const NamedGridLinesMap&amp; gridLinesNames = isColumnSide(side) ? gridContainerStyle.namedGridColumnLines() : gridContainerStyle.namedGridRowLines();
-    auto iterator = gridLinesNames.find(position.namedGridLine());
-    const Vector&lt;unsigned&gt;* gridLines = iterator == gridLinesNames.end() ? nullptr : &amp;iterator-&gt;value;
-    unsigned lastLine = explicitGridSizeForSide(gridContainerStyle, side);
-
-    return definiteGridSpanWithNamedLineSpanAgainstOpposite(resolvedOppositePosition, position, side, gridLines, lastLine);
-}
-
-static GridSpan resolveGridPositionAgainstOppositePosition(const RenderStyle&amp; gridContainerStyle, int resolvedOppositePosition, const GridPosition&amp; position, GridPositionSide side)
-{
-    if (position.isAuto()) {
-        if (isStartSide(side))
-            return GridSpan::untranslatedDefiniteGridSpan(resolvedOppositePosition - 1, resolvedOppositePosition);
-        return GridSpan::untranslatedDefiniteGridSpan(resolvedOppositePosition, resolvedOppositePosition + 1);
-    }
-
-    ASSERT(position.isSpan());
-    ASSERT(position.spanPosition() &gt; 0);
-
-    if (!position.namedGridLine().isNull()) {
-        // span 2 'c' -&gt; we need to find the appropriate grid line before / after our opposite position.
-        return resolveNamedGridLinePositionAgainstOppositePosition(gridContainerStyle, resolvedOppositePosition, position, side);
-    }
-
-    // 'span 1' is contained inside a single grid track regardless of the direction.
-    // That's why the CSS span value is one more than the offset we apply.
-    unsigned positionOffset = position.spanPosition();
-    if (isStartSide(side))
-        return GridSpan::untranslatedDefiniteGridSpan(resolvedOppositePosition - positionOffset, resolvedOppositePosition);
-
-    return GridSpan::untranslatedDefiniteGridSpan(resolvedOppositePosition, resolvedOppositePosition + positionOffset);
-}
-
-unsigned GridResolvedPosition::spanSizeForAutoPlacedItem(const RenderStyle&amp; gridContainerStyle, const RenderBox&amp; gridItem, GridTrackSizingDirection direction)
-{
-    GridPosition initialPosition, finalPosition;
-    adjustGridPositionsFromStyle(gridContainerStyle, gridItem, direction, initialPosition, finalPosition);
-
-    // This method will only be used when both positions need to be resolved against the opposite one.
-    ASSERT(initialPosition.shouldBeResolvedAgainstOppositePosition() &amp;&amp; finalPosition.shouldBeResolvedAgainstOppositePosition());
-
-    if (initialPosition.isAuto() &amp;&amp; finalPosition.isAuto())
-        return 1;
-
-    GridPosition position = initialPosition.isSpan() ? initialPosition : finalPosition;
-    ASSERT(position.isSpan());
-
-    ASSERT(position.spanPosition());
-    return position.spanPosition();
-}
-
-static int resolveGridPositionFromStyle(const RenderStyle&amp; gridContainerStyle, const GridPosition&amp; position, GridPositionSide side)
-{
-    switch (position.type()) {
-    case ExplicitPosition: {
-        ASSERT(position.integerPosition());
-
-        if (!position.namedGridLine().isNull())
-            return resolveNamedGridLinePositionFromStyle(gridContainerStyle, position, side);
-
-        // Handle &lt;integer&gt; explicit position.
-        if (position.isPositive())
-            return position.integerPosition() - 1;
-
-        unsigned resolvedPosition = std::abs(position.integerPosition()) - 1;
-        const unsigned endOfTrack = explicitGridSizeForSide(gridContainerStyle, side);
-
-        return endOfTrack - resolvedPosition;
-    }
-    case NamedGridAreaPosition:
-    {
-        // First attempt to match the grid area's edge to a named grid area: if there is a named line with the name
-        // ''&lt;custom-ident&gt;-start (for grid-*-start) / &lt;custom-ident&gt;-end'' (for grid-*-end), contributes the first such
-        // line to the grid item's placement.
-        String namedGridLine = position.namedGridLine();
-        ASSERT(!position.namedGridLine().isNull());
-
-        const NamedGridLinesMap&amp; gridLineNames = gridLinesForSide(gridContainerStyle, side);
-        auto implicitLine = gridLineNames.find(implicitNamedGridLineForSide(namedGridLine, side));
-        if (implicitLine != gridLineNames.end())
-            return implicitLine-&gt;value[0];
-
-        // Otherwise, if there is a named line with the specified name, contributes the first such line to the grid
-        // item's placement.
-        auto explicitLine = gridLineNames.find(namedGridLine);
-        if (explicitLine != gridLineNames.end())
-            return explicitLine-&gt;value[0];
-
-        ASSERT(GridResolvedPosition::isNonExistentNamedLineOrArea(namedGridLine, gridContainerStyle, side));
-        // If none of the above works specs mandate to assume that all the lines in the implicit grid have this name.
-        unsigned lastLine = explicitGridSizeForSide(gridContainerStyle, side);
-        return lastLine + 1;
-    }
-    case AutoPosition:
-    case SpanPosition:
-        // 'auto' and span depend on the opposite position for resolution (e.g. grid-row: auto / 1 or grid-column: span 3 / &quot;myHeader&quot;).
-        ASSERT_NOT_REACHED();
-        return 0;
-    }
-    ASSERT_NOT_REACHED();
-    return 0;
-}
-
-GridSpan GridResolvedPosition::resolveGridPositionsFromStyle(const RenderStyle&amp; gridContainerStyle, const RenderBox&amp; gridItem, GridTrackSizingDirection direction)
-{
-    GridPosition initialPosition, finalPosition;
-    adjustGridPositionsFromStyle(gridContainerStyle, gridItem, direction, initialPosition, finalPosition);
-
-    GridPositionSide initialSide = initialPositionSide(direction);
-    GridPositionSide finalSide = finalPositionSide(direction);
-
-    // We can't get our grid positions without running the auto placement algorithm.
-    if (initialPosition.shouldBeResolvedAgainstOppositePosition() &amp;&amp; finalPosition.shouldBeResolvedAgainstOppositePosition())
-        return GridSpan::indefiniteGridSpan();
-
-    if (initialPosition.shouldBeResolvedAgainstOppositePosition()) {
-        // Infer the position from the final position ('auto / 1' or 'span 2 / 3' case).
-        auto finalResolvedPosition = resolveGridPositionFromStyle(gridContainerStyle, finalPosition, finalSide);
-        return resolveGridPositionAgainstOppositePosition(gridContainerStyle, finalResolvedPosition, initialPosition, initialSide);
-    }
-
-    if (finalPosition.shouldBeResolvedAgainstOppositePosition()) {
-        // Infer our position from the initial position ('1 / auto' or '3 / span 2' case).
-        auto initialResolvedPosition = resolveGridPositionFromStyle(gridContainerStyle, initialPosition, initialSide);
-        return resolveGridPositionAgainstOppositePosition(gridContainerStyle, initialResolvedPosition, finalPosition, finalSide);
-    }
-
-    int resolvedInitialPosition = resolveGridPositionFromStyle(gridContainerStyle, initialPosition, initialSide);
-    int resolvedFinalPosition = resolveGridPositionFromStyle(gridContainerStyle, finalPosition, finalSide);
-
-    if (resolvedInitialPosition &gt; resolvedFinalPosition)
-        std::swap(resolvedInitialPosition, resolvedFinalPosition);
-    else if (resolvedInitialPosition == resolvedFinalPosition)
-        resolvedFinalPosition = resolvedInitialPosition + 1;
-
-    return GridSpan::untranslatedDefiniteGridSpan(resolvedInitialPosition, std::max(resolvedInitialPosition, resolvedFinalPosition));
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(CSS_GRID_LAYOUT)
</del></span></pre></div>
<a id="trunkSourceWebCorerenderingstyleGridResolvedPositionh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/rendering/style/GridResolvedPosition.h (198206 => 198207)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/style/GridResolvedPosition.h        2016-03-15 08:59:01 UTC (rev 198206)
+++ trunk/Source/WebCore/rendering/style/GridResolvedPosition.h        2016-03-15 10:38:43 UTC (rev 198207)
</span><span class="lines">@@ -1,64 +0,0 @@
</span><del>-/*
- * Copyright (C) 2014 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
- * &quot;AS IS&quot; 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.
- */
-
-#ifndef GridResolvedPosition_h
-#define GridResolvedPosition_h
-
-#if ENABLE(CSS_GRID_LAYOUT)
-
-#include &quot;GridPosition.h&quot;
-
-namespace WebCore {
-
-class GridSpan;
-class RenderBox;
-class RenderStyle;
-
-enum GridTrackSizingDirection {
-    ForColumns,
-    ForRows
-};
-
-// Class with all the code related to grid items positions resolution.
-// TODO(rego): Rename class to GridPositionsResolver.
-class GridResolvedPosition {
-public:
-    static unsigned spanSizeForAutoPlacedItem(const RenderStyle&amp;, const RenderBox&amp;, GridTrackSizingDirection);
-    static GridSpan resolveGridPositionsFromStyle(const RenderStyle&amp;, const RenderBox&amp;, GridTrackSizingDirection);
-    static unsigned explicitGridColumnCount(const RenderStyle&amp;);
-    static unsigned explicitGridRowCount(const RenderStyle&amp;);
-    static bool isNonExistentNamedLineOrArea(const String&amp; lineName, const RenderStyle&amp;, GridPositionSide);
-};
-
-} // namespace WebCore
-
-#endif // ENABLE(CSS_GRID_LAYOUT)
-
-#endif // GridResolvedPosition_h
</del></span></pre></div>
<a id="trunkSourceWebCorerenderingstyleStyleAllInOnecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/style/StyleAllInOne.cpp (198206 => 198207)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/style/StyleAllInOne.cpp        2016-03-15 08:59:01 UTC (rev 198206)
+++ trunk/Source/WebCore/rendering/style/StyleAllInOne.cpp        2016-03-15 10:38:43 UTC (rev 198207)
</span><span class="lines">@@ -29,7 +29,7 @@
</span><span class="cx"> #include &quot;ContentData.cpp&quot;
</span><span class="cx"> #include &quot;CounterDirectives.cpp&quot;
</span><span class="cx"> #include &quot;FillLayer.cpp&quot;
</span><del>-#include &quot;GridResolvedPosition.cpp&quot;
</del><ins>+#include &quot;GridPositionsResolver.cpp&quot;
</ins><span class="cx"> #include &quot;KeyframeList.cpp&quot;
</span><span class="cx"> #include &quot;NinePieceImage.cpp&quot;
</span><span class="cx"> #include &quot;QuotesData.cpp&quot;
</span></span></pre>
</div>
</div>

</body>
</html>