Changeset 288184 in webkit


Ignore:
Timestamp:
Jan 19, 2022 1:28:38 AM (6 months ago)
Author:
svillar@igalia.com
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.

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r288174 r288184  
     12022-01-18  Sergio Villar Senin  <svillar@igalia.com>
     2
     3        [css-flexbox] Add support for intrinsic sizes to the flex shorthand
     4        https://bugs.webkit.org/show_bug.cgi?id=235314
     5
     6        Reviewed by Darin Adler.
     7
     8        * web-platform-tests/css/css-flexbox/parsing/flex-shorthand-expected.txt: Replaced FAIL by PASS expectations.
     9
    1102022-01-18  Chris Dumez  <cdumez@apple.com>
    211
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/parsing/flex-shorthand-expected.txt

    r285709 r288184  
    2828PASS e.style['flex'] = "content" should set flex-shrink
    2929PASS e.style['flex'] = "content" should not set unrelated longhands
    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 FAIL e.style['flex'] = "0 fit-content" should set flex-grow assert_equals: flex-grow should be canonical expected "0" but got ""
    32 FAIL e.style['flex'] = "0 fit-content" should set flex-shrink assert_equals: flex-shrink should be canonical expected "1" but got ""
    33 FAIL e.style['flex'] = "0 fit-content" should not set unrelated longhands assert_true: expected true got false
    34 FAIL e.style['flex'] = "1 0 max-content" should set flex-basis assert_equals: flex-basis should be canonical expected "max-content" but got ""
    35 FAIL e.style['flex'] = "1 0 max-content" should set flex-grow assert_equals: flex-grow should be canonical expected "1" but got ""
    36 FAIL e.style['flex'] = "1 0 max-content" should set flex-shrink assert_equals: flex-shrink should be canonical expected "0" but got ""
    37 FAIL e.style['flex'] = "1 0 max-content" should not set unrelated longhands assert_true: expected true got false
     30PASS e.style['flex'] = "0 fit-content" should set flex-basis
     31PASS e.style['flex'] = "0 fit-content" should set flex-grow
     32PASS e.style['flex'] = "0 fit-content" should set flex-shrink
     33PASS e.style['flex'] = "0 fit-content" should not set unrelated longhands
     34PASS e.style['flex'] = "1 0 max-content" should set flex-basis
     35PASS e.style['flex'] = "1 0 max-content" should set flex-grow
     36PASS e.style['flex'] = "1 0 max-content" should set flex-shrink
     37PASS e.style['flex'] = "1 0 max-content" should not set unrelated longhands
    3838
  • trunk/Source/WebCore/ChangeLog

    r288183 r288184  
     12022-01-18  Sergio Villar Senin  <svillar@igalia.com>
     2
     3        [css-flexbox] Add support for intrinsic sizes to the flex shorthand
     4        https://bugs.webkit.org/show_bug.cgi?id=235314
     5
     6        Reviewed by Darin Adler.
     7
     8        In r288113 we added support for intrinsic sizes in the flex-basis property. However the flex-basis property
     9        can be also set via the flex shorthand. The flex shorthand was still not accepting the intrinsic sizes as
     10        valid values. That's why the code that was checking idents in flex-basis was refactored so we do perform
     11        now the very same test when parsing flex-basis and flex.
     12
     13        This allows WebKit to pass 8 additional WPT subtests.
     14
     15        * css/parser/CSSPropertyParser.cpp:
     16        (WebCore::isFlexBasisIdent): Refactored from consumeFlexBasis. Checks whether a given ident is a valid keyword
     17        for the flex-basis property.
     18        (WebCore::consumeFlexBasis): Use isFlexBasisIdent.
     19        (WebCore::CSSPropertyParser::consumeFlex): Ditto.
     20
    1212022-01-19  Said Abou-Hallawa  <said@apple.com>
    222
  • trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp

    r288113 r288184  
    22852285}
    22862286
     2287static bool isFlexBasisIdent(const WebCore::CSSValueID id, const CSSParserContext& context)
     2288{
     2289    return identMatches<CSSValueAuto, CSSValueContent>(id) || validWidthOrHeightKeyword(id, context);
     2290}
     2291
    22872292static RefPtr<CSSValue> consumeFlexBasis(CSSParserTokenRange& range, const CSSParserContext& context)
    22882293{
    2289     if (identMatches<CSSValueAuto, CSSValueContent>(range.peek().id()) || validWidthOrHeightKeyword(range.peek().id(), context))
     2294    if (isFlexBasisIdent(range.peek().id(), context))
    22902295        return consumeIdent(range);
    22912296    return consumeLengthOrPercent(range, context.mode, ValueRange::NonNegative);
     
    53535358                    return false;
    53545359            } else if (!flexBasis) {
    5355                 if (m_range.peek().id() == CSSValueAuto || m_range.peek().id() == CSSValueContent)
     5360                if (isFlexBasisIdent(m_range.peek().id(), m_context))
    53565361                    flexBasis = consumeIdent(m_range);
    53575362                if (!flexBasis)
Note: See TracChangeset for help on using the changeset viewer.