Changeset 284440 in webkit
- Timestamp:
- Oct 19, 2021 3:14:40 AM (9 months ago)
- Location:
- trunk
- Files:
-
- 20 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/TestExpectations (modified) (1 diff)
-
LayoutTests/imported/w3c/ChangeLog (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/parsing/flex-basis-computed-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/parsing/flex-basis-valid-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/parsing/flex-shorthand-expected.txt (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/css/CSSPrimitiveValue.cpp (modified) (3 diffs)
-
Source/WebCore/css/CSSProperties.json (modified) (1 diff)
-
Source/WebCore/css/LengthFunctions.cpp (modified) (3 diffs)
-
Source/WebCore/css/LengthFunctions.h (modified) (1 diff)
-
Source/WebCore/css/calc/CSSCalcValue.cpp (modified) (1 diff)
-
Source/WebCore/css/parser/CSSPropertyParser.cpp (modified) (2 diffs)
-
Source/WebCore/platform/Length.cpp (modified) (2 diffs)
-
Source/WebCore/platform/Length.h (modified) (5 diffs)
-
Source/WebCore/rendering/RenderBox.cpp (modified) (1 diff)
-
Source/WebCore/rendering/RenderFlexibleBox.cpp (modified) (4 diffs)
-
Source/WebCore/style/StyleBuilderConverter.h (modified) (2 diffs)
-
Source/WebKit/ChangeLog (modified) (1 diff)
-
Source/WebKit/Shared/WebCoreArgumentCoders.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r284439 r284440 1 2021-10-18 Sergio Villar Senin <svillar@igalia.com> 2 3 [css-flexbox] Add flex-basis: content support 4 https://bugs.webkit.org/show_bug.cgi?id=221479 5 6 Reviewed by Javier Fernandez. 7 8 * TestExpectations: Unskipped 6 tests that are now passing. 9 1 10 2021-10-19 Cameron McCormack <heycam@apple.com> 2 11 -
trunk/LayoutTests/TestExpectations
r284439 r284440 4211 4211 webkit.org/b/221478 imported/w3c/web-platform-tests/css/css-flexbox/synthesize-vrl-baseline.html [ ImageOnlyFailure ] 4212 4212 4213 # flex-basis:content.4214 webkit.org/b/221479 imported/w3c/web-platform-tests/css/css-flexbox/flexbox-flex-basis-content-001a.html [ ImageOnlyFailure ]4215 webkit.org/b/221479 imported/w3c/web-platform-tests/css/css-flexbox/flexbox-flex-basis-content-001b.html [ ImageOnlyFailure ]4216 webkit.org/b/221479 imported/w3c/web-platform-tests/css/css-flexbox/flexbox-flex-basis-content-002a.html [ ImageOnlyFailure ]4217 webkit.org/b/221479 imported/w3c/web-platform-tests/css/css-flexbox/flexbox-flex-basis-content-002b.html [ ImageOnlyFailure ]4218 webkit.org/b/221479 imported/w3c/web-platform-tests/css/css-flexbox/flexbox-flex-basis-content-003a.html [ ImageOnlyFailure ]4219 webkit.org/b/221479 imported/w3c/web-platform-tests/css/css-flexbox/flexbox-flex-basis-content-004a.html [ ImageOnlyFailure ]4220 4221 4213 # Flex item's min|max content contributions 4222 4214 webkit.org/b/230747 imported/w3c/web-platform-tests/css/css-flexbox/flex-container-max-content-001.html [ ImageOnlyFailure ] -
trunk/LayoutTests/imported/w3c/ChangeLog
r284439 r284440 1 2021-10-18 Sergio Villar Senin <svillar@igalia.com> 2 3 [css-flexbox] Add flex-basis: content support 4 https://bugs.webkit.org/show_bug.cgi?id=221479 5 6 Reviewed by Javier Fernandez. 7 8 Fixed 6 subtest expectations. All of them working fine now. 9 10 * web-platform-tests/css/css-flexbox/parsing/flex-basis-computed-expected.txt: 11 * web-platform-tests/css/css-flexbox/parsing/flex-basis-valid-expected.txt: 12 * web-platform-tests/css/css-flexbox/parsing/flex-shorthand-expected.txt: 13 1 14 2021-10-19 Cameron McCormack <heycam@apple.com> 2 15 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/parsing/flex-basis-computed-expected.txt
r283041 r284440 3 3 PASS Property flex-basis value '400%' 4 4 PASS Property flex-basis value 'auto' 5 FAIL Property flex-basis value 'content' assert_true: 'content' is a supported value for flex-basis. expected true got false 5 PASS Property flex-basis value 'content' 6 6 FAIL Property flex-basis value 'fit-content' assert_true: 'fit-content' is a supported value for flex-basis. expected true got false 7 7 FAIL Property flex-basis value 'min-content' assert_true: 'min-content' is a supported value for flex-basis. expected true got false -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/parsing/flex-basis-valid-expected.txt
r283041 r284440 7 7 FAIL e.style['flex-basis'] = "min-content" should set the property value assert_not_equals: property should be set got disallowed value "" 8 8 FAIL e.style['flex-basis'] = "max-content" should set the property value assert_not_equals: property should be set got disallowed value "" 9 FAIL e.style['flex-basis'] = "content" should set the property value assert_not_equals: property should be set got disallowed value "" 9 PASS e.style['flex-basis'] = "content" should set the property value 10 10 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/parsing/flex-shorthand-expected.txt
r283041 r284440 24 24 PASS e.style['flex'] = "8 auto" should set flex-shrink 25 25 PASS e.style['flex'] = "8 auto" should not set unrelated longhands 26 FAIL e.style['flex'] = "content" should set flex-basis assert_equals: flex-basis should be canonical expected "content" but got "" 27 FAIL e.style['flex'] = "content" should set flex-grow assert_equals: flex-grow should be canonical expected "1" but got "" 28 FAIL e.style['flex'] = "content" should set flex-shrink assert_equals: flex-shrink should be canonical expected "1" but got "" 29 FAIL e.style['flex'] = "content" should not set unrelated longhands assert_true: expected true got false 26 PASS e.style['flex'] = "content" should set flex-basis 27 PASS e.style['flex'] = "content" should set flex-grow 28 PASS e.style['flex'] = "content" should set flex-shrink 29 PASS e.style['flex'] = "content" should not set unrelated longhands 30 30 FAIL e.style['flex'] = "0 fit-content" should set flex-basis assert_equals: flex-basis should be canonical expected "fit-content" but got "" 31 31 FAIL e.style['flex'] = "0 fit-content" should set flex-grow assert_equals: flex-grow should be canonical expected "0" but got "" -
trunk/Source/WebCore/ChangeLog
r284439 r284440 1 2021-10-18 Sergio Villar Senin <svillar@igalia.com> 2 3 [css-flexbox] Add flex-basis: content support 4 https://bugs.webkit.org/show_bug.cgi?id=221479 5 6 Reviewed by Javier Fernandez. 7 8 Add support for the content keyword as a valid value for the flex-basis property. 9 It indicates an automated size based on the contents of the flex item. It's typically 10 equivalent to the max-content size but it has some adjustments for aspect ratios, 11 orthogonal flows and intrinsic sizing constraints. 12 13 Apart from adding the parsing support, it required very little adjustments in the 14 flexbox code after the refactoring in r284359. 15 16 This makes WebKit pass all of the flex-basis:content tests in WPT. We're talking 17 about 6 tests testing the feature and 6 subtests related to parsing. 18 19 * css/CSSPrimitiveValue.cpp: 20 (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): Handle Content in switch. 21 (WebCore::CSSPrimitiveValue::init): Initialization for content CSS value. 22 * css/CSSProperties.json: 23 * css/LengthFunctions.cpp: Replaced LengthOrAuto by LengthSizing. 24 (WebCore::valueForLength): Handle Content in switch. 25 (WebCore::floatValueForLength): Ditto. 26 * css/LengthFunctions.h: 27 (WebCore::minimumValueForLength): Ditto. 28 * css/calc/CSSCalcValue.cpp: 29 (WebCore::createCSS): Ditto. 30 * css/parser/CSSPropertyParser.cpp: 31 (WebCore::consumeFlexBasis): Consume CSSValueContent. 32 (WebCore::CSSPropertyParser::consumeFlex): Ditto. 33 * platform/Length.cpp: 34 (WebCore::operator<<): Added printing support for content. 35 * platform/Length.h: 36 (WebCore::Length::initialize): Added enum for content. 37 (WebCore::Length::isContent const): New method. 38 * rendering/RenderBox.cpp: 39 (WebCore::RenderBox::computeReplacedLogicalWidthUsing const): Handle content in switch. 40 * rendering/RenderFlexibleBox.cpp: 41 (WebCore::RenderFlexibleBox::childMainSizeIsDefinite): Treat content as indefinite lenght. 42 (WebCore::RenderFlexibleBox::childHasComputableAspectRatioAndCrossSizeIsConsideredDefinite): 43 Flex basis must be either auto or content. 44 (WebCore::RenderFlexibleBox::computeFlexBaseSizeForChild): Compute flex-basis using max-content 45 if flex-basis:content is specified. 46 * style/StyleBuilderConverter.h: 47 (WebCore::Style::BuilderConverter::convertLengthSizing): Handle content in switch. 48 1 49 2021-10-19 Cameron McCormack <heycam@apple.com> 2 50 -
trunk/Source/WebCore/css/CSSPrimitiveValue.cpp
r283562 r284440 38 38 #include "DeprecatedCSSOMPrimitiveValue.h" 39 39 #include "FontCascade.h" 40 #include "Length.h" 40 41 #include "Node.h" 41 42 #include "Pair.h" … … 291 292 switch (length.type()) { 292 293 case LengthType::Auto: 294 case LengthType::Content: 293 295 case LengthType::Intrinsic: 294 296 case LengthType::MinIntrinsic: … … 345 347 setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID); 346 348 m_value.valueID = CSSValueAuto; 349 return; 350 case LengthType::Content: 351 setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID); 352 m_value.valueID = CSSValueContent; 347 353 return; 348 354 case LengthType::Fixed: -
trunk/Source/WebCore/css/CSSProperties.json
r284361 r284440 5672 5672 "-webkit-flex-basis" 5673 5673 ], 5674 "converter": "Length OrAuto"5674 "converter": "LengthSizing" 5675 5675 }, 5676 5676 "specification": { -
trunk/Source/WebCore/css/LengthFunctions.cpp
r272805 r284440 50 50 case LengthType::Intrinsic: 51 51 case LengthType::MinIntrinsic: 52 case LengthType::Content: 52 53 case LengthType::MinContent: 53 54 case LengthType::MaxContent: … … 77 78 case LengthType::Intrinsic: 78 79 case LengthType::MinIntrinsic: 80 case LengthType::Content: 79 81 case LengthType::MinContent: 80 82 case LengthType::MaxContent: … … 103 105 case LengthType::Intrinsic: 104 106 case LengthType::MinIntrinsic: 107 case LengthType::Content: 105 108 case LengthType::MinContent: 106 109 case LengthType::MaxContent: -
trunk/Source/WebCore/css/LengthFunctions.h
r272805 r284440 60 60 case LengthType::FillAvailable: 61 61 case LengthType::Auto: 62 case LengthType::Content: 62 63 return 0; 63 64 case LengthType::Relative: -
trunk/Source/WebCore/css/calc/CSSCalcValue.cpp
r283359 r284440 265 265 return createCSS(length.calculationValue().expression(), style); 266 266 case LengthType::Auto: 267 case LengthType::Content: 267 268 case LengthType::Intrinsic: 268 269 case LengthType::MinIntrinsic: -
trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp
r284361 r284440 2242 2242 { 2243 2243 // FIXME: Support intrinsic dimensions too. 2244 if (range.peek().id() == CSSValueAuto )2244 if (range.peek().id() == CSSValueAuto || range.peek().id() == CSSValueContent) 2245 2245 return consumeIdent(range); 2246 2246 return consumeLengthOrPercent(range, cssParserMode, ValueRange::NonNegative); … … 5228 5228 return false; 5229 5229 } else if (!flexBasis) { 5230 if (m_range.peek().id() == CSSValueAuto )5230 if (m_range.peek().id() == CSSValueAuto || m_range.peek().id() == CSSValueContent) 5231 5231 flexBasis = consumeIdent(m_range); 5232 5232 if (!flexBasis) -
trunk/Source/WebCore/platform/Length.cpp
r283568 r284440 371 371 case LengthType::FitContent: ts << "fit-content"; break; 372 372 case LengthType::Calculated: ts << "calc"; break; 373 case LengthType::Content: ts << "content"; break; 373 374 case LengthType::Undefined: ts << "undefined"; break; 374 375 } … … 380 381 switch (length.type()) { 381 382 case LengthType::Auto: 383 case LengthType::Content: 382 384 case LengthType::Undefined: 383 385 ts << length.type(); -
trunk/Source/WebCore/platform/Length.h
r283470 r284440 48 48 FitContent, 49 49 Calculated, 50 Content, 50 51 Undefined 51 52 }; … … 104 105 bool isFitContent() const; 105 106 bool isMinIntrinsic() const; 107 bool isContent() const; 106 108 107 109 bool hasQuirk() const; … … 237 239 switch (m_type) { 238 240 case LengthType::Auto: 241 case LengthType::Content: 239 242 case LengthType::Undefined: 240 243 m_intValue = 0; … … 269 272 switch (m_type) { 270 273 case LengthType::Auto: 274 case LengthType::Content: 271 275 case LengthType::Undefined: 272 276 m_intValue = 0; … … 512 516 } 513 517 518 inline bool Length::isContent() const 519 { 520 return type() == LengthType::Content; 521 } 522 514 523 Length convertTo100PercentMinusLength(const Length&); 515 524 -
trunk/Source/WebCore/rendering/RenderBox.cpp
r284380 r284440 3342 3342 case LengthType::MinIntrinsic: 3343 3343 case LengthType::Auto: 3344 case LengthType::Content: 3344 3345 case LengthType::Relative: 3345 3346 case LengthType::Undefined: -
trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp
r284397 r284440 35 35 #include "HitTestResult.h" 36 36 #include "LayoutRepainter.h" 37 #include "Length.h" 37 38 #include "RenderBox.h" 38 39 #include "RenderChildIterator.h" … … 918 919 bool RenderFlexibleBox::childMainSizeIsDefinite(const RenderBox& child, const Length& flexBasis) 919 920 { 920 if (flexBasis.isAuto() )921 if (flexBasis.isAuto() || flexBasis.isContent()) 921 922 return false; 922 923 if (isColumnFlow() && (flexBasis.isIntrinsic() || flexBasis.type() == LengthType::Intrinsic)) … … 936 937 bool RenderFlexibleBox::childHasComputableAspectRatioAndCrossSizeIsConsideredDefinite(const RenderBox& child) 937 938 { 938 return childHasComputableAspectRatio(child) 939 auto flexBasis = flexBasisForChild(child); 940 return childHasComputableAspectRatio(child) && (flexBasis.isContent() || flexBasis.isAuto()) 939 941 && (childCrossSizeIsDefinite(child, crossSizeLengthForChild(MainOrPreferredSize, child)) || childCrossSizeShouldUseContainerCrossSize(child)); 940 942 } … … 1070 1072 // 9.3.2 E. Otherwise, size the item into the available space using its used flex basis in place of its main size. 1071 1073 { 1072 ScopedUnboundedBoxWithFlexBasisAsChildMainSize flexBasisScope(child, flexBasis , mainAxisIsChildInlineAxis(child));1074 ScopedUnboundedBoxWithFlexBasisAsChildMainSize flexBasisScope(child, flexBasis.isContent() ? Length(LengthType::MaxContent) : flexBasis, mainAxisIsChildInlineAxis(child)); 1073 1075 if (mainAxisIsChildInlineAxis(child)) 1074 1076 return child.maxPreferredLogicalWidth() - mainAxisBorderAndPadding; -
trunk/Source/WebCore/style/StyleBuilderConverter.h
r284361 r284440 69 69 static Length convertLength(const BuilderState&, const CSSValue&); 70 70 static Length convertLengthOrAuto(const BuilderState&, const CSSValue&); 71 static Length convertLengthOrAutoOrContent(const BuilderState&, const CSSValue&); 71 72 static Length convertLengthSizing(const BuilderState&, const CSSValue&); 72 73 static Length convertLengthMaxSizing(const BuilderState&, const CSSValue&); … … 245 246 case CSSValueAuto: 246 247 return Length(LengthType::Auto); 248 case CSSValueContent: 249 return Length(LengthType::Content); 247 250 default: 248 251 ASSERT_NOT_REACHED(); -
trunk/Source/WebKit/ChangeLog
r284439 r284440 1 2021-10-18 Sergio Villar Senin <svillar@igalia.com> 2 3 [css-flexbox] Add flex-basis: content support 4 https://bugs.webkit.org/show_bug.cgi?id=221479 5 <rdar://problem/74279369> 6 7 Reviewed by Javier Fernandez. 8 9 Handle LengthType::Content in encode/decode functions. 10 11 * Shared/WebCoreArgumentCoders.cpp: 12 (IPC::ArgumentCoder<Length>::encode): 13 (IPC::ArgumentCoder<Length>::decode): 14 1 15 2021-10-19 Cameron McCormack <heycam@apple.com> 2 16 -
trunk/Source/WebKit/Shared/WebCoreArgumentCoders.cpp
r284095 r284440 718 718 switch (length.type()) { 719 719 case LengthType::Auto: 720 case LengthType::Content: 720 721 case LengthType::Undefined: 721 722 break; … … 753 754 switch (type) { 754 755 case LengthType::Auto: 756 case LengthType::Content: 755 757 case LengthType::Undefined: 756 758 length = Length(type);
Note: See TracChangeset
for help on using the changeset viewer.