Title: [189208] trunk
- Revision
- 189208
- Author
- [email protected]
- Date
- 2015-09-01 08:04:08 -0700 (Tue, 01 Sep 2015)
Log Message
[CSS Grid Layout] Layout is wrong for flex factor sum between 0 and 1
https://bugs.webkit.org/show_bug.cgi?id=148645
Reviewed by Darin Adler.
Source/WebCore:
This patch ensures that we don't normalize the individual tracks
to fill the space. More precisely, when we sum up the flexes, that
tells us how many "units" of flex need to fit into the free
space. We then figure out what size to assign to the flex unit
based on that, and send that back to the individual items, sizing
them appropriately to their flex value.
This way we get flex fraction values applied correctly so they fill
the available space in the indicated proportion. This approach has
an additional advantage of dealing with division by 0 when reducing
automatically the flex value.
Test: fast/css-grid-layout/flex-factor-sum-less-than-1.html
* rendering/RenderGrid.cpp:
(WebCore::RenderGrid::computeNormalizedFractionBreadth):
LayoutTests:
Ensure we don't normalize individual tracks to fill the space, so
at least, the sum of flex values must be 1. We also needed to
modify the grid-element-shrink-to-fit to adapt it to the new
behavior of flex fraction units.
* fast/css-grid-layout/flex-factor-sum-less-than-1-expected.txt: Added.
* fast/css-grid-layout/flex-factor-sum-less-than-1.html: Added.
* fast/css-grid-layout/grid-element-shrink-to-fit.html:
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (189207 => 189208)
--- trunk/LayoutTests/ChangeLog 2015-09-01 13:06:57 UTC (rev 189207)
+++ trunk/LayoutTests/ChangeLog 2015-09-01 15:04:08 UTC (rev 189208)
@@ -1,3 +1,19 @@
+2015-09-01 Javier Fernandez <[email protected]>
+
+ [CSS Grid Layout] Layout is wrong for flex factor sum between 0 and 1
+ https://bugs.webkit.org/show_bug.cgi?id=148645
+
+ Reviewed by Darin Adler.
+
+ Ensure we don't normalize individual tracks to fill the space, so
+ at least, the sum of flex values must be 1. We also needed to
+ modify the grid-element-shrink-to-fit to adapt it to the new
+ behavior of flex fraction units.
+
+ * fast/css-grid-layout/flex-factor-sum-less-than-1-expected.txt: Added.
+ * fast/css-grid-layout/flex-factor-sum-less-than-1.html: Added.
+ * fast/css-grid-layout/grid-element-shrink-to-fit.html:
+
2015-09-01 Gyuyoung Kim <[email protected]>
Unreviewed EFL gardening. Skip new two tests which aren't supported by EFL port.
Added: trunk/LayoutTests/fast/css-grid-layout/flex-factor-sum-less-than-1-expected.txt (0 => 189208)
--- trunk/LayoutTests/fast/css-grid-layout/flex-factor-sum-less-than-1-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/css-grid-layout/flex-factor-sum-less-than-1-expected.txt 2015-09-01 15:04:08 UTC (rev 189208)
@@ -0,0 +1,5 @@
+Test that resolving auto tracks on grid items works properly.
+
+PASS
+PASS
+PASS
Added: trunk/LayoutTests/fast/css-grid-layout/flex-factor-sum-less-than-1.html (0 => 189208)
--- trunk/LayoutTests/fast/css-grid-layout/flex-factor-sum-less-than-1.html (rev 0)
+++ trunk/LayoutTests/fast/css-grid-layout/flex-factor-sum-less-than-1.html 2015-09-01 15:04:08 UTC (rev 189208)
@@ -0,0 +1,81 @@
+<!DOCTYPE html>
+<html>
+<link href="" rel="stylesheet">
+<style>
+.onlyColumnFractionFlexFactors {
+ -webkit-grid-template-columns: minmax(0,0.1fr) minmax(0,0.2fr) minmax(0,0.3fr);
+ -webkit-grid-template-rows: 50px;
+ width: 100px;
+}
+.onlyRowFractionFlexFactors {
+ -webkit-grid-template-columns: 50px;
+ -webkit-grid-template-rows: minmax(0,0.1fr) minmax(0,0.2fr) minmax(0,0.3fr);
+ width: 50px;
+ height: 100px;
+}
+.fixedAndfractionFlexFactors {
+ -webkit-grid-template-columns: 50px minmax(0,0.2fr) 30px;
+ -webkit-grid-template-rows: minmax(0,0.1fr) 50px minmax(0,0.3fr);
+ width: 100px;
+ height: 100px;
+}
+.firstRowThirdColumn {
+ background-color: yellow;
+ -webkit-grid-column: 3;
+ -webkit-grid-row: 1;
+}
+.secondRowThirdColumn {
+ background-color: yellow;
+ -webkit-grid-column: 3;
+ -webkit-grid-row: 2;
+}
+.thirdRowFirstColumn {
+ background-color: brown;
+ -webkit-grid-column: 1;
+ -webkit-grid-row: 3;
+}
+.thirdRowThirdColumn {
+ background-color: magenta;
+ -webkit-grid-column: 3;
+ -webkit-grid-row: 3;
+}
+</style>
+<script src=""
+<body _onload_="checkLayout('.grid');">
+
+<p>Test that resolving auto tracks on grid items works properly.</p>
+
+<div style="position: relative;">
+ <div class="grid onlyColumnFractionFlexFactors">
+ <div class="firstRowFirstColumn" data-expected-width="10" data-expected-height="50"></div>
+ <div class="firstRowSecondColumn" data-expected-width="20" data-expected-height="50"></div>
+ <div class="firstRowThirdColumn" data-expected-width="30" data-expected-height="50"></div>
+ </div>
+</div>
+
+<div style="position: relative;">
+ <div class="grid onlyRowFractionFlexFactors">
+ <div class="firstRowFirstColumn" data-expected-width="50" data-expected-height="10"></div>
+ <div class="secondRowFirstColumn" data-expected-width="50" data-expected-height="20"></div>
+ <div class="thirdRowFirstColumn" data-expected-width="50" data-expected-height="30"></div>
+ </div>
+</div>
+
+<div style="position: relative;">
+ <div class="grid fixedAndfractionFlexFactors">
+ <div class="firstRowFirstColumn" data-expected-width="50" data-expected-height="5"></div>
+ <div class="firstRowSecondColumn" data-expected-width="4" data-expected-height="5"></div>
+ <div class="firstRowThirdColumn" data-expected-width="30" data-expected-height="5"></div>
+ <div class="secondRowFirstColumn" data-expected-width="50" data-expected-height="50"></div>
+ <div class="secondRowSecondColumn" data-expected-width="4" data-expected-height="50"></div>
+ <div class="secondRowThirdColumn" data-expected-width="30" data-expected-height="50"></div>
+ <div class="thirdRowFirstColumn" data-expected-width="50" data-expected-height="15"></div>
+ <div class="thirdRowSecondColumn" data-expected-width="4" data-expected-height="15"></div>
+ <div class="thirdRowThirdColumn" data-expected-width="30" data-expected-height="15"></div>
+ </div>
+</div>
+
+</body>
+</html>
+
+
Modified: trunk/LayoutTests/fast/css-grid-layout/grid-element-shrink-to-fit.html (189207 => 189208)
--- trunk/LayoutTests/fast/css-grid-layout/grid-element-shrink-to-fit.html 2015-09-01 13:06:57 UTC (rev 189207)
+++ trunk/LayoutTests/fast/css-grid-layout/grid-element-shrink-to-fit.html 2015-09-01 15:04:08 UTC (rev 189208)
@@ -4,7 +4,7 @@
<style>
.grid {
-webkit-grid-template-rows: 50px 50px;
- -webkit-grid-template-columns: 0.5fr 0.5fr;
+ -webkit-grid-template-columns: 1fr 1fr;
}
.floatPos {
Modified: trunk/Source/WebCore/ChangeLog (189207 => 189208)
--- trunk/Source/WebCore/ChangeLog 2015-09-01 13:06:57 UTC (rev 189207)
+++ trunk/Source/WebCore/ChangeLog 2015-09-01 15:04:08 UTC (rev 189208)
@@ -1,3 +1,27 @@
+2015-09-01 Javier Fernandez <[email protected]>
+
+ [CSS Grid Layout] Layout is wrong for flex factor sum between 0 and 1
+ https://bugs.webkit.org/show_bug.cgi?id=148645
+
+ Reviewed by Darin Adler.
+
+ This patch ensures that we don't normalize the individual tracks
+ to fill the space. More precisely, when we sum up the flexes, that
+ tells us how many "units" of flex need to fit into the free
+ space. We then figure out what size to assign to the flex unit
+ based on that, and send that back to the individual items, sizing
+ them appropriately to their flex value.
+
+ This way we get flex fraction values applied correctly so they fill
+ the available space in the indicated proportion. This approach has
+ an additional advantage of dealing with division by 0 when reducing
+ automatically the flex value.
+
+ Test: fast/css-grid-layout/flex-factor-sum-less-than-1.html
+
+ * rendering/RenderGrid.cpp:
+ (WebCore::RenderGrid::computeNormalizedFractionBreadth):
+
2015-08-31 Commit Queue <[email protected]>
Unreviewed, rolling out r189198.
Modified: trunk/Source/WebCore/rendering/RenderGrid.cpp (189207 => 189208)
--- trunk/Source/WebCore/rendering/RenderGrid.cpp 2015-09-01 13:06:57 UTC (rev 189207)
+++ trunk/Source/WebCore/rendering/RenderGrid.cpp 2015-09-01 15:04:08 UTC (rev 189208)
@@ -500,6 +500,11 @@
availableLogicalSpaceIgnoringFractionTracks += track.m_track->baseSize();
}
+ // Let flex factor sum be the sum of the flex factors of the flexible tracks. If this value
+ // is less than 1, set it to 1 instead.
+ if (accumulatedFractions < 1)
+ return availableLogicalSpaceIgnoringFractionTracks;
+
return availableLogicalSpaceIgnoringFractionTracks / accumulatedFractions;
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes