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

68 Add support for non-positive resolutions to image-set · web-platform-tests/wpt@ec65f57 · GitHub
Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit ec65f57

Browse files
tcaptan-crchromium-wpt-export-bot
authored andcommittedMar 7, 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 R=futhark, pdr Change-Id: I7b329519168f3c088f5c9ee8614931b0ead7a4df
1 parent b33268d commit ec65f57

5 files changed

+74
-6
lines changed
 
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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="reference/image-set-rendering-ref.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(
11+
url("/images/red.png") -1x,
12+
url("/images/green.png") 2x
13+
);
14+
width: 100px;
15+
height: 100px;
16+
}
17+
</style>
18+
<div id="test"></div>
Lines changed: 15 additions & 0 deletions
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

Lines changed: 37 additions & 2 deletions
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-2.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!DOCTYPE html>
2-
<title>Image set invalid resolution rendering</title>
2+
<title>Image set zero resolution rendering</title>
33
<link rel="author" title="Noam Rosenthal" href="mailto:noam@webkit.org">
44
<link rel="author" title="Traian Captan" href="mailto:tcaptan@chromium.org">
55
<link rel="help" href="https://drafts.csswg.org/css-images-4/#image-set-notation">
@@ -9,7 +9,7 @@
99
#test {
1010
background-image: url("/images/red.png");
1111
background-image: image-set(
12-
url("/images/green.png") 0x,
12+
url("/images/red.png") 0x,
1313
url("/images/green.png") 2x
1414
);
1515
width: 100px;

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<!DOCTYPE html>
2-
<title>Image set invalid resolution rendering</title>
2+
<title>Image set zero resolution rendering</title>
33
<link rel="author" title="Noam Rosenthal" href="mailto:noam@webkit.org">
44
<link rel="author" title="Traian Captan" href="mailto:tcaptan@chromium.org">
55
<link rel="help" href="https://drafts.csswg.org/css-images-4/#image-set-notation">
6-
<link rel="match" href="reference/image-set-rendering-ref.html">
6+
<link rel="match" href="/css/reference/blank.html">
77
<meta name="assert" content="image-set rendering with zero resolution">
88
<style>
99
#test {

0 commit comments

Comments
 (0)
Failed to load comments.








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/ec65f57c4c88495737297861e56e6615062190b4

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy