Changeset 276498 in webkit
- Timestamp:
- Apr 23, 2021, 8:16:30 AM (5 years ago)
- Location:
- trunk/LayoutTests/imported/w3c
- Files:
-
- 8 edited
-
ChangeLog (modified) (1 diff)
-
web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/canvas-aspect-ratio-expected.txt (modified) (1 diff)
-
web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/img-aspect-ratio-expected.txt (modified) (1 diff)
-
web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/img-aspect-ratio.html (modified) (6 diffs)
-
web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/picture-aspect-ratio-expected.txt (modified) (2 diffs)
-
web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/picture-aspect-ratio.html (modified) (4 diffs)
-
web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/resources/aspect-ratio.js (modified) (1 diff)
-
web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/video-aspect-ratio-expected.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/imported/w3c/ChangeLog
r276488 r276498 1 2021-04-23 Cathie Chen <cathiechen@igalia.com> 2 3 Import the update to "mapping attribute width and height to aspect ratio" tests from WPT 4 https://bugs.webkit.org/show_bug.cgi?id=224911 5 6 Reviewed by Rob Buis. 7 8 Import the update to "mapping attribute width and height to aspect ratio" tests from WPT commit 0ae0bb7cab. Split up the test cases, to make sure 9 each image has its own test case and won't affect testing other images. 10 11 * web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/canvas-aspect-ratio-expected.txt: 12 * web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/img-aspect-ratio-expected.txt: 13 * web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/img-aspect-ratio.html: 14 * web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/picture-aspect-ratio-expected.txt: 15 * web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/picture-aspect-ratio.html: 16 * web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/resources/aspect-ratio.js: 17 (test_computed_style_aspect_ratio): 18 * web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/video-aspect-ratio-expected.txt: 19 1 20 2021-04-22 Tyler Wilcock <twilco.o@protonmail.com> 2 21 -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/canvas-aspect-ratio-expected.txt
r276296 r276498 3 3 PASS Canvas width and height attributes are used as the surface size with contain:size 4 4 PASS Canvas width and height attributes are used as the surface size 5 FAIL canvas with {"width":"10","height":"20"} assert_equals: expected "auto 10 / 20" but got "auto"6 PASS canvas with {"width":"0","height":"1"}7 PASS canvas with {"width":"1","height":"0"}8 PASS canvas with {"width":"0","height":"0"}9 FAIL canvas with {"width":"0.5","height":"1.5"} assert_in_array: value "auto" not in array ["auto 0 / 1", "auto 0.5 / 1.5"]10 PASS canvas with {"width":"10%","height":"20"}11 PASS canvas with {"width":null,"height":null}12 PASS canvas with {"width":"10","height":null}13 PASS canvas with {"width":null,"height":"20"}14 PASS canvas with {"width":"xx","height":"20"}5 FAIL Computed style test: canvas with {"width":"10","height":"20"} assert_equals: expected "auto 10 / 20" but got "auto" 6 PASS Computed style test: canvas with {"width":"0","height":"1"} 7 PASS Computed style test: canvas with {"width":"1","height":"0"} 8 PASS Computed style test: canvas with {"width":"0","height":"0"} 9 FAIL Computed style test: canvas with {"width":"0.5","height":"1.5"} assert_in_array: value "auto" not in array ["auto 0 / 1", "auto 0.5 / 1.5"] 10 PASS Computed style test: canvas with {"width":"10%","height":"20"} 11 PASS Computed style test: canvas with {"width":null,"height":null} 12 PASS Computed style test: canvas with {"width":"10","height":null} 13 PASS Computed style test: canvas with {"width":null,"height":"20"} 14 PASS Computed style test: canvas with {"width":"xx","height":"20"} 15 15 -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/img-aspect-ratio-expected.txt
r276296 r276498 1 1 2 2 3 FAIL Image width and height attributes are used to infer aspect-ratio assert_approx_equals: aspect-ratio should override intrinsic size of images that don't have any src. expected 0.8 +/- 0.001 but got Infinity 4 FAIL img with {"width":"10","height":"20"} assert_equals: expected "auto 10 / 20" but got "auto" 5 FAIL input with {"type":"image","width":"10","height":"20"} assert_equals: expected "auto 10 / 20" but got "auto" 6 PASS input with {"type":"submit","width":"10","height":"20"} 7 FAIL img with {"width":"0","height":"1"} assert_equals: expected "auto 0 / 1" but got "auto" 8 FAIL input with {"type":"image","width":"0","height":"1"} assert_equals: expected "auto 0 / 1" but got "auto" 9 PASS input with {"type":"submit","width":"0","height":"1"} 10 FAIL img with {"width":"1","height":"0"} assert_equals: expected "auto 1 / 0" but got "auto" 11 FAIL input with {"type":"image","width":"1","height":"0"} assert_equals: expected "auto 1 / 0" but got "auto" 12 PASS input with {"type":"submit","width":"1","height":"0"} 13 FAIL img with {"width":"0","height":"0"} assert_equals: expected "auto 0 / 0" but got "auto" 14 FAIL input with {"type":"image","width":"0","height":"0"} assert_equals: expected "auto 0 / 0" but got "auto" 15 PASS input with {"type":"submit","width":"0","height":"0"} 16 FAIL img with {"width":"0.5","height":"1.5"} assert_equals: expected "auto 0.5 / 1.5" but got "auto" 17 FAIL input with {"type":"image","width":"0.5","height":"1.5"} assert_equals: expected "auto 0.5 / 1.5" but got "auto" 18 PASS input with {"type":"submit","width":"0.5","height":"1.5"} 19 PASS img with {"width":null,"height":null} 20 PASS input with {"type":"image","width":null,"height":null} 21 PASS input with {"type":"submit","width":null,"height":null} 22 PASS img with {"width":"10","height":null} 23 PASS input with {"type":"image","width":"10","height":null} 24 PASS input with {"type":"submit","width":"10","height":null} 25 PASS img with {"width":null,"height":"20"} 26 PASS input with {"type":"image","width":null,"height":"20"} 27 PASS input with {"type":"submit","width":null,"height":"20"} 28 PASS img with {"width":"xx","height":"20"} 29 PASS input with {"type":"image","width":"xx","height":"20"} 30 PASS input with {"type":"submit","width":"xx","height":"20"} 31 PASS img with {"width":"10%","height":"20"} 32 PASS input with {"type":"image","width":"10%","height":"20"} 33 PASS input with {"type":"submit","width":"10%","height":"20"} 3 PASS Image width and height attributes are used to infer aspect-ratio 4 PASS Create, append and test immediately: <img> with attributes width=250, height=100 5 PASS Create, append and test immediately: <img> with attributes width=0.8, height=0.2 6 PASS Create, append and test immediately: <img> with attributes width=50% height=25% 7 FAIL Computed style test: img with {"width":"10","height":"20"} assert_equals: expected "auto 10 / 20" but got "auto" 8 FAIL Computed style test: input with {"type":"image","width":"10","height":"20"} assert_equals: expected "auto 10 / 20" but got "auto" 9 PASS Computed style test: input with {"type":"submit","width":"10","height":"20"} 10 FAIL Computed style test: img with {"width":"0","height":"1"} assert_equals: expected "auto 0 / 1" but got "auto" 11 FAIL Computed style test: input with {"type":"image","width":"0","height":"1"} assert_equals: expected "auto 0 / 1" but got "auto" 12 PASS Computed style test: input with {"type":"submit","width":"0","height":"1"} 13 FAIL Computed style test: img with {"width":"1","height":"0"} assert_equals: expected "auto 1 / 0" but got "auto" 14 FAIL Computed style test: input with {"type":"image","width":"1","height":"0"} assert_equals: expected "auto 1 / 0" but got "auto" 15 PASS Computed style test: input with {"type":"submit","width":"1","height":"0"} 16 FAIL Computed style test: img with {"width":"0","height":"0"} assert_equals: expected "auto 0 / 0" but got "auto" 17 FAIL Computed style test: input with {"type":"image","width":"0","height":"0"} assert_equals: expected "auto 0 / 0" but got "auto" 18 PASS Computed style test: input with {"type":"submit","width":"0","height":"0"} 19 FAIL Computed style test: img with {"width":"0.5","height":"1.5"} assert_equals: expected "auto 0.5 / 1.5" but got "auto" 20 FAIL Computed style test: input with {"type":"image","width":"0.5","height":"1.5"} assert_equals: expected "auto 0.5 / 1.5" but got "auto" 21 PASS Computed style test: input with {"type":"submit","width":"0.5","height":"1.5"} 22 PASS Computed style test: img with {"width":null,"height":null} 23 PASS Computed style test: input with {"type":"image","width":null,"height":null} 24 PASS Computed style test: input with {"type":"submit","width":null,"height":null} 25 PASS Computed style test: img with {"width":"10","height":null} 26 PASS Computed style test: input with {"type":"image","width":"10","height":null} 27 PASS Computed style test: input with {"type":"submit","width":"10","height":null} 28 PASS Computed style test: img with {"width":null,"height":"20"} 29 PASS Computed style test: input with {"type":"image","width":null,"height":"20"} 30 PASS Computed style test: input with {"type":"submit","width":null,"height":"20"} 31 PASS Computed style test: img with {"width":"xx","height":"20"} 32 PASS Computed style test: input with {"type":"image","width":"xx","height":"20"} 33 PASS Computed style test: input with {"type":"submit","width":"xx","height":"20"} 34 PASS Computed style test: img with {"width":"10%","height":"20"} 35 PASS Computed style test: input with {"type":"image","width":"10%","height":"20"} 36 PASS Computed style test: input with {"type":"submit","width":"10%","height":"20"} 37 PASS Loaded images test: <img> without width height attributes 38 PASS Loaded images test: <img> with width and height attributes, but conflicting to the original aspect ratio 39 FAIL Loaded images test: <img> with width, height and empty src attributes assert_approx_equals: aspect-ratio should override intrinsic size of images that don't have any src. expected 0.8 +/- 0.001 but got Infinity 40 FAIL Loaded images test: Error image with width and height attributes assert_approx_equals: aspect-ratio should affect the size of error images. expected 0.8 +/- 0.001 but got 1 41 PASS Loaded images test: Error image with width, height and alt attributes 42 FAIL Loaded images test: <img> with width and height attributes, but not equal to the original aspect ratio assert_approx_equals: The original aspect ratio of blue.png expected 1.2547169811320755 +/- 0.001 but got 1.25 34 43 -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/img-aspect-ratio.html
r276296 r276498 18 18 <img src="error.png" alt="Alt text" width=100 height=500> 19 19 <script> 20 let t= async_test("Image width and height attributes are used to infer aspect-ratio");20 let guard = async_test("Image width and height attributes are used to infer aspect-ratio"); 21 21 function assert_ratio(img, expected, description) { 22 22 let epsilon = 0.001; … … 35 35 // This is not racy because the spec requires the user agent to queue a task: 36 36 // https://html.spec.whatwg.org/multipage/images.html#updating-the-image-data 37 t.step(function() { 37 test(function() { 38 // This img will be tested again after loaded. In order to locate it correctly, body should append it first. 38 39 var img = new Image(); 39 40 img.width = 250; … … 42 43 document.body.appendChild(img); 43 44 assert_ratio(img, 2.5); 45 }, "Create, append and test immediately: <img> with attributes width=250, height=100"); 44 46 47 test(function () { 45 48 img = new Image(); 46 49 img.setAttribute("width", "0.8"); … … 49 52 document.body.appendChild(img); 50 53 assert_ratio(img, 4); 54 }, "Create, append and test immediately: <img> with attributes width=0.8, height=0.2"); 51 55 56 test(function () { 52 57 img = new Image(); 53 58 img.setAttribute("width", "50%"); … … 57 62 // Percentages should be ignored. 58 63 assert_equals(getComputedStyle(img).height, "0px"); 59 }); 60 61 onload = t.step_func_done(function() { 62 let images = document.querySelectorAll("img"); 63 assert_ratio(images[0], 2.0, "2.0 is the original aspect ratio of green.png"); 64 assert_ratio(images[1], 2.0, "Loaded image's aspect ratio, at least by default, overrides width / height ratio."); 65 assert_ratio(images[2], 100/125, "aspect-ratio should override intrinsic size of images that don't have any src."); 66 assert_ratio(images[3], 100/125, "aspect-ratio should affect the size of error images."); 67 assert_not_equals(images[5].offsetHeight, 500, "Images with alt text should be inline and ignore the aspect ratio"); 68 assert_ratio(images[6], 133/106, "The original aspect ratio of blue.png"); 69 }); 64 }, "Create, append and test immediately: <img> with attributes width=50% height=25%"); 70 65 71 66 test_computed_style("10", "20", "auto 10 / 20"); … … 85 80 test_computed_style("10%", "20", "auto"); 86 81 82 onload = function() { 83 let images = document.querySelectorAll("img"); 84 // Tests for images finished loading. 85 test(function() { 86 assert_ratio(images[0], 2.0, "2.0 is the original aspect ratio of green.png"); 87 }, "Loaded images test: <img> without width height attributes"); 88 89 test(function() { 90 assert_ratio(images[1], 2.0, "Loaded image's aspect ratio, at least by default, overrides width / height ratio."); 91 }, "Loaded images test: <img> with width and height attributes, but conflicting to the original aspect ratio"); 92 93 test(function () { 94 assert_ratio(images[2], 100 / 125, "aspect-ratio should override intrinsic size of images that don't have any src."); 95 }, "Loaded images test: <img> with width, height and empty src attributes"); 96 97 test(function () { 98 assert_ratio(images[3], 100 / 125, "aspect-ratio should affect the size of error images."); 99 }, "Loaded images test: Error image with width and height attributes"); 100 101 test(function () { 102 assert_not_equals(images[5].offsetHeight, 500, "Images with alt text should be inline and ignore the aspect ratio"); 103 }, "Loaded images test: Error image with width, height and alt attributes"); 104 105 test(function () { 106 assert_ratio(images[6], 133 / 106, "The original aspect ratio of blue.png"); 107 }, "Loaded images test: <img> with width and height attributes, but not equal to the original aspect ratio"); 108 109 guard.done(); 110 }; 87 111 </script> -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/picture-aspect-ratio-expected.txt
r276296 r276498 3 3 4 4 5 FAIL source width and height attributes are used to infer aspect-ratio in <picture> assert_equals: expected "auto 100 / 100" but got "auto" 5 PASS source width and height attributes are used to infer aspect-ratio in <picture> 6 6 FAIL Computed style for width/height/aspect-ratio assert_approx_equals: expected 1 +/- 0.001 but got Infinity 7 7 FAIL Source width/height should take precedence over img attributes. assert_approx_equals: expected 2 +/- 0.001 but got 5 … … 9 9 FAIL If the <source> has only one of width/height, we don't get an aspect ratio, even if the <img> has both. assert_equals: expected "100px" but got "200px" 10 10 FAIL If we don't have width/height on the source, we fall back to width/height on the <img>. assert_equals: expected "auto 200 / 100" but got "auto" 11 FAIL If we only have one width/height attribute, we should get that attribute mapped but no aspect ratio, even if <img> has attributes. assert_equals: expected "100px" but got "200px" 11 FAIL If we only have one width attribute, we should get width mapped but no aspect ratio, even if <img> has attributes. assert_equals: expected "100px" but got "200px" 12 FAIL If we only have height attribute, we should get height mapped but no aspect ratio, even if <img> has attributes. assert_equals: expected "auto" but got "200px" 12 13 FAIL Dynamically changing width/height should change computed style assert_equals: expected "auto 100 / 100" but got "auto" 13 14 FAIL Changing which <source> matches should change computed style assert_equals: expected "auto 100 / 100" but got "auto" 14 15 FAIL Percentages on source should be ignored for aspect-ratio but used for width/height. assert_equals: expected 100 but got 0 15 16 FAIL Trailing garbage should be ignored but not make the attribute invalid assert_equals: expected 100 but got 0 17 PASS Loaded picture test: Both <source> and <img> are without width and height attributes 18 FAIL Loaded picture test: <source> with width and height attributes, <img> without width and height attributes assert_equals: expected "auto 100 / 100" but got "auto" 19 FAIL Loaded picture test: Both <source> and <img> are with width and height attributes assert_equals: expected "auto 100 / 100" but got "auto" 16 20 -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/picture-aspect-ratio.html
r276296 r276498 44 44 45 45 <script> 46 let t= async_test("source width and height attributes are used to infer aspect-ratio in <picture>");46 let guard = async_test("source width and height attributes are used to infer aspect-ratio in <picture>"); 47 47 function assert_ratio(img, expected, description) { 48 48 let epsilon = 0.001; … … 139 139 assert_equals(getComputedStyle(img).width, "100px"); 140 140 assert_equals(getComputedStyle(img).height, "auto"); 141 141 }, "If we only have one width attribute, we should get width mapped but no aspect ratio, even if <img> has attributes."); 142 143 test(function() { 142 144 img = createPicture(undefined, 100); 143 145 img.parentNode.style.display = "none"; … … 148 150 assert_equals(getComputedStyle(img).width, "auto"); 149 151 assert_equals(getComputedStyle(img).height, "100px"); 150 }, "If we only have one width/height attribute, we should get that attributemapped but no aspect ratio, even if <img> has attributes.");152 }, "If we only have height attribute, we should get height mapped but no aspect ratio, even if <img> has attributes."); 151 153 152 154 test(function() { … … 204 206 }, "Trailing garbage should be ignored but not make the attribute invalid"); 205 207 206 onload = t.step_func_done(function() {208 onload = function() { 207 209 let images = document.querySelectorAll("img"); 208 var img = images[0]; 209 assert_ratio(img, 2.0, "2.0 is the original aspect ratio of green-100x50.png"); 210 assert_cs(img, "auto"); 211 img.style.display = "none"; 212 img.setAttribute("nowidth", "true"); 213 assert_equals(getComputedStyle(img).width, "auto"); 214 assert_equals(getComputedStyle(img).height, "auto"); 215 img = images[1]; 216 assert_ratio(img, 2.0, "Loaded image's aspect ratio, at least by default, overrides width / height ratio."); 217 assert_cs(img, "auto 100 / 100"); 218 img.style.display = "none"; 219 img.setAttribute("nowidth", "true"); 220 assert_equals(getComputedStyle(img).width, "100px"); 221 assert_equals(getComputedStyle(img).height, "100px"); 222 img = images[2]; 223 assert_ratio(img, 2.0, "Loaded image's aspect ratio, at least by default, overrides width / height ratio (2)."); 224 assert_cs(img, "auto 100 / 100"); 225 img.style.display = "none"; 226 img.setAttribute("nowidth", "true"); 227 assert_equals(getComputedStyle(img).width, "100px"); 228 assert_equals(getComputedStyle(img).height, "100px"); 229 }); 210 test(function() { 211 var img = images[0]; 212 assert_ratio(img, 2.0, "2.0 is the original aspect ratio of green-100x50.png"); 213 assert_cs(img, "auto"); 214 img.style.display = "none"; 215 img.setAttribute("nowidth", "true"); 216 assert_equals(getComputedStyle(img).width, "auto"); 217 assert_equals(getComputedStyle(img).height, "auto"); 218 }, "Loaded picture test: Both <source> and <img> are without width and height attributes"); 219 220 test(function () { 221 img = images[1]; 222 assert_ratio(img, 2.0, "Loaded image's aspect ratio, at least by default, overrides width / height ratio."); 223 assert_cs(img, "auto 100 / 100"); 224 img.style.display = "none"; 225 img.setAttribute("nowidth", "true"); 226 assert_equals(getComputedStyle(img).width, "100px"); 227 assert_equals(getComputedStyle(img).height, "100px"); 228 }, "Loaded picture test: <source> with width and height attributes, <img> without width and height attributes"); 229 230 test(function () { 231 img = images[2]; 232 assert_ratio(img, 2.0, "Loaded image's aspect ratio, at least by default, overrides width / height ratio (2)."); 233 assert_cs(img, "auto 100 / 100"); 234 img.style.display = "none"; 235 img.setAttribute("nowidth", "true"); 236 assert_equals(getComputedStyle(img).width, "100px"); 237 assert_equals(getComputedStyle(img).height, "100px"); 238 }, "Loaded picture test: Both <source> and <img> are with width and height attributes"); 239 240 guard.done(); 241 }; 230 242 </script> -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/resources/aspect-ratio.js
r276296 r276498 15 15 } 16 16 elem.remove(); 17 }, ` ${tag} with ${JSON.stringify(attributes)}`);17 }, `Computed style test: ${tag} with ${JSON.stringify(attributes)}`); 18 18 } -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/video-aspect-ratio-expected.txt
r276296 r276498 2 2 3 3 FAIL Video width and height attributes are not used to infer aspect-ratio assert_approx_equals: expected 2.5 +/- 0.001 but got 2 4 FAIL video with {"width":"10","height":"20"} assert_equals: expected "auto 10 / 20" but got "auto"5 FAIL video with {"width":"0.5","height":"1.5"} assert_equals: expected "auto 0.5 / 1.5" but got "auto"6 PASS video with {"width":"0","height":"1"}7 PASS video with {"width":"1","height":"0"}8 PASS video with {"width":"0","height":"0"}9 PASS video with {"width":null,"height":null}10 PASS video with {"width":"10","height":null}11 PASS video with {"width":null,"height":"20"}12 PASS video with {"width":"xx","height":"20"}13 PASS video with {"width":"10%","height":"20"}4 FAIL Computed style test: video with {"width":"10","height":"20"} assert_equals: expected "auto 10 / 20" but got "auto" 5 FAIL Computed style test: video with {"width":"0.5","height":"1.5"} assert_equals: expected "auto 0.5 / 1.5" but got "auto" 6 PASS Computed style test: video with {"width":"0","height":"1"} 7 PASS Computed style test: video with {"width":"1","height":"0"} 8 PASS Computed style test: video with {"width":"0","height":"0"} 9 PASS Computed style test: video with {"width":null,"height":null} 10 PASS Computed style test: video with {"width":"10","height":null} 11 PASS Computed style test: video with {"width":null,"height":"20"} 12 PASS Computed style test: video with {"width":"xx","height":"20"} 13 PASS Computed style test: video with {"width":"10%","height":"20"} 14 14
Note:
See TracChangeset
for help on using the changeset viewer.