Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
-webkit-image-set() should be an alias of image-set()
https://bugs.webkit.org/show_bug.cgi?id=229909
rdar://82999675

Reviewed by Tim Nguyen.

-webkit-image-set had a strict subset of image-set's syntax and so the former was made
into an alias of the latter in the css-images module level 4. This change removes the
restrictions on the syntax for the prefixed function and makes it into a parse-time alias
of image-set.

* LayoutTests/fast/css/image-set-parsing-invalid-expected.txt: Removed.
* LayoutTests/fast/css/image-set-parsing-invalid.html: Removed.
    This test is made obsolete by changes to the image-set parsing WPT and by making
    -webkit-image-set an alias to image-set.

* LayoutTests/imported/w3c/web-platform-tests/css/css-images/image-set/image-set-computed.sub-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-images/image-set/image-set-parsing-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-images/image-set/image-set-parsing.html:
* LayoutTests/platform/glib/imported/w3c/web-platform-tests/css/css-images/image-set/image-set-computed.sub-expected.txt:

* Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp:
(WebCore::CSSPropertyParserHelpers::consumeImage):

Canonical link: https://commits.webkit.org/259994@main
  • Loading branch information
rreno committed Feb 8, 2023
1 parent a172e77 commit 5e38273
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 108 deletions.
42 changes: 0 additions & 42 deletions LayoutTests/fast/css/image-set-parsing-invalid-expected.txt

This file was deleted.

46 changes: 0 additions & 46 deletions LayoutTests/fast/css/image-set-parsing-invalid.html

This file was deleted.

Expand Up @@ -3,23 +3,23 @@
PASS Property background-image value 'image-set(url(http://localhost/example.png) 1x)'
PASS Property background-image value '-webkit-image-set(url(http://localhost/example.png) 1x)'
PASS Property background-image value 'image-set(url(http://localhost/example.png) 1x, 'http://localhost/example.png' 2x)'
FAIL Property background-image value '-webkit-image-set(url(http://localhost/example.png) 1x, 'http://localhost/example.png' 2x)' assert_true: '-webkit-image-set(url(http://localhost/example.png) 1x, 'http://localhost/example.png' 2x)' is a supported value for background-image. expected true got false
PASS Property background-image value '-webkit-image-set(url(http://localhost/example.png) 1x, 'http://localhost/example.png' 2x)'
PASS Property background-image value 'image-set(url("http://localhost/example.png") 1dppx)'
PASS Property background-image value '-webkit-image-set(url("http://localhost/example.png") 1dppx)'
PASS Property background-image value 'image-set(url(http://localhost/example.png) 48dpi)'
PASS Property background-image value '-webkit-image-set(url(http://localhost/example.png) 48dpi)'
FAIL Property background-image value 'image-set(url(http://localhost/example.png) 2400dpcm, 'http://localhost/example.png' 2x)' assert_equals: expected "image-set(url(\"http://localhost/example.png\") 63.5dppx, url(\"http://localhost/example.png\") 2dppx)" but got "image-set(url(\"http://localhost/example.png\") 2dppx, url(\"http://localhost/example.png\") 63.5dppx)"
FAIL Property background-image value '-webkit-image-set(url(http://localhost/example.png) 2400dpcm, 'http://localhost/example.png' 2x)' assert_true: '-webkit-image-set(url(http://localhost/example.png) 2400dpcm, 'http://localhost/example.png' 2x)' is a supported value for background-image. expected true got false
FAIL Property background-image value '-webkit-image-set(url(http://localhost/example.png) 2400dpcm, 'http://localhost/example.png' 2x)' assert_equals: expected "image-set(url(\"http://localhost/example.png\") 63.5dppx, url(\"http://localhost/example.png\") 2dppx)" but got "image-set(url(\"http://localhost/example.png\") 2dppx, url(\"http://localhost/example.png\") 63.5dppx)"
PASS Property background-image value 'image-set('http://localhost/example.jpeg' 240dpi, url(http://localhost/example.png) 3.5x)'
FAIL Property background-image value '-webkit-image-set('http://localhost/example.jpeg' 240dpi, url(http://localhost/example.png) 3.5x)' assert_true: '-webkit-image-set('http://localhost/example.jpeg' 240dpi, url(http://localhost/example.png) 3.5x)' is a supported value for background-image. expected true got false
PASS Property background-image value '-webkit-image-set('http://localhost/example.jpeg' 240dpi, url(http://localhost/example.png) 3.5x)'
PASS Property background-image value 'image-set(linear-gradient(black, white) 1x)'
FAIL Property background-image value '-webkit-image-set(linear-gradient(black, white) 1x)' assert_true: '-webkit-image-set(linear-gradient(black, white) 1x)' is a supported value for background-image. expected true got false
PASS Property background-image value '-webkit-image-set(linear-gradient(black, white) 1x)'
FAIL Property background-image value 'image-set(url(http://localhost/example.png) 1x type('image/png'))' assert_true: 'image-set(url(http://localhost/example.png) 1x type('image/png'))' is a supported value for background-image. expected true got false
FAIL Property background-image value '-webkit-image-set(url(http://localhost/example.png) 1x type('image/png'))' assert_true: '-webkit-image-set(url(http://localhost/example.png) 1x type('image/png'))' is a supported value for background-image. expected true got false
FAIL Property background-image value 'image-set(url(http://localhost/example.png) type('image/png'))' assert_true: 'image-set(url(http://localhost/example.png) type('image/png'))' is a supported value for background-image. expected true got false
FAIL Property background-image value '-webkit-image-set(url(http://localhost/example.png) type('image/png'))' assert_true: '-webkit-image-set(url(http://localhost/example.png) type('image/png'))' is a supported value for background-image. expected true got false
FAIL Property background-image value 'image-set(url(http://localhost/example.png) type('image/png') 1x)' assert_true: 'image-set(url(http://localhost/example.png) type('image/png') 1x)' is a supported value for background-image. expected true got false
FAIL Property background-image value '-webkit-image-set(url(http://localhost/example.png) type('image/png') 1x)' assert_true: '-webkit-image-set(url(http://localhost/example.png) type('image/png') 1x)' is a supported value for background-image. expected true got false
FAIL Property content value 'image-set(url('http://localhost/example.png') 192dpi, linear-gradient(black, white) 1x)' assert_equals: expected "image-set(url(\"http://localhost/example.png\") 2dppx, linear-gradient(rgb(0, 0, 0), rgb(255, 255, 255)) 1dppx)" but got "image-set(linear-gradient(rgb(0, 0, 0), rgb(255, 255, 255)) 1dppx, url(\"http://localhost/example.png\") 2dppx)"
FAIL Property content value '-webkit-image-set(url('http://localhost/example.png') 192dpi, linear-gradient(black, white) 1x)' assert_true: '-webkit-image-set(url('http://localhost/example.png') 192dpi, linear-gradient(black, white) 1x)' is a supported value for content. expected true got false
FAIL Property content value '-webkit-image-set(url('http://localhost/example.png') 192dpi, linear-gradient(black, white) 1x)' assert_equals: expected "image-set(url(\"http://localhost/example.png\") 2dppx, linear-gradient(rgb(0, 0, 0), rgb(255, 255, 255)) 1dppx)" but got "image-set(linear-gradient(rgb(0, 0, 0), rgb(255, 255, 255)) 1dppx, url(\"http://localhost/example.png\") 2dppx)"

Expand Up @@ -2,25 +2,25 @@
PASS e.style['background-image'] = "image-set(url(example.png) 1x)" should set the property value
PASS e.style['background-image'] = "-webkit-image-set(url(example.png) 1x)" should set the property value
PASS e.style['background-image'] = "image-set('example.jpg' 1x)" should set the property value
FAIL e.style['background-image'] = "-webkit-image-set('example.jpg' 1x)" should set the property value assert_not_equals: property should be set got disallowed value ""
PASS e.style['background-image'] = "-webkit-image-set('example.jpg' 1x)" should set the property value
PASS e.style['background-image'] = "image-set(url(example.png) 1x, 'example.png' 2x)" should set the property value
FAIL e.style['background-image'] = "-webkit-image-set(url(example.png) 1x, 'example.png' 2x)" should set the property value assert_not_equals: property should be set got disallowed value ""
PASS e.style['background-image'] = "-webkit-image-set(url(example.png) 1x, 'example.png' 2x)" should set the property value
PASS e.style['background-image'] = "image-set(url(example.png) 1dpcm, 'example.png' 2x)" should set the property value
FAIL e.style['background-image'] = "-webkit-image-set(url(example.png) 1dpcm, 'example.png' 2x)" should set the property value assert_not_equals: property should be set got disallowed value ""
PASS e.style['background-image'] = "-webkit-image-set(url(example.png) 1dpcm, 'example.png' 2x)" should set the property value
PASS e.style['background-image'] = "image-set('example.jpeg' 222dpi, url(example.png) 3.5x)" should set the property value
FAIL e.style['background-image'] = "-webkit-image-set('example.jpeg' 222dpi, url(example.png) 3.5x)" should set the property value assert_not_equals: property should be set got disallowed value ""
PASS e.style['background-image'] = "-webkit-image-set('example.jpeg' 222dpi, url(example.png) 3.5x)" should set the property value
PASS e.style['background-image'] = "image-set(linear-gradient(black, white) 1x)" should set the property value
FAIL e.style['background-image'] = "-webkit-image-set(linear-gradient(black, white) 1x)" should set the property value assert_not_equals: property should be set got disallowed value ""
PASS e.style['background-image'] = "-webkit-image-set(linear-gradient(black, white) 1x)" should set the property value
FAIL e.style['background-image'] = "image-set(url(\"example.png\") 1x type(\"image/png\"))" should set the property value assert_not_equals: property should be set got disallowed value ""
FAIL e.style['background-image'] = "-webkit-image-set(url(\"example.png\") 1x type(\"image/png\"))" should set the property value assert_not_equals: property should be set got disallowed value ""
FAIL e.style['background-image'] = "image-set(url(example.png) type('image/png'))" should set the property value assert_not_equals: property should be set got disallowed value ""
FAIL e.style['background-image'] = "-webkit-image-set(url(example.png) type('image/png'))" should set the property value assert_not_equals: property should be set got disallowed value ""
FAIL e.style['background-image'] = "image-set(url(example.png) type('image/png') 1x)" should set the property value assert_not_equals: property should be set got disallowed value ""
FAIL e.style['background-image'] = "-webkit-image-set(url(example.png) type('image/png') 1x)" should set the property value assert_not_equals: property should be set got disallowed value ""
PASS e.style['content'] = "image-set(linear-gradient(black, white) 1x, 'example.png' 4x)" should set the property value
FAIL e.style['content'] = "-webkit-image-set(linear-gradient(black, white) 1x, 'example.png' 4x)" should set the property value assert_not_equals: property should be set got disallowed value ""
PASS e.style['content'] = "-webkit-image-set(linear-gradient(black, white) 1x, 'example.png' 4x)" should set the property value
PASS e.style['content'] = "image-set(url(\"example.png\") 192dpi, linear-gradient(black, white) 1x)" should set the property value
FAIL e.style['content'] = "-webkit-image-set(url(\"example.png\") 192dpi, linear-gradient(black, white) 1x)" should set the property value assert_not_equals: property should be set got disallowed value ""
PASS e.style['content'] = "-webkit-image-set(url(\"example.png\") 192dpi, linear-gradient(black, white) 1x)" should set the property value
PASS e.style['background-image'] = "image-set(none, url(example.png) 1x)" should not set the property value
PASS e.style['background-image'] = "-webkit-image-set(none, url(example.png) 1x)" should not set the property value
PASS e.style['background-image'] = "image-set()" should not set the property value
Expand All @@ -41,6 +41,12 @@ PASS e.style['background-image'] = "image-set(type('image/png') url(example.png)
PASS e.style['background-image'] = "-webkit-image-set(type('image/png') url(example.png) 1x)" should not set the property value
PASS e.style['cursor'] = "image-set(linear-gradient(black, white) 1x)" should not set the property value
PASS e.style['cursor'] = "-webkit-image-set(linear-gradient(black, white) 1x)" should not set the property value
PASS e.style['background-image'] = "image-set(url(example.png) 1x url(example.jpeg))" should not set the property value
PASS e.style['background-image'] = "-webkit-image-set(url(example.png) 1x url(example.jpeg))" should not set the property value
PASS e.style['background-image'] = "image-set(url(example.png) 1x 2x)" should not set the property value
PASS e.style['background-image'] = "-webkit-image-set(url(example.png) 1x 2x)" should not set the property value
PASS e.style['background-image'] = "image-set(image-set(url(example.png)) 2x)" should not set the property value
PASS e.style['background-image'] = "-webkit-image-set(image-set(url(example.png)) 2x)" should not set the property value
FAIL e.style['background-image'] = "image-set(url(foo))" should set the property value assert_not_equals: property should be set got disallowed value ""
FAIL e.style['background-image'] = "-webkit-image-set(url(foo))" should set the property value assert_not_equals: property should be set got disallowed value ""
FAIL e.style['background-image'] = "image-set(url(foo), url(bar) 1x)" should set the property value assert_not_equals: property should be set got disallowed value ""
Expand Down
Expand Up @@ -119,6 +119,10 @@
test_invalid_value_variants('background-image', "image-set(type('image/png') url(example.png) 1x)");
test_invalid_value_variants('cursor', "image-set(linear-gradient(black, white) 1x)");

test_invalid_value_variants('background-image', "image-set(url(example.png) 1x url(example.jpeg))");
test_invalid_value_variants('background-image', "image-set(url(example.png) 1x 2x)");
test_invalid_value_variants('background-image', "image-set(image-set(url(example.png)) 2x)");

test_default_resolution_parsing();
test_resolution_units_parsing();
}
Expand Down

0 comments on commit 5e38273

Please sign in to comment.