Title: [288184] trunk
Revision
288184
Author
[email protected]
Date
2022-01-19 01:28:38 -0800 (Wed, 19 Jan 2022)

Log Message

[css-flexbox] Add support for intrinsic sizes to the flex shorthand
https://bugs.webkit.org/show_bug.cgi?id=235314

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

* web-platform-tests/css/css-flexbox/parsing/flex-shorthand-expected.txt: Replaced FAIL by PASS expectations.

Source/WebCore:

In r288113 we added support for intrinsic sizes in the flex-basis property. However the flex-basis property
can be also set via the flex shorthand. The flex shorthand was still not accepting the intrinsic sizes as
valid values. That's why the code that was checking idents in flex-basis was refactored so we do perform
now the very same test when parsing flex-basis and flex.

This allows WebKit to pass 8 additional WPT subtests.

* css/parser/CSSPropertyParser.cpp:
(WebCore::isFlexBasisIdent): Refactored from consumeFlexBasis. Checks whether a given ident is a valid keyword
for the flex-basis property.
(WebCore::consumeFlexBasis): Use isFlexBasisIdent.
(WebCore::CSSPropertyParser::consumeFlex): Ditto.

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (288183 => 288184)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2022-01-19 08:37:08 UTC (rev 288183)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2022-01-19 09:28:38 UTC (rev 288184)
@@ -1,3 +1,12 @@
+2022-01-18  Sergio Villar Senin  <[email protected]>
+
+        [css-flexbox] Add support for intrinsic sizes to the flex shorthand
+        https://bugs.webkit.org/show_bug.cgi?id=235314
+
+        Reviewed by Darin Adler.
+
+        * web-platform-tests/css/css-flexbox/parsing/flex-shorthand-expected.txt: Replaced FAIL by PASS expectations.
+
 2022-01-18  Chris Dumez  <[email protected]>
 
         When inserting a selected <option> in a <select> element, its selected state should remain

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


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/parsing/flex-shorthand-expected.txt	2022-01-19 08:37:08 UTC (rev 288183)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/parsing/flex-shorthand-expected.txt	2022-01-19 09:28:38 UTC (rev 288184)
@@ -27,12 +27,12 @@
 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'] = "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 ""
-FAIL e.style['flex'] = "0 fit-content" should not set unrelated longhands assert_true: expected true got false
-FAIL e.style['flex'] = "1 0 max-content" should set flex-basis assert_equals: flex-basis should be canonical expected "max-content" but got ""
-FAIL e.style['flex'] = "1 0 max-content" should set flex-grow assert_equals: flex-grow should be canonical expected "1" but got ""
-FAIL e.style['flex'] = "1 0 max-content" should set flex-shrink assert_equals: flex-shrink should be canonical expected "0" but got ""
-FAIL e.style['flex'] = "1 0 max-content" should not set unrelated longhands assert_true: expected true got false
+PASS e.style['flex'] = "0 fit-content" should set flex-basis
+PASS e.style['flex'] = "0 fit-content" should set flex-grow
+PASS e.style['flex'] = "0 fit-content" should set flex-shrink
+PASS e.style['flex'] = "0 fit-content" should not set unrelated longhands
+PASS e.style['flex'] = "1 0 max-content" should set flex-basis
+PASS e.style['flex'] = "1 0 max-content" should set flex-grow
+PASS e.style['flex'] = "1 0 max-content" should set flex-shrink
+PASS e.style['flex'] = "1 0 max-content" should not set unrelated longhands
 

Modified: trunk/Source/WebCore/ChangeLog (288183 => 288184)


--- trunk/Source/WebCore/ChangeLog	2022-01-19 08:37:08 UTC (rev 288183)
+++ trunk/Source/WebCore/ChangeLog	2022-01-19 09:28:38 UTC (rev 288184)
@@ -1,3 +1,23 @@
+2022-01-18  Sergio Villar Senin  <[email protected]>
+
+        [css-flexbox] Add support for intrinsic sizes to the flex shorthand
+        https://bugs.webkit.org/show_bug.cgi?id=235314
+
+        Reviewed by Darin Adler.
+
+        In r288113 we added support for intrinsic sizes in the flex-basis property. However the flex-basis property
+        can be also set via the flex shorthand. The flex shorthand was still not accepting the intrinsic sizes as
+        valid values. That's why the code that was checking idents in flex-basis was refactored so we do perform
+        now the very same test when parsing flex-basis and flex.
+
+        This allows WebKit to pass 8 additional WPT subtests.
+
+        * css/parser/CSSPropertyParser.cpp:
+        (WebCore::isFlexBasisIdent): Refactored from consumeFlexBasis. Checks whether a given ident is a valid keyword
+        for the flex-basis property.
+        (WebCore::consumeFlexBasis): Use isFlexBasisIdent.
+        (WebCore::CSSPropertyParser::consumeFlex): Ditto.
+
 2022-01-19  Said Abou-Hallawa  <[email protected]>
 
         filterRegion and outsets of referenced SVG filter are calculated incorrectly

Modified: trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp (288183 => 288184)


--- trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp	2022-01-19 08:37:08 UTC (rev 288183)
+++ trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp	2022-01-19 09:28:38 UTC (rev 288184)
@@ -2284,9 +2284,14 @@
     return consumeUrl(range);
 }
 
+static bool isFlexBasisIdent(const WebCore::CSSValueID id, const CSSParserContext& context)
+{
+    return identMatches<CSSValueAuto, CSSValueContent>(id) || validWidthOrHeightKeyword(id, context);
+}
+
 static RefPtr<CSSValue> consumeFlexBasis(CSSParserTokenRange& range, const CSSParserContext& context)
 {
-    if (identMatches<CSSValueAuto, CSSValueContent>(range.peek().id()) || validWidthOrHeightKeyword(range.peek().id(), context))
+    if (isFlexBasisIdent(range.peek().id(), context))
         return consumeIdent(range);
     return consumeLengthOrPercent(range, context.mode, ValueRange::NonNegative);
 }
@@ -5352,7 +5357,7 @@
                 else
                     return false;
             } else if (!flexBasis) {
-                if (m_range.peek().id() == CSSValueAuto || m_range.peek().id() == CSSValueContent)
+                if (isFlexBasisIdent(m_range.peek().id(), m_context))
                     flexBasis = consumeIdent(m_range);
                 if (!flexBasis)
                     flexBasis = consumeLengthOrPercent(m_range, m_context.mode, ValueRange::NonNegative);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to