Changeset 269237 in webkit


Ignore:
Timestamp:
Nov 1, 2020 12:14:18 PM (21 months ago)
Author:
commit-queue@webkit.org
Message:

background-size should not accept negative values
https://bugs.webkit.org/show_bug.cgi?id=183990

Patch by Tyler Wilcock <Tyler Wilcock> on 2020-11-01
Reviewed by Darin Adler.

LayoutTests/imported/w3c:

We now reject negative values for background-size. Update newly
passing test expectations to reflect this.

  • web-platform-tests/css/css-backgrounds/parsing/background-size-computed-expected.txt:
  • web-platform-tests/css/css-backgrounds/parsing/background-size-invalid-expected.txt:

Source/WebCore:

Reject negative background-size length-percentage values,
as these are explicitly disallowed by the spec.

https://www.w3.org/TR/2017/CR-css-backgrounds-3-20171017/#the-background-size

Change is covered by existing tests that now pass.

  • css/parser/CSSPropertyParser.cpp:

(WebCore::consumeBackgroundSize): Reject negative length-percentage
values as is mandated by the spec.

LayoutTests:

We now reject negative background-size values. Update newly passing
test expectations to reflect this.

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r269236 r269237  
     12020-11-01  Tyler Wilcock  <twilco.o@protonmail.com>
     2
     3        background-size should not accept negative values
     4        https://bugs.webkit.org/show_bug.cgi?id=183990
     5
     6        Reviewed by Darin Adler.
     7
     8        We now reject negative background-size values.  Update newly passing
     9        test expectations to reflect this.
     10
     11        * TestExpectations:
     12
    1132020-11-01  Sam Weinig  <weinig@apple.com>
    214
  • trunk/LayoutTests/TestExpectations

    r269187 r269237  
    34413441webkit.org/b/206753 imported/w3c/web-platform-tests/css/css-backgrounds/background-position-negative-percentage-comparison.html [ ImageOnlyFailure ]
    34423442webkit.org/b/206753 imported/w3c/web-platform-tests/css/css-backgrounds/background-size-cover-003.html [ ImageOnlyFailure ]
    3443 webkit.org/b/206753 imported/w3c/web-platform-tests/css/css-backgrounds/background-size-with-negative-value.html [ ImageOnlyFailure ]
     3443webkit.org/b/206753 imported/w3c/web-platform-tests/css/css-backgrounds/background-size-with-negative-value.html [ Pass ]
    34443444webkit.org/b/206753 imported/w3c/web-platform-tests/css/css-backgrounds/background-size/background-size-cover-svg.html [ ImageOnlyFailure ]
    34453445webkit.org/b/206753 imported/w3c/web-platform-tests/css/css-backgrounds/background-size/vector/background-size-vector-003.html [ ImageOnlyFailure ]
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r269235 r269237  
     12020-11-01  Tyler Wilcock  <twilco.o@protonmail.com>
     2
     3        background-size should not accept negative values
     4        https://bugs.webkit.org/show_bug.cgi?id=183990
     5
     6        Reviewed by Darin Adler.
     7
     8        We now reject negative values for background-size.  Update newly
     9        passing test expectations to reflect this.
     10
     11        * web-platform-tests/css/css-backgrounds/parsing/background-size-computed-expected.txt:
     12        * web-platform-tests/css/css-backgrounds/parsing/background-size-invalid-expected.txt:
     13
    1142020-11-01  Chris Dumez  <cdumez@apple.com>
    215
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-backgrounds/parsing/background-size-computed-expected.txt

    r267650 r269237  
    88PASS Property background-size value 'contain'
    99PASS Property background-size value 'cover'
    10 FAIL Property background-size value 'calc(10px + 0.5em) calc(10px - 0.5em)' assert_equals: expected "30px 0px" but got "30px -10px"
    11 FAIL Property background-size value 'calc(10px - 0.5em) calc(10px + 0.5em)' assert_equals: expected "0px 30px" but got "-10px 30px"
     10PASS Property background-size value 'calc(10px + 0.5em) calc(10px - 0.5em)'
     11PASS Property background-size value 'calc(10px - 0.5em) calc(10px + 0.5em)'
    1212PASS Property background-size value 'auto 1px, 2% 3%, contain'
    1313
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-backgrounds/parsing/background-size-invalid-expected.txt

    r267650 r269237  
    11
    2 FAIL e.style['background-size'] = "-1px" should not set the property value assert_equals: expected "" but got "-1px"
    3 FAIL e.style['background-size'] = "2% -3%" should not set the property value assert_equals: expected "" but got "2% -3%"
     2PASS e.style['background-size'] = "-1px" should not set the property value
     3PASS e.style['background-size'] = "2% -3%" should not set the property value
    44PASS e.style['background-size'] = "1px 2px 3px" should not set the property value
    55
  • trunk/Source/WebCore/ChangeLog

    r269232 r269237  
     12020-11-01  Tyler Wilcock  <twilco.o@protonmail.com>
     2
     3        background-size should not accept negative values
     4        https://bugs.webkit.org/show_bug.cgi?id=183990
     5
     6        Reviewed by Darin Adler.
     7
     8        Reject negative background-size length-percentage values,
     9        as these are explicitly disallowed by the spec.
     10
     11        https://www.w3.org/TR/2017/CR-css-backgrounds-3-20171017/#the-background-size
     12
     13        Change is covered by existing tests that now pass.
     14
     15        * css/parser/CSSPropertyParser.cpp:
     16        (WebCore::consumeBackgroundSize): Reject negative length-percentage
     17        values as is mandated by the spec.
     18
    1192020-11-01  Chris Fleizach  <cfleizach@apple.com>
    220
  • trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp

    r268889 r269237  
    31953195    RefPtr<CSSPrimitiveValue> horizontal = consumeIdent<CSSValueAuto>(range);
    31963196    if (!horizontal)
    3197         horizontal = consumeLengthOrPercent(range, cssParserMode, ValueRangeAll, UnitlessQuirk::Allow);
     3197        horizontal = consumeLengthOrPercent(range, cssParserMode, ValueRangeNonNegative, UnitlessQuirk::Allow);
    31983198
    31993199    RefPtr<CSSPrimitiveValue> vertical;
     
    32023202            range.consumeIncludingWhitespace();
    32033203        else
    3204             vertical = consumeLengthOrPercent(range, cssParserMode, ValueRangeAll, UnitlessQuirk::Allow);
     3204            vertical = consumeLengthOrPercent(range, cssParserMode, ValueRangeNonNegative, UnitlessQuirk::Allow);
    32053205    } else if (!vertical && property == CSSPropertyWebkitBackgroundSize) {
    32063206        // Legacy syntax: "-webkit-background-size: 10px" is equivalent to "background-size: 10px 10px".
Note: See TracChangeset for help on using the changeset viewer.