- Revision
- 198486
- Author
- svil...@igalia.com
- Date
- 2016-03-21 03:42:33 -0700 (Mon, 21 Mar 2016)
Log Message
[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:
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (198485 => 198486)
--- trunk/LayoutTests/ChangeLog 2016-03-21 09:46:21 UTC (rev 198485)
+++ trunk/LayoutTests/ChangeLog 2016-03-21 10:42:33 UTC (rev 198486)
@@ -1,3 +1,15 @@
+2016-02-03 Sergio Villar Senin <svil...@igalia.com>
+
+ [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:
+
2016-03-20 Jinwoo Jeong <jw00.je...@samsung.com>
The setter of binaryType attribute in WebSocket should raise the exception.
Modified: trunk/LayoutTests/fast/css-grid-layout/grid-gutters-and-flex-content-expected.txt (198485 => 198486)
--- 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)
@@ -5,6 +5,8 @@
PASS
PASS
PASS
+PASS
+PASS
XXXX XXXX
XXX XXX
XXXXX XXXXX
Modified: trunk/LayoutTests/fast/css-grid-layout/grid-gutters-and-flex-content.html (198485 => 198486)
--- 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)
@@ -5,11 +5,11 @@
<script src=""
<script src=""
<style>
-.gridMaxFlexContent { -webkit-grid-template: 50px / minmax(30px, 2fr); }
+.gridPercentAndFlexContent { -webkit-grid-template: 50px / 50% minmax(30px, 2fr); }
.gridTwoDoubleMaxFlexContent { -webkit-grid-template: 50px / minmax(10px, 0.5fr) minmax(10px, 2fr); }
.gridIgnoreSecondGridItem { -webkit-grid-template: 50px / minmax(300px, 3fr) minmax(150px, 1fr); }
-.gridRowsMaxFlexContent { -webkit-grid-template: minmax(30px, 2fr) / 50px; }
+.gridRowsPercentAndFlexContent { -webkit-grid-template: minmax(30px, 2fr) 50% / 50px; }
.gridRowsTwoMaxFlexContent { -webkit-grid-template: minmax(10px, 1fr) minmax(10px, 2fr) / 50px; }
.gridRowsTwoDoubleMaxFlexContent { -webkit-grid-template: minmax(10px, 0.5fr) minmax(10px, 2fr) / 50px; }
@@ -43,6 +43,13 @@
</div>
</div>
+<div style="width: 120px; height: 10px;">
+ <div class="grid gridPercentAndFlexContent gridRowColumnGaps" data-expected-width="120" data-expected-height="50">
+ <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="60" data-expected-height="50"></div>
+ <div class="firstRowSecondColumn" data-expected-width="41" data-expected-height="50"></div>
+ </div>
+</div>
+
<!-- Check that gutters do not interfere with flex content resolution for rows -->
<div style="width: 10px; height: 60px">
@@ -59,6 +66,13 @@
</div>
</div>
+<div style="width: 10px;">
+ <div class="grid gridRowsPercentAndFlexContent gridRowColumnGaps" style="height: 150px" data-expected-width="10" data-expected-height="150">
+ <div class="firstRowFirstColumn" data-expected-width="50" data-expected-height="42"></div>
+ <div class="sizedToGridArea secondRowFirstColumn" data-expected-width="50" data-expected-height="75"></div>
+ </div>
+</div>
+
<!-- Check that gutters do not interfere with flex content resolution with content sized tracks -->
<div style="position: relative; width: 100px;">
Modified: trunk/LayoutTests/fast/css-grid-layout/grid-gutters-and-tracks-expected.txt (198485 => 198486)
--- 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)
@@ -44,6 +44,7 @@
X
XX XX
PASS
+PASS
XXXXX
X
X
@@ -56,3 +57,4 @@
PASS
PASS
PASS
+PASS
Modified: trunk/LayoutTests/fast/css-grid-layout/grid-gutters-and-tracks.html (198485 => 198486)
--- 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)
@@ -20,7 +20,18 @@
.gridAutoAuto { -webkit-grid-template: auto auto / auto auto; }
.gridMultipleFixed { -webkit-grid-template: [first] 37px [foo] 57px [bar] 77px [last] / [first] 15px [foo] 25px [bar] 35px [last]; }
.gridFixed100 { -webkit-grid-template: repeat(2, 100px) / repeat(2, 100px); }
+.gridWithPercent { -webkit-grid-template: 10% 10px / 10px 20% repeat(1, 30px); }
+.gridWithDoublePercent { -webkit-grid-template: 35% 65% / 60% 40%; }
+.fixedSizeGrid {
+ width: 220px;
+ height: 300px;
+}
+.gridFixedAutoTracks {
+ -webkit-grid-auto-rows: 20px;
+ -webkit-grid-auto-columns: 40px;
+}
+
.thirdRowThirdColumn { -webkit-grid-area: 3 / 3; }
.firstRowThirdColumn { -webkit-grid-area: 1 / 3; }
@@ -100,6 +111,14 @@
</div>
</div>
+<div style="position: relative">
+ <div class="grid gridWithPercent fixedSizeGrid gridRowColumnGaps gridFixedAutoTracks" data-expected-width="220" data-expected-height="300">
+ <div class="firstRowFirstColumn" data-offset-x="0" data-offset-y="0" data-expected-width="10" data-expected-height="30"></div>
+ <div class="secondRowSecondColumn" data-offset-x="33" data-offset-y="42" data-expected-width="44" data-expected-height="10"></div>
+ <div class="thirdRowThirdColumn" data-offset-x="100" data-offset-y="64" data-expected-width="30" data-expected-height="20"></div>
+ </div>
+</div>
+
<!-- Check that gutters contribute to the size of spanning items. -->
<div style="position: relative">
<div class="grid gridGap gridAutoAuto constrainedContainer">
@@ -117,6 +136,14 @@
</div>
</div>
+<div style="position: relative">
+ <div class="grid gridWithDoublePercent fixedSizeGrid gridRowColumnGaps gridFixedAutoTracks" data-expected-width="220" data-expected-height="300">
+ <div class="firstRowFirstColumn" data-offset-x="0" data-offset-y="0" data-expected-width="132" data-expected-height="105"></div>
+ <div class="secondRowSecondColumn" data-offset-x="155" data-offset-y="117" data-expected-width="88" data-expected-height="195"></div>
+ <div class="secondRowBothColumn" data-offset-x="0" data-offset-y="117" data-expected-width="243" data-expected-height="195"></div>
+ </div>
+</div>
+
<!-- Check that gutters do not interfere with margins computation. -->
<div style="position: relative">
<div class="grid gridFixed100 gridGap">
Modified: trunk/Source/WebCore/ChangeLog (198485 => 198486)
--- 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)
@@ -1,3 +1,20 @@
+2016-02-03 Sergio Villar Senin <svil...@igalia.com>
+
+ [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):
+
2016-03-21 Carlos Garcia Campos <cgar...@igalia.com>
[GTK] scrollbar thumb clipped in 2.11.92
Modified: trunk/Source/WebCore/rendering/RenderGrid.cpp (198485 => 198486)
--- 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)
@@ -503,7 +503,12 @@
Vector<unsigned> flexibleSizedTracksIndex;
sizingData.contentSizedTracksIndex.shrink(0);
- const LayoutUnit maxSize = initialFreeSpace.valueOr(0);
+ 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());
+
// 1. Initialize per Grid track variables.
for (unsigned i = 0; i < tracks.size(); ++i) {
GridTrack& track = tracks[i];