Title: [285045] trunk
Revision
285045
Author
[email protected]
Date
2021-10-29 13:17:26 -0700 (Fri, 29 Oct 2021)

Log Message

Unreviewed, revert r284440, r284397, r284359

LayoutTests/imported/w3c:

* web-platform-tests/css/css-flexbox/parsing/flex-basis-computed-expected.txt:
* web-platform-tests/css/css-flexbox/parsing/flex-basis-valid-expected.txt:
* web-platform-tests/css/css-flexbox/parsing/flex-shorthand-expected.txt:

Source/WebCore:

r284359 causes Twitter using CPU 100%.
We reverted r284440 and r284397 too since they rely on r284359 change.

* css/CSSPrimitiveValue.cpp:
(WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
(WebCore::CSSPrimitiveValue::init):
* css/CSSProperties.json:
* css/LengthFunctions.cpp:
(WebCore::valueForLength):
(WebCore::floatValueForLength):
* css/LengthFunctions.h:
(WebCore::minimumValueForLength):
* css/calc/CSSCalcValue.cpp:
(WebCore::createCSS):
* css/parser/CSSPropertyParser.cpp:
(WebCore::consumeFlexBasis):
(WebCore::CSSPropertyParser::consumeFlex):
* platform/Length.cpp:
(WebCore::operator<<):
* platform/Length.h:
(WebCore::Length::initialize):
(WebCore::Length::isContent const): Deleted.
* rendering/RenderBox.cpp:
(WebCore::RenderBox::computeReplacedLogicalWidthUsing const):
* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::computeMainAxisExtentForChild):
(WebCore::RenderFlexibleBox::childMainSizeIsDefinite):
(WebCore::RenderFlexibleBox::childHasComputableAspectRatioAndCrossSizeIsConsideredDefinite):
(WebCore::RenderFlexibleBox::computeInnerFlexBaseSizeForChild):
(WebCore::RenderFlexibleBox::computeFlexItemMinMaxSizes):
(WebCore::RenderFlexibleBox::constructFlexItem):
(WebCore::RenderFlexibleBox::layoutAndPlaceChildren):
(WebCore::RenderFlexibleBox::applyStretchAlignmentToChild):
(WebCore::ScopedUnboundedBoxWithFlexBasisAsChildMainSize::ScopedUnboundedBoxWithFlexBasisAsChildMainSize): Deleted.
(WebCore::ScopedUnboundedBoxWithFlexBasisAsChildMainSize::~ScopedUnboundedBoxWithFlexBasisAsChildMainSize): Deleted.
(WebCore::RenderFlexibleBox::computeFlexBaseSizeForChild): Deleted.
* rendering/RenderFlexibleBox.h:
* style/StyleBuilderConverter.h:
(WebCore::Style::BuilderConverter::convertLengthSizing):

Source/WebKit:

* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<Length>::encode):
(IPC::ArgumentCoder<Length>::decode):

LayoutTests:

* TestExpectations:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (285044 => 285045)


--- trunk/LayoutTests/ChangeLog	2021-10-29 19:28:34 UTC (rev 285044)
+++ trunk/LayoutTests/ChangeLog	2021-10-29 20:17:26 UTC (rev 285045)
@@ -1,3 +1,9 @@
+2021-10-29  Yusuke Suzuki  <[email protected]>
+
+        Unreviewed, revert r284440, r284397, r284359
+
+        * TestExpectations:
+
 2021-10-29  Ayumi Kojima  <[email protected]>
 
         [ BigSur wk1 Debug arm64 ] inspector/audit/run-accessibility.html is a flaky timeout.

Modified: trunk/LayoutTests/TestExpectations (285044 => 285045)


--- trunk/LayoutTests/TestExpectations	2021-10-29 19:28:34 UTC (rev 285044)
+++ trunk/LayoutTests/TestExpectations	2021-10-29 20:17:26 UTC (rev 285045)
@@ -4188,7 +4188,9 @@
 webkit.org/b/209080 imported/w3c/web-platform-tests/css/css-writing-modes/vertical-alignment-srl-034.xht [ ImageOnlyFailure ]
 webkit.org/b/209080 imported/w3c/web-platform-tests/css/css-writing-modes/vertical-alignment-srl-040.xht [ ImageOnlyFailure ]
 
+webkit.org/b/219343 imported/w3c/web-platform-tests/css/css-flexbox/flex-aspect-ratio-img-column-012.html [ ImageOnlyFailure ]
 webkit.org/b/219343 imported/w3c/web-platform-tests/css/css-flexbox/flex-aspect-ratio-img-column-015.html [ ImageOnlyFailure ]
+webkit.org/b/219343 imported/w3c/web-platform-tests/css/css-flexbox/flex-aspect-ratio-img-row-007.html [ ImageOnlyFailure ]
 webkit.org/b/219343 imported/w3c/web-platform-tests/css/css-flexbox/flex-aspect-ratio-img-row-010.html [ ImageOnlyFailure ]
 webkit.org/b/219343 imported/w3c/web-platform-tests/css/css-flexbox/aspect-ratio-intrinsic-size-005.html [ ImageOnlyFailure ]
 
@@ -4214,6 +4216,7 @@
 webkit.org/b/221473 imported/w3c/web-platform-tests/css/css-flexbox/table-as-item-inflexible-in-column-1.html [ ImageOnlyFailure ]
 webkit.org/b/221473 imported/w3c/web-platform-tests/css/css-flexbox/table-as-item-inflexible-in-column-2.html [ ImageOnlyFailure ]
 webkit.org/b/221473 imported/w3c/web-platform-tests/css/css-flexbox/table-as-item-inflexible-in-row-2.html [ ImageOnlyFailure ]
+webkit.org/b/221473 imported/w3c/web-platform-tests/css/css-flexbox/table-as-item-min-height-1.html [ ImageOnlyFailure ]
 
 # SVGs as flex items.
 webkit.org/b/221474 imported/w3c/web-platform-tests/css/css-flexbox/svg-root-as-flex-item-002.html [ ImageOnlyFailure ]
@@ -4234,6 +4237,17 @@
 webkit.org/b/221478 imported/w3c/web-platform-tests/css/css-flexbox/dynamic-baseline-change.html [ ImageOnlyFailure ]
 webkit.org/b/221478 imported/w3c/web-platform-tests/css/css-flexbox/synthesize-vrl-baseline.html [ ImageOnlyFailure ]
 
+# flex-basis:content.
+webkit.org/b/221479 imported/w3c/web-platform-tests/css/css-flexbox/flexbox-flex-basis-content-001a.html [ ImageOnlyFailure ]
+webkit.org/b/221479 imported/w3c/web-platform-tests/css/css-flexbox/flexbox-flex-basis-content-001b.html [ ImageOnlyFailure ]
+webkit.org/b/221479 imported/w3c/web-platform-tests/css/css-flexbox/flexbox-flex-basis-content-002a.html [ ImageOnlyFailure ]
+webkit.org/b/221479 imported/w3c/web-platform-tests/css/css-flexbox/flexbox-flex-basis-content-002b.html [ ImageOnlyFailure ]
+webkit.org/b/221479 imported/w3c/web-platform-tests/css/css-flexbox/flexbox-flex-basis-content-003a.html [ ImageOnlyFailure ]
+webkit.org/b/221479 imported/w3c/web-platform-tests/css/css-flexbox/flexbox-flex-basis-content-004a.html [ ImageOnlyFailure ]
+
+# flex-basis with %.
+webkit.org/b/ imported/w3c/web-platform-tests/css/css-flexbox/flex-basis-011.html [ ImageOnlyFailure ]
+
 # Flex item's min|max content contributions
 webkit.org/b/230747 imported/w3c/web-platform-tests/css/css-flexbox/flex-container-max-content-001.html [ ImageOnlyFailure ]
 webkit.org/b/230747 imported/w3c/web-platform-tests/css/css-flexbox/flex-container-min-content-001.html [ ImageOnlyFailure ]

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (285044 => 285045)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2021-10-29 19:28:34 UTC (rev 285044)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2021-10-29 20:17:26 UTC (rev 285045)
@@ -1,3 +1,11 @@
+2021-10-29  Yusuke Suzuki  <[email protected]>
+
+        Unreviewed, revert r284440, r284397, r284359
+
+        * web-platform-tests/css/css-flexbox/parsing/flex-basis-computed-expected.txt:
+        * web-platform-tests/css/css-flexbox/parsing/flex-basis-valid-expected.txt:
+        * web-platform-tests/css/css-flexbox/parsing/flex-shorthand-expected.txt:
+
 2021-10-29  Chris Dumez  <[email protected]>
 
         [ iOS ] imported/w3c/web-platform-tests/dom/events/scrolling/iframe-chains.html is missing its results

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/parsing/flex-basis-computed-expected.txt (285044 => 285045)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/parsing/flex-basis-computed-expected.txt	2021-10-29 19:28:34 UTC (rev 285044)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/parsing/flex-basis-computed-expected.txt	2021-10-29 20:17:26 UTC (rev 285045)
@@ -2,7 +2,7 @@
 PASS Property flex-basis value '1px'
 PASS Property flex-basis value '400%'
 PASS Property flex-basis value 'auto'
-PASS Property flex-basis value 'content'
+FAIL Property flex-basis value 'content' assert_true: 'content' is a supported value for flex-basis. expected true got false
 FAIL Property flex-basis value 'fit-content' assert_true: 'fit-content' is a supported value for flex-basis. expected true got false
 FAIL Property flex-basis value 'min-content' assert_true: 'min-content' is a supported value for flex-basis. expected true got false
 FAIL Property flex-basis value 'max-content' assert_true: 'max-content' is a supported value for flex-basis. expected true got false

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/parsing/flex-basis-valid-expected.txt (285044 => 285045)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/parsing/flex-basis-valid-expected.txt	2021-10-29 19:28:34 UTC (rev 285044)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/parsing/flex-basis-valid-expected.txt	2021-10-29 20:17:26 UTC (rev 285045)
@@ -6,5 +6,5 @@
 FAIL e.style['flex-basis'] = "fit-content" should set the property value assert_not_equals: property should be set got disallowed value ""
 FAIL e.style['flex-basis'] = "min-content" should set the property value assert_not_equals: property should be set got disallowed value ""
 FAIL e.style['flex-basis'] = "max-content" should set the property value assert_not_equals: property should be set got disallowed value ""
-PASS e.style['flex-basis'] = "content" should set the property value
+FAIL e.style['flex-basis'] = "content" should set the property value assert_not_equals: property should be set got disallowed value ""
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/parsing/flex-shorthand-expected.txt (285044 => 285045)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/parsing/flex-shorthand-expected.txt	2021-10-29 19:28:34 UTC (rev 285044)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/parsing/flex-shorthand-expected.txt	2021-10-29 20:17:26 UTC (rev 285045)
@@ -23,10 +23,10 @@
 PASS e.style['flex'] = "8 auto" should set flex-grow
 PASS e.style['flex'] = "8 auto" should set flex-shrink
 PASS e.style['flex'] = "8 auto" should not set unrelated longhands
-PASS e.style['flex'] = "content" should set flex-basis
-PASS e.style['flex'] = "content" should set flex-grow
-PASS e.style['flex'] = "content" should set flex-shrink
-PASS e.style['flex'] = "content" should not set unrelated longhands
+FAIL e.style['flex'] = "content" should set flex-basis assert_equals: flex-basis should be canonical expected "content" but got ""
+FAIL e.style['flex'] = "content" should set flex-grow assert_equals: flex-grow should be canonical expected "1" but got ""
+FAIL e.style['flex'] = "content" should set flex-shrink assert_equals: flex-shrink should be canonical expected "1" but got ""
+FAIL e.style['flex'] = "content" should not set unrelated longhands assert_true: expected true got false
 FAIL e.style['flex'] = "0 fit-content" should set flex-basis assert_equals: flex-basis should be canonical expected "fit-content" but got ""
 FAIL e.style['flex'] = "0 fit-content" should set flex-grow assert_equals: flex-grow should be canonical expected "0" but got ""
 FAIL e.style['flex'] = "0 fit-content" should set flex-shrink assert_equals: flex-shrink should be canonical expected "1" but got ""

Modified: trunk/Source/WebCore/ChangeLog (285044 => 285045)


--- trunk/Source/WebCore/ChangeLog	2021-10-29 19:28:34 UTC (rev 285044)
+++ trunk/Source/WebCore/ChangeLog	2021-10-29 20:17:26 UTC (rev 285045)
@@ -1,3 +1,47 @@
+2021-10-29  Yusuke Suzuki  <[email protected]>
+
+        Unreviewed, revert r284440, r284397, r284359
+
+        r284359 causes Twitter using CPU 100%.
+        We reverted r284440 and r284397 too since they rely on r284359 change.
+
+        * css/CSSPrimitiveValue.cpp:
+        (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
+        (WebCore::CSSPrimitiveValue::init):
+        * css/CSSProperties.json:
+        * css/LengthFunctions.cpp:
+        (WebCore::valueForLength):
+        (WebCore::floatValueForLength):
+        * css/LengthFunctions.h:
+        (WebCore::minimumValueForLength):
+        * css/calc/CSSCalcValue.cpp:
+        (WebCore::createCSS):
+        * css/parser/CSSPropertyParser.cpp:
+        (WebCore::consumeFlexBasis):
+        (WebCore::CSSPropertyParser::consumeFlex):
+        * platform/Length.cpp:
+        (WebCore::operator<<):
+        * platform/Length.h:
+        (WebCore::Length::initialize):
+        (WebCore::Length::isContent const): Deleted.
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::computeReplacedLogicalWidthUsing const):
+        * rendering/RenderFlexibleBox.cpp:
+        (WebCore::RenderFlexibleBox::computeMainAxisExtentForChild):
+        (WebCore::RenderFlexibleBox::childMainSizeIsDefinite):
+        (WebCore::RenderFlexibleBox::childHasComputableAspectRatioAndCrossSizeIsConsideredDefinite):
+        (WebCore::RenderFlexibleBox::computeInnerFlexBaseSizeForChild):
+        (WebCore::RenderFlexibleBox::computeFlexItemMinMaxSizes):
+        (WebCore::RenderFlexibleBox::constructFlexItem):
+        (WebCore::RenderFlexibleBox::layoutAndPlaceChildren):
+        (WebCore::RenderFlexibleBox::applyStretchAlignmentToChild):
+        (WebCore::ScopedUnboundedBoxWithFlexBasisAsChildMainSize::ScopedUnboundedBoxWithFlexBasisAsChildMainSize): Deleted.
+        (WebCore::ScopedUnboundedBoxWithFlexBasisAsChildMainSize::~ScopedUnboundedBoxWithFlexBasisAsChildMainSize): Deleted.
+        (WebCore::RenderFlexibleBox::computeFlexBaseSizeForChild): Deleted.
+        * rendering/RenderFlexibleBox.h:
+        * style/StyleBuilderConverter.h:
+        (WebCore::Style::BuilderConverter::convertLengthSizing):
+
 2021-10-29  Sihui Liu  <[email protected]>
 
         Release FileSystemStorageHandle when it is not in use

Modified: trunk/Source/WebCore/css/CSSPrimitiveValue.cpp (285044 => 285045)


--- trunk/Source/WebCore/css/CSSPrimitiveValue.cpp	2021-10-29 19:28:34 UTC (rev 285044)
+++ trunk/Source/WebCore/css/CSSPrimitiveValue.cpp	2021-10-29 20:17:26 UTC (rev 285045)
@@ -37,7 +37,6 @@
 #include "Counter.h"
 #include "DeprecatedCSSOMPrimitiveValue.h"
 #include "FontCascade.h"
-#include "Length.h"
 #include "Node.h"
 #include "Pair.h"
 #include "Rect.h"
@@ -315,7 +314,6 @@
 {
     switch (length.type()) {
     case LengthType::Auto:
-    case LengthType::Content:
     case LengthType::Intrinsic:
     case LengthType::MinIntrinsic:
     case LengthType::MinContent:
@@ -371,10 +369,6 @@
         setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
         m_value.valueID = CSSValueAuto;
         return;
-    case LengthType::Content:
-        setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
-        m_value.valueID = CSSValueContent;
-        return;
     case LengthType::Fixed:
         setPrimitiveUnitType(CSSUnitType::CSS_PX);
         m_value.num = length.value();

Modified: trunk/Source/WebCore/css/CSSProperties.json (285044 => 285045)


--- trunk/Source/WebCore/css/CSSProperties.json	2021-10-29 19:28:34 UTC (rev 285044)
+++ trunk/Source/WebCore/css/CSSProperties.json	2021-10-29 20:17:26 UTC (rev 285045)
@@ -5630,7 +5630,7 @@
                 "aliases": [
                     "-webkit-flex-basis"
                 ],
-                "converter": "LengthSizing"
+                "converter": "LengthOrAuto"
             },
             "specification": {
                 "category": "css-flexbox",

Modified: trunk/Source/WebCore/css/LengthFunctions.cpp (285044 => 285045)


--- trunk/Source/WebCore/css/LengthFunctions.cpp	2021-10-29 19:28:34 UTC (rev 285044)
+++ trunk/Source/WebCore/css/LengthFunctions.cpp	2021-10-29 20:17:26 UTC (rev 285045)
@@ -49,7 +49,6 @@
     case LengthType::Relative:
     case LengthType::Intrinsic:
     case LengthType::MinIntrinsic:
-    case LengthType::Content:
     case LengthType::MinContent:
     case LengthType::MaxContent:
     case LengthType::FitContent:
@@ -77,7 +76,6 @@
     case LengthType::Relative:
     case LengthType::Intrinsic:
     case LengthType::MinIntrinsic:
-    case LengthType::Content:
     case LengthType::MinContent:
     case LengthType::MaxContent:
     case LengthType::FitContent:
@@ -104,7 +102,6 @@
     case LengthType::Relative:
     case LengthType::Intrinsic:
     case LengthType::MinIntrinsic:
-    case LengthType::Content:
     case LengthType::MinContent:
     case LengthType::MaxContent:
     case LengthType::FitContent:

Modified: trunk/Source/WebCore/css/LengthFunctions.h (285044 => 285045)


--- trunk/Source/WebCore/css/LengthFunctions.h	2021-10-29 19:28:34 UTC (rev 285044)
+++ trunk/Source/WebCore/css/LengthFunctions.h	2021-10-29 20:17:26 UTC (rev 285045)
@@ -59,7 +59,6 @@
         return LayoutUnit(length.nonNanCalculatedValue(maximumValue));
     case LengthType::FillAvailable:
     case LengthType::Auto:
-    case LengthType::Content:
         return 0;
     case LengthType::Relative:
     case LengthType::Intrinsic:

Modified: trunk/Source/WebCore/css/calc/CSSCalcValue.cpp (285044 => 285045)


--- trunk/Source/WebCore/css/calc/CSSCalcValue.cpp	2021-10-29 19:28:34 UTC (rev 285044)
+++ trunk/Source/WebCore/css/calc/CSSCalcValue.cpp	2021-10-29 20:17:26 UTC (rev 285045)
@@ -264,7 +264,6 @@
     case LengthType::Calculated:
         return createCSS(length.calculationValue()._expression_(), style);
     case LengthType::Auto:
-    case LengthType::Content:
     case LengthType::Intrinsic:
     case LengthType::MinIntrinsic:
     case LengthType::MinContent:

Modified: trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp (285044 => 285045)


--- trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp	2021-10-29 19:28:34 UTC (rev 285044)
+++ trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp	2021-10-29 20:17:26 UTC (rev 285045)
@@ -2241,7 +2241,7 @@
 static RefPtr<CSSValue> consumeFlexBasis(CSSParserTokenRange& range, CSSParserMode cssParserMode)
 {
     // FIXME: Support intrinsic dimensions too.
-    if (range.peek().id() == CSSValueAuto || range.peek().id() == CSSValueContent)
+    if (range.peek().id() == CSSValueAuto)
         return consumeIdent(range);
     return consumeLengthOrPercent(range, cssParserMode, ValueRange::NonNegative);
 }
@@ -5237,7 +5237,7 @@
                 else
                     return false;
             } else if (!flexBasis) {
-                if (m_range.peek().id() == CSSValueAuto || m_range.peek().id() == CSSValueContent)
+                if (m_range.peek().id() == CSSValueAuto)
                     flexBasis = consumeIdent(m_range);
                 if (!flexBasis)
                     flexBasis = consumeLengthOrPercent(m_range, m_context.mode, ValueRange::NonNegative);

Modified: trunk/Source/WebCore/platform/Length.cpp (285044 => 285045)


--- trunk/Source/WebCore/platform/Length.cpp	2021-10-29 19:28:34 UTC (rev 285044)
+++ trunk/Source/WebCore/platform/Length.cpp	2021-10-29 20:17:26 UTC (rev 285045)
@@ -370,7 +370,6 @@
     case LengthType::FillAvailable: ts << "fill-available"; break;
     case LengthType::FitContent: ts << "fit-content"; break;
     case LengthType::Calculated: ts << "calc"; break;
-    case LengthType::Content: ts << "content"; break;
     case LengthType::Undefined: ts << "undefined"; break;
     }
     return ts;
@@ -380,7 +379,6 @@
 {
     switch (length.type()) {
     case LengthType::Auto:
-    case LengthType::Content:
     case LengthType::Undefined:
         ts << length.type();
         break;

Modified: trunk/Source/WebCore/platform/Length.h (285044 => 285045)


--- trunk/Source/WebCore/platform/Length.h	2021-10-29 19:28:34 UTC (rev 285044)
+++ trunk/Source/WebCore/platform/Length.h	2021-10-29 20:17:26 UTC (rev 285045)
@@ -47,7 +47,6 @@
     FillAvailable,
     FitContent,
     Calculated,
-    Content,
     Undefined
 };
 
@@ -104,7 +103,6 @@
     bool isFillAvailable() const;
     bool isFitContent() const;
     bool isMinIntrinsic() const;
-    bool isContent() const;
 
     bool hasQuirk() const;
     void setHasQuirk(bool);
@@ -238,7 +236,6 @@
 
     switch (m_type) {
     case LengthType::Auto:
-    case LengthType::Content:
     case LengthType::Undefined:
         m_intValue = 0;
         break;
@@ -271,7 +268,6 @@
 
     switch (m_type) {
     case LengthType::Auto:
-    case LengthType::Content:
     case LengthType::Undefined:
         m_intValue = 0;
         break;
@@ -515,11 +511,6 @@
     return type() == LengthType::MinIntrinsic;
 }
 
-inline bool Length::isContent() const
-{
-    return type() == LengthType::Content;
-}
-
 Length convertTo100PercentMinusLength(const Length&);
 
 WTF::TextStream& operator<<(WTF::TextStream&, Length);

Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (285044 => 285045)


--- trunk/Source/WebCore/rendering/RenderBox.cpp	2021-10-29 19:28:34 UTC (rev 285044)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp	2021-10-29 20:17:26 UTC (rev 285045)
@@ -3346,7 +3346,6 @@
     case LengthType::Intrinsic:
     case LengthType::MinIntrinsic:
     case LengthType::Auto:
-    case LengthType::Content:
     case LengthType::Relative:
     case LengthType::Undefined:
         return intrinsicLogicalWidth();

Modified: trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp (285044 => 285045)


--- trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp	2021-10-29 19:28:34 UTC (rev 285044)
+++ trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp	2021-10-29 20:17:26 UTC (rev 285045)
@@ -34,12 +34,9 @@
 #include "FlexibleBoxAlgorithm.h"
 #include "HitTestResult.h"
 #include "LayoutRepainter.h"
-#include "Length.h"
-#include "RenderBox.h"
 #include "RenderChildIterator.h"
 #include "RenderLayer.h"
 #include "RenderLayoutState.h"
-#include "RenderObjectEnums.h"
 #include "RenderStyleConstants.h"
 #include "RenderView.h"
 #include "WritingMode.h"
@@ -631,7 +628,13 @@
     // horizontal flow and horizontal writing mode, or vertical flow and vertical
     // writing mode. Otherwise we need the logical height.
     if (!mainAxisIsChildInlineAxis(child)) {
-        child.layoutIfNeeded();
+        // We don't have to check for "auto" here - computeContentLogicalHeight
+        // will just return a null Optional for that case anyway. It's safe to access
+        // scrollbarLogicalHeight here because ComputeNextFlexLine will have
+        // already forced layout on the child. We previously did a layout out the child
+        // if necessary (see ComputeNextFlexLine and the call to
+        // childHasIntrinsicMainAxisSize) so we can be sure that the two height
+        // calls here will return up-to-date data.
         std::optional<LayoutUnit> height = child.computeContentLogicalHeight(sizeType, size, cachedChildIntrinsicContentLogicalHeight(child));
         if (!height)
             return height;
@@ -918,7 +921,7 @@
 
 bool RenderFlexibleBox::childMainSizeIsDefinite(const RenderBox& child, const Length& flexBasis)
 {
-    if (flexBasis.isAuto() || flexBasis.isContent())
+    if (flexBasis.isAuto())
         return false;
     if (isColumnFlow() && (flexBasis.isIntrinsic() || flexBasis.type() == LengthType::Intrinsic))
         return false;
@@ -936,8 +939,7 @@
 
 bool RenderFlexibleBox::childHasComputableAspectRatioAndCrossSizeIsConsideredDefinite(const RenderBox& child)
 {
-    auto flexBasis = flexBasisForChild(child);
-    return childHasComputableAspectRatio(child) && (flexBasis.isContent() || flexBasis.isAuto())
+    return childHasComputableAspectRatio(child)
         && (childCrossSizeIsDefinite(child, crossSizeLengthForChild(MainOrPreferredSize, child)) || childCrossSizeShouldUseContainerCrossSize(child));
 }
 
@@ -998,88 +1000,29 @@
     m_intrinsicSizeAlongMainAxis.remove(&child);
 }
 
-// This is a RAII class that is used to temporarily set the flex basis as the child size in the main axis. Apart from that
-// the min|max-size restrictions are ignored for this computation. See https://drafts.csswg.org/css-flexbox/#algo-main-item
-// for further details.
-class ScopedUnboundedBoxWithFlexBasisAsChildMainSize {
-public:
-    ScopedUnboundedBoxWithFlexBasisAsChildMainSize(RenderBox& child, Length flexBasis, bool mainAxisIsInlineAxis)
-        : m_child(child)
-        , m_isHorizontalWritingModeInParallelFlow(mainAxisIsInlineAxis == child.isHorizontalWritingMode())
-        , m_mainAxisIsInlineAxis(mainAxisIsInlineAxis)
-    {
-        if (m_isHorizontalWritingModeInParallelFlow) {
-            m_originalMinSize = m_child.style().minWidth();
-            m_originalMaxSize = m_child.style().maxWidth();
-            m_child.mutableStyle().setMinWidth(RenderStyle::initialMinSize());
-            m_child.mutableStyle().setMaxWidth(RenderStyle::initialMaxSize());
-        } else {
-            m_originalMinSize = m_child.style().minHeight();
-            m_originalMaxSize = m_child.style().maxHeight();
-            m_child.mutableStyle().setMinHeight(RenderStyle::initialMinSize());
-            m_child.mutableStyle().setMaxHeight(RenderStyle::initialMaxSize());
-        }
-
-        if (m_mainAxisIsInlineAxis) {
-            m_originalSize = m_child.style().logicalWidth();
-            m_child.mutableStyle().setLogicalWidth(Length(flexBasis));
-            return;
-        }
-        m_originalSize = m_child.style().logicalHeight();
-        m_child.mutableStyle().setLogicalHeight(Length(flexBasis));
-    }
-    ~ScopedUnboundedBoxWithFlexBasisAsChildMainSize()
-    {
-        if (m_isHorizontalWritingModeInParallelFlow) {
-            m_child.mutableStyle().setMinWidth(Length(m_originalMinSize));
-            m_child.mutableStyle().setMaxWidth(Length(m_originalMaxSize));
-        } else {
-            m_child.mutableStyle().setMinHeight(Length(m_originalMinSize));
-            m_child.mutableStyle().setMaxHeight(Length(m_originalMaxSize));
-        }
-
-        if (m_mainAxisIsInlineAxis)
-            m_child.mutableStyle().setLogicalWidth(Length(m_originalSize));
-        else
-            m_child.mutableStyle().setLogicalHeight(Length(m_originalSize));
-    }
-private:
-    RenderBox& m_child;
-    bool m_isHorizontalWritingModeInParallelFlow;
-    bool m_mainAxisIsInlineAxis;
-    Length m_originalSize;
-    Length m_originalMinSize;
-    Length m_originalMaxSize;
-};
-
-// https://drafts.csswg.org/css-flexbox/#algo-main-item
-LayoutUnit RenderFlexibleBox::computeFlexBaseSizeForChild(RenderBox& child, LayoutUnit mainAxisBorderAndPadding)
+LayoutUnit RenderFlexibleBox::computeInnerFlexBaseSizeForChild(RenderBox& child, LayoutUnit mainAxisBorderAndPadding)
 {
     Length flexBasis = flexBasisForChild(child);
-    // 9.3.2 A.
     if (childMainSizeIsDefinite(child, flexBasis))
         return std::max(0_lu, computeMainAxisExtentForChild(child, MainOrPreferredSize, flexBasis).value());
 
-    // 9.3.2 B.
     if (childHasComputableAspectRatioAndCrossSizeIsConsideredDefinite(child)) {
         const Length& crossSizeLength = crossSizeLengthForChild(MainOrPreferredSize, child);
         return adjustChildSizeForAspectRatioCrossAxisMinAndMax(child, computeMainSizeFromAspectRatioUsing(child, crossSizeLength));
     }
 
-    // FIXME: implement 9.3.2 C.
-    // FIXME: implement 9.3.2 D.
-
-    // 9.3.2 E. Otherwise, size the item into the available space using its used flex basis in place of its main size.
-    {
-        ScopedUnboundedBoxWithFlexBasisAsChildMainSize flexBasisScope(child, flexBasis.isContent() ? Length(LengthType::MaxContent) : flexBasis, mainAxisIsChildInlineAxis(child));
-        if (mainAxisIsChildInlineAxis(child))
-            return child.maxPreferredLogicalWidth() - mainAxisBorderAndPadding;
-
-        if (childHasIntrinsicMainAxisSize(child))
-            child.setNeedsLayout(MarkOnlyThis);
-        child.layoutIfNeeded();
-        return child.logicalHeight() - mainAxisBorderAndPadding;
+    // The flex basis is indefinite (=auto), so we need to compute the actual width of the child.
+    LayoutUnit mainAxisExtent;
+    if (!mainAxisIsChildInlineAxis(child)) {
+        ASSERT(!child.needsLayout());
+        ASSERT(m_intrinsicSizeAlongMainAxis.contains(&child));
+        mainAxisExtent = m_intrinsicSizeAlongMainAxis.get(&child);
+    } else {
+        // We don't need to add scrollbarLogicalWidth here because the preferred
+        // width includes the scrollbar, even for overflow: auto.
+        mainAxisExtent = child.maxPreferredLogicalWidth();
     }
+    return mainAxisExtent - mainAxisBorderAndPadding;
 }
 
 void RenderFlexibleBox::layoutFlexItems(bool relayoutChildren)
@@ -1317,7 +1260,7 @@
     }
 }
 
-std::pair<LayoutUnit, LayoutUnit> RenderFlexibleBox::computeFlexItemMinMaxSizes(RenderBox& child, bool relayoutChildren)
+std::pair<LayoutUnit, LayoutUnit> RenderFlexibleBox::computeFlexItemMinMaxSizes(RenderBox& child)
 {
     Length max = mainSizeLengthForChild(MaxSize, child);
     std::optional<LayoutUnit> maxExtent = std::nullopt;
@@ -1336,30 +1279,8 @@
         Length childCrossSizeLength = crossSizeLengthForChild(MainOrPreferredSize, child);
         if (child.isRenderReplaced() && childHasComputableAspectRatio(child) && childCrossSizeIsDefinite(child, childCrossSizeLength))
             contentSize = computeMainSizeFromAspectRatioUsing(child, childCrossSizeLength);
-        else {
-            if (childHasIntrinsicMainAxisSize(child)) {
-                // If this condition is true, then computeMainAxisExtentForChild will call
-                // child.intrinsicContentLogicalHeight() and child.scrollbarLogicalHeight(),
-                // so if the child has intrinsic min/max/preferred size, run layout on it now to make sure
-                // its logical height and scroll bars are up to date.
-                updateBlockChildDirtyBitsBeforeLayout(relayoutChildren, child);
-                // Don't resolve percentages in children. This is especially important for the min-height calculation,
-                // where we want percentages to be treated as auto.
-                if (child.needsLayout() || !m_intrinsicSizeAlongMainAxis.contains(&child)) {
-                    if (isHorizontalWritingMode() == child.isHorizontalWritingMode())
-                        child.setOverridingContainingBlockContentLogicalHeight(std::nullopt);
-                    else
-                        child.setOverridingContainingBlockContentLogicalWidth(std::nullopt);
-
-                    child.clearOverridingContentSize();
-                    child.setChildNeedsLayout(MarkOnlyThis);
-                    child.layoutIfNeeded();
-                    cacheChildMainSize(child);
-                    child.clearOverridingContainingBlockContentSize();
-                }
-            }
+        else
             contentSize = computeMainAxisExtentForChild(child, MinSize, Length(LengthType::MinContent)).value_or(0);
-        }
         if (child.hasIntrinsicAspectRatio() && child.intrinsicSize().height())
             contentSize = adjustChildSizeForAspectRatioCrossAxisMinAndMax(child, contentSize);
         ASSERT(contentSize >= 0);
@@ -1446,10 +1367,32 @@
 {
     auto childHadLayout = child.everHadLayout();
     child.clearOverridingContentSize();
+    if (childHasIntrinsicMainAxisSize(child)) {
+        // If this condition is true, then computeMainAxisExtentForChild will call
+        // child.intrinsicContentLogicalHeight() and child.scrollbarLogicalHeight(),
+        // so if the child has intrinsic min/max/preferred size, run layout on it now to make sure
+        // its logical height and scroll bars are up to date.
+        updateBlockChildDirtyBitsBeforeLayout(relayoutChildren, child);
+        // Don't resolve percentages in children. This is especially important for the min-height calculation,
+        // where we want percentages to be treated as auto. For flex-basis itself, this is not a problem because
+        // by definition we have an indefinite flex basis here and thus percentages should not resolve.
+        if (child.needsLayout() || !m_intrinsicSizeAlongMainAxis.contains(&child)) {
+            if (isHorizontalWritingMode() == child.isHorizontalWritingMode())
+                child.setOverridingContainingBlockContentLogicalHeight(std::nullopt);
+            else
+                child.setOverridingContainingBlockContentLogicalWidth(std::nullopt);
+            child.clearOverridingContentSize();
+            child.setChildNeedsLayout(MarkOnlyThis);
+            child.layoutIfNeeded();
+            cacheChildMainSize(child);
+            child.clearOverridingContainingBlockContentSize();
+        }
+    }
+    
     LayoutUnit borderAndPadding = isHorizontalFlow() ? child.horizontalBorderAndPaddingExtent() : child.verticalBorderAndPaddingExtent();
-    LayoutUnit childFlexBaseSize = computeFlexBaseSizeForChild(child, borderAndPadding);
+    LayoutUnit childInnerFlexBaseSize = computeInnerFlexBaseSizeForChild(child, borderAndPadding);
     LayoutUnit margin = isHorizontalFlow() ? child.horizontalMarginExtent() : child.verticalMarginExtent();
-    return FlexItem(child, childFlexBaseSize, borderAndPadding, margin, computeFlexItemMinMaxSizes(child, relayoutChildren), childHadLayout);
+    return FlexItem(child, childInnerFlexBaseSize, borderAndPadding, margin, computeFlexItemMinMaxSizes(child), childHadLayout);
 }
     
 void RenderFlexibleBox::freezeViolations(Vector<FlexItem*>& violations, LayoutUnit& availableFreeSpace, double& totalFlexGrow, double& totalFlexShrink, double& totalWeightedFlexShrink)
@@ -1945,7 +1888,7 @@
             resetAutoMarginsAndLogicalTopInCrossAxis(child);
         }
         // We may have already forced relayout for orthogonal flowing children in
-        // computeFlexBaseSizeForChild.
+        // computeInnerFlexBaseSizeForChild.
         bool forceChildRelayout = relayoutChildren && !m_relaidOutChildren.contains(&child);
         if (!forceChildRelayout && childHasPercentHeightDescendants(child)) {
             // Have to force another relayout even though the child is sized
@@ -2200,7 +2143,7 @@
     } else if (!mainAxisIsChildInlineAxis(child) && child.style().logicalWidth().isAuto()) {
         LayoutUnit childWidth = std::max(0_lu, lineCrossAxisExtent - crossAxisMarginExtentForChild(child));
         childWidth = child.constrainLogicalWidthInFragmentByMinMax(childWidth, crossAxisContentExtent(), *this, nullptr);
-
+        
         if (childWidth != child.logicalWidth()) {
             child.setOverridingLogicalWidth(childWidth);
             child.setChildNeedsLayout(MarkOnlyThis);

Modified: trunk/Source/WebCore/rendering/RenderFlexibleBox.h (285044 => 285045)


--- trunk/Source/WebCore/rendering/RenderFlexibleBox.h	2021-10-29 19:28:34 UTC (rev 285044)
+++ trunk/Source/WebCore/rendering/RenderFlexibleBox.h	2021-10-29 20:17:26 UTC (rev 285045)
@@ -150,7 +150,7 @@
     void computeChildIntrinsicLogicalWidths(RenderObject&, LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const override;
     LayoutUnit computeMainSizeFromAspectRatioUsing(const RenderBox& child, Length crossSizeLength) const;
     void setFlowAwareLocationForChild(RenderBox& child, const LayoutPoint&);
-    LayoutUnit computeFlexBaseSizeForChild(RenderBox& child, LayoutUnit mainAxisBorderAndPadding);
+    LayoutUnit computeInnerFlexBaseSizeForChild(RenderBox& child, LayoutUnit mainAxisBorderAndPadding);
     void adjustAlignmentForChild(RenderBox& child, LayoutUnit);
     ItemPosition alignmentForChild(const RenderBox& child) const;
     bool canComputePercentageFlexBasis(const RenderBox& child, const Length& flexBasis, UpdatePercentageHeightDescendants);
@@ -176,7 +176,7 @@
     
     LayoutUnit computeChildMarginValue(Length margin);
     void prepareOrderIteratorAndMargins();
-    std::pair<LayoutUnit, LayoutUnit> computeFlexItemMinMaxSizes(RenderBox& child, bool relayoutChildren);
+    std::pair<LayoutUnit, LayoutUnit> computeFlexItemMinMaxSizes(RenderBox& child);
     LayoutUnit adjustChildSizeForAspectRatioCrossAxisMinAndMax(const RenderBox& child, LayoutUnit childSize);
     FlexItem constructFlexItem(RenderBox&, bool relayoutChildren);
     

Modified: trunk/Source/WebCore/style/StyleBuilderConverter.h (285044 => 285045)


--- trunk/Source/WebCore/style/StyleBuilderConverter.h	2021-10-29 19:28:34 UTC (rev 285044)
+++ trunk/Source/WebCore/style/StyleBuilderConverter.h	2021-10-29 20:17:26 UTC (rev 285045)
@@ -68,7 +68,6 @@
 public:
     static Length convertLength(const BuilderState&, const CSSValue&);
     static Length convertLengthOrAuto(const BuilderState&, const CSSValue&);
-    static Length convertLengthOrAutoOrContent(const BuilderState&, const CSSValue&);
     static Length convertLengthSizing(const BuilderState&, const CSSValue&);
     static Length convertLengthMaxSizing(const BuilderState&, const CSSValue&);
     static TabSize convertTabSize(const BuilderState&, const CSSValue&);
@@ -245,8 +244,6 @@
         return Length(LengthType::FitContent);
     case CSSValueAuto:
         return Length(LengthType::Auto);
-    case CSSValueContent:
-        return Length(LengthType::Content);
     default:
         ASSERT_NOT_REACHED();
         return Length();

Modified: trunk/Source/WebKit/ChangeLog (285044 => 285045)


--- trunk/Source/WebKit/ChangeLog	2021-10-29 19:28:34 UTC (rev 285044)
+++ trunk/Source/WebKit/ChangeLog	2021-10-29 20:17:26 UTC (rev 285045)
@@ -1,3 +1,11 @@
+2021-10-29  Yusuke Suzuki  <[email protected]>
+
+        Unreviewed, revert r284440, r284397, r284359
+
+        * Shared/WebCoreArgumentCoders.cpp:
+        (IPC::ArgumentCoder<Length>::encode):
+        (IPC::ArgumentCoder<Length>::decode):
+
 2021-10-29  Sihui Liu  <[email protected]>
 
         Release FileSystemStorageHandle when it is not in use

Modified: trunk/Source/WebKit/Shared/WebCoreArgumentCoders.cpp (285044 => 285045)


--- trunk/Source/WebKit/Shared/WebCoreArgumentCoders.cpp	2021-10-29 19:28:34 UTC (rev 285044)
+++ trunk/Source/WebKit/Shared/WebCoreArgumentCoders.cpp	2021-10-29 20:17:26 UTC (rev 285045)
@@ -717,7 +717,6 @@
 
     switch (length.type()) {
     case LengthType::Auto:
-    case LengthType::Content:
     case LengthType::Undefined:
         break;
     case LengthType::Fixed:
@@ -753,7 +752,6 @@
 
     switch (type) {
     case LengthType::Auto:
-    case LengthType::Content:
     case LengthType::Undefined:
         length = Length(type);
         return true;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to