Changeset 273072 in webkit
- Timestamp:
- Feb 18, 2021 1:58:39 AM (17 months ago)
- Location:
- trunk
- Files:
-
- 12 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/TestExpectations (modified) (3 diffs)
-
LayoutTests/imported/w3c/ChangeLog (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/flex-aspect-ratio-img-column-011-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/flex-aspect-ratio-img-row-013-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/image-as-flexitem-size-003-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/image-as-flexitem-size-003v-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/image-as-flexitem-size-004-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/image-as-flexitem-size-004v-expected.txt (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/rendering/RenderFlexibleBox.cpp (modified) (8 diffs)
-
Source/WebCore/rendering/RenderFlexibleBox.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r273071 r273072 1 2021-02-15 Sergio Villar Senin <svillar@igalia.com> 2 3 [css-flex] Implement section 9.8 Definite and Indefinite Sizes case 1 4 https://bugs.webkit.org/show_bug.cgi?id=219538 5 <rdar://problem/72136484> 6 7 Reviewed by Manuel Rego Casasnovas. 8 9 * TestExpectations: Unskipped 8 tests that are passing now. 10 1 11 2021-02-18 Youenn Fablet <youenn@apple.com> 2 12 -
trunk/LayoutTests/TestExpectations
r273065 r273072 3919 3919 webkit.org/b/219343 imported/w3c/web-platform-tests/css/css-flexbox/flex-aspect-ratio-img-column-015.html [ ImageOnlyFailure ] 3920 3920 webkit.org/b/219343 imported/w3c/web-platform-tests/css/css-flexbox/flex-aspect-ratio-img-column-017.html [ ImageOnlyFailure ] 3921 webkit.org/b/219343 imported/w3c/web-platform-tests/css/css-flexbox/flex-aspect-ratio-img-row-006.html [ ImageOnlyFailure ]3922 3921 webkit.org/b/219343 imported/w3c/web-platform-tests/css/css-flexbox/flex-aspect-ratio-img-row-007.html [ ImageOnlyFailure ] 3923 3922 webkit.org/b/219343 imported/w3c/web-platform-tests/css/css-flexbox/flex-aspect-ratio-img-row-010.html [ ImageOnlyFailure ] … … 3929 3928 webkit.org/b/210144 imported/w3c/web-platform-tests/css/css-flexbox/anonymous-flex-item-005.html [ ImageOnlyFailure ] 3930 3929 webkit.org/b/210478 imported/w3c/web-platform-tests/css/css-flexbox/percentage-heights-006.html [ ImageOnlyFailure ] 3931 webkit.org/b/212046 imported/w3c/web-platform-tests/css/css-flexbox/flex-minimum-height-flex-items-007.xht [ ImageOnlyFailure ]3932 webkit.org/b/212046 imported/w3c/web-platform-tests/css/css-flexbox/flex-minimum-width-flex-items-007.xht [ ImageOnlyFailure ]3933 3930 webkit.org/b/212046 imported/w3c/web-platform-tests/css/css-flexbox/overflow-area-001.html [ ImageOnlyFailure ] 3934 3931 webkit.org/b/212046 imported/w3c/web-platform-tests/css/css-flexbox/overflow-area-002.html [ ImageOnlyFailure ] … … 4049 4046 4050 4047 # min-size:auto in flexbox. 4051 webkit.org/b/221481 imported/w3c/web-platform-tests/css/css-flexbox/flexbox-min-height-auto-002a.html [ ImageOnlyFailure ]4052 webkit.org/b/221481 imported/w3c/web-platform-tests/css/css-flexbox/flexbox-min-height-auto-002c.html [ ImageOnlyFailure ]4053 webkit.org/b/221481 imported/w3c/web-platform-tests/css/css-flexbox/flexbox-min-width-auto-002a.html [ ImageOnlyFailure ]4054 webkit.org/b/221481 imported/w3c/web-platform-tests/css/css-flexbox/flexbox-min-width-auto-002c.html [ ImageOnlyFailure ]4055 webkit.org/b/221481 imported/w3c/web-platform-tests/css/css-flexbox/flexbox-min-width-auto-005.html [ ImageOnlyFailure ]4056 4048 webkit.org/b/221481 imported/w3c/web-platform-tests/css/css-flexbox/flex-minimum-height-flex-items-026.html [ ImageOnlyFailure ] 4057 4049 webkit.org/b/221481 imported/w3c/web-platform-tests/css/css-flexbox/flex-minimum-height-flex-items-029.html [ ImageOnlyFailure ] -
trunk/LayoutTests/imported/w3c/ChangeLog
r273068 r273072 1 2021-02-15 Sergio Villar Senin <svillar@igalia.com> 2 3 [css-flex] Implement section 9.8 Definite and Indefinite Sizes case 1 4 https://bugs.webkit.org/show_bug.cgi?id=219538 5 <rdar://problem/72136484> 6 7 Reviewed by Manuel Rego Casasnovas. 8 9 * web-platform-tests/css/css-flexbox/flex-aspect-ratio-img-row-013-expected.txt: Replaced FAIL by PASS expectations. 10 * web-platform-tests/css/css-flexbox/image-as-flexitem-size-003-expected.txt: Ditto. 11 * web-platform-tests/css/css-flexbox/image-as-flexitem-size-003v-expected.txt: Ditto. 12 * web-platform-tests/css/css-flexbox/image-as-flexitem-size-004-expected.txt: Ditto. 13 * web-platform-tests/css/css-flexbox/image-as-flexitem-size-004v-expected.txt: Ditto. 14 * web-platform-tests/css/css-sizing/percentage-height-in-flexbox.html: Updated expectation. Still failing. 15 1 16 2021-02-18 Rob Buis <rbuis@igalia.com> 2 17 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/flex-aspect-ratio-img-column-011-expected.txt
r270237 r273072 4 4 PASS .flexbox 3 5 5 PASS .flexbox 4 6 FAIL .flexbox 5 assert_equals: 7 <div class="flexbox" style="width: 10px;" data-expected-width="10"> 8 <!-- transferred and content suggestions are both 100px here, so minimum 9 width is min(transferred, content width) = 100px. --> 10 <img src="support/10x10-green.png" style="height: 100px;" data-expected-width="100"> 11 </div> 12 width expected 100 but got 10 6 PASS .flexbox 5 13 7 PASS .flexbox 6 14 8 PASS .flexbox 7 15 9 PASS .flexbox 8 16 10 PASS .flexbox 9 17 FAIL .flexbox 10 assert_equals: 18 <div class="flexbox column" style="height: 10px;" data-expected-height="10"> 19 <!-- should use min(transferred (100), content height (100)) = 100px as 20 minimum height, which will be final height of the image --> 21 <img src="support/10x10-green.png" style="width: 100px;" data-expected-height="100"> 22 </div> 23 height expected 100 but got 10 11 PASS .flexbox 10 24 12 25 13 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/flex-aspect-ratio-img-row-013-expected.txt
r272755 r273072 13 13 14 14 15 FAIL img 1 assert_equals: 16 <img src="support/200x200-green.png" data-expected-height="100" data-expected-width="100"> 17 width expected 100 but got 200 15 PASS img 1 18 16 FAIL img 2 assert_equals: 19 17 <img src="support/200x200-green.png" style="margin-bottom: 20px" data-expected-height="100" data-expected-width="100"> 20 width expected 100 but got 200 21 FAIL img 3 assert_equals: 22 <img src="support/200x200-green.png" style="min-height: 100px;" data-expected-height="100" data-expected-width="100"> 23 width expected 100 but got 200 18 width expected 100 but got 120 19 PASS img 3 24 20 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/image-as-flexitem-size-003-expected.txt
r272755 r273072 6 6 7 7 8 FAIL .flexbox > img 1 assert_equals: 9 <img src="support/solidblue.png" data-expected-width="40" data-expected-height="40"> 10 width expected 40 but got 16 8 PASS .flexbox > img 1 11 9 PASS .flexbox > img 2 12 10 PASS .flexbox > img 3 13 11 PASS .flexbox > img 4 14 FAIL .flexbox > img 5 assert_equals: 15 <img src="support/solidblue.png" style="min-width: 34px" data-expected-width="40" data-expected-height="40"> 16 width expected 40 but got 34 17 FAIL .flexbox > img 6 assert_equals: 18 <img src="support/solidblue.png" style="min-height: 34px" data-expected-width="40" data-expected-height="40"> 19 width expected 40 but got 34 20 FAIL .flexbox > img 7 assert_equals: 21 <img src="support/solidblue.png" style="min-width: 30px; 22 min-height: 34px" data-expected-width="40" data-expected-height="40"> 23 width expected 40 but got 34 24 FAIL .flexbox > img 8 assert_equals: 25 <img src="support/solidblue.png" style="min-width: 34px; 26 min-height: 30px" data-expected-width="40" data-expected-height="40"> 27 width expected 40 but got 34 12 PASS .flexbox > img 5 13 PASS .flexbox > img 6 14 PASS .flexbox > img 7 15 PASS .flexbox > img 8 28 16 PASS .flexbox > img 9 29 17 PASS .flexbox > img 10 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/image-as-flexitem-size-003v-expected.txt
r272755 r273072 6 6 7 7 8 FAIL .flexbox > img 1 assert_equals: 9 <img src="support/solidblue.png" data-expected-width="40" data-expected-height="40"> 10 width expected 40 but got 16 8 PASS .flexbox > img 1 11 9 PASS .flexbox > img 2 12 10 PASS .flexbox > img 3 13 11 PASS .flexbox > img 4 14 FAIL .flexbox > img 5 assert_equals: 15 <img src="support/solidblue.png" style="min-width: 34px" data-expected-width="40" data-expected-height="40"> 16 width expected 40 but got 34 17 FAIL .flexbox > img 6 assert_equals: 18 <img src="support/solidblue.png" style="min-height: 34px" data-expected-width="40" data-expected-height="40"> 19 width expected 40 but got 34 20 FAIL .flexbox > img 7 assert_equals: 21 <img src="support/solidblue.png" style="min-width: 30px; 22 min-height: 34px" data-expected-width="40" data-expected-height="40"> 23 width expected 40 but got 34 24 FAIL .flexbox > img 8 assert_equals: 25 <img src="support/solidblue.png" style="min-width: 34px; 26 min-height: 30px" data-expected-width="40" data-expected-height="40"> 27 width expected 40 but got 34 12 PASS .flexbox > img 5 13 PASS .flexbox > img 6 14 PASS .flexbox > img 7 15 PASS .flexbox > img 8 28 16 PASS .flexbox > img 9 29 17 PASS .flexbox > img 10 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/image-as-flexitem-size-004-expected.txt
r272755 r273072 6 6 7 7 8 FAIL .flexbox > img 1 assert_equals: 9 <img src="support/solidblue.png" data-expected-width="40" data-expected-height="40"> 10 height expected 40 but got 16 8 PASS .flexbox > img 1 11 9 PASS .flexbox > img 2 12 10 PASS .flexbox > img 3 13 11 PASS .flexbox > img 4 14 FAIL .flexbox > img 5 assert_equals: 15 <img src="support/solidblue.png" style="min-width: 34px" data-expected-width="40" data-expected-height="40"> 16 height expected 40 but got 34 17 FAIL .flexbox > img 6 assert_equals: 18 <img src="support/solidblue.png" style="min-height: 34px" data-expected-width="40" data-expected-height="40"> 19 height expected 40 but got 34 20 FAIL .flexbox > img 7 assert_equals: 21 <img src="support/solidblue.png" style="min-width: 30px; 22 min-height: 34px" data-expected-width="40" data-expected-height="40"> 23 height expected 40 but got 34 24 FAIL .flexbox > img 8 assert_equals: 25 <img src="support/solidblue.png" style="min-width: 34px; 26 min-height: 30px" data-expected-width="40" data-expected-height="40"> 27 height expected 40 but got 34 12 PASS .flexbox > img 5 13 PASS .flexbox > img 6 14 PASS .flexbox > img 7 15 PASS .flexbox > img 8 28 16 PASS .flexbox > img 9 29 17 PASS .flexbox > img 10 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/image-as-flexitem-size-004v-expected.txt
r272755 r273072 6 6 7 7 8 FAIL .flexbox > img 1 assert_equals: 9 <img src="support/solidblue.png" data-expected-width="40" data-expected-height="40"> 10 height expected 40 but got 16 8 PASS .flexbox > img 1 11 9 PASS .flexbox > img 2 12 10 PASS .flexbox > img 3 13 11 PASS .flexbox > img 4 14 FAIL .flexbox > img 5 assert_equals: 15 <img src="support/solidblue.png" style="min-width: 34px" data-expected-width="40" data-expected-height="40"> 16 height expected 40 but got 34 17 FAIL .flexbox > img 6 assert_equals: 18 <img src="support/solidblue.png" style="min-height: 34px" data-expected-width="40" data-expected-height="40"> 19 height expected 40 but got 34 20 FAIL .flexbox > img 7 assert_equals: 21 <img src="support/solidblue.png" style="min-width: 30px; 22 min-height: 34px" data-expected-width="40" data-expected-height="40"> 23 height expected 40 but got 34 24 FAIL .flexbox > img 8 assert_equals: 25 <img src="support/solidblue.png" style="min-width: 34px; 26 min-height: 30px" data-expected-width="40" data-expected-height="40"> 27 height expected 40 but got 34 12 PASS .flexbox > img 5 13 PASS .flexbox > img 6 14 PASS .flexbox > img 7 15 PASS .flexbox > img 8 28 16 PASS .flexbox > img 9 29 17 PASS .flexbox > img 10 -
trunk/Source/WebCore/ChangeLog
r273071 r273072 1 2021-02-15 Sergio Villar Senin <svillar@igalia.com> 2 3 [css-flex] Implement section 9.8 Definite and Indefinite Sizes case 1 4 https://bugs.webkit.org/show_bug.cgi?id=219538 5 <rdar://problem/72136484> 6 7 Reviewed by Manuel Rego Casasnovas. 8 9 If a single-line flex container has a definite cross size, the automatic preferred outer cross size 10 of any stretched flex items is the flex container's inner cross size (clamped to the flex item's 11 min and max cross size) and is considered definite. Before that we were considering all automatic 12 sizes as indefinite (see https://drafts.csswg.org/css-flexbox/#definite-sizes). 13 14 This patch does not consider all the cases where the container cross size is definite but just when 15 that size is fixed. Support for additional cases should be added in followup patches. 16 17 This change unveiled an implementation mistake when computing content sizes for the min-size:auto case. 18 In those cases we were always calling computeMainAxisExtentForChild() but that does not take into 19 account the aspect ratio, that's why we added an additional code path which computes the content 20 size using computeMainSizeFromAspectRatioUsing() instead. 21 22 This fixes 8 full tests plus 24 subtests in some other flexbox aspect ratio tests from the WPT suite. 23 24 * rendering/RenderFlexibleBox.cpp: 25 (WebCore::RenderFlexibleBox::useChildAspectRatio const): Use ternary operator to simplify code. 26 (WebCore::RenderFlexibleBox::computeMainSizeFromAspectRatioUsing const): Resolve child size to container's 27 size if childCrossSizeShouldUseContainerCrossSize(). 28 (WebCore::RenderFlexibleBox::childCrossSizeShouldUseContainerCrossSize const): New method implementing 29 section 9.8.1 of the specs. 30 (WebCore::RenderFlexibleBox::childCrossSizeIsDefinite const): 31 (WebCore::RenderFlexibleBox::computeInnerFlexBaseSizeForChild): Use aspect ratio to compute cross size 32 also if childCrossSizeShouldUseContainerCrossSize(). 33 (WebCore::RenderFlexibleBox::adjustChildSizeForMinAndMax): Use aspect ratio specific code to compute 34 content size if aspect ratio should be used for child. 35 (WebCore::RenderFlexibleBox::adjustChildSizeForAspectRatioCrossAxisMinAndMax): 36 * rendering/RenderFlexibleBox.h: 37 1 38 2021-02-18 Youenn Fablet <youenn@apple.com> 2 39 -
trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp
r272846 r273072 747 747 return false; 748 748 } 749 Length crossSize; 750 if (isHorizontalFlow()) 751 crossSize = child.style().height(); 752 else 753 crossSize = child.style().width(); 754 return childCrossSizeIsDefinite(child, crossSize); 749 return childCrossSizeIsDefinite(child, isHorizontalFlow() ? child.style().height() : child.style().width()); 755 750 } 756 751 … … 775 770 if (crossSizeLength.isFixed()) 776 771 crossSize = adjustForBoxSizing(child, crossSizeLength); 777 else { 772 else if (crossSizeLength.isAuto()) { 773 ASSERT(childCrossSizeShouldUseContainerCrossSize(child)); 774 auto containerCrossSizeLength = isHorizontalFlow() ? style().height() : style().width(); 775 // Keep this sync'ed with childCrossSizeShouldUseContainerCrossSize(). 776 ASSERT(containerCrossSizeLength.isFixed()); 777 crossSize = valueForLength(containerCrossSizeLength, -1_lu); 778 } else { 778 779 ASSERT(crossSizeLength.isPercentOrCalculated()); 779 780 crossSize = mainAxisIsChildInlineAxis(child) ? child.computePercentageLogicalHeight(crossSizeLength) : adjustBorderBoxLogicalWidthForBoxSizing(valueForLength(crossSizeLength, contentWidth()), crossSizeLength.type()); … … 823 824 } 824 825 826 bool RenderFlexibleBox::childCrossSizeShouldUseContainerCrossSize(const RenderBox& child) const 827 { 828 if (!child.hasAspectRatio() || !child.intrinsicSize().height()) 829 return false; 830 831 // 9.8 https://drafts.csswg.org/css-flexbox/#definite-sizes 832 // 1. If a single-line flex container has a definite cross size, the automatic preferred outer cross size of any 833 // stretched flex items is the flex container's inner cross size (clamped to the flex item's min and max cross size) 834 // and is considered definite. 835 if (!isMultiline() && alignmentForChild(child) == ItemPosition::Stretch && !hasAutoMarginsInCrossAxis(child)) { 836 // This must be kept in sync with computeMainSizeFromAspectRatioUsing(). 837 // FIXME: so far we're only considered fixed sizes but we should extend it to other definite sizes. 838 auto& crossSize = isHorizontalFlow() ? style().height() : style().width(); 839 return crossSize.isFixed(); 840 } 841 return false; 842 } 843 825 844 bool RenderFlexibleBox::childCrossSizeIsDefinite(const RenderBox& child, const Length& length) const 826 845 { 827 846 if (length.isAuto()) 828 847 return false; 848 829 849 if (length.isPercentOrCalculated()) { 830 850 if (!mainAxisIsChildInlineAxis(child) || m_hasDefiniteHeight == SizeDefiniteness::Definite) … … 873 893 return std::max(0_lu, computeMainAxisExtentForChild(child, MainOrPreferredSize, flexBasis).value()); 874 894 875 if (useChildAspectRatio(child) ) {895 if (useChildAspectRatio(child) || childCrossSizeShouldUseContainerCrossSize(child)) { 876 896 const Length& crossSizeLength = isHorizontalFlow() ? child.style().height() : child.style().width(); 877 897 return adjustChildSizeForAspectRatioCrossAxisMinAndMax(child, computeMainSizeFromAspectRatioUsing(child, crossSizeLength)); … … 1151 1171 // FIXME: If the min value is expected to be valid here, we need to come up with a non optional version of computeMainAxisExtentForChild and 1152 1172 // ensure it's valid through the virtual calls of computeIntrinsicLogicalContentHeightUsing. 1153 LayoutUnit contentSize = computeMainAxisExtentForChild(child, MinSize, Length(LengthType::MinContent)).valueOr(0); 1173 LayoutUnit contentSize; 1174 Length childCrossSizeLength = isHorizontalFlow() ? child.style().height() : child.style().width(); 1175 if (useChildAspectRatio(child)) 1176 contentSize = computeMainSizeFromAspectRatioUsing(child, childCrossSizeLength); 1177 else 1178 contentSize = computeMainAxisExtentForChild(child, MinSize, Length(LengthType::MinContent)).valueOr(0); 1179 if (child.hasAspectRatio() && child.intrinsicSize().height()) 1180 contentSize = adjustChildSizeForAspectRatioCrossAxisMinAndMax(child, contentSize); 1154 1181 ASSERT(contentSize >= 0); 1155 if (child.hasAspectRatio() && child.intrinsicSize().height() > 0)1156 contentSize = adjustChildSizeForAspectRatioCrossAxisMinAndMax(child, contentSize);1157 1182 contentSize = std::min(contentSize, maxExtent.valueOr(contentSize)); 1158 1183 … … 1165 1190 } 1166 1191 1167 if (useChildAspectRatio(child)) { 1168 Length crossSizeLength = isHorizontalFlow() ? child.style().height() : child.style().width(); 1169 Optional<LayoutUnit> transferredSize = computeMainSizeFromAspectRatioUsing(child, crossSizeLength); 1192 if (useChildAspectRatio(child) || childCrossSizeShouldUseContainerCrossSize(child)) { 1193 Optional<LayoutUnit> transferredSize = computeMainSizeFromAspectRatioUsing(child, childCrossSizeLength); 1170 1194 if (transferredSize) { 1171 1195 transferredSize = adjustChildSizeForAspectRatioCrossAxisMinAndMax(child, transferredSize.value()); … … 1173 1197 } 1174 1198 } 1175 1199 1176 1200 return std::max(childSize, contentSize); 1177 1201 } … … 1222 1246 Length crossMin = isHorizontalFlow() ? child.style().minHeight() : child.style().minWidth(); 1223 1247 Length crossMax = isHorizontalFlow() ? child.style().maxHeight() : child.style().maxWidth(); 1224 1248 1225 1249 if (childCrossSizeIsDefinite(child, crossMax)) { 1226 1250 LayoutUnit maxValue = computeMainSizeFromAspectRatioUsing(child, crossMax); 1227 1251 childSize = std::min(maxValue, childSize); 1228 1252 } 1229 1253 1230 1254 if (childCrossSizeIsDefinite(child, crossMin)) { 1231 1255 LayoutUnit minValue = computeMainSizeFromAspectRatioUsing(child, crossMin); -
trunk/Source/WebCore/rendering/RenderFlexibleBox.h
r272054 r273072 142 142 LayoutPoint flowAwareLocationForChild(const RenderBox& child) const; 143 143 bool useChildAspectRatio(const RenderBox& child) const; 144 bool childCrossSizeShouldUseContainerCrossSize(const RenderBox& child) const; 144 145 LayoutUnit computeMainSizeFromAspectRatioUsing(const RenderBox& child, Length crossSizeLength) const; 145 146 void setFlowAwareLocationForChild(RenderBox& child, const LayoutPoint&);
Note: See TracChangeset
for help on using the changeset viewer.