Changeset 285709 in webkit
- Timestamp:
- Nov 12, 2021, 2:17:21 AM (5 years 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) (2 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
r285708 r285709 1 2021-11-11 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 all the flexbox-flex-basis-content tests that work fine now. 9 1 10 2021-11-12 Arcady Goldmints-Orlov <agoldmints@igalia.com> 2 11 -
trunk/LayoutTests/TestExpectations
r285624 r285709 4262 4262 webkit.org/b/221478 imported/w3c/web-platform-tests/css/css-flexbox/synthesize-vrl-baseline.html [ ImageOnlyFailure ] 4263 4263 4264 # flex-basis:content.4265 webkit.org/b/221479 imported/w3c/web-platform-tests/css/css-flexbox/flexbox-flex-basis-content-001a.html [ ImageOnlyFailure ]4266 webkit.org/b/221479 imported/w3c/web-platform-tests/css/css-flexbox/flexbox-flex-basis-content-001b.html [ ImageOnlyFailure ]4267 webkit.org/b/221479 imported/w3c/web-platform-tests/css/css-flexbox/flexbox-flex-basis-content-002a.html [ ImageOnlyFailure ]4268 webkit.org/b/221479 imported/w3c/web-platform-tests/css/css-flexbox/flexbox-flex-basis-content-002b.html [ ImageOnlyFailure ]4269 webkit.org/b/221479 imported/w3c/web-platform-tests/css/css-flexbox/flexbox-flex-basis-content-003a.html [ ImageOnlyFailure ]4270 webkit.org/b/221479 imported/w3c/web-platform-tests/css/css-flexbox/flexbox-flex-basis-content-004a.html [ ImageOnlyFailure ]4271 4272 4264 # Flex item's min|max content contributions 4273 4265 webkit.org/b/230747 imported/w3c/web-platform-tests/css/css-flexbox/flex-container-max-content-001.html [ ImageOnlyFailure ] -
trunk/LayoutTests/imported/w3c/ChangeLog
r285639 r285709 1 2021-11-11 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 * web-platform-tests/css/css-flexbox/parsing/flex-basis-computed-expected.txt: Replaced FAIL 9 by PASS expectations. 10 * web-platform-tests/css/css-flexbox/parsing/flex-basis-valid-expected.txt: Ditto. 11 * web-platform-tests/css/css-flexbox/parsing/flex-shorthand-expected.txt: Ditto. 12 1 13 2021-11-11 Alexey Shvayka <ashvayka@apple.com> 2 14 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/parsing/flex-basis-computed-expected.txt
r285045 r285709 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
r285045 r285709 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
r285045 r285709 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
r285698 r285709 1 2021-11-11 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::computeFlexBaseSizeForChild): Compute flex-basis using max-content 43 if flex-basis:content is specified. 44 * style/StyleBuilderConverter.h: 45 (WebCore::Style::BuilderConverter::convertLengthSizing): Handle content in switch. 46 1 47 2021-11-11 Brent Fulgham <bfulgham@apple.com> 2 48 -
trunk/Source/WebCore/css/CSSPrimitiveValue.cpp
r285373 r285709 39 39 #include "DeprecatedCSSOMPrimitiveValue.h" 40 40 #include "FontCascade.h" 41 #include "Length.h" 41 42 #include "Node.h" 42 43 #include "Pair.h" … … 316 317 switch (length.type()) { 317 318 case LengthType::Auto: 319 case LengthType::Content: 318 320 case LengthType::Intrinsic: 319 321 case LengthType::MinIntrinsic: … … 377 379 setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID); 378 380 m_value.valueID = CSSValueAuto; 381 return; 382 case LengthType::Content: 383 setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID); 384 m_value.valueID = CSSValueContent; 379 385 return; 380 386 case LengthType::Fixed: -
trunk/Source/WebCore/css/CSSProperties.json
r285615 r285709 5634 5634 "-webkit-flex-basis" 5635 5635 ], 5636 "converter": "Length OrAuto"5636 "converter": "LengthSizing" 5637 5637 }, 5638 5638 "specification": { -
trunk/Source/WebCore/css/LengthFunctions.cpp
r285045 r285709 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
r285045 r285709 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
r285045 r285709 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
r285492 r285709 2270 2270 { 2271 2271 // FIXME: Support intrinsic dimensions too. 2272 if (range.peek().id() == CSSValueAuto )2272 if (range.peek().id() == CSSValueAuto || range.peek().id() == CSSValueContent) 2273 2273 return consumeIdent(range); 2274 2274 return consumeLengthOrPercent(range, cssParserMode, ValueRange::NonNegative); … … 5269 5269 return false; 5270 5270 } else if (!flexBasis) { 5271 if (m_range.peek().id() == CSSValueAuto )5271 if (m_range.peek().id() == CSSValueAuto || m_range.peek().id() == CSSValueContent) 5272 5272 flexBasis = consumeIdent(m_range); 5273 5273 if (!flexBasis) -
trunk/Source/WebCore/platform/Length.cpp
r285397 r285709 379 379 case LengthType::FitContent: ts << "fit-content"; break; 380 380 case LengthType::Calculated: ts << "calc"; break; 381 case LengthType::Content: ts << "content"; break; 381 382 case LengthType::Undefined: ts << "undefined"; break; 382 383 } … … 388 389 switch (length.type()) { 389 390 case LengthType::Auto: 391 case LengthType::Content: 390 392 case LengthType::Undefined: 391 393 ts << length.type(); -
trunk/Source/WebCore/platform/Length.h
r285045 r285709 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
r285640 r285709 3404 3404 case LengthType::MinIntrinsic: 3405 3405 case LengthType::Auto: 3406 case LengthType::Content: 3406 3407 case LengthType::Relative: 3407 3408 case LengthType::Undefined: -
trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp
r285623 r285709 922 922 bool RenderFlexibleBox::childMainSizeIsDefinite(const RenderBox& child, const Length& flexBasis) 923 923 { 924 if (flexBasis.isAuto() )924 if (flexBasis.isAuto() || flexBasis.isContent()) 925 925 return false; 926 926 if (isColumnFlow() && (flexBasis.isIntrinsic() || flexBasis.type() == LengthType::Intrinsic)) … … 1030 1030 { 1031 1031 Length flexBasis = flexBasisForChild(child); 1032 ScopedFlexBasisAsChildMainSize scoped(child, flexBasis ForChild(child), mainAxisIsChildInlineAxis(child));1032 ScopedFlexBasisAsChildMainSize scoped(child, flexBasis.isContent() ? Length(LengthType::MaxContent) : flexBasis, mainAxisIsChildInlineAxis(child)); 1033 1033 1034 1034 maybeCacheChildMainIntrinsicSize(child, relayoutChildren); -
trunk/Source/WebCore/style/StyleBuilderConverter.h
r285343 r285709 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
r285707 r285709 1 2021-11-11 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 * Shared/WebCoreArgumentCoders.cpp: 9 (IPC::ArgumentCoder<Length>::encode): Handle content in switch. 10 (IPC::ArgumentCoder<Length>::decode): Ditto. 11 1 12 2021-11-11 Per Arne Vollan <pvollan@apple.com> 2 13 -
trunk/Source/WebKit/Shared/WebCoreArgumentCoders.cpp
r285361 r285709 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.