<!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>[207460] trunk</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/207460">207460</a></dd>
<dt>Author</dt> <dd>jfernandez@igalia.com</dd>
<dt>Date</dt> <dd>2016-10-18 05:33:28 -0700 (Tue, 18 Oct 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>[css-grid] Different width of grid container between initial load and refresh
https://bugs.webkit.org/show_bug.cgi?id=163535

Reviewed by Manuel Rego Casasnovas.

Source/WebCore:

Grid's layout logic manages two different override sizes; one it's
designed to implement the grid item's stretching behavior, identified
with the concept of 'overrideContentLogicalSize'; there is another
override size, known as overrideContainingBlockContentLogicalSize,
used to implement the Grid Area abstraction, which will behave as
the actual containing block of any grid item.

During grid's layout logic these override sizes are set according
to the CSS style rules. This affects how the grid container and its
children are going to be sized during layout. Grid Tracks sizing
algorithm depends on these override sizes.

In order to ensure that the tracks sizing algorithm produces the
same results when it's run consecutively several times, we need to
clear these override sizes and perform a layout of the affected grid
items. Otherwise, the affected items will return sizing values which
depend on the override values set in the previous layout, which in
some cases, like orthogonal flows, may change through different runs
of the sizing algorithm.

Test: fast/css-grid-layout/repeating-layout-must-produce-the-same-results.html

* rendering/RenderGrid.cpp:
(WebCore::RenderGrid::layoutBlock):

LayoutTests:

Tests to ensure repeated layouts on grid elements produce the same results when using
orthogonal grid items.

* fast/css-grid-layout/repeating-layout-must-produce-the-same-results-expected.txt: Added.
* fast/css-grid-layout/repeating-layout-must-produce-the-same-results.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsfastcssgridlayoutgridtracksizingwithorthogonalflowshtml">trunk/LayoutTests/fast/css-grid-layout/grid-track-sizing-with-orthogonal-flows.html</a></li>
<li><a href="#trunkLayoutTestsfastcssgridlayoutgridtracksizingwithpercentagesandorthogonalflowshtml">trunk/LayoutTests/fast/css-grid-layout/grid-track-sizing-with-percentages-and-orthogonal-flows.html</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderGridcpp">trunk/Source/WebCore/rendering/RenderGrid.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastcssgridlayoutrepeatinglayoutmustproducethesameresultsexpectedtxt">trunk/LayoutTests/fast/css-grid-layout/repeating-layout-must-produce-the-same-results-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastcssgridlayoutrepeatinglayoutmustproducethesameresultshtml">trunk/LayoutTests/fast/css-grid-layout/repeating-layout-must-produce-the-same-results.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (207459 => 207460)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-10-18 12:30:40 UTC (rev 207459)
+++ trunk/LayoutTests/ChangeLog        2016-10-18 12:33:28 UTC (rev 207460)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2016-10-18  Javier Fernandez  &lt;jfernandez@igalia.com&gt;
+
+        [css-grid] Different width of grid container between initial load and refresh
+        https://bugs.webkit.org/show_bug.cgi?id=163535
+
+        Reviewed by Manuel Rego Casasnovas.
+
+        Tests to ensure repeated layouts on grid elements produce the same results when using
+        orthogonal grid items.
+
+        * fast/css-grid-layout/repeating-layout-must-produce-the-same-results-expected.txt: Added.
+        * fast/css-grid-layout/repeating-layout-must-produce-the-same-results.html: Added.
+
</ins><span class="cx"> 2016-10-17  Sergio Villar Senin  &lt;svillar@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [css-grid] Constrain by min|max-height on auto repeat computation
</span></span></pre></div>
<a id="trunkLayoutTestsfastcssgridlayoutgridtracksizingwithorthogonalflowshtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/css-grid-layout/grid-track-sizing-with-orthogonal-flows.html (207459 => 207460)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css-grid-layout/grid-track-sizing-with-orthogonal-flows.html        2016-10-18 12:30:40 UTC (rev 207459)
+++ trunk/LayoutTests/fast/css-grid-layout/grid-track-sizing-with-orthogonal-flows.html        2016-10-18 12:33:28 UTC (rev 207460)
</span><span class="lines">@@ -46,7 +46,7 @@
</span><span class="cx"> 
</span><span class="cx"> &lt;div class=&quot;container&quot;&gt;
</span><span class="cx">     &lt;p&gt;Grid width under &lt;b&gt;min-content&lt;/b&gt; constrain and &lt;b&gt;fixed&lt;/b&gt; height.&lt;br&gt; All grid items sized with &lt;b&gt;min-{width, height} auto&lt;/b&gt;.&lt;br&gt; Orthogonal green row track assumed as infinity, hence 10px for the column track. Actual row tracks size is different, hence overflowing. &lt;/p&gt;
</span><del>-    &lt;div class=&quot;grid itemsStart contentStart min-content height200&quot; data-expected-width=&quot;30&quot; data-expected-height=&quot;200&quot;&gt;
</del><ins>+    &lt;div class=&quot;grid itemsStart contentStart min-content height200&quot; data-expected-width=&quot;50&quot; data-expected-height=&quot;200&quot;&gt;
</ins><span class="cx">         &lt;div class=&quot;firstRowFirstColumn&quot;             data-offset-x=&quot;0&quot;  data-offset-y=&quot;0&quot;   data-expected-width=&quot;30&quot; data-expected-height=&quot;50&quot;&gt;XX XXX X XXX XX&lt;/div&gt;
</span><span class="cx">         &lt;div class=&quot;verticalLR firstRowSecondColumn&quot; data-offset-x=&quot;30&quot; data-offset-y=&quot;0&quot;   data-expected-width=&quot;40&quot; data-expected-height=&quot;105&quot;&gt;X XXX XX XXXXX XX XXX X XXXX X XX&lt;/div&gt;
</span><span class="cx">         &lt;div class=&quot;verticalLR secondRowFirstColumn&quot; data-offset-x=&quot;0&quot;  data-offset-y=&quot;105&quot; data-expected-width=&quot;20&quot; data-expected-height=&quot;95&quot;&gt;XXXX XX X XX XXX&lt;/div&gt;
</span><span class="lines">@@ -55,9 +55,9 @@
</span><span class="cx"> 
</span><span class="cx"> &lt;div class=&quot;container&quot;&gt;
</span><span class="cx">     &lt;p&gt;Grid width under &lt;b&gt;max-content&lt;/b&gt; constrain and &lt;b&gt;fixed&lt;/b&gt; height.&lt;br&gt; All grid items sized with &lt;b&gt;min-{width, height} auto&lt;/b&gt;.&lt;br&gt; Parallel blue column track sized as its max of 150x, while Orthogonal green row, assumed as infinity, sized as 10px. Since actual row tracks size is different, green column track will occupy some space initally assigned to the blue one.&lt;/p&gt;
</span><del>-    &lt;div class=&quot;grid itemsStart contentStart max-content height200&quot; data-expected-width=&quot;150&quot; data-expected-height=&quot;200&quot;&gt;
-        &lt;div class=&quot;firstRowFirstColumn&quot;             data-offset-x=&quot;0&quot;   data-offset-y=&quot;0&quot;   data-expected-width=&quot;110&quot; data-expected-height=&quot;20&quot;&gt;XX XXX X XXX XX&lt;/div&gt;
-        &lt;div class=&quot;verticalLR firstRowSecondColumn&quot; data-offset-x=&quot;110&quot; data-offset-y=&quot;0&quot;   data-expected-width=&quot;40&quot;  data-expected-height=&quot;105&quot;&gt;X XXX XX XXXXX XX XXX X XXXX X XX&lt;/div&gt;
</del><ins>+    &lt;div class=&quot;grid itemsStart contentStart max-content height200&quot; data-expected-width=&quot;170&quot; data-expected-height=&quot;200&quot;&gt;
+        &lt;div class=&quot;firstRowFirstColumn&quot;             data-offset-x=&quot;0&quot;   data-offset-y=&quot;0&quot;   data-expected-width=&quot;130&quot; data-expected-height=&quot;20&quot;&gt;XX XXX X XXX XX&lt;/div&gt;
+        &lt;div class=&quot;verticalLR firstRowSecondColumn&quot; data-offset-x=&quot;130&quot; data-offset-y=&quot;0&quot;   data-expected-width=&quot;40&quot;  data-expected-height=&quot;105&quot;&gt;X XXX XX XXXXX XX XXX X XXXX X XX&lt;/div&gt;
</ins><span class="cx">         &lt;div class=&quot;verticalLR secondRowFirstColumn&quot; data-offset-x=&quot;0&quot;   data-offset-y=&quot;105&quot; data-expected-width=&quot;20&quot;  data-expected-height=&quot;95&quot;&gt;XXXX XX X XX XXX&lt;/div&gt;
</span><span class="cx">     &lt;/div&gt;
</span><span class="cx"> &lt;/div&gt;
</span><span class="lines">@@ -64,9 +64,9 @@
</span><span class="cx"> 
</span><span class="cx"> &lt;div class=&quot;container&quot;&gt;
</span><span class="cx">     &lt;p&gt;Grid width under &lt;b&gt;fit-content&lt;/b&gt; constrain and &lt;b&gt;fixed&lt;/b&gt; height.&lt;br &gt;All grid items sized with &lt;b&gt;min-{width, height} auto&lt;/b&gt;.&lt;br&gt; Since we use assumed row tracks sizes, minimum and maximum will be the same, hence fit-content will produce the same result than max-content.&lt;/p&gt;
</span><del>-    &lt;div class=&quot;grid itemsStart contentStart fit-content height200&quot; data-expected-width=&quot;150&quot; data-expected-height=&quot;200&quot;&gt;
-        &lt;div class=&quot;firstRowFirstColumn&quot;             data-offset-x=&quot;0&quot;   data-offset-y=&quot;0&quot;   data-expected-width=&quot;110&quot; data-expected-height=&quot;20&quot;&gt;XX XXX X XXX XX&lt;/div&gt;
-        &lt;div class=&quot;verticalLR firstRowSecondColumn&quot; data-offset-x=&quot;110&quot; data-offset-y=&quot;0&quot;   data-expected-width=&quot;40&quot;  data-expected-height=&quot;105&quot;&gt;X XXX XX XXXXX XX XXX X XXXX X XX&lt;/div&gt;
</del><ins>+    &lt;div class=&quot;grid itemsStart contentStart fit-content height200&quot; data-expected-width=&quot;170&quot; data-expected-height=&quot;200&quot;&gt;
+        &lt;div class=&quot;firstRowFirstColumn&quot;             data-offset-x=&quot;0&quot;   data-offset-y=&quot;0&quot;   data-expected-width=&quot;130&quot; data-expected-height=&quot;20&quot;&gt;XX XXX X XXX XX&lt;/div&gt;
+        &lt;div class=&quot;verticalLR firstRowSecondColumn&quot; data-offset-x=&quot;130&quot; data-offset-y=&quot;0&quot;   data-expected-width=&quot;40&quot;  data-expected-height=&quot;105&quot;&gt;X XXX XX XXXXX XX XXX X XXXX X XX&lt;/div&gt;
</ins><span class="cx">         &lt;div class=&quot;verticalLR secondRowFirstColumn&quot; data-offset-x=&quot;0&quot;   data-offset-y=&quot;105&quot; data-expected-width=&quot;20&quot;  data-expected-height=&quot;95&quot;&gt;XXXX XX X XX XXX&lt;/div&gt;
</span><span class="cx">     &lt;/div&gt;
</span><span class="cx"> &lt;/div&gt;
</span><span class="lines">@@ -120,9 +120,9 @@
</span><span class="cx"> 
</span><span class="cx"> &lt;div class=&quot;container&quot;&gt;
</span><span class="cx">     &lt;p&gt;Grid width under &lt;b&gt;max-content&lt;/b&gt; constrain and &lt;b&gt;fixed&lt;/b&gt; height.&lt;br&gt; All grid items sized with &lt;b&gt;min-width: 0px, min-height: auto&lt;/b&gt;.&lt;br&gt; Since container is sized under max-content, tracks will use its maximum size.&lt;/p&gt;
</span><del>-    &lt;div class=&quot;grid itemsStart contentStart max-content height200&quot; data-expected-width=&quot;160&quot; data-expected-height=&quot;200&quot;&gt;
-        &lt;div class=&quot;minWidthZero firstRowFirstColumn&quot;               data-offset-x=&quot;0&quot;   data-offset-y=&quot;0&quot;   data-expected-width=&quot;120&quot; data-expected-height=&quot;20&quot;&gt;XX XXX X XXX XX&lt;/div&gt;
-        &lt;div class=&quot;minWidthZero verticalLR firstRowSecondColumn&quot;   data-offset-x=&quot;120&quot; data-offset-y=&quot;0&quot;   data-expected-width=&quot;40&quot;  data-expected-height=&quot;105&quot;&gt;X XXX XX XXXXX XX XXX X XXXX X XX&lt;/div&gt;
</del><ins>+    &lt;div class=&quot;grid itemsStart contentStart max-content height200&quot; data-expected-width=&quot;170&quot; data-expected-height=&quot;200&quot;&gt;
+        &lt;div class=&quot;minWidthZero firstRowFirstColumn&quot;               data-offset-x=&quot;0&quot;   data-offset-y=&quot;0&quot;   data-expected-width=&quot;130&quot; data-expected-height=&quot;20&quot;&gt;XX XXX X XXX XX&lt;/div&gt;
+        &lt;div class=&quot;minWidthZero verticalLR firstRowSecondColumn&quot;   data-offset-x=&quot;130&quot; data-offset-y=&quot;0&quot;   data-expected-width=&quot;40&quot;  data-expected-height=&quot;105&quot;&gt;X XXX XX XXXXX XX XXX X XXXX X XX&lt;/div&gt;
</ins><span class="cx">         &lt;div class=&quot;minWidthZero verticalLR secondRowFirstColumn&quot;   data-offset-x=&quot;0&quot;   data-offset-y=&quot;105&quot; data-expected-width=&quot;20&quot;  data-expected-height=&quot;95&quot;&gt;XXXX XX X XX XXX&lt;/div&gt;
</span><span class="cx">     &lt;/div&gt;
</span><span class="cx"> &lt;/div&gt;
</span></span></pre></div>
<a id="trunkLayoutTestsfastcssgridlayoutgridtracksizingwithpercentagesandorthogonalflowshtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/css-grid-layout/grid-track-sizing-with-percentages-and-orthogonal-flows.html (207459 => 207460)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css-grid-layout/grid-track-sizing-with-percentages-and-orthogonal-flows.html        2016-10-18 12:30:40 UTC (rev 207459)
+++ trunk/LayoutTests/fast/css-grid-layout/grid-track-sizing-with-percentages-and-orthogonal-flows.html        2016-10-18 12:33:28 UTC (rev 207460)
</span><span class="lines">@@ -24,7 +24,7 @@
</span><span class="cx"> 
</span><span class="cx"> &lt;p&gt;HORIZONTAL-TB container with VERTICAL-LR items.&lt;/p&gt;
</span><span class="cx"> &lt;div class=&quot;container&quot;&gt;
</span><del>-    &lt;div class=&quot;grid itemsStart contentStart fit-content&quot; data-expected-width=&quot;100&quot; data-expected-height=&quot;260&quot;&gt;
</del><ins>+    &lt;div class=&quot;grid itemsStart contentStart fit-content&quot; data-expected-width=&quot;110&quot; data-expected-height=&quot;260&quot;&gt;
</ins><span class="cx">         &lt;div class=&quot;firstRowFirstColumn   verticalLR&quot; data-offset-x=&quot;0&quot;  data-offset-y=&quot;0&quot;  data-expected-width=&quot;10&quot; data-expected-height=&quot;50&quot;&gt;X X X&lt;/div&gt;
</span><span class="cx">         &lt;div class=&quot;firstRowSecondColumn  verticalLR&quot; data-offset-x=&quot;100&quot; data-offset-y=&quot;0&quot;  data-expected-width=&quot;10&quot; data-expected-height=&quot;110&quot;&gt;X X X X X X&lt;/div&gt;
</span><span class="cx">         &lt;div class=&quot;secondRowFirstColumn  verticalLR&quot; data-offset-x=&quot;0&quot;  data-offset-y=&quot;110&quot; data-expected-width=&quot;10&quot; data-expected-height=&quot;110&quot;&gt;X X X X X X&lt;/div&gt;
</span><span class="lines">@@ -34,7 +34,7 @@
</span><span class="cx"> 
</span><span class="cx"> &lt;p&gt;HORIZONTAL-TB container with VERTICAL-RL items.&lt;/p&gt;
</span><span class="cx"> &lt;div class=&quot;container&quot;&gt;
</span><del>-    &lt;div class=&quot;grid itemsStart contentStart fit-content&quot; data-expected-width=&quot;100&quot; data-expected-height=&quot;260&quot;&gt;
</del><ins>+    &lt;div class=&quot;grid itemsStart contentStart fit-content&quot; data-expected-width=&quot;110&quot; data-expected-height=&quot;260&quot;&gt;
</ins><span class="cx">         &lt;div class=&quot;firstRowFirstColumn   verticalRL&quot; data-offset-x=&quot;0&quot;  data-offset-y=&quot;0&quot;  data-expected-width=&quot;10&quot; data-expected-height=&quot;50&quot;&gt;X X X&lt;/div&gt;
</span><span class="cx">         &lt;div class=&quot;firstRowSecondColumn  verticalRL&quot; data-offset-x=&quot;100&quot; data-offset-y=&quot;0&quot;  data-expected-width=&quot;10&quot; data-expected-height=&quot;110&quot;&gt;X X X X X X&lt;/div&gt;
</span><span class="cx">         &lt;div class=&quot;secondRowFirstColumn  verticalRL&quot; data-offset-x=&quot;0&quot;  data-offset-y=&quot;110&quot; data-expected-width=&quot;10&quot; data-expected-height=&quot;110&quot;&gt;X X X X X X&lt;/div&gt;
</span><span class="lines">@@ -44,7 +44,7 @@
</span><span class="cx"> 
</span><span class="cx"> &lt;p&gt;VERTICAL-LR container with HORIZONTAL-TB items.&lt;/p&gt;
</span><span class="cx"> &lt;div class=&quot;container&quot;&gt;
</span><del>-    &lt;div class=&quot;grid itemsStart contentStart verticalLR fit-content&quot; data-expected-width=&quot;260&quot; data-expected-height=&quot;120&quot;&gt;
</del><ins>+    &lt;div class=&quot;grid itemsStart contentStart verticalLR fit-content&quot; data-expected-width=&quot;260&quot; data-expected-height=&quot;110&quot;&gt;
</ins><span class="cx">         &lt;div class=&quot;firstRowFirstColumn   horizontalTB&quot; data-offset-x=&quot;0&quot;   data-offset-y=&quot;0&quot;  data-expected-width=&quot;50&quot; data-expected-height=&quot;10&quot;&gt;X X X&lt;/div&gt;
</span><span class="cx">         &lt;div class=&quot;firstRowSecondColumn  horizontalTB&quot; data-offset-x=&quot;0&quot; data-offset-y=&quot;100&quot; data-expected-width=&quot;110&quot; data-expected-height=&quot;10&quot;&gt;X X X X X X&lt;/div&gt;
</span><span class="cx">         &lt;div class=&quot;secondRowFirstColumn  horizontalTB&quot; data-offset-x=&quot;110&quot;   data-offset-y=&quot;0&quot;  data-expected-width=&quot;110&quot; data-expected-height=&quot;10&quot;&gt;X X X X X X&lt;/div&gt;
</span><span class="lines">@@ -54,7 +54,7 @@
</span><span class="cx"> 
</span><span class="cx"> &lt;p&gt;VERTICAL-RL container with HORIZONTAL-TB items.&lt;/p&gt;
</span><span class="cx"> &lt;div class=&quot;container&quot;&gt;
</span><del>-    &lt;div class=&quot;grid itemsStart contentStart verticalRL fit-content&quot; data-expected-width=&quot;260&quot; data-expected-height=&quot;100&quot;&gt;
</del><ins>+    &lt;div class=&quot;grid itemsStart contentStart verticalRL fit-content&quot; data-expected-width=&quot;260&quot; data-expected-height=&quot;110&quot;&gt;
</ins><span class="cx">         &lt;div class=&quot;firstRowFirstColumn   horizontalTB&quot; data-offset-x=&quot;210&quot;   data-offset-y=&quot;0&quot;  data-expected-width=&quot;50&quot; data-expected-height=&quot;10&quot;&gt;X X X&lt;/div&gt;
</span><span class="cx">         &lt;div class=&quot;firstRowSecondColumn  horizontalTB&quot; data-offset-x=&quot;150&quot; data-offset-y=&quot;100&quot; data-expected-width=&quot;110&quot; data-expected-height=&quot;10&quot;&gt;X X X X X X&lt;/div&gt;
</span><span class="cx">         &lt;div class=&quot;secondRowFirstColumn  horizontalTB&quot; data-offset-x=&quot;40&quot;   data-offset-y=&quot;0&quot;  data-expected-width=&quot;110&quot; data-expected-height=&quot;10&quot;&gt;X X X X X X&lt;/div&gt;
</span></span></pre></div>
<a id="trunkLayoutTestsfastcssgridlayoutrepeatinglayoutmustproducethesameresultsexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css-grid-layout/repeating-layout-must-produce-the-same-results-expected.txt (0 => 207460)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css-grid-layout/repeating-layout-must-produce-the-same-results-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/css-grid-layout/repeating-layout-must-produce-the-same-results-expected.txt        2016-10-18 12:33:28 UTC (rev 207460)
</span><span class="lines">@@ -0,0 +1,13 @@
</span><ins>+Regresison test for bug 628565 - Ensure that we get the same sizing results when doing several layouts.
+
+XX X
+XX X
+PASS
+
+XX X
+XX X
+PASS
+
+XX X
+XX X
+PASS
</ins></span></pre></div>
<a id="trunkLayoutTestsfastcssgridlayoutrepeatinglayoutmustproducethesameresultshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css-grid-layout/repeating-layout-must-produce-the-same-results.html (0 => 207460)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css-grid-layout/repeating-layout-must-produce-the-same-results.html                                (rev 0)
+++ trunk/LayoutTests/fast/css-grid-layout/repeating-layout-must-produce-the-same-results.html        2016-10-18 12:33:28 UTC (rev 207460)
</span><span class="lines">@@ -0,0 +1,43 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;link href=&quot;resources/grid.css&quot; rel=&quot;stylesheet&quot;&gt;
+&lt;link href=&quot;../css-intrinsic-dimensions/resources/width-keyword-classes.css&quot; rel=&quot;stylesheet&quot;&gt;
+&lt;style&gt;
+body {
+   margin: 0;
+}
+.container {
+   width: 100px;
+}
+.grid {
+  border: 5px solid;
+  grid-template-rows: 50px;
+  font: 25px/1 Ahem;
+}
+&lt;/style&gt;
+&lt;script src=&quot;../../resources/check-layout.js&quot;&gt;&lt;/script&gt;
+&lt;script&gt;
+    function runTest() {
+       document.body.offsetTop;
+       document.body.style.width = &quot;99%&quot;;
+       document.body.offsetTop;
+       document.body.style.width = &quot;100%&quot;;
+       checkLayout('.grid');
+    }
+&lt;/script&gt;
+&lt;body onload=&quot;runTest();&quot;&gt;
+&lt;p&gt;Regresison test for bug 628565 - Ensure that we get the same sizing results when doing several layouts.&lt;/p&gt;
+&lt;div class=&quot;grid fit-content&quot; data-expected-width=&quot;135&quot; data-expected-height=&quot;60&quot;&gt;
+  &lt;div class=&quot;firstRowFirstColumn verticalLR&quot; data-expected-width=&quot;50&quot; data-expected-height=&quot;50&quot;&gt;XX X&lt;/div&gt;
+  &lt;div class=&quot;firstRowSecondColumn&quot; data-expected-width=&quot;75&quot; data-expected-height=&quot;50&quot;&gt;XX X&lt;/div&gt;
+&lt;/div&gt;
+&lt;br&gt;
+&lt;div class=&quot;grid min-content&quot; data-expected-width=&quot;85&quot; data-expected-height=&quot;60&quot;&gt;
+  &lt;div class=&quot;firstRowFirstColumn verticalLR&quot; data-expected-width=&quot;50&quot; data-expected-height=&quot;50&quot;&gt;XX X&lt;/div&gt;
+  &lt;div class=&quot;firstRowSecondColumn&quot; data-expected-width=&quot;50&quot; data-expected-height=&quot;50&quot;&gt;XX X&lt;/div&gt;
+&lt;/div&gt;
+&lt;br&gt;
+&lt;div class=&quot;grid max-content&quot; data-expected-width=&quot;135&quot; data-expected-height=&quot;60&quot;&gt;
+  &lt;div class=&quot;firstRowFirstColumn verticalLR&quot; data-expected-width=&quot;50&quot; data-expected-height=&quot;50&quot;&gt;XX X&lt;/div&gt;
+  &lt;div class=&quot;firstRowSecondColumn&quot; data-expected-width=&quot;75&quot; data-expected-height=&quot;50&quot;&gt;XX X&lt;/div&gt;
+&lt;/div&gt;
+&lt;/body&gt;
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (207459 => 207460)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-10-18 12:30:40 UTC (rev 207459)
+++ trunk/Source/WebCore/ChangeLog        2016-10-18 12:33:28 UTC (rev 207460)
</span><span class="lines">@@ -1,3 +1,35 @@
</span><ins>+2016-10-18  Javier Fernandez  &lt;jfernandez@igalia.com&gt;
+
+        [css-grid] Different width of grid container between initial load and refresh
+        https://bugs.webkit.org/show_bug.cgi?id=163535
+
+        Reviewed by Manuel Rego Casasnovas.
+
+        Grid's layout logic manages two different override sizes; one it's
+        designed to implement the grid item's stretching behavior, identified
+        with the concept of 'overrideContentLogicalSize'; there is another
+        override size, known as overrideContainingBlockContentLogicalSize,
+        used to implement the Grid Area abstraction, which will behave as
+        the actual containing block of any grid item.
+
+        During grid's layout logic these override sizes are set according
+        to the CSS style rules. This affects how the grid container and its
+        children are going to be sized during layout. Grid Tracks sizing
+        algorithm depends on these override sizes.
+
+        In order to ensure that the tracks sizing algorithm produces the
+        same results when it's run consecutively several times, we need to
+        clear these override sizes and perform a layout of the affected grid
+        items. Otherwise, the affected items will return sizing values which
+        depend on the override values set in the previous layout, which in
+        some cases, like orthogonal flows, may change through different runs
+        of the sizing algorithm.
+
+        Test: fast/css-grid-layout/repeating-layout-must-produce-the-same-results.html
+
+        * rendering/RenderGrid.cpp:
+        (WebCore::RenderGrid::layoutBlock):
+
</ins><span class="cx"> 2016-10-18  Youenn Fablet  &lt;youenn@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         CachedResourceLoader should not need to remove fragment identifier
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderGridcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderGrid.cpp (207459 => 207460)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderGrid.cpp        2016-10-18 12:30:40 UTC (rev 207459)
+++ trunk/Source/WebCore/rendering/RenderGrid.cpp        2016-10-18 12:33:28 UTC (rev 207460)
</span><span class="lines">@@ -460,6 +460,19 @@
</span><span class="cx"> 
</span><span class="cx">     LayoutSize previousSize = size();
</span><span class="cx"> 
</span><ins>+    // We need to clear both own and containingBlock override sizes of orthogonal items to ensure we get the
+    // same result when grid's intrinsic size is computed again in the updateLogicalWidth call bellow.
+    if (sizesLogicalWidthToFitContent(MaxSize) || style().logicalWidth().isIntrinsicOrAuto()) {
+        for (auto* child = firstChildBox(); child; child = child-&gt;nextSiblingBox()) {
+            if (child-&gt;isOutOfFlowPositioned() || !isOrthogonalChild(*child))
+                continue;
+            child-&gt;clearOverrideSize();
+            child-&gt;clearContainingBlockOverrideSize();
+            child-&gt;setNeedsLayout();
+            child-&gt;layoutIfNeeded();
+        }
+    }
+
</ins><span class="cx">     setLogicalHeight(0);
</span><span class="cx">     updateLogicalWidth();
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>