<!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>[198486] 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/198486">198486</a></dd>
<dt>Author</dt> <dd>svillar@igalia.com</dd>
<dt>Date</dt> <dd>2016-03-21 03:42:33 -0700 (Mon, 21 Mar 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>[css-grid] Fix percentage tracks' size computation in grids with gutters
https://bugs.webkit.org/show_bug.cgi?id=153825

Reviewed by Darin Adler.

Source/WebCore:

The track sizing algorithm is passed an available size
(freeSpace in the code) where to size the tracks. The total size of the grid
gutters was pre-removed from that available size because we cannot use it to size
the tracks. However that available size is also used to compute the size of
percentage tracks. As we're removing the size of the gutters, the base size for
percentage computations is smaller than it should be.

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

LayoutTests:

* fast/css-grid-layout/grid-gutters-and-flex-content-expected.txt:
* fast/css-grid-layout/grid-gutters-and-flex-content.html:
* fast/css-grid-layout/grid-gutters-and-tracks-expected.txt:
* fast/css-grid-layout/grid-gutters-and-tracks.html:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsfastcssgridlayoutgridguttersandflexcontentexpectedtxt">trunk/LayoutTests/fast/css-grid-layout/grid-gutters-and-flex-content-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastcssgridlayoutgridguttersandflexcontenthtml">trunk/LayoutTests/fast/css-grid-layout/grid-gutters-and-flex-content.html</a></li>
<li><a href="#trunkLayoutTestsfastcssgridlayoutgridguttersandtracksexpectedtxt">trunk/LayoutTests/fast/css-grid-layout/grid-gutters-and-tracks-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastcssgridlayoutgridguttersandtrackshtml">trunk/LayoutTests/fast/css-grid-layout/grid-gutters-and-tracks.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>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (198485 => 198486)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-03-21 09:46:21 UTC (rev 198485)
+++ trunk/LayoutTests/ChangeLog        2016-03-21 10:42:33 UTC (rev 198486)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2016-02-03  Sergio Villar Senin  &lt;svillar@igalia.com&gt;
+
+        [css-grid] Fix percentage tracks' size computation in grids with gutters
+        https://bugs.webkit.org/show_bug.cgi?id=153825
+
+        Reviewed by Darin Adler.
+
+        * fast/css-grid-layout/grid-gutters-and-flex-content-expected.txt:
+        * fast/css-grid-layout/grid-gutters-and-flex-content.html:
+        * fast/css-grid-layout/grid-gutters-and-tracks-expected.txt:
+        * fast/css-grid-layout/grid-gutters-and-tracks.html:
+
</ins><span class="cx"> 2016-03-20  Jinwoo Jeong  &lt;jw00.jeong@samsung.com&gt;
</span><span class="cx"> 
</span><span class="cx">         The setter of binaryType attribute in WebSocket should raise the exception.
</span></span></pre></div>
<a id="trunkLayoutTestsfastcssgridlayoutgridguttersandflexcontentexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/css-grid-layout/grid-gutters-and-flex-content-expected.txt (198485 => 198486)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css-grid-layout/grid-gutters-and-flex-content-expected.txt        2016-03-21 09:46:21 UTC (rev 198485)
+++ trunk/LayoutTests/fast/css-grid-layout/grid-gutters-and-flex-content-expected.txt        2016-03-21 10:42:33 UTC (rev 198486)
</span><span class="lines">@@ -5,6 +5,8 @@
</span><span class="cx"> PASS
</span><span class="cx"> PASS
</span><span class="cx"> PASS
</span><ins>+PASS
+PASS
</ins><span class="cx"> XXXX XXXX
</span><span class="cx"> XXX XXX
</span><span class="cx"> XXXXX XXXXX
</span></span></pre></div>
<a id="trunkLayoutTestsfastcssgridlayoutgridguttersandflexcontenthtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/css-grid-layout/grid-gutters-and-flex-content.html (198485 => 198486)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css-grid-layout/grid-gutters-and-flex-content.html        2016-03-21 09:46:21 UTC (rev 198485)
+++ trunk/LayoutTests/fast/css-grid-layout/grid-gutters-and-flex-content.html        2016-03-21 10:42:33 UTC (rev 198486)
</span><span class="lines">@@ -5,11 +5,11 @@
</span><span class="cx"> &lt;script src=&quot;../../resources/check-layout.js&quot;&gt;&lt;/script&gt;
</span><span class="cx"> &lt;script src=&quot;../../resources/js-test.js&quot;&gt;&lt;/script&gt;
</span><span class="cx"> &lt;style&gt;
</span><del>-.gridMaxFlexContent { -webkit-grid-template: 50px / minmax(30px, 2fr); }
</del><ins>+.gridPercentAndFlexContent { -webkit-grid-template: 50px / 50% minmax(30px, 2fr); }
</ins><span class="cx"> .gridTwoDoubleMaxFlexContent { -webkit-grid-template: 50px / minmax(10px, 0.5fr) minmax(10px, 2fr); }
</span><span class="cx"> .gridIgnoreSecondGridItem { -webkit-grid-template: 50px / minmax(300px, 3fr) minmax(150px, 1fr); }
</span><span class="cx"> 
</span><del>-.gridRowsMaxFlexContent { -webkit-grid-template: minmax(30px, 2fr) / 50px; }
</del><ins>+.gridRowsPercentAndFlexContent { -webkit-grid-template: minmax(30px, 2fr) 50% / 50px; }
</ins><span class="cx"> .gridRowsTwoMaxFlexContent { -webkit-grid-template: minmax(10px, 1fr) minmax(10px, 2fr) / 50px; }
</span><span class="cx"> .gridRowsTwoDoubleMaxFlexContent { -webkit-grid-template: minmax(10px, 0.5fr) minmax(10px, 2fr) / 50px; }
</span><span class="cx"> 
</span><span class="lines">@@ -43,6 +43,13 @@
</span><span class="cx">     &lt;/div&gt;
</span><span class="cx"> &lt;/div&gt;
</span><span class="cx"> 
</span><ins>+&lt;div style=&quot;width: 120px; height: 10px;&quot;&gt;
+    &lt;div class=&quot;grid gridPercentAndFlexContent gridRowColumnGaps&quot; data-expected-width=&quot;120&quot; data-expected-height=&quot;50&quot;&gt;
+        &lt;div class=&quot;sizedToGridArea firstRowFirstColumn&quot; data-expected-width=&quot;60&quot; data-expected-height=&quot;50&quot;&gt;&lt;/div&gt;
+        &lt;div class=&quot;firstRowSecondColumn&quot; data-expected-width=&quot;41&quot; data-expected-height=&quot;50&quot;&gt;&lt;/div&gt;
+    &lt;/div&gt;
+&lt;/div&gt;
+
</ins><span class="cx"> &lt;!-- Check that gutters do not interfere with flex content resolution for rows --&gt;
</span><span class="cx"> 
</span><span class="cx"> &lt;div style=&quot;width: 10px; height: 60px&quot;&gt;
</span><span class="lines">@@ -59,6 +66,13 @@
</span><span class="cx">     &lt;/div&gt;
</span><span class="cx"> &lt;/div&gt;
</span><span class="cx"> 
</span><ins>+&lt;div style=&quot;width: 10px;&quot;&gt;
+    &lt;div class=&quot;grid gridRowsPercentAndFlexContent gridRowColumnGaps&quot; style=&quot;height: 150px&quot; data-expected-width=&quot;10&quot; data-expected-height=&quot;150&quot;&gt;
+        &lt;div class=&quot;firstRowFirstColumn&quot; data-expected-width=&quot;50&quot; data-expected-height=&quot;42&quot;&gt;&lt;/div&gt;
+        &lt;div class=&quot;sizedToGridArea secondRowFirstColumn&quot; data-expected-width=&quot;50&quot; data-expected-height=&quot;75&quot;&gt;&lt;/div&gt;
+    &lt;/div&gt;
+&lt;/div&gt;
+
</ins><span class="cx"> &lt;!-- Check that gutters do not interfere with flex content resolution with content sized tracks --&gt;
</span><span class="cx"> 
</span><span class="cx"> &lt;div style=&quot;position: relative; width: 100px;&quot;&gt;
</span></span></pre></div>
<a id="trunkLayoutTestsfastcssgridlayoutgridguttersandtracksexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/css-grid-layout/grid-gutters-and-tracks-expected.txt (198485 => 198486)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css-grid-layout/grid-gutters-and-tracks-expected.txt        2016-03-21 09:46:21 UTC (rev 198485)
+++ trunk/LayoutTests/fast/css-grid-layout/grid-gutters-and-tracks-expected.txt        2016-03-21 10:42:33 UTC (rev 198486)
</span><span class="lines">@@ -44,6 +44,7 @@
</span><span class="cx"> X
</span><span class="cx"> XX XX
</span><span class="cx"> PASS
</span><ins>+PASS
</ins><span class="cx"> XXXXX
</span><span class="cx"> X
</span><span class="cx"> X
</span><span class="lines">@@ -56,3 +57,4 @@
</span><span class="cx"> PASS
</span><span class="cx"> PASS
</span><span class="cx"> PASS
</span><ins>+PASS
</ins></span></pre></div>
<a id="trunkLayoutTestsfastcssgridlayoutgridguttersandtrackshtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/css-grid-layout/grid-gutters-and-tracks.html (198485 => 198486)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css-grid-layout/grid-gutters-and-tracks.html        2016-03-21 09:46:21 UTC (rev 198485)
+++ trunk/LayoutTests/fast/css-grid-layout/grid-gutters-and-tracks.html        2016-03-21 10:42:33 UTC (rev 198486)
</span><span class="lines">@@ -20,7 +20,18 @@
</span><span class="cx"> .gridAutoAuto { -webkit-grid-template: auto auto / auto auto; }
</span><span class="cx"> .gridMultipleFixed { -webkit-grid-template: [first] 37px [foo] 57px [bar] 77px [last] / [first] 15px [foo] 25px [bar] 35px [last]; }
</span><span class="cx"> .gridFixed100 { -webkit-grid-template: repeat(2, 100px) / repeat(2, 100px); }
</span><ins>+.gridWithPercent { -webkit-grid-template: 10% 10px / 10px 20% repeat(1, 30px); }
+.gridWithDoublePercent { -webkit-grid-template: 35% 65% / 60% 40%; }
</ins><span class="cx"> 
</span><ins>+.fixedSizeGrid {
+    width: 220px;
+    height: 300px;
+}
+.gridFixedAutoTracks {
+    -webkit-grid-auto-rows: 20px;
+    -webkit-grid-auto-columns: 40px;
+}
+
</ins><span class="cx"> .thirdRowThirdColumn { -webkit-grid-area: 3 / 3; }
</span><span class="cx"> .firstRowThirdColumn { -webkit-grid-area: 1 / 3; }
</span><span class="cx"> 
</span><span class="lines">@@ -100,6 +111,14 @@
</span><span class="cx">     &lt;/div&gt;
</span><span class="cx"> &lt;/div&gt;
</span><span class="cx"> 
</span><ins>+&lt;div style=&quot;position: relative&quot;&gt;
+    &lt;div class=&quot;grid gridWithPercent fixedSizeGrid gridRowColumnGaps gridFixedAutoTracks&quot; data-expected-width=&quot;220&quot; data-expected-height=&quot;300&quot;&gt;
+        &lt;div class=&quot;firstRowFirstColumn&quot; data-offset-x=&quot;0&quot; data-offset-y=&quot;0&quot; data-expected-width=&quot;10&quot; data-expected-height=&quot;30&quot;&gt;&lt;/div&gt;
+        &lt;div class=&quot;secondRowSecondColumn&quot; data-offset-x=&quot;33&quot; data-offset-y=&quot;42&quot; data-expected-width=&quot;44&quot; data-expected-height=&quot;10&quot;&gt;&lt;/div&gt;
+        &lt;div class=&quot;thirdRowThirdColumn&quot; data-offset-x=&quot;100&quot; data-offset-y=&quot;64&quot; data-expected-width=&quot;30&quot; data-expected-height=&quot;20&quot;&gt;&lt;/div&gt;
+    &lt;/div&gt;
+&lt;/div&gt;
+
</ins><span class="cx"> &lt;!-- Check that gutters contribute to the size of spanning items. --&gt;
</span><span class="cx"> &lt;div style=&quot;position: relative&quot;&gt;
</span><span class="cx">     &lt;div class=&quot;grid gridGap gridAutoAuto constrainedContainer&quot;&gt;
</span><span class="lines">@@ -117,6 +136,14 @@
</span><span class="cx">     &lt;/div&gt;
</span><span class="cx"> &lt;/div&gt;
</span><span class="cx"> 
</span><ins>+&lt;div style=&quot;position: relative&quot;&gt;
+    &lt;div class=&quot;grid gridWithDoublePercent fixedSizeGrid gridRowColumnGaps gridFixedAutoTracks&quot; data-expected-width=&quot;220&quot; data-expected-height=&quot;300&quot;&gt;
+        &lt;div class=&quot;firstRowFirstColumn&quot; data-offset-x=&quot;0&quot; data-offset-y=&quot;0&quot; data-expected-width=&quot;132&quot; data-expected-height=&quot;105&quot;&gt;&lt;/div&gt;
+        &lt;div class=&quot;secondRowSecondColumn&quot; data-offset-x=&quot;155&quot; data-offset-y=&quot;117&quot; data-expected-width=&quot;88&quot; data-expected-height=&quot;195&quot;&gt;&lt;/div&gt;
+        &lt;div class=&quot;secondRowBothColumn&quot; data-offset-x=&quot;0&quot; data-offset-y=&quot;117&quot; data-expected-width=&quot;243&quot; data-expected-height=&quot;195&quot;&gt;&lt;/div&gt;
+    &lt;/div&gt;
+&lt;/div&gt;
+
</ins><span class="cx"> &lt;!-- Check that gutters do not interfere with margins computation. --&gt;
</span><span class="cx"> &lt;div style=&quot;position: relative&quot;&gt;
</span><span class="cx">     &lt;div class=&quot;grid gridFixed100 gridGap&quot;&gt;
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (198485 => 198486)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-03-21 09:46:21 UTC (rev 198485)
+++ trunk/Source/WebCore/ChangeLog        2016-03-21 10:42:33 UTC (rev 198486)
</span><span class="lines">@@ -1,3 +1,20 @@
</span><ins>+2016-02-03  Sergio Villar Senin  &lt;svillar@igalia.com&gt;
+
+        [css-grid] Fix percentage tracks' size computation in grids with gutters
+        https://bugs.webkit.org/show_bug.cgi?id=153825
+
+        Reviewed by Darin Adler.
+
+        The track sizing algorithm is passed an available size
+        (freeSpace in the code) where to size the tracks. The total size of the grid
+        gutters was pre-removed from that available size because we cannot use it to size
+        the tracks. However that available size is also used to compute the size of
+        percentage tracks. As we're removing the size of the gutters, the base size for
+        percentage computations is smaller than it should be.
+
+        * rendering/RenderGrid.cpp:
+        (WebCore::RenderGrid::computeUsedBreadthOfGridTracks):
+
</ins><span class="cx"> 2016-03-21  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [GTK] scrollbar thumb clipped in 2.11.92
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderGridcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderGrid.cpp (198485 => 198486)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderGrid.cpp        2016-03-21 09:46:21 UTC (rev 198485)
+++ trunk/Source/WebCore/rendering/RenderGrid.cpp        2016-03-21 10:42:33 UTC (rev 198486)
</span><span class="lines">@@ -503,7 +503,12 @@
</span><span class="cx">     Vector&lt;unsigned&gt; flexibleSizedTracksIndex;
</span><span class="cx">     sizingData.contentSizedTracksIndex.shrink(0);
</span><span class="cx"> 
</span><del>-    const LayoutUnit maxSize = initialFreeSpace.valueOr(0);
</del><ins>+    LayoutUnit maxSize = initialFreeSpace.valueOr(0);
+    // Grid gutters were removed from freeSpace by the caller (if freeSpace is definite),
+    // but we must use them to compute relative (i.e. percentages) sizes.
+    if (initialFreeSpace)
+        maxSize += guttersSize(direction, direction == ForColumns ? gridColumnCount() : gridRowCount());
+
</ins><span class="cx">     // 1. Initialize per Grid track variables.
</span><span class="cx">     for (unsigned i = 0; i &lt; tracks.size(); ++i) {
</span><span class="cx">         GridTrack&amp; track = tracks[i];
</span></span></pre>
</div>
</div>

</body>
</html>