<!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>[203252] 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/203252">203252</a></dd>
<dt>Author</dt> <dd>jfernandez@igalia.com</dd>
<dt>Date</dt> <dd>2016-07-14 16:33:13 -0700 (Thu, 14 Jul 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>[css-grid] Handle min-content/max-content with orthogonal flows
https://bugs.webkit.org/show_bug.cgi?id=159294

Reviewed by Darin Adler.

Currently there is no support for orthogonal flows in many aspects of the
Grid Layout logic.

The Grid sizing algorithm should be adapted to this scenario, hence this
patch focus on the min-content and max-content functions, used to resolve
content based track sizes.

There are still issues related to alignment and sizes using percentages,
but they will be addressed in different patches.

Tests: fast/css-grid-layout/grid-item-positioning-with-orthogonal-flows.html
       fast/css-grid-layout/grid-item-sizing-with-orthogonal-flows.html
       fast/css-grid-layout/grid-item-spanning-and-orthogonal-flows.html
       fast/css-grid-layout/grid-track-sizing-with-orthogonal-flows.html
       fast/css-grid-layout/grid-track-sizing-with-percentages-and-orthogonal-flows.html

* rendering/RenderBox.cpp:
(WebCore::RenderBox::computeLogicalWidthInRegion):
* rendering/RenderGrid.cpp:
(WebCore::RenderGrid::GridSizingData::advanceNextState):
(WebCore::RenderGrid::GridSizingData::isValidTransitionForDirection):
(WebCore::RenderGrid::computeTrackSizesForDirection):
(WebCore::RenderGrid::repeatTracksSizingIfNeeded): Added.
(WebCore::RenderGrid::layoutBlock):
(WebCore::RenderGrid::computeIntrinsicLogicalWidths):
(WebCore::RenderGrid::computeIntrinsicLogicalHeight):
(WebCore::hasOverrideContainingBlockContentSizeForChild):
(WebCore::overrideContainingBlockContentSizeForChild):
(WebCore::setOverrideContainingBlockContentSizeForChild):
(WebCore::shouldClearOverrideContainingBlockContentSizeForChild):
(WebCore::RenderGrid::gridTrackSize):
(WebCore::RenderGrid::isOrthogonalChild): Added.
(WebCore::RenderGrid::logicalHeightForChild):
(WebCore::RenderGrid::flowAwareDirectionForChild): Added.
(WebCore::RenderGrid::minSizeForChild):
(WebCore::RenderGrid::updateOverrideContainingBlockContentSizeForChild):
(WebCore::RenderGrid::minContentForChild):
(WebCore::RenderGrid::maxContentForChild):
(WebCore::RenderGrid::placeItemsOnGrid):
(WebCore::RenderGrid::layoutPositionedObject):
(WebCore::RenderGrid::offsetAndBreadthForPositionedChild):
(WebCore::RenderGrid::assumedRowsSizeForOrthogonalChild): Added.
(WebCore::RenderGrid::gridAreaBreadthForChild):
(WebCore::RenderGrid::columnAxisPositionForChild):
(WebCore::RenderGrid::rowAxisPositionForChild):
(WebCore::RenderGrid::findChildLogicalPosition):
* rendering/RenderGrid.h:
(WebCore::RenderGrid::SizingOperation): This enum has been moved to the header file.
(WebCore::RenderGrid::m_hasAnyOrthogonalChild): New class attribute to know if there are any orthogonal grid items.
(WebCore::RenderGrid::updateOverrideContainingBlockContentSizeForChild):
(WebCore::RenderGrid::logicalHeightForChild):
(WebCore::RenderGrid::gridAreaBreadthForChild):
(WebCore::RenderGrid::assumedRowsSizeForOrthogonalChild):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderBoxcpp">trunk/Source/WebCore/rendering/RenderBox.cpp</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>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (203251 => 203252)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-07-14 23:21:34 UTC (rev 203251)
+++ trunk/Source/WebCore/ChangeLog        2016-07-14 23:33:13 UTC (rev 203252)
</span><span class="lines">@@ -1,3 +1,66 @@
</span><ins>+2016-07-14  Javier Fernandez  &lt;jfernandez@igalia.com&gt;
+
+        [css-grid] Handle min-content/max-content with orthogonal flows
+        https://bugs.webkit.org/show_bug.cgi?id=159294
+
+        Reviewed by Darin Adler.
+
+        Currently there is no support for orthogonal flows in many aspects of the
+        Grid Layout logic.
+
+        The Grid sizing algorithm should be adapted to this scenario, hence this
+        patch focus on the min-content and max-content functions, used to resolve
+        content based track sizes.
+
+        There are still issues related to alignment and sizes using percentages,
+        but they will be addressed in different patches.
+
+        Tests: fast/css-grid-layout/grid-item-positioning-with-orthogonal-flows.html
+               fast/css-grid-layout/grid-item-sizing-with-orthogonal-flows.html
+               fast/css-grid-layout/grid-item-spanning-and-orthogonal-flows.html
+               fast/css-grid-layout/grid-track-sizing-with-orthogonal-flows.html
+               fast/css-grid-layout/grid-track-sizing-with-percentages-and-orthogonal-flows.html
+
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::computeLogicalWidthInRegion):
+        * rendering/RenderGrid.cpp:
+        (WebCore::RenderGrid::GridSizingData::advanceNextState):
+        (WebCore::RenderGrid::GridSizingData::isValidTransitionForDirection):
+        (WebCore::RenderGrid::computeTrackSizesForDirection):
+        (WebCore::RenderGrid::repeatTracksSizingIfNeeded): Added.
+        (WebCore::RenderGrid::layoutBlock):
+        (WebCore::RenderGrid::computeIntrinsicLogicalWidths):
+        (WebCore::RenderGrid::computeIntrinsicLogicalHeight):
+        (WebCore::hasOverrideContainingBlockContentSizeForChild):
+        (WebCore::overrideContainingBlockContentSizeForChild):
+        (WebCore::setOverrideContainingBlockContentSizeForChild):
+        (WebCore::shouldClearOverrideContainingBlockContentSizeForChild):
+        (WebCore::RenderGrid::gridTrackSize):
+        (WebCore::RenderGrid::isOrthogonalChild): Added.
+        (WebCore::RenderGrid::logicalHeightForChild):
+        (WebCore::RenderGrid::flowAwareDirectionForChild): Added.
+        (WebCore::RenderGrid::minSizeForChild):
+        (WebCore::RenderGrid::updateOverrideContainingBlockContentSizeForChild):
+        (WebCore::RenderGrid::minContentForChild):
+        (WebCore::RenderGrid::maxContentForChild):
+        (WebCore::RenderGrid::placeItemsOnGrid):
+        (WebCore::RenderGrid::layoutPositionedObject):
+        (WebCore::RenderGrid::offsetAndBreadthForPositionedChild):
+        (WebCore::RenderGrid::assumedRowsSizeForOrthogonalChild): Added.
+        (WebCore::RenderGrid::gridAreaBreadthForChild):
+        (WebCore::RenderGrid::columnAxisPositionForChild):
+        (WebCore::RenderGrid::rowAxisPositionForChild):
+        (WebCore::RenderGrid::findChildLogicalPosition):
+        * rendering/RenderGrid.h:
+        (WebCore::RenderGrid::SizingOperation): This enum has been moved to the header file.
+        (WebCore::RenderGrid::m_hasAnyOrthogonalChild): New class attribute to know if there are any orthogonal grid items.
+        (WebCore::RenderGrid::updateOverrideContainingBlockContentSizeForChild):
+        (WebCore::RenderGrid::logicalHeightForChild):
+        (WebCore::RenderGrid::gridAreaBreadthForChild):
+        (WebCore::RenderGrid::assumedRowsSizeForOrthogonalChild):
+
+
+
</ins><span class="cx"> 2016-07-14  Chris Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Use emptyString() instead of &quot;&quot; when possible
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBoxcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (203251 => 203252)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBox.cpp        2016-07-14 23:21:34 UTC (rev 203251)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp        2016-07-14 23:33:13 UTC (rev 203252)
</span><span class="lines">@@ -2408,19 +2408,20 @@
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    LayoutUnit containerWidthInInlineDirection = containerLogicalWidth;
+    if (hasPerpendicularContainingBlock)
+        containerWidthInInlineDirection = perpendicularContainingBlockLogicalHeight();
+
</ins><span class="cx">     // Width calculations
</span><span class="cx">     if (treatAsReplaced) {
</span><span class="cx">         computedValues.m_extent = logicalWidthLength.value() + borderAndPaddingLogicalWidth();
</span><span class="cx"> #if ENABLE(CSS_GRID_LAYOUT)
</span><del>-    } else if (parent()-&gt;isRenderGrid() &amp;&amp; style().logicalWidth().isAuto() &amp;&amp; style().logicalMinWidth().isAuto() &amp;&amp; style().overflowX() == OVISIBLE &amp;&amp; containerLogicalWidth &lt; minPreferredLogicalWidth()) {
</del><ins>+    } else if (parent()-&gt;isRenderGrid() &amp;&amp; style().logicalWidth().isAuto() &amp;&amp; style().logicalMinWidth().isAuto() &amp;&amp; style().overflowX() == OVISIBLE &amp;&amp; containerWidthInInlineDirection &lt; minPreferredLogicalWidth()) {
</ins><span class="cx">         // TODO (lajava) Move this logic to the LayoutGrid class.
</span><span class="cx">         // Implied minimum size of Grid items.
</span><del>-        computedValues.m_extent = constrainLogicalWidthInRegionByMinMax(minPreferredLogicalWidth(), containerLogicalWidth, cb);
</del><ins>+        computedValues.m_extent = constrainLogicalWidthInRegionByMinMax(minPreferredLogicalWidth(), containerWidthInInlineDirection, cb);
</ins><span class="cx"> #endif
</span><span class="cx">     } else {
</span><del>-        LayoutUnit containerWidthInInlineDirection = containerLogicalWidth;
-        if (hasPerpendicularContainingBlock)
-            containerWidthInInlineDirection = perpendicularContainingBlockLogicalHeight();
</del><span class="cx">         LayoutUnit preferredWidth = computeLogicalWidthInRegionUsing(MainOrPreferredSize, styleToUse.logicalWidth(), containerWidthInInlineDirection, cb, region);
</span><span class="cx">         computedValues.m_extent = constrainLogicalWidthInRegionByMinMax(preferredWidth, containerWidthInInlineDirection, cb, region);
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderGridcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderGrid.cpp (203251 => 203252)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderGrid.cpp        2016-07-14 23:21:34 UTC (rev 203251)
+++ trunk/Source/WebCore/rendering/RenderGrid.cpp        2016-07-14 23:33:13 UTC (rev 203252)
</span><span class="lines">@@ -240,6 +240,45 @@
</span><span class="cx"> 
</span><span class="cx">     SizingOperation sizingOperation { TrackSizing };
</span><span class="cx"> 
</span><ins>+    enum SizingState { ColumnSizingFirstIteration, RowSizingFirstIteration, ColumnSizingSecondIteration, RowSizingSecondIteration};
+    SizingState sizingState { ColumnSizingFirstIteration };
+    void advanceNextState()
+    {
+        switch (sizingState) {
+        case ColumnSizingFirstIteration:
+            sizingState = RowSizingFirstIteration;
+            return;
+        case RowSizingFirstIteration:
+            sizingState = ColumnSizingSecondIteration;
+            return;
+        case ColumnSizingSecondIteration:
+            sizingState = RowSizingSecondIteration;
+            return;
+        case RowSizingSecondIteration:
+            sizingState = ColumnSizingFirstIteration;
+            return;
+        }
+        ASSERT_NOT_REACHED();
+        sizingState = ColumnSizingFirstIteration;
+    }
+    bool isValidTransition(GridTrackSizingDirection direction)
+    {
+        switch (sizingState) {
+        case ColumnSizingFirstIteration:
+            return direction == ForColumns;
+        case RowSizingFirstIteration:
+            return direction == ForRows;
+        case ColumnSizingSecondIteration:
+            if (direction == ForRows)
+                sizingState = RowSizingFirstIteration;
+            return true;
+        case RowSizingSecondIteration:
+            return direction == ForRows;
+        }
+        ASSERT_NOT_REACHED();
+        return false;
+    }
+
</ins><span class="cx"> private:
</span><span class="cx">     Optional&lt;LayoutUnit&gt; freeSpaceForColumns;
</span><span class="cx">     Optional&lt;LayoutUnit&gt; freeSpaceForRows;
</span><span class="lines">@@ -357,6 +396,7 @@
</span><span class="cx"> 
</span><span class="cx"> void RenderGrid::computeTrackSizesForDirection(GridTrackSizingDirection direction, GridSizingData&amp; sizingData, LayoutUnit freeSpace)
</span><span class="cx"> {
</span><ins>+    ASSERT(sizingData.isValidTransition(direction));
</ins><span class="cx">     LayoutUnit totalGuttersSize = guttersSize(direction, direction == ForRows ? gridRowCount() : gridColumnCount());
</span><span class="cx">     sizingData.setFreeSpaceForDirection(direction, freeSpace - totalGuttersSize);
</span><span class="cx">     sizingData.sizingOperation = TrackSizing;
</span><span class="lines">@@ -364,8 +404,28 @@
</span><span class="cx">     LayoutUnit baseSizes, growthLimits;
</span><span class="cx">     computeUsedBreadthOfGridTracks(direction, sizingData, baseSizes, growthLimits);
</span><span class="cx">     ASSERT(tracksAreWiderThanMinTrackBreadth(direction, sizingData));
</span><ins>+    sizingData.advanceNextState();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void RenderGrid::repeatTracksSizingIfNeeded(GridSizingData&amp; sizingData, LayoutUnit availableSpaceForColumns, LayoutUnit availableSpaceForRows)
+{
+    ASSERT(!m_gridIsDirty);
+    ASSERT(sizingData.sizingState &gt; GridSizingData::RowSizingFirstIteration);
+
+    // In orthogonal flow cases column track's size is determined by using the computed
+    // row track's size, which it was estimated during the first cycle of the sizing
+    // algorithm. Hence we need to repeat computeUsedBreadthOfGridTracks for both,
+    // columns and rows, to determine the final values.
+    // TODO (lajava): orthogonal flows is just one of the cases which may require
+    // a new cycle of the sizing algorithm; there may be more. In addition, not all the
+    // cases with orthogonal flows require this extra cycle; we need a more specific
+    // condition to detect whether child's min-content contribution has changed or not.
+    if (m_hasAnyOrthogonalChild) {
+        computeTrackSizesForDirection(ForColumns, sizingData, availableSpaceForColumns);
+        computeTrackSizesForDirection(ForRows, sizingData, availableSpaceForRows);
+    }
+}
+
</ins><span class="cx"> void RenderGrid::layoutBlock(bool relayoutChildren, LayoutUnit)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(needsLayout());
</span><span class="lines">@@ -392,7 +452,8 @@
</span><span class="cx">     // properly resolves intrinsic sizes. We cannot do the same for heights though because many code
</span><span class="cx">     // paths inside updateLogicalHeight() require a previous call to setLogicalHeight() to resolve
</span><span class="cx">     // heights properly (like for positioned items for example).
</span><del>-    computeTrackSizesForDirection(ForColumns, sizingData, availableLogicalWidth());
</del><ins>+    LayoutUnit availableSpaceForColumns = availableLogicalWidth();
+    computeTrackSizesForDirection(ForColumns, sizingData, availableSpaceForColumns);
</ins><span class="cx"> 
</span><span class="cx">     if (logicalHeightWasIndefinite)
</span><span class="cx">         computeIntrinsicLogicalHeight(sizingData);
</span><span class="lines">@@ -405,9 +466,15 @@
</span><span class="cx"> 
</span><span class="cx">     // The above call might have changed the grid's logical height depending on min|max height restrictions.
</span><span class="cx">     // Update the sizes of the rows whose size depends on the logical height (also on definite|indefinite sizes).
</span><ins>+    LayoutUnit availableSpaceForRows = contentLogicalHeight();
</ins><span class="cx">     if (logicalHeightWasIndefinite)
</span><del>-        computeTrackSizesForDirection(ForRows, sizingData, contentLogicalHeight());
</del><ins>+        computeTrackSizesForDirection(ForRows, sizingData, availableSpaceForRows);
</ins><span class="cx"> 
</span><ins>+    // 3- If the min-content contribution of any grid items have changed based on the row
+    // sizes calculated in step 2, steps 1 and 2 are repeated with the new min-content
+    // contribution (once only).
+    repeatTracksSizingIfNeeded(sizingData, availableSpaceForColumns, availableSpaceForRows);
+
</ins><span class="cx">     // Grid container should have the minimum height of a line if it's editable. That does not affect track sizing though.
</span><span class="cx">     if (hasLineIfEmpty()) {
</span><span class="cx">         LayoutUnit minHeightForEmptyLine = borderAndPaddingLogicalHeight()
</span><span class="lines">@@ -720,6 +787,31 @@
</span><span class="cx">     return computeFlexFactorUnitSize(tracks, direction, sizingOperation, flexFactorSum, leftOverSpace, flexibleTracksIndexes);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static bool hasOverrideContainingBlockContentSizeForChild(const RenderBox&amp; child, GridTrackSizingDirection direction)
+{
+    return direction == ForColumns ? child.hasOverrideContainingBlockLogicalWidth() : child.hasOverrideContainingBlockLogicalHeight();
+}
+
+static Optional&lt;LayoutUnit&gt; overrideContainingBlockContentSizeForChild(const RenderBox&amp; child, GridTrackSizingDirection direction)
+{
+    return direction == ForColumns ? child.overrideContainingBlockContentLogicalWidth() : child.overrideContainingBlockContentLogicalHeight();
+}
+
+static void setOverrideContainingBlockContentSizeForChild(RenderBox&amp; child, GridTrackSizingDirection direction, Optional&lt;LayoutUnit&gt; size)
+{
+    if (direction == ForColumns)
+        child.setOverrideContainingBlockContentLogicalWidth(size);
+    else
+        child.setOverrideContainingBlockContentLogicalHeight(size);
+}
+
+static bool shouldClearOverrideContainingBlockContentSizeForChild(const RenderBox&amp; child, GridTrackSizingDirection direction)
+{
+    if (direction == ForColumns)
+        return child.hasRelativeLogicalWidth() || child.style().logicalWidth().isIntrinsicOrAuto();
+    return child.hasRelativeLogicalHeight() || child.style().logicalHeight().isIntrinsicOrAuto();
+}
+
</ins><span class="cx"> const GridTrackSize&amp; RenderGrid::rawGridTrackSize(GridTrackSizingDirection direction, unsigned translatedIndex) const
</span><span class="cx"> {
</span><span class="cx">     bool isRowAxis = direction == ForColumns;
</span><span class="lines">@@ -758,6 +850,7 @@
</span><span class="cx">     GridLength minTrackBreadth = trackSize.minTrackBreadth();
</span><span class="cx">     GridLength maxTrackBreadth = trackSize.maxTrackBreadth();
</span><span class="cx"> 
</span><ins>+    // FIXME: Ensure this condition for determining whether a size is indefinite or not is working correctly for orthogonal flows.
</ins><span class="cx">     if (minTrackBreadth.isPercentage() || maxTrackBreadth.isPercentage()) {
</span><span class="cx">         // If the logical width/height of the grid container is indefinite, percentage values are treated as &lt;auto&gt;.
</span><span class="cx">         // For the inline axis this only happens when we're computing the intrinsic sizes (IntrinsicSizeComputation).
</span><span class="lines">@@ -777,22 +870,30 @@
</span><span class="cx">     return GridTrackSize(minTrackBreadth, maxTrackBreadth);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-LayoutUnit RenderGrid::logicalHeightForChild(RenderBox&amp; child, GridSizingData&amp; sizingData) const
</del><ins>+bool RenderGrid::isOrthogonalChild(const RenderBox&amp; child) const
</ins><span class="cx"> {
</span><del>-    Optional&lt;LayoutUnit&gt; oldOverrideContainingBlockContentLogicalWidth = child.hasOverrideContainingBlockLogicalWidth() ? child.overrideContainingBlockContentLogicalWidth() : LayoutUnit();
-    LayoutUnit overrideContainingBlockContentLogicalWidth = gridAreaBreadthForChild(child, ForColumns, sizingData.columnTracks);
-    if (child.hasOverrideLogicalContentHeight() || child.hasRelativeLogicalHeight() || !oldOverrideContainingBlockContentLogicalWidth || oldOverrideContainingBlockContentLogicalWidth.value() != overrideContainingBlockContentLogicalWidth)
</del><ins>+    return child.isHorizontalWritingMode() != isHorizontalWritingMode();
+}
+
+GridTrackSizingDirection RenderGrid::flowAwareDirectionForChild(const RenderBox&amp; child, GridTrackSizingDirection direction) const
+{
+    return !isOrthogonalChild(child) ? direction : (direction == ForColumns ? ForRows : ForColumns);
+}
+
+LayoutUnit RenderGrid::logicalHeightForChild(RenderBox&amp; child) const
+{
+    GridTrackSizingDirection childBlockDirection = flowAwareDirectionForChild(child, ForRows);
+    // If |child| has a relative logical height, we shouldn't let it override its intrinsic height, which is
+    // what we are interested in here. Thus we need to set the block-axis override size to -1 (no possible resolution).
+    if (shouldClearOverrideContainingBlockContentSizeForChild(child, ForRows)) {
+        setOverrideContainingBlockContentSizeForChild(child, childBlockDirection, Nullopt);
</ins><span class="cx">         child.setNeedsLayout(MarkOnlyThis);
</span><ins>+    }
</ins><span class="cx"> 
</span><span class="cx">     // We need to clear the stretched height to properly compute logical height during layout.
</span><span class="cx">     if (child.needsLayout())
</span><span class="cx">         child.clearOverrideLogicalContentHeight();
</span><span class="cx"> 
</span><del>-    // If |child| has a relative logical height, we shouldn't let it override its intrinsic height, which is
-    // what we are interested in here. Thus we need to set the override logical height to Nullopt (no possible resolution).
-    if (child.hasRelativeLogicalHeight())
-        child.setOverrideContainingBlockContentLogicalHeight(Nullopt);
-
</del><span class="cx">     child.layoutIfNeeded();
</span><span class="cx">     return child.logicalHeight() + child.marginLogicalHeight();
</span><span class="cx"> }
</span><span class="lines">@@ -799,51 +900,43 @@
</span><span class="cx"> 
</span><span class="cx"> LayoutUnit RenderGrid::minSizeForChild(RenderBox&amp; child, GridTrackSizingDirection direction, GridSizingData&amp; sizingData) const
</span><span class="cx"> {
</span><del>-    bool hasOrthogonalWritingMode = child.isHorizontalWritingMode() != isHorizontalWritingMode();
-    // FIXME: Properly support orthogonal writing mode.
-    if (hasOrthogonalWritingMode)
-        return { };
-
-    bool isRowAxis = direction == ForColumns;
</del><ins>+    GridTrackSizingDirection childInlineDirection = flowAwareDirectionForChild(child, ForColumns);
+    bool isRowAxis = direction == childInlineDirection;
</ins><span class="cx">     const Length&amp; childMinSize = isRowAxis ? child.style().logicalMinWidth() : child.style().logicalMinHeight();
</span><span class="cx">     const Length&amp; childSize = isRowAxis ? child.style().logicalWidth() : child.style().logicalHeight();
</span><span class="cx">     if (!childSize.isAuto() || childMinSize.isAuto())
</span><span class="cx">         return minContentForChild(child, direction, sizingData);
</span><span class="cx"> 
</span><del>-    bool overrideLogicalWidthHasChanged = updateOverrideContainingBlockContentLogicalWidthForChild(child, sizingData);
</del><ins>+    bool overrideSizeHasChanged = updateOverrideContainingBlockContentSizeForChild(child, childInlineDirection, sizingData);
</ins><span class="cx">     if (isRowAxis) {
</span><del>-        LayoutUnit marginLogicalWidth = sizingData.sizingOperation == TrackSizing ? computeMarginLogicalSizeForChild(ForColumns, child) : marginIntrinsicLogicalWidthForChild(child);
-        return child.computeLogicalWidthInRegionUsing(MinSize, childMinSize, child.overrideContainingBlockContentLogicalWidth().valueOr(0), *this, nullptr) + marginLogicalWidth;
</del><ins>+        LayoutUnit marginLogicalWidth = sizingData.sizingOperation == TrackSizing ? computeMarginLogicalSizeForChild(childInlineDirection, child) : marginIntrinsicLogicalWidthForChild(child);
+        return child.computeLogicalWidthInRegionUsing(MinSize, childMinSize, overrideContainingBlockContentSizeForChild(child, childInlineDirection).valueOr(0), *this, nullptr) + marginLogicalWidth;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (overrideLogicalWidthHasChanged)
</del><ins>+    if (overrideSizeHasChanged &amp;&amp; (direction != ForColumns || sizingData.sizingOperation != IntrinsicSizeComputation))
</ins><span class="cx">         child.setNeedsLayout(MarkOnlyThis);
</span><span class="cx">     child.layoutIfNeeded();
</span><span class="cx">     return child.computeLogicalHeightUsing(MinSize, childMinSize, Nullopt).valueOr(0) + child.marginLogicalHeight() + child.scrollbarLogicalHeight();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool RenderGrid::updateOverrideContainingBlockContentLogicalWidthForChild(RenderBox&amp; child, GridSizingData&amp; sizingData) const
</del><ins>+bool RenderGrid::updateOverrideContainingBlockContentSizeForChild(RenderBox&amp; child, GridTrackSizingDirection direction, GridSizingData&amp; sizingData) const
</ins><span class="cx"> {
</span><del>-    LayoutUnit overrideWidth = gridAreaBreadthForChild(child, ForColumns, sizingData.columnTracks);
-    if (child.hasOverrideContainingBlockLogicalWidth() &amp;&amp; child.overrideContainingBlockContentLogicalWidth() == overrideWidth)
</del><ins>+    LayoutUnit overrideSize = gridAreaBreadthForChild(child, direction, sizingData);
+    if (hasOverrideContainingBlockContentSizeForChild(child, direction) &amp;&amp; overrideContainingBlockContentSizeForChild(child, direction) == overrideSize)
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><del>-    child.setOverrideContainingBlockContentLogicalWidth(overrideWidth);
</del><ins>+    setOverrideContainingBlockContentSizeForChild(child, direction, overrideSize);
</ins><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> LayoutUnit RenderGrid::minContentForChild(RenderBox&amp; child, GridTrackSizingDirection direction, GridSizingData&amp; sizingData) const
</span><span class="cx"> {
</span><del>-    bool hasOrthogonalWritingMode = child.isHorizontalWritingMode() != isHorizontalWritingMode();
-    // FIXME: Properly support orthogonal writing mode.
-    if (hasOrthogonalWritingMode)
-        return 0;
-
-    if (direction == ForColumns) {
</del><ins>+    GridTrackSizingDirection childInlineDirection = flowAwareDirectionForChild(child, ForColumns);
+    if (direction == childInlineDirection) {
</ins><span class="cx">         // If |child| has a relative logical width, we shouldn't let it override its intrinsic width, which is
</span><span class="cx">         // what we are interested in here. Thus we need to set the override logical width to Nullopt (no possible resolution).
</span><del>-        if (child.hasRelativeLogicalWidth())
-            child.setOverrideContainingBlockContentLogicalWidth(Nullopt);
</del><ins>+        if (shouldClearOverrideContainingBlockContentSizeForChild(child, ForColumns))
+            setOverrideContainingBlockContentSizeForChild(child, childInlineDirection, Nullopt);
</ins><span class="cx"> 
</span><span class="cx">         // FIXME: It's unclear if we should return the intrinsic width or the preferred width.
</span><span class="cx">         // See http://lists.w3.org/Archives/Public/www-style/2013Jan/0245.html
</span><span class="lines">@@ -850,23 +943,28 @@
</span><span class="cx">         return child.minPreferredLogicalWidth() + marginIntrinsicLogicalWidthForChild(child);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (updateOverrideContainingBlockContentLogicalWidthForChild(child, sizingData))
</del><ins>+    // All orthogonal flow boxes were already laid out during an early layout phase performed in FrameView::performLayout.
+    // It's true that grid track sizing was not completed at that time and it may afffect the final height of a
+    // grid item, but since it's forbidden to perform a layout during intrinsic width computation, we have to use
+    // that computed height for now.
+    if (direction == ForColumns &amp;&amp; sizingData.sizingOperation == IntrinsicSizeComputation) {
+        ASSERT(isOrthogonalChild(child));
+        return child.logicalHeight() + child.marginLogicalHeight();
+    }
+
+    if (updateOverrideContainingBlockContentSizeForChild(child, childInlineDirection, sizingData))
</ins><span class="cx">         child.setNeedsLayout(MarkOnlyThis);
</span><del>-    return logicalHeightForChild(child, sizingData);
</del><ins>+    return logicalHeightForChild(child);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> LayoutUnit RenderGrid::maxContentForChild(RenderBox&amp; child, GridTrackSizingDirection direction, GridSizingData&amp; sizingData) const
</span><span class="cx"> {
</span><del>-    bool hasOrthogonalWritingMode = child.isHorizontalWritingMode() != isHorizontalWritingMode();
-    // FIXME: Properly support orthogonal writing mode.
-    if (hasOrthogonalWritingMode)
-        return LayoutUnit();
-
-    if (direction == ForColumns) {
</del><ins>+    GridTrackSizingDirection childInlineDirection = flowAwareDirectionForChild(child, ForColumns);
+    if (direction == childInlineDirection) {
</ins><span class="cx">         // If |child| has a relative logical width, we shouldn't let it override its intrinsic width, which is
</span><del>-        // what we are interested in here. Thus we need to set the override logical width to Nullopt (no possible resolution).
-        if (child.hasRelativeLogicalWidth())
-            child.setOverrideContainingBlockContentLogicalWidth(Nullopt);
</del><ins>+        // what we are interested in here. Thus we need to set the inline-axis override size to -1 (no possible resolution).
+        if (shouldClearOverrideContainingBlockContentSizeForChild(child, ForColumns))
+            setOverrideContainingBlockContentSizeForChild(child, childInlineDirection, Nullopt);
</ins><span class="cx"> 
</span><span class="cx">         // FIXME: It's unclear if we should return the intrinsic width or the preferred width.
</span><span class="cx">         // See http://lists.w3.org/Archives/Public/www-style/2013Jan/0245.html
</span><span class="lines">@@ -873,9 +971,18 @@
</span><span class="cx">         return child.maxPreferredLogicalWidth() + marginIntrinsicLogicalWidthForChild(child);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (updateOverrideContainingBlockContentLogicalWidthForChild(child, sizingData))
</del><ins>+    // All orthogonal flow boxes were already laid out during an early layout phase performed in FrameView::performLayout.
+    // It's true that grid track sizing was not completed at that time and it may afffect the final height of a
+    // grid item, but since it's forbidden to perform a layout during intrinsic width computation, we have to use
+    // that computed height for now.
+    if (direction == ForColumns &amp;&amp; sizingData.sizingOperation == IntrinsicSizeComputation) {
+        ASSERT(isOrthogonalChild(child));
+        return child.logicalHeight() + child.marginLogicalHeight();
+    }
+
+    if (updateOverrideContainingBlockContentSizeForChild(child, childInlineDirection, sizingData))
</ins><span class="cx">         child.setNeedsLayout(MarkOnlyThis);
</span><del>-    return logicalHeightForChild(child, sizingData);
</del><ins>+    return logicalHeightForChild(child);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> class GridItemWithSpan {
</span><span class="lines">@@ -1329,10 +1436,13 @@
</span><span class="cx"> 
</span><span class="cx">     Vector&lt;RenderBox*&gt; autoMajorAxisAutoGridItems;
</span><span class="cx">     Vector&lt;RenderBox*&gt; specifiedMajorAxisAutoGridItems;
</span><ins>+    m_hasAnyOrthogonalChild = false;
</ins><span class="cx">     for (RenderBox* child = m_orderIterator.first(); child; child = m_orderIterator.next()) {
</span><span class="cx">         if (child-&gt;isOutOfFlowPositioned())
</span><span class="cx">             continue;
</span><span class="cx"> 
</span><ins>+        m_hasAnyOrthogonalChild = m_hasAnyOrthogonalChild || isOrthogonalChild(*child);
+
</ins><span class="cx">         GridArea area = cachedGridArea(*child);
</span><span class="cx">         if (!area.rows.isIndefinite())
</span><span class="cx">             area.rows.translate(std::abs(m_smallestRowStart));
</span><span class="lines">@@ -1634,9 +1744,8 @@
</span><span class="cx"> 
</span><span class="cx"> void RenderGrid::layoutPositionedObject(RenderBox&amp; child, bool relayoutChildren, bool fixedPositionObjectsOnly)
</span><span class="cx"> {
</span><del>-    bool hasOrthogonalWritingMode = child.isHorizontalWritingMode() != isHorizontalWritingMode();
</del><span class="cx">     // FIXME: Properly support orthogonal writing mode.
</span><del>-    if (!hasOrthogonalWritingMode) {
</del><ins>+    if (!isOrthogonalChild(child)) {
</ins><span class="cx">         LayoutUnit columnOffset = LayoutUnit();
</span><span class="cx">         LayoutUnit columnBreadth = LayoutUnit();
</span><span class="cx">         offsetAndBreadthForPositionedChild(child, ForColumns, columnOffset, columnBreadth);
</span><span class="lines">@@ -1661,7 +1770,7 @@
</span><span class="cx"> 
</span><span class="cx"> void RenderGrid::offsetAndBreadthForPositionedChild(const RenderBox&amp; child, GridTrackSizingDirection direction, LayoutUnit&amp; offset, LayoutUnit&amp; breadth)
</span><span class="cx"> {
</span><del>-    ASSERT(child.isHorizontalWritingMode() == isHorizontalWritingMode());
</del><ins>+    ASSERT(!isOrthogonalChild(child));
</ins><span class="cx">     bool isRowAxis = direction == ForColumns;
</span><span class="cx"> 
</span><span class="cx">     unsigned autoRepeatCount = autoRepeatCountForDirection(direction);
</span><span class="lines">@@ -1750,8 +1859,35 @@
</span><span class="cx">     return direction == ForColumns ? area.columns : area.rows;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-LayoutUnit RenderGrid::gridAreaBreadthForChild(const RenderBox&amp; child, GridTrackSizingDirection direction, const Vector&lt;GridTrack&gt;&amp; tracks) const
</del><ins>+LayoutUnit RenderGrid::assumedRowsSizeForOrthogonalChild(const RenderBox&amp; child, SizingOperation sizingOperation) const
</ins><span class="cx"> {
</span><ins>+    ASSERT(isOrthogonalChild(child));
+    const GridSpan&amp; span = cachedGridSpan(child, ForRows);
+    LayoutUnit gridAreaSize;
+    bool gridAreaIsIndefinite = false;
+    LayoutUnit containingBlockAvailableSize = containingBlockLogicalHeightForContent(ExcludeMarginBorderPadding);
+    for (auto trackPosition : span) {
+        const GridLength&amp; maxTrackSize = gridTrackSize(ForRows, trackPosition, sizingOperation).maxTrackBreadth();
+        if (maxTrackSize.isContentSized() || maxTrackSize.isFlex())
+            gridAreaIsIndefinite = true;
+        else
+            gridAreaSize += valueForLength(maxTrackSize.length(), containingBlockAvailableSize);
+    }
+
+    gridAreaSize += guttersSize(ForRows, span.integerSpan());
+
+    return gridAreaIsIndefinite ? std::max(child.maxPreferredLogicalWidth(), gridAreaSize) : gridAreaSize;
+}
+
+LayoutUnit RenderGrid::gridAreaBreadthForChild(const RenderBox&amp; child, GridTrackSizingDirection direction, const GridSizingData&amp; sizingData) const
+{
+    // To determine the column track's size based on an orthogonal grid item we need it's logical height, which
+    // may depend on the row track's size. It's possible that the row tracks sizing logic has not been performed yet,
+    // so we will need to do an estimation.
+    if (direction == ForRows &amp;&amp; sizingData.sizingState == GridSizingData::ColumnSizingFirstIteration)
+        return assumedRowsSizeForOrthogonalChild(child, sizingData.sizingOperation);
+
+    const Vector&lt;GridTrack&gt;&amp; tracks = direction == ForColumns ? sizingData.columnTracks : sizingData.rowTracks;
</ins><span class="cx">     const GridSpan&amp; span = cachedGridSpan(child, direction);
</span><span class="cx">     LayoutUnit gridAreaBreadth = 0;
</span><span class="cx">     for (auto trackPosition : span)
</span><span class="lines">@@ -1958,7 +2094,6 @@
</span><span class="cx"> 
</span><span class="cx"> GridAxisPosition RenderGrid::columnAxisPositionForChild(const RenderBox&amp; child) const
</span><span class="cx"> {
</span><del>-    bool hasOrthogonalWritingMode = child.isHorizontalWritingMode() != isHorizontalWritingMode();
</del><span class="cx">     bool hasSameWritingMode = child.style().writingMode() == style().writingMode();
</span><span class="cx"> 
</span><span class="cx">     switch (child.style().resolvedAlignSelf(style(), selfAlignmentNormalBehavior).position()) {
</span><span class="lines">@@ -1966,12 +2101,12 @@
</span><span class="cx">         // If orthogonal writing-modes, this computes to 'start'.
</span><span class="cx">         // FIXME: grid track sizing and positioning do not support orthogonal modes yet.
</span><span class="cx">         // self-start is based on the child's block axis direction. That's why we need to check against the grid container's block flow.
</span><del>-        return (hasOrthogonalWritingMode || hasSameWritingMode) ? GridAxisStart : GridAxisEnd;
</del><ins>+        return (isOrthogonalChild(child) || hasSameWritingMode) ? GridAxisStart : GridAxisEnd;
</ins><span class="cx">     case ItemPositionSelfEnd:
</span><span class="cx">         // If orthogonal writing-modes, this computes to 'end'.
</span><span class="cx">         // FIXME: grid track sizing and positioning do not support orthogonal modes yet.
</span><span class="cx">         // self-end is based on the child's block axis direction. That's why we need to check against the grid container's block flow.
</span><del>-        return (hasOrthogonalWritingMode || hasSameWritingMode) ? GridAxisEnd : GridAxisStart;
</del><ins>+        return (isOrthogonalChild(child) || hasSameWritingMode) ? GridAxisEnd : GridAxisStart;
</ins><span class="cx">     case ItemPositionLeft:
</span><span class="cx">         // The alignment axis (column axis) and the inline axis are parallell in
</span><span class="cx">         // orthogonal writing mode. Otherwise this this is equivalent to 'start'.
</span><span class="lines">@@ -1981,7 +2116,7 @@
</span><span class="cx">         // The alignment axis (column axis) and the inline axis are parallell in
</span><span class="cx">         // orthogonal writing mode. Otherwise this this is equivalent to 'start'.
</span><span class="cx">         // FIXME: grid track sizing and positioning do not support orthogonal modes yet.
</span><del>-        return hasOrthogonalWritingMode ? GridAxisEnd : GridAxisStart;
</del><ins>+        return isOrthogonalChild(child) ? GridAxisEnd : GridAxisStart;
</ins><span class="cx">     case ItemPositionCenter:
</span><span class="cx">         return GridAxisCenter;
</span><span class="cx">     case ItemPositionFlexStart: // Only used in flex layout, otherwise equivalent to 'start'.
</span><span class="lines">@@ -2007,7 +2142,6 @@
</span><span class="cx"> 
</span><span class="cx"> GridAxisPosition RenderGrid::rowAxisPositionForChild(const RenderBox&amp; child) const
</span><span class="cx"> {
</span><del>-    bool hasOrthogonalWritingMode = child.isHorizontalWritingMode() != isHorizontalWritingMode();
</del><span class="cx">     bool hasSameDirection = child.style().direction() == style().direction();
</span><span class="cx">     bool isLTR = style().isLeftToRightDirection();
</span><span class="cx"> 
</span><span class="lines">@@ -2016,11 +2150,11 @@
</span><span class="cx">         // For orthogonal writing-modes, this computes to 'start'
</span><span class="cx">         // FIXME: grid track sizing and positioning do not support orthogonal modes yet.
</span><span class="cx">         // self-start is based on the child's direction. That's why we need to check against the grid container's direction.
</span><del>-        return (hasOrthogonalWritingMode || hasSameDirection) ? GridAxisStart : GridAxisEnd;
</del><ins>+        return (isOrthogonalChild(child) || hasSameDirection) ? GridAxisStart : GridAxisEnd;
</ins><span class="cx">     case ItemPositionSelfEnd:
</span><span class="cx">         // For orthogonal writing-modes, this computes to 'start'
</span><span class="cx">         // FIXME: grid track sizing and positioning do not support orthogonal modes yet.
</span><del>-        return (hasOrthogonalWritingMode || hasSameDirection) ? GridAxisEnd : GridAxisStart;
</del><ins>+        return (isOrthogonalChild(child) || hasSameDirection) ? GridAxisEnd : GridAxisStart;
</ins><span class="cx">     case ItemPositionLeft:
</span><span class="cx">         return isLTR ? GridAxisStart : GridAxisEnd;
</span><span class="cx">     case ItemPositionRight:
</span><span class="lines">@@ -2225,6 +2359,7 @@
</span><span class="cx"> 
</span><span class="cx"> LayoutPoint RenderGrid::findChildLogicalPosition(const RenderBox&amp; child) const
</span><span class="cx"> {
</span><ins>+    LayoutUnit columnAxisOffset = columnAxisOffsetForChild(child);
</ins><span class="cx">     LayoutUnit rowAxisOffset = rowAxisOffsetForChild(child);
</span><span class="cx">     // We stored m_columnPositions's data ignoring the direction, hence we might need now
</span><span class="cx">     // to translate positions from RTL to LTR, as it's more convenient for painting.
</span><span class="lines">@@ -2231,7 +2366,12 @@
</span><span class="cx">     if (!style().isLeftToRightDirection())
</span><span class="cx">         rowAxisOffset = translateRTLCoordinate(rowAxisOffset) - child.logicalWidth();
</span><span class="cx"> 
</span><del>-    return LayoutPoint(rowAxisOffset, columnAxisOffsetForChild(child));
</del><ins>+    // &quot;In the positioning phase [...] calculations are performed according to the writing mode
+    // of the containing block of the box establishing the orthogonal flow.&quot; However, the
+    // resulting LayoutPoint will be used in 'setLogicalPosition' in order to set the child's
+    // logical position, which will only take into account the child's writing-mode.
+    LayoutPoint childLocation(rowAxisOffset, columnAxisOffset);
+    return isOrthogonalChild(child) ? childLocation.transposedPoint() : childLocation;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void RenderGrid::paintChildren(PaintInfo&amp; paintInfo, const LayoutPoint&amp; paintOffset, PaintInfo&amp; forChild, bool usePrintRect)
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderGridh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderGrid.h (203251 => 203252)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderGrid.h        2016-07-14 23:21:34 UTC (rev 203251)
+++ trunk/Source/WebCore/rendering/RenderGrid.h        2016-07-14 23:33:13 UTC (rev 203252)
</span><span class="lines">@@ -103,6 +103,8 @@
</span><span class="cx">     LayoutUnit computeTrackBasedLogicalHeight(const GridSizingData&amp;) const;
</span><span class="cx">     void computeTrackSizesForDirection(GridTrackSizingDirection, GridSizingData&amp;, LayoutUnit freeSpace);
</span><span class="cx"> 
</span><ins>+    void repeatTracksSizingIfNeeded(GridSizingData&amp;, LayoutUnit availableSpaceForColumns, LayoutUnit availableSpaceForRows);
+
</ins><span class="cx">     void layoutGridItems(GridSizingData&amp;);
</span><span class="cx">     void populateGridPositionsForDirection(GridSizingData&amp;, GridTrackSizingDirection);
</span><span class="cx">     void clearGrid();
</span><span class="lines">@@ -138,8 +140,8 @@
</span><span class="cx">     const GridTrackSize&amp; rawGridTrackSize(GridTrackSizingDirection, unsigned) const;
</span><span class="cx">     GridTrackSize gridTrackSize(GridTrackSizingDirection, unsigned, SizingOperation) const;
</span><span class="cx"> 
</span><del>-    bool updateOverrideContainingBlockContentLogicalWidthForChild(RenderBox&amp;, GridSizingData&amp;) const;
-    LayoutUnit logicalHeightForChild(RenderBox&amp;, GridSizingData&amp;) const;
</del><ins>+    bool updateOverrideContainingBlockContentSizeForChild(RenderBox&amp;, GridTrackSizingDirection, GridSizingData&amp;) const;
+    LayoutUnit logicalHeightForChild(RenderBox&amp;) const;
</ins><span class="cx">     LayoutUnit minSizeForChild(RenderBox&amp;, GridTrackSizingDirection, GridSizingData&amp;) const;
</span><span class="cx">     LayoutUnit minContentForChild(RenderBox&amp;, GridTrackSizingDirection, GridSizingData&amp;) const;
</span><span class="cx">     LayoutUnit maxContentForChild(RenderBox&amp;, GridTrackSizingDirection, GridSizingData&amp;) const;
</span><span class="lines">@@ -153,8 +155,9 @@
</span><span class="cx">     GridSpan cachedGridSpan(const RenderBox&amp;, GridTrackSizingDirection) const;
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-    LayoutUnit gridAreaBreadthForChild(const RenderBox&amp; child, GridTrackSizingDirection, const Vector&lt;GridTrack&gt;&amp;) const;
</del><ins>+    LayoutUnit gridAreaBreadthForChild(const RenderBox&amp; child, GridTrackSizingDirection, const GridSizingData&amp;) const;
</ins><span class="cx">     LayoutUnit gridAreaBreadthForChildIncludingAlignmentOffsets(const RenderBox&amp;, GridTrackSizingDirection, const GridSizingData&amp;) const;
</span><ins>+    LayoutUnit assumedRowsSizeForOrthogonalChild(const RenderBox&amp;, SizingOperation) const;
</ins><span class="cx"> 
</span><span class="cx">     void applyStretchAlignmentToTracksIfNeeded(GridTrackSizingDirection, GridSizingData&amp;);
</span><span class="cx"> 
</span><span class="lines">@@ -181,6 +184,9 @@
</span><span class="cx"> 
</span><span class="cx">     LayoutUnit translateRTLCoordinate(LayoutUnit) const;
</span><span class="cx"> 
</span><ins>+    bool isOrthogonalChild(const RenderBox&amp;) const;
+    GridTrackSizingDirection flowAwareDirectionForChild(const RenderBox&amp;, GridTrackSizingDirection) const;
+
</ins><span class="cx">     Vector&lt;Vector&lt;Vector&lt;RenderBox*, 1&gt;&gt;&gt; m_grid;
</span><span class="cx">     Vector&lt;LayoutUnit&gt; m_columnPositions;
</span><span class="cx">     Vector&lt;LayoutUnit&gt; m_rowPositions;
</span><span class="lines">@@ -198,6 +204,8 @@
</span><span class="cx">     unsigned m_autoRepeatColumns { 0 };
</span><span class="cx">     unsigned m_autoRepeatRows { 0 };
</span><span class="cx"> 
</span><ins>+    bool m_hasAnyOrthogonalChild;
+
</ins><span class="cx">     bool m_gridIsDirty { true };
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>