Title: [191385] trunk
- Revision
- 191385
- Author
- svil...@igalia.com
- Date
- 2015-10-21 04:47:16 -0700 (Wed, 21 Oct 2015)
Log Message
Source/WebCore:
[css-grid] Fix availableLogicalSpace computation with non-zero baseSize flex tracks
https://bugs.webkit.org/show_bug.cgi?id=150359
Reviewed by Zalan Bujtas.
The availableLogicalSpace computation was incorrect whenever
the flex tracks had a non-zero baseSize before the 1fr unit
size resolution. That happened because when assigning the new
baseSize to the flex track, we were unconditionally
subtracting the whole baseSize to the
availableLogicalSpace. That's correct if the track is a "pure"
flex track, i.e. 2fr, but if the track had a non-zero baseSize
(like minmax(10px, 1fr)) then both the new and the old base
sizes were incorrectly used to compute the
availableLogicalSpace.
We can test the amount of remaining freeSpace by using content
distribution to align and item place on a non-zero baseSize
flex track. The content distribution will be accurate if and
only if the availableLogicalSpace computation is correct.
Test: fast/css-grid-layout/flex-content-distribution.html
* rendering/RenderGrid.cpp:
(WebCore::RenderGrid::computeUsedBreadthOfGridTracks):
LayoutTests:
[css-grid] Fix freeSpace computation with non-zero baseSize flex tracks
https://bugs.webkit.org/show_bug.cgi?id=150359
Reviewed by Zalan Bujtas.
* fast/css-grid-layout/flex-content-distribution-expected.txt: Added.
* fast/css-grid-layout/flex-content-distribution.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (191384 => 191385)
--- trunk/LayoutTests/ChangeLog 2015-10-21 08:52:27 UTC (rev 191384)
+++ trunk/LayoutTests/ChangeLog 2015-10-21 11:47:16 UTC (rev 191385)
@@ -1,3 +1,13 @@
+2015-10-20 Sergio Villar Senin <svil...@igalia.com>
+
+ [css-grid] Fix freeSpace computation with non-zero baseSize flex tracks
+ https://bugs.webkit.org/show_bug.cgi?id=150359
+
+ Reviewed by Zalan Bujtas.
+
+ * fast/css-grid-layout/flex-content-distribution-expected.txt: Added.
+ * fast/css-grid-layout/flex-content-distribution.html: Added.
+
2015-10-21 Youenn Fablet <youenn.fab...@crf.canon.fr>
Remove commented lines in TestExpectations
Added: trunk/LayoutTests/fast/css-grid-layout/flex-content-distribution-expected.txt (0 => 191385)
--- trunk/LayoutTests/fast/css-grid-layout/flex-content-distribution-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/css-grid-layout/flex-content-distribution-expected.txt 2015-10-21 11:47:16 UTC (rev 191385)
@@ -0,0 +1,20 @@
+This test checks that freeSpace is properly computed after computing fr tracks so that we could use it for content distribution
+
+Grid with justify-content: start.
+
+PASS
+Grid with justify-content: center.
+
+PASS
+Grid with justify-content: end.
+
+PASS
+Grid with align-content: start.
+
+PASS
+Grid with align-content: center.
+
+PASS
+Grid with align-content: end.
+
+PASS
Property changes on: trunk/LayoutTests/fast/css-grid-layout/flex-content-distribution-expected.txt
___________________________________________________________________
Added: svn:eol-style
Added: trunk/LayoutTests/fast/css-grid-layout/flex-content-distribution.html (0 => 191385)
--- trunk/LayoutTests/fast/css-grid-layout/flex-content-distribution.html (rev 0)
+++ trunk/LayoutTests/fast/css-grid-layout/flex-content-distribution.html 2015-10-21 11:47:16 UTC (rev 191385)
@@ -0,0 +1,81 @@
+<!DOCTYPE html>
+
+<link href="" rel="stylesheet">
+<link href="" rel="stylesheet">
+<style>
+.freeSpaceForColumnsGrid {
+ -webkit-grid-template: minmax(20px, 0.7fr) / 100%;
+ width: 50px;
+ height: 100px;
+}
+
+.freeSpaceForRowsGrid {
+ -webkit-grid-template: 100% / minmax(20px, 0.7fr);
+ width: 50px;
+ height: 100px;
+}
+
+.container { position: relative; }
+
+.item {
+ width: 100%;
+ height: 50px;
+ background-color: red;
+}
+
+.item2 {
+ width: 50px;
+ height: 100%;
+ background-color: red;
+}
+
+</style>
+
+<script src=""
+
+<body _onload_="checkLayout('.grid');">
+
+<p>This test checks that freeSpace is properly computed after computing fr tracks so that we could use it for content distribution</p>
+
+<p>Grid with justify-content: start.</p>
+<div class="container">
+ <div class="grid freeSpaceForColumnsGrid justifyContentStart">
+ <div class="item" data-offset-x="0" data-offset-y="0" data-expected-width="35" data-expected-height="50"></div>
+ </div>
+</div>
+
+<p>Grid with justify-content: center.</p>
+<div class="container">
+ <div class="grid freeSpaceForColumnsGrid justifyContentCenter">
+ <div class="item" data-offset-x="8" data-offset-y="0" data-expected-width="35" data-expected-height="50"></div>
+ </div>
+</div>
+
+<p>Grid with justify-content: end.</p>
+<div class="container">
+ <div class="grid freeSpaceForColumnsGrid justifyContentEnd">
+ <div class="item" data-offset-x="15" data-offset-y="0" data-expected-width="35" data-expected-height="50"></div>
+ </div>
+</div>
+
+<p>Grid with align-content: start.</p>
+<div class="container">
+ <div class="grid freeSpaceForRowsGrid alignContentStart">
+ <div class="item2" data-offset-x="0" data-offset-y="0" data-expected-width="50" data-expected-height="70"></div>
+ </div>
+</div>
+
+<p>Grid with align-content: center.</p>
+<div class="container">
+ <div class="grid freeSpaceForRowsGrid alignContentCenter">
+ <div class="item2" data-offset-x="0" data-offset-y="15" data-expected-width="50" data-expected-height="70"></div>
+ </div>
+</div>
+
+<p>Grid with align-content: end.</p>
+<div class="container">
+ <div class="grid freeSpaceForRowsGrid alignContentEnd">
+ <div class="item2" data-offset-x="0" data-offset-y="30" data-expected-width="50" data-expected-height="70"></div>
+ </div>
+</div>
+</body>
Property changes on: trunk/LayoutTests/fast/css-grid-layout/flex-content-distribution.html
___________________________________________________________________
Added: svn:mime-type
Added: svn:eol-style
Modified: trunk/Source/WebCore/ChangeLog (191384 => 191385)
--- trunk/Source/WebCore/ChangeLog 2015-10-21 08:52:27 UTC (rev 191384)
+++ trunk/Source/WebCore/ChangeLog 2015-10-21 11:47:16 UTC (rev 191385)
@@ -1,3 +1,31 @@
+2015-10-20 Sergio Villar Senin <svil...@igalia.com>
+
+ [css-grid] Fix availableLogicalSpace computation with non-zero baseSize flex tracks
+ https://bugs.webkit.org/show_bug.cgi?id=150359
+
+ Reviewed by Zalan Bujtas.
+
+ The availableLogicalSpace computation was incorrect whenever
+ the flex tracks had a non-zero baseSize before the 1fr unit
+ size resolution. That happened because when assigning the new
+ baseSize to the flex track, we were unconditionally
+ subtracting the whole baseSize to the
+ availableLogicalSpace. That's correct if the track is a "pure"
+ flex track, i.e. 2fr, but if the track had a non-zero baseSize
+ (like minmax(10px, 1fr)) then both the new and the old base
+ sizes were incorrectly used to compute the
+ availableLogicalSpace.
+
+ We can test the amount of remaining freeSpace by using content
+ distribution to align and item place on a non-zero baseSize
+ flex track. The content distribution will be accurate if and
+ only if the availableLogicalSpace computation is correct.
+
+ Test: fast/css-grid-layout/flex-content-distribution.html
+
+ * rendering/RenderGrid.cpp:
+ (WebCore::RenderGrid::computeUsedBreadthOfGridTracks):
+
2015-10-21 Xabier Rodriguez Calvar <calva...@igalia.com>
[Streams API] Construct a writable stream
Modified: trunk/Source/WebCore/rendering/RenderGrid.cpp (191384 => 191385)
--- trunk/Source/WebCore/rendering/RenderGrid.cpp 2015-10-21 08:52:27 UTC (rev 191384)
+++ trunk/Source/WebCore/rendering/RenderGrid.cpp 2015-10-21 11:47:16 UTC (rev 191385)
@@ -473,9 +473,12 @@
for (auto trackIndex : flexibleSizedTracksIndex) {
const GridTrackSize& trackSize = gridTrackSize(direction, trackIndex);
GridTrack& track = tracks[trackIndex];
- LayoutUnit baseSize = std::max<LayoutUnit>(track.baseSize(), flexFraction * trackSize.maxTrackBreadth().flex());
- track.setBaseSize(baseSize);
- availableLogicalSpace -= baseSize;
+ LayoutUnit oldBaseSize = track.baseSize();
+ LayoutUnit baseSize = std::max<LayoutUnit>(oldBaseSize, flexFraction * trackSize.maxTrackBreadth().flex());
+ if (LayoutUnit increment = baseSize - oldBaseSize) {
+ track.setBaseSize(baseSize);
+ availableLogicalSpace -= increment;
+ }
}
}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes