Changeset 225741 in webkit
- Timestamp:
- Dec 11, 2017 1:11:19 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r225736 r225741 1 2017-12-11 Manuel Rego Casasnovas <rego@igalia.com> 2 3 REGRESSION(r221931): Row stretch doesn't work for grid container with min-height 4 https://bugs.webkit.org/show_bug.cgi?id=180287 5 6 Reviewed by Darin Adler. 7 8 * TestExpectations: Now layout-algorithm/grid-stretch-respects-min-size-001.html 9 from WPT is passing, so this patch removes it from TestExpectations file. 10 1 11 2017-12-10 Minsheng Liu <lambda@liu.ms> 2 12 -
trunk/LayoutTests/TestExpectations
r225702 r225741 480 480 webkit.org/b/169271 imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-sizing-alignment-001.html [ ImageOnlyFailure ] 481 481 webkit.org/b/180283 imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-minimum-size-grid-items-017.html [ ImageOnlyFailure ] 482 webkit.org/b/180287 imported/w3c/web-platform-tests/css/css-grid/layout-algorithm/grid-stretch-respects-min-size-001.html [ ImageOnlyFailure ]483 482 webkit.org/b/180290 imported/w3c/web-platform-tests/css/css-grid/alignment/grid-gutters-001.html [ ImageOnlyFailure ] 484 483 webkit.org/b/180290 imported/w3c/web-platform-tests/css/css-grid/alignment/grid-gutters-002.html [ ImageOnlyFailure ] -
trunk/LayoutTests/imported/w3c/ChangeLog
r225718 r225741 1 2017-12-11 Manuel Rego Casasnovas <rego@igalia.com> 2 3 REGRESSION(r221931): Row stretch doesn't work for grid container with min-height 4 https://bugs.webkit.org/show_bug.cgi?id=180287 5 6 Reviewed by Darin Adler. 7 8 * web-platform-tests/css/css-grid/grid-model/grid-box-sizing-001-expected.txt: 9 Update expectations as the test is now passing. 10 1 11 2017-12-08 Chris Dumez <cdumez@apple.com> 2 12 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-model/grid-box-sizing-001-expected.txt
r225561 r225741 60 60 </div> 61 61 height expected 56 but got 0 62 FAIL .grid 13 assert_equals: 63 <div class="grid wholeWidth" style="min-height: 100px; bottom: 0; box-sizing: border-box;" data-expected-width="200" data-expected-height="100"> 64 <div class="item" data-expected-width="154" data-expected-height="56"></div> 65 </div> 66 height expected 56 but got 0 62 PASS .grid 13 67 63 PASS .grid 14 68 FAIL .grid 15 assert_equals: 69 <div class="grid wholeWidth" style="min-height: 100px; bottom: 0;" data-expected-width="200" data-expected-height="144"> 70 <div class="item" data-expected-width="154" data-expected-height="100"></div> 71 </div> 72 height expected 100 but got 0 64 PASS .grid 15 73 65 PASS .grid 16 74 66 FAIL .grid 17 assert_equals: … … 92 84 </div> 93 85 height expected 56 but got 0 94 FAIL .grid 21 assert_equals: 95 <div class="grid wholeWidth" style="min-height: 100px; box-sizing: border-box;" data-expected-width="200" data-expected-height="100"> 96 <div class="item" data-expected-width="154" data-expected-height="56"></div> 97 </div> 98 height expected 56 but got 0 86 PASS .grid 21 99 87 PASS .grid 22 100 FAIL .grid 23 assert_equals: 101 <div class="grid wholeWidth" style="min-height: 100px;" data-expected-width="200" data-expected-height="144"> 102 <div class="item" data-expected-width="154" data-expected-height="100"></div> 103 </div> 104 height expected 100 but got 0 88 PASS .grid 23 105 89 PASS .grid 24 106 90 -
trunk/Source/WebCore/ChangeLog
r225736 r225741 1 2017-12-11 Manuel Rego Casasnovas <rego@igalia.com> 2 3 REGRESSION(r221931): Row stretch doesn't work for grid container with min-height 4 https://bugs.webkit.org/show_bug.cgi?id=180287 5 6 Reviewed by Darin Adler. 7 8 In r221931 we moved the stretch phase as the last step of 9 the track sizing algorithm. 10 However this introduced a regression as we were no longer 11 taking into account the grid container min-width|height constraints 12 during this step. 13 14 The CSS WG modified the spec so it now defines what to do 15 in these situations (https://drafts.csswg.org/css-grid/#algo-stretch): 16 "If the free space is indefinite, but the grid container 17 has a definite min-width/height, use that size to calculate 18 the free space for this step instead." 19 20 This patch adds a new method 21 GridTrackSizingAlgorithmStrategy::freeSpaceForStretchAutoTracksStep(). 22 When we're in the DefiniteSizeStrategy it just returns the current 23 free space. 24 For the IndefiniteSizeStrategy in the columns case we don't need 25 any special computation (the same that happens in 26 recomputeUsedFlexFractionIfNeeded()); for rows it uses the min size 27 of the grid container (respecting min-width|height properties) 28 to calculate the free space. 29 30 Test: imported/w3c/web-platform-tests/css/css-grid/layout-algorithm/grid-stretch-respects-min-size-001.html 31 32 * rendering/GridTrackSizingAlgorithm.cpp: 33 (WebCore::IndefiniteSizeStrategy::freeSpaceForStretchAutoTracksStep const): 34 (WebCore::DefiniteSizeStrategy::freeSpaceForStretchAutoTracksStep const): 35 (WebCore::GridTrackSizingAlgorithm::stretchAutoTracks): 36 * rendering/GridTrackSizingAlgorithm.h: 37 1 38 2017-12-10 Minsheng Liu <lambda@liu.ms> 2 39 -
trunk/Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp
r225104 r225741 790 790 double findUsedFlexFraction(Vector<unsigned>& flexibleSizedTracksIndex, GridTrackSizingDirection, std::optional<LayoutUnit> freeSpace) const override; 791 791 bool recomputeUsedFlexFractionIfNeeded(double& flexFraction, LayoutUnit& totalGrowth) const override; 792 LayoutUnit freeSpaceForStretchAutoTracksStep() const override; 792 793 }; 793 794 … … 887 888 double findUsedFlexFraction(Vector<unsigned>& flexibleSizedTracksIndex, GridTrackSizingDirection, std::optional<LayoutUnit> freeSpace) const override; 888 889 bool recomputeUsedFlexFractionIfNeeded(double& flexFraction, LayoutUnit& totalGrowth) const override; 890 LayoutUnit freeSpaceForStretchAutoTracksStep() const override; 889 891 }; 892 893 LayoutUnit IndefiniteSizeStrategy::freeSpaceForStretchAutoTracksStep() const 894 { 895 ASSERT(!m_algorithm.freeSpace(direction())); 896 if (direction() == ForColumns) 897 return LayoutUnit(); 898 899 auto minSize = renderGrid()->computeContentLogicalHeight(MinSize, renderGrid()->style().logicalMinHeight(), std::nullopt); 900 return minSize.value() - computeTrackBasedSize(); 901 } 890 902 891 903 LayoutUnit DefiniteSizeStrategy::minLogicalWidthForChild(RenderBox& child, Length childMinSize, LayoutUnit availableSize) const … … 925 937 ASSERT(freeSpace); 926 938 return findFrUnitSize(allTracksSpan, freeSpace.value()); 939 } 940 941 LayoutUnit DefiniteSizeStrategy::freeSpaceForStretchAutoTracksStep() const 942 { 943 return m_algorithm.freeSpace(direction()).value(); 927 944 } 928 945 … … 1041 1058 void GridTrackSizingAlgorithm::stretchAutoTracks() 1042 1059 { 1043 auto currentFreeSpace = freeSpace(m_direction); 1044 if (m_autoSizedTracksForStretchIndex.isEmpty() 1045 || !currentFreeSpace 1046 || currentFreeSpace.value() <= 0 1060 auto currentFreeSpace = m_strategy->freeSpaceForStretchAutoTracksStep(); 1061 if (m_autoSizedTracksForStretchIndex.isEmpty() || currentFreeSpace <= 0 1047 1062 || (m_renderGrid->contentAlignment(m_direction).distribution() != ContentDistributionStretch)) 1048 1063 return; … … 1050 1065 Vector<GridTrack>& allTracks = tracks(m_direction); 1051 1066 unsigned numberOfAutoSizedTracks = m_autoSizedTracksForStretchIndex.size(); 1052 LayoutUnit sizeToIncrease = currentFreeSpace .value()/ numberOfAutoSizedTracks;1067 LayoutUnit sizeToIncrease = currentFreeSpace / numberOfAutoSizedTracks; 1053 1068 for (const auto& trackIndex : m_autoSizedTracksForStretchIndex) { 1054 1069 auto& track = allTracks[trackIndex]; -
trunk/Source/WebCore/rendering/GridTrackSizingAlgorithm.h
r223955 r225741 224 224 virtual double findUsedFlexFraction(Vector<unsigned>& flexibleSizedTracksIndex, GridTrackSizingDirection, std::optional<LayoutUnit> initialFreeSpace) const = 0; 225 225 virtual bool recomputeUsedFlexFractionIfNeeded(double& flexFraction, LayoutUnit& totalGrowth) const = 0; 226 virtual LayoutUnit freeSpaceForStretchAutoTracksStep() const = 0; 226 227 227 228 protected:
Note: See TracChangeset
for help on using the changeset viewer.