Skip to content

Commit

Permalink
[image-set] Stop rejecting negative resolutions
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=254388
rdar://107167273

Reviewed by NOBODY (OOPS!).

Resolution ranges are currently not restricted by the specification, so we should accept them.

Corresponding WPT commit with more details: web-platform-tests/wpt@6dd9e79

The two unskipped tests are for rendering, negative resolutions are considered invalid for rendering purposes, so they display as blank.
However, they are still parsed, which means the declaration stays valid, which wasn't the case before.

Also rebaseline parsing tests.

It is possible that the spec changes again in the future: w3c/csswg-drafts#8532

* LayoutTests/TestExpectations:
* LayoutTests/imported/w3c/web-platform-tests/css/css-images/image-set/image-set-parsing-expected.txt:
* Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp:
(WebCore::CSSPropertyParserHelpers::consumeImageSetOption):
  • Loading branch information
nt1m committed Mar 24, 2023
1 parent 10170ea commit 16b8db1
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 21 deletions.
3 changes: 0 additions & 3 deletions LayoutTests/TestExpectations
Original file line number Diff line number Diff line change
Expand Up @@ -4641,9 +4641,6 @@ webkit.org/b/214456 imported/w3c/web-platform-tests/css/css-images/tiled-conic-g

webkit.org/b/149828 imported/w3c/web-platform-tests/css/css-images/image-orientation/image-orientation-mask-image.html [ ImageOnlyFailure ]

webkit.org/b/254390 imported/w3c/web-platform-tests/css/css-images/image-set/image-set-negative-resolution-rendering-2.html [ ImageOnlyFailure ]
webkit.org/b/254390 imported/w3c/web-platform-tests/css/css-images/image-set/image-set-negative-resolution-rendering.html [ ImageOnlyFailure ]

webkit.org/b/214457 imported/w3c/web-platform-tests/css/css-lists/change-list-descendant-display.html [ ImageOnlyFailure ]
webkit.org/b/214457 imported/w3c/web-platform-tests/css/css-lists/counter-set-001.html [ ImageOnlyFailure ]
webkit.org/b/214457 imported/w3c/web-platform-tests/css/css-lists/inline-block-list.html [ ImageOnlyFailure ]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,22 +69,22 @@ PASS e.style['background-image'] = "image-set(url(\"example.png\") calc(2x - 1))
PASS e.style['background-image'] = "-webkit-image-set(url(\"example.png\") calc(2x - 1))" should not set the property value
PASS e.style['background-image'] = "image-set(url(\"example.png\") calc(1 + 4dpi))" should not set the property value
PASS e.style['background-image'] = "-webkit-image-set(url(\"example.png\") calc(1 + 4dpi))" should not set the property value
FAIL e.style['background-image'] = "image-set(url(\"example.png\") 0x)" 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\") 0x)" 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\") 0dppx)" 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\") 0dppx)" 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\") 0dpi)" 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\") 0dpi)" 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\") 0dpcm)" 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\") 0dpcm)" 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\") -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\") -1x)" 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\") -3dppx)" 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\") -3dppx)" 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\") -96dpi)" 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\") -96dpi)" 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\") -113dpcm)" 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\") -113dpcm)" should set the property value assert_not_equals: property should be set got disallowed value ""
PASS e.style['background-image'] = "image-set(url(\"example.png\") 0x)" should set the property value
PASS e.style['background-image'] = "-webkit-image-set(url(\"example.png\") 0x)" should set the property value
PASS e.style['background-image'] = "image-set(url(\"example.png\") 0dppx)" should set the property value
PASS e.style['background-image'] = "-webkit-image-set(url(\"example.png\") 0dppx)" should set the property value
PASS e.style['background-image'] = "image-set(url(\"example.png\") 0dpi)" should set the property value
PASS e.style['background-image'] = "-webkit-image-set(url(\"example.png\") 0dpi)" should set the property value
PASS e.style['background-image'] = "image-set(url(\"example.png\") 0dpcm)" should set the property value
PASS e.style['background-image'] = "-webkit-image-set(url(\"example.png\") 0dpcm)" should set the property value
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(url(\"example.png\") -3dppx)" should set the property value
PASS e.style['background-image'] = "-webkit-image-set(url(\"example.png\") -3dppx)" should set the property value
PASS e.style['background-image'] = "image-set(url(\"example.png\") -96dpi)" should set the property value
PASS e.style['background-image'] = "-webkit-image-set(url(\"example.png\") -96dpi)" should set the property value
PASS e.style['background-image'] = "image-set(url(\"example.png\") -113dpcm)" should set the property value
PASS e.style['background-image'] = "-webkit-image-set(url(\"example.png\") -113dpcm)" should set the property value
PASS e.style['background-image'] = "image-set(linear-gradient(black, white) 1x)" should set the property value
PASS e.style['background-image'] = "-webkit-image-set(linear-gradient(black, white) 1x)" should set the property value
PASS e.style['background-image'] = "image-set(repeating-linear-gradient(red, blue 25%) 1x)" should set the property value
Expand Down
2 changes: 0 additions & 2 deletions Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4471,8 +4471,6 @@ static RefPtr<CSSImageSetOptionValue> consumeImageSetOption(CSSParserTokenRange&
return nullptr;

if (optionalArgument->isResolution()) {
if (optionalArgument->floatValue() <= 0)
return nullptr;
resolution = optionalArgument;
result->setResolution(optionalArgument.releaseNonNull());
continue;
Expand Down

0 comments on commit 16b8db1

Please sign in to comment.