Changeset 268665 in webkit


Ignore:
Timestamp:
Oct 19, 2020 2:24:46 AM (21 months ago)
Author:
commit-queue@webkit.org
Message:

axis in scroll-snap-type should be required
https://bugs.webkit.org/show_bug.cgi?id=210468
<rdar://problem/61746766>

Patch by Martin Robinson <mrobinson@igalia.com> on 2020-10-19
Reviewed by Simon Fraser.

LayoutTests/imported/w3c:

  • web-platform-tests/css/css-scroll-snap/parsing/scroll-snap-type-invalid-expected.txt: Update

expected results to note newly passing tests.

Source/WebCore:

  • css/parser/CSSPropertyParser.cpp:

(WebCore::consumeScrollSnapType): The first value is either the scroll axis or 'none'.

  • style/StyleBuilderConverter.h:

(WebCore::Style::BuilderConverter::convertScrollSnapType): If the first value is 'none',
the default values of ScrollSnapType should be fine. If we have a second value, use it.
Otherwise the default for strictness is "proximity."

LayoutTests:

  • css3/scroll-snap/scroll-snap-inherit.html: Update test and results to reflect specification.
  • css3/scroll-snap/scroll-snap-property-computed-style-expected.txt: Ditto.
  • css3/scroll-snap/scroll-snap-property-computed-style.js: Ditto.
  • css3/scroll-snap/scroll-snap-property-parsing-expected.txt: Ditto.
  • css3/scroll-snap/scroll-snap-property-parsing.js: Ditto.
Location:
trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r268659 r268665  
     12020-10-19  Martin Robinson  <mrobinson@igalia.com>
     2
     3        axis in scroll-snap-type should be required
     4        https://bugs.webkit.org/show_bug.cgi?id=210468
     5        <rdar://problem/61746766>
     6
     7        Reviewed by Simon Fraser.
     8
     9        * css3/scroll-snap/scroll-snap-inherit.html: Update test and results to reflect specification.
     10        * css3/scroll-snap/scroll-snap-property-computed-style-expected.txt: Ditto.
     11        * css3/scroll-snap/scroll-snap-property-computed-style.js: Ditto.
     12        * css3/scroll-snap/scroll-snap-property-parsing-expected.txt: Ditto.
     13        * css3/scroll-snap/scroll-snap-property-parsing.js: Ditto.
     14
    1152020-10-18  Emilio Cobos Álvarez  <emilio@crisal.io>
    216
  • trunk/LayoutTests/css3/scroll-snap/scroll-snap-inherit.html

    r268348 r268665  
    3030
    3131            .noInherit {
    32                 scroll-snap-type: mandatory;
     32                scroll-snap-type: both mandatory;
    3333                scroll-snap-align: center;
    3434                scroll-padding: 20px;
     
    4444
    4545            .inheritAlign {
    46                 scroll-snap-type: mandatory;
     46                scroll-snap-type: both mandatory;
    4747                scroll-snap-align: inherit;
    4848                scroll-padding: 20px;
     
    5151
    5252            .inheritPadding {
    53                 scroll-snap-type: mandatory;
     53                scroll-snap-type: both mandatory;
    5454                scroll-snap-align: center;
    5555                scroll-padding: inherit;
     
    5858
    5959            .inheritMargin {
    60                 scroll-snap-type: mandatory;
     60                scroll-snap-type: both mandatory;
    6161                scroll-snap-align: center;
    6262                scroll-padding: 20px;
  • trunk/LayoutTests/css3/scroll-snap/scroll-snap-property-computed-style-expected.txt

    r268348 r268665  
    2626PASS window.getComputedStyle(document.body).getPropertyValue('scroll-snap-type') is 'none'
    2727
     28only strictness: `mandatory`
     29PASS window.getComputedStyle(document.body).getPropertyValue('scroll-snap-type') is 'none'
     30
    2831initial value: `initial`
    2932PASS window.getComputedStyle(document.body).getPropertyValue('scroll-snap-type') is 'none'
    30 
    31 only strictness: `mandatory`
    32 PASS window.getComputedStyle(document.body).getPropertyValue('scroll-snap-type') is 'both mandatory'
    3333
    3434only axis: `both`
  • trunk/LayoutTests/css3/scroll-snap/scroll-snap-property-computed-style.js

    r268348 r268665  
    2828testComputedScrollSnapRule("two strictness values", "scroll-snap-type", "proximity mandatory", "none");
    2929testComputedScrollSnapRule("axis following strictness", "scroll-snap-type", "mandatory inline", "none");
     30testComputedScrollSnapRule("only strictness", "scroll-snap-type", "mandatory", "none");
    3031// Valid declarations
    3132testComputedScrollSnapRule("initial value", "scroll-snap-type", "initial", "none");
    32 testComputedScrollSnapRule("only strictness", "scroll-snap-type", "mandatory", "both mandatory");
    3333testComputedScrollSnapRule("only axis", "scroll-snap-type", "both", "both");
    3434testComputedScrollSnapRule("none", "scroll-snap-type", "none", "none");
  • trunk/LayoutTests/css3/scroll-snap/scroll-snap-property-parsing-expected.txt

    r253079 r268665  
    99PASS declaration.length is 1
    1010PASS declaration.getPropertyValue('scroll-snap-type') is 'initial'
    11 
    12 only strictness : mandatory
    13 PASS cssRule.type is 1
    14 PASS declaration.length is 1
    15 PASS declaration.getPropertyValue('scroll-snap-type') is 'mandatory'
    1611
    1712only axis : both
  • trunk/LayoutTests/css3/scroll-snap/scroll-snap-property-parsing.js

    r253079 r268665  
    2222
    2323testScrollSnapRule("initial value", "scroll-snap-type", "initial", "initial", 1);
    24 testScrollSnapRule("only strictness", "scroll-snap-type", "mandatory", "mandatory", 1);
    2524testScrollSnapRule("only axis", "scroll-snap-type", "both", "both", 1);
    2625testScrollSnapRule("none", "scroll-snap-type", "none", "none", 1);
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r268659 r268665  
     12020-10-19  Martin Robinson  <mrobinson@igalia.com>
     2
     3        axis in scroll-snap-type should be required
     4        https://bugs.webkit.org/show_bug.cgi?id=210468
     5        <rdar://problem/61746766>
     6
     7        Reviewed by Simon Fraser.
     8
     9        * web-platform-tests/css/css-scroll-snap/parsing/scroll-snap-type-invalid-expected.txt: Update
     10        expected results to note newly passing tests.
     11
    1122020-10-18  Emilio Cobos Álvarez  <emilio@crisal.io>
    213
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-scroll-snap/parsing/scroll-snap-type-invalid-expected.txt

    r268250 r268665  
    44PASS e.style['scroll-snap-type'] = "block mandatory inline" should not set the property value
    55PASS e.style['scroll-snap-type'] = "both none" should not set the property value
    6 FAIL e.style['scroll-snap-type'] = "mandatory" should not set the property value assert_equals: expected "" but got "mandatory"
    7 FAIL e.style['scroll-snap-type'] = "proximity" should not set the property value assert_equals: expected "" but got "proximity"
     6PASS e.style['scroll-snap-type'] = "mandatory" should not set the property value
     7PASS e.style['scroll-snap-type'] = "proximity" should not set the property value
    88PASS e.style['scroll-snap-type'] = "mandatory inline" should not set the property value
    99PASS e.style['scroll-snap-type'] = "proximity both" should not set the property value
  • trunk/Source/WebCore/ChangeLog

    r268663 r268665  
     12020-10-19  Martin Robinson  <mrobinson@igalia.com>
     2
     3        axis in scroll-snap-type should be required
     4        https://bugs.webkit.org/show_bug.cgi?id=210468
     5        <rdar://problem/61746766>
     6
     7        Reviewed by Simon Fraser.
     8
     9        * css/parser/CSSPropertyParser.cpp:
     10        (WebCore::consumeScrollSnapType): The first value is either the scroll axis or 'none'.
     11        * style/StyleBuilderConverter.h:
     12        (WebCore::Style::BuilderConverter::convertScrollSnapType): If the first value is 'none',
     13        the default values of ScrollSnapType should be fine. If we have a second value, use it.
     14        Otherwise the default for strictness is "proximity."
     15
    1162020-10-18  Joonghun Park  <jh718.park@samsung.com>
    217
  • trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp

    r268599 r268665  
    25432543{
    25442544    RefPtr<CSSValueList> typeValue = CSSValueList::createSpaceSeparated();
    2545     RefPtr<CSSPrimitiveValue> secondValue;
    2546 
    2547     auto firstValue = consumeIdent<CSSValueX, CSSValueY, CSSValueBlock, CSSValueInline, CSSValueBoth>(range);
    2548     if (firstValue)
    2549         secondValue = consumeIdent<CSSValueProximity, CSSValueMandatory>(range);
    2550     else
    2551         firstValue = consumeIdent<CSSValueNone, CSSValueProximity, CSSValueMandatory>(range);
    2552 
     2545
     2546    auto firstValue = consumeIdent<CSSValueNone, CSSValueX, CSSValueY, CSSValueBlock, CSSValueInline, CSSValueBoth>(range);
    25532547    if (!firstValue)
    25542548        return nullptr;
     2549    auto secondValue = consumeIdent<CSSValueProximity, CSSValueMandatory>(range);
    25552550
    25562551    typeValue->append(firstValue.releaseNonNull());
  • trunk/Source/WebCore/style/StyleBuilderConverter.h

    r268138 r268665  
    907907    auto& values = downcast<CSSValueList>(value);
    908908    auto& firstValue = downcast<CSSPrimitiveValue>(*values.item(0));
    909     if (values.length() == 2) {
    910         type.axis = firstValue;
     909    if (firstValue.valueID() == CSSValueNone)
     910        return type;
     911
     912    type.axis = firstValue;
     913    if (values.length() == 2)
    911914        type.strictness = downcast<CSSPrimitiveValue>(*values.item(1));
    912         return type;
    913     }
    914 
    915     switch (firstValue.valueID()) {
    916     case CSSValueNone:
    917     case CSSValueMandatory:
    918     case CSSValueProximity:
    919         type.strictness = firstValue;
    920         break;
    921     default:
    922         type.axis = firstValue;
     915    else
    923916        type.strictness = ScrollSnapStrictness::Proximity;
    924         break;
    925     }
     917
    926918    return type;
    927919}
Note: See TracChangeset for help on using the changeset viewer.