Title: [269237] trunk
Revision
269237
Author
[email protected]
Date
2020-11-01 12:14:18 -0800 (Sun, 01 Nov 2020)

Log Message

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

Patch by Tyler Wilcock <[email protected]> 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.

* TestExpectations:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (269236 => 269237)


--- trunk/LayoutTests/ChangeLog	2020-11-01 20:09:38 UTC (rev 269236)
+++ trunk/LayoutTests/ChangeLog	2020-11-01 20:14:18 UTC (rev 269237)
@@ -1,3 +1,15 @@
+2020-11-01  Tyler Wilcock  <[email protected]>
+
+        background-size should not accept negative values
+        https://bugs.webkit.org/show_bug.cgi?id=183990
+
+        Reviewed by Darin Adler.
+
+        We now reject negative background-size values.  Update newly passing
+        test expectations to reflect this.
+
+        * TestExpectations:
+
 2020-11-01  Sam Weinig  <[email protected]>
 
         Remove remaining alternative preference setting mechanisms from LayoutTests

Modified: trunk/LayoutTests/TestExpectations (269236 => 269237)


--- trunk/LayoutTests/TestExpectations	2020-11-01 20:09:38 UTC (rev 269236)
+++ trunk/LayoutTests/TestExpectations	2020-11-01 20:14:18 UTC (rev 269237)
@@ -3440,7 +3440,7 @@
 webkit.org/b/206753 imported/w3c/web-platform-tests/css/css-backgrounds/background-attachment-local/attachment-local-positioning-4.html [ ImageOnlyFailure ]
 webkit.org/b/206753 imported/w3c/web-platform-tests/css/css-backgrounds/background-position-negative-percentage-comparison.html [ ImageOnlyFailure ]
 webkit.org/b/206753 imported/w3c/web-platform-tests/css/css-backgrounds/background-size-cover-003.html [ ImageOnlyFailure ]
-webkit.org/b/206753 imported/w3c/web-platform-tests/css/css-backgrounds/background-size-with-negative-value.html [ ImageOnlyFailure ]
+webkit.org/b/206753 imported/w3c/web-platform-tests/css/css-backgrounds/background-size-with-negative-value.html [ Pass ]
 webkit.org/b/206753 imported/w3c/web-platform-tests/css/css-backgrounds/background-size/background-size-cover-svg.html [ ImageOnlyFailure ]
 webkit.org/b/206753 imported/w3c/web-platform-tests/css/css-backgrounds/background-size/vector/background-size-vector-003.html [ ImageOnlyFailure ]
 webkit.org/b/206753 imported/w3c/web-platform-tests/css/css-backgrounds/background-size/vector/background-size-vector-004.html [ ImageOnlyFailure ]

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (269236 => 269237)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2020-11-01 20:09:38 UTC (rev 269236)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2020-11-01 20:14:18 UTC (rev 269237)
@@ -1,3 +1,16 @@
+2020-11-01  Tyler Wilcock  <[email protected]>
+
+        background-size should not accept negative values
+        https://bugs.webkit.org/show_bug.cgi?id=183990
+
+        Reviewed by Darin Adler.
+
+        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:
+
 2020-11-01  Chris Dumez  <[email protected]>
 
         Resync web-platform-tests/tools tests from upstream

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-backgrounds/parsing/background-size-computed-expected.txt (269236 => 269237)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-backgrounds/parsing/background-size-computed-expected.txt	2020-11-01 20:09:38 UTC (rev 269236)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-backgrounds/parsing/background-size-computed-expected.txt	2020-11-01 20:14:18 UTC (rev 269237)
@@ -7,7 +7,7 @@
 PASS Property background-size value 'auto 4%'
 PASS Property background-size value 'contain'
 PASS Property background-size value 'cover'
-FAIL Property background-size value 'calc(10px + 0.5em) calc(10px - 0.5em)' assert_equals: expected "30px 0px" but got "30px -10px"
-FAIL Property background-size value 'calc(10px - 0.5em) calc(10px + 0.5em)' assert_equals: expected "0px 30px" but got "-10px 30px"
+PASS Property background-size value 'calc(10px + 0.5em) calc(10px - 0.5em)'
+PASS Property background-size value 'calc(10px - 0.5em) calc(10px + 0.5em)'
 PASS Property background-size value 'auto 1px, 2% 3%, contain'
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-backgrounds/parsing/background-size-invalid-expected.txt (269236 => 269237)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-backgrounds/parsing/background-size-invalid-expected.txt	2020-11-01 20:09:38 UTC (rev 269236)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-backgrounds/parsing/background-size-invalid-expected.txt	2020-11-01 20:14:18 UTC (rev 269237)
@@ -1,5 +1,5 @@
 
-FAIL e.style['background-size'] = "-1px" should not set the property value assert_equals: expected "" but got "-1px"
-FAIL e.style['background-size'] = "2% -3%" should not set the property value assert_equals: expected "" but got "2% -3%"
+PASS e.style['background-size'] = "-1px" should not set the property value
+PASS e.style['background-size'] = "2% -3%" should not set the property value
 PASS e.style['background-size'] = "1px 2px 3px" should not set the property value
 

Modified: trunk/Source/WebCore/ChangeLog (269236 => 269237)


--- trunk/Source/WebCore/ChangeLog	2020-11-01 20:09:38 UTC (rev 269236)
+++ trunk/Source/WebCore/ChangeLog	2020-11-01 20:14:18 UTC (rev 269237)
@@ -1,3 +1,21 @@
+2020-11-01  Tyler Wilcock  <[email protected]>
+
+        background-size should not accept negative values
+        https://bugs.webkit.org/show_bug.cgi?id=183990
+
+        Reviewed by Darin Adler.
+
+        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.
+
 2020-11-01  Chris Fleizach  <[email protected]>
 
         AX: Provide build workaround while isSystemVoice is not in all SDKs

Modified: trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp (269236 => 269237)


--- trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp	2020-11-01 20:09:38 UTC (rev 269236)
+++ trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp	2020-11-01 20:14:18 UTC (rev 269237)
@@ -3194,7 +3194,7 @@
     // tests assume that. Other browser engines don't allow it though.
     RefPtr<CSSPrimitiveValue> horizontal = consumeIdent<CSSValueAuto>(range);
     if (!horizontal)
-        horizontal = consumeLengthOrPercent(range, cssParserMode, ValueRangeAll, UnitlessQuirk::Allow);
+        horizontal = consumeLengthOrPercent(range, cssParserMode, ValueRangeNonNegative, UnitlessQuirk::Allow);
 
     RefPtr<CSSPrimitiveValue> vertical;
     if (!range.atEnd()) {
@@ -3201,7 +3201,7 @@
         if (range.peek().id() == CSSValueAuto) // `auto' is the default
             range.consumeIncludingWhitespace();
         else
-            vertical = consumeLengthOrPercent(range, cssParserMode, ValueRangeAll, UnitlessQuirk::Allow);
+            vertical = consumeLengthOrPercent(range, cssParserMode, ValueRangeNonNegative, UnitlessQuirk::Allow);
     } else if (!vertical && property == CSSPropertyWebkitBackgroundSize) {
         // Legacy syntax: "-webkit-background-size: 10px" is equivalent to "background-size: 10px 10px".
         vertical = horizontal;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to