Content-Length: 474634 | pFad | http://github.com/web-platform-tests/wpt/commit/f0de80a2f2c2e33ee4b76b6ec41973da1cfd9050

75 Add support for non-positive resolutions to image-set · web-platform-tests/wpt@f0de80a · GitHub
Skip to content

Commit f0de80a

Browse files
tcaptan-crmarcoscaceres
authored andcommittedMar 28, 2023
Add support for non-positive resolutions to image-set
This change was triggered by the recently added wpt tests that started failing after auto import: third_party/blink/web_tests/external/wpt/css/css-images/image-set/image-set-zero-resolution-rendering.html third_party/blink/web_tests/external/wpt/css/css-images/image-set/image-set-zero-resolution-rendering-2.html Currently the spec does not restrict the range for resolution, thus non-positive resolutions are valid and should not be rejected at parse time. The current consensus is to parse the non-positive resolutions, but treat them as unsupported options for rendering purposes. With this change, image-set will match resolution parsing with media queries. An issue has been opend for the spec to define the valid argument range for resolution: w3c/csswg-drafts#8532 In the discussion on the issue new proposals were added about how to treat zero resolutions for rendering purposes. Until the spec is well defined in this area we will remove the zero resolution rendering tests. R=futhark, pdr Change-Id: I7b329519168f3c088f5c9ee8614931b0ead7a4df Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4312883 Commit-Queue: Philip Rogers <pdr@chromium.org> Commit-Queue: Traian Captan <tcaptan@chromium.org> Reviewed-by: Philip Rogers <pdr@chromium.org> Cr-Commit-Position: refs/heads/main@{#1114116}
1 parent 19aa967 commit f0de80a

4 files changed

+55
-22
lines changed
 

‎css/css-images/image-set/image-set-zero-resolution-rendering-2.html renamed to ‎css/css-images/image-set/image-set-negative-resolution-rendering-2.html

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
<!DOCTYPE html>
2-
<title>Image set invalid resolution rendering</title>
3-
<link rel="author" title="Noam Rosenthal" href="mailto:noam@webkit.org">
2+
<title>Image set negative resolution rendering</title>
43
<link rel="author" title="Traian Captan" href="mailto:tcaptan@chromium.org">
54
<link rel="help" href="https://drafts.csswg.org/css-images-4/#image-set-notation">
65
<link rel="match" href="reference/image-set-rendering-ref.html">
7-
<meta name="assert" content="image-set rendering with zero resolution">
6+
<meta name="assert" content="image-set rendering with negative resolution">
87
<style>
98
#test {
109
background-image: url("/images/red.png");
1110
background-image: image-set(
12-
url("/images/green.png") 0x,
11+
url("/images/red.png") -1x,
1312
url("/images/green.png") 2x
1413
);
1514
width: 100px;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<!DOCTYPE html>
2+
<title>Image set negative resolution rendering</title>
3+
<link rel="author" title="Traian Captan" href="mailto:tcaptan@chromium.org">
4+
<link rel="help" href="https://drafts.csswg.org/css-images-4/#image-set-notation">
5+
<link rel="match" href="/css/reference/blank.html">
6+
<meta name="assert" content="image-set rendering with negative resolution">
7+
<style>
8+
#test {
9+
background-image: url("/images/red.png");
10+
background-image: image-set(url("/images/green.png") -1x);
11+
width: 100px;
12+
height: 100px;
13+
}
14+
</style>
15+
<div id="test"></div>

‎css/css-images/image-set/image-set-parsing.html

+37-2
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,42 @@
142142
);
143143
}
144144

145+
function test_non_positive_resolutions_parsing() {
146+
test_valid_value_variants(
147+
'background-image',
148+
'image-set(url("example.png") 0x)'
149+
);
150+
test_valid_value_variants(
151+
'background-image',
152+
'image-set(url("example.png") 0dppx)'
153+
);
154+
test_valid_value_variants(
155+
'background-image',
156+
'image-set(url("example.png") 0dpi)'
157+
);
158+
test_valid_value_variants(
159+
'background-image',
160+
'image-set(url("example.png") 0dpcm)'
161+
);
162+
163+
test_valid_value_variants(
164+
'background-image',
165+
'image-set(url("example.png") -1x)'
166+
);
167+
test_valid_value_variants(
168+
'background-image',
169+
'image-set(url("example.png") -3dppx)'
170+
);
171+
test_valid_value_variants(
172+
'background-image',
173+
'image-set(url("example.png") -96dpi)'
174+
);
175+
test_valid_value_variants(
176+
'background-image',
177+
'image-set(url("example.png") -113dpcm)'
178+
);
179+
}
180+
145181
function test_gradient_images_parsing() {
146182
test_valid_value_variants(
147183
'background-image',
@@ -257,14 +293,13 @@
257293

258294
test_invalid_value_variants('background-image', "image-set(none, url(example.png) 1x)");
259295
test_invalid_value_variants('background-image', "image-set()");
260-
test_invalid_value_variants('background-image', "image-set(url(example.png) 0x)");
261-
test_invalid_value_variants('background-image', "image-set(url(example.png) -20x)");
262296
test_invalid_value_variants('background-image', "image-set('example.jpeg' 92pid url(example.png) 1x)");
263297
test_invalid_value_variants('background-image', "image-set(url(example.png) 1x url(example.jpeg))");
264298
test_invalid_value_variants('background-image', "image-set(url(example.png) 1x 2x)");
265299

266300
test_default_resolution_parsing();
267301
test_resolution_units_parsing();
302+
test_non_positive_resolutions_parsing();
268303
test_gradient_images_parsing();
269304
test_image_type_parsing();
270305
test_no_images_set_nesting();

‎css/css-images/image-set/image-set-zero-resolution-rendering.html

-16
This file was deleted.

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/web-platform-tests/wpt/commit/f0de80a2f2c2e33ee4b76b6ec41973da1cfd9050

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy