Title: [276498] trunk/LayoutTests/imported/w3c
Revision
276498
Author
[email protected]
Date
2021-04-23 08:16:30 -0700 (Fri, 23 Apr 2021)

Log Message

Import the update to "mapping attribute width and height to aspect ratio" tests from WPT
https://bugs.webkit.org/show_bug.cgi?id=224911

Reviewed by Rob Buis.

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
each image has its own test case and won't affect testing other images.

* web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/canvas-aspect-ratio-expected.txt:
* web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/img-aspect-ratio-expected.txt:
* web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/img-aspect-ratio.html:
* web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/picture-aspect-ratio-expected.txt:
* web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/picture-aspect-ratio.html:
* web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/resources/aspect-ratio.js:
(test_computed_style_aspect_ratio):
* web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/video-aspect-ratio-expected.txt:

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (276497 => 276498)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2021-04-23 14:32:36 UTC (rev 276497)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2021-04-23 15:16:30 UTC (rev 276498)
@@ -1,3 +1,22 @@
+2021-04-23  Cathie Chen  <[email protected]>
+
+        Import the update to "mapping attribute width and height to aspect ratio" tests from WPT
+        https://bugs.webkit.org/show_bug.cgi?id=224911
+
+        Reviewed by Rob Buis.
+
+        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
+        each image has its own test case and won't affect testing other images.
+
+        * web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/canvas-aspect-ratio-expected.txt:
+        * web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/img-aspect-ratio-expected.txt:
+        * web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/img-aspect-ratio.html:
+        * web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/picture-aspect-ratio-expected.txt:
+        * web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/picture-aspect-ratio.html:
+        * web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/resources/aspect-ratio.js:
+        (test_computed_style_aspect_ratio):
+        * web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/video-aspect-ratio-expected.txt:
+
 2021-04-22  Tyler Wilcock  <[email protected]>
 
         [css-counter-styles] Parse @counter-style descriptors

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/canvas-aspect-ratio-expected.txt (276497 => 276498)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/canvas-aspect-ratio-expected.txt	2021-04-23 14:32:36 UTC (rev 276497)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/canvas-aspect-ratio-expected.txt	2021-04-23 15:16:30 UTC (rev 276498)
@@ -2,14 +2,14 @@
 
 PASS Canvas width and height attributes are used as the surface size with contain:size
 PASS Canvas width and height attributes are used as the surface size
-FAIL canvas with {"width":"10","height":"20"} assert_equals: expected "auto 10 / 20" but got "auto"
-PASS canvas with {"width":"0","height":"1"}
-PASS canvas with {"width":"1","height":"0"}
-PASS canvas with {"width":"0","height":"0"}
-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"]
-PASS canvas with {"width":"10%","height":"20"}
-PASS canvas with {"width":null,"height":null}
-PASS canvas with {"width":"10","height":null}
-PASS canvas with {"width":null,"height":"20"}
-PASS canvas with {"width":"xx","height":"20"}
+FAIL Computed style test: canvas with {"width":"10","height":"20"} assert_equals: expected "auto 10 / 20" but got "auto"
+PASS Computed style test: canvas with {"width":"0","height":"1"}
+PASS Computed style test: canvas with {"width":"1","height":"0"}
+PASS Computed style test: canvas with {"width":"0","height":"0"}
+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"]
+PASS Computed style test: canvas with {"width":"10%","height":"20"}
+PASS Computed style test: canvas with {"width":null,"height":null}
+PASS Computed style test: canvas with {"width":"10","height":null}
+PASS Computed style test: canvas with {"width":null,"height":"20"}
+PASS Computed style test: canvas with {"width":"xx","height":"20"}
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/img-aspect-ratio-expected.txt (276497 => 276498)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/img-aspect-ratio-expected.txt	2021-04-23 14:32:36 UTC (rev 276497)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/img-aspect-ratio-expected.txt	2021-04-23 15:16:30 UTC (rev 276498)
@@ -1,34 +1,43 @@
 
 
-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
-FAIL img with {"width":"10","height":"20"} assert_equals: expected "auto 10 / 20" but got "auto"
-FAIL input with {"type":"image","width":"10","height":"20"} assert_equals: expected "auto 10 / 20" but got "auto"
-PASS input with {"type":"submit","width":"10","height":"20"}
-FAIL img with {"width":"0","height":"1"} assert_equals: expected "auto 0 / 1" but got "auto"
-FAIL input with {"type":"image","width":"0","height":"1"} assert_equals: expected "auto 0 / 1" but got "auto"
-PASS input with {"type":"submit","width":"0","height":"1"}
-FAIL img with {"width":"1","height":"0"} assert_equals: expected "auto 1 / 0" but got "auto"
-FAIL input with {"type":"image","width":"1","height":"0"} assert_equals: expected "auto 1 / 0" but got "auto"
-PASS input with {"type":"submit","width":"1","height":"0"}
-FAIL img with {"width":"0","height":"0"} assert_equals: expected "auto 0 / 0" but got "auto"
-FAIL input with {"type":"image","width":"0","height":"0"} assert_equals: expected "auto 0 / 0" but got "auto"
-PASS input with {"type":"submit","width":"0","height":"0"}
-FAIL img with {"width":"0.5","height":"1.5"} assert_equals: expected "auto 0.5 / 1.5" but got "auto"
-FAIL input with {"type":"image","width":"0.5","height":"1.5"} assert_equals: expected "auto 0.5 / 1.5" but got "auto"
-PASS input with {"type":"submit","width":"0.5","height":"1.5"}
-PASS img with {"width":null,"height":null}
-PASS input with {"type":"image","width":null,"height":null}
-PASS input with {"type":"submit","width":null,"height":null}
-PASS img with {"width":"10","height":null}
-PASS input with {"type":"image","width":"10","height":null}
-PASS input with {"type":"submit","width":"10","height":null}
-PASS img with {"width":null,"height":"20"}
-PASS input with {"type":"image","width":null,"height":"20"}
-PASS input with {"type":"submit","width":null,"height":"20"}
-PASS img with {"width":"xx","height":"20"}
-PASS input with {"type":"image","width":"xx","height":"20"}
-PASS input with {"type":"submit","width":"xx","height":"20"}
-PASS img with {"width":"10%","height":"20"}
-PASS input with {"type":"image","width":"10%","height":"20"}
-PASS input with {"type":"submit","width":"10%","height":"20"}
+PASS Image width and height attributes are used to infer aspect-ratio
+PASS Create, append and test immediately: <img> with attributes width=250, height=100
+PASS Create, append and test immediately: <img> with attributes width=0.8, height=0.2
+PASS Create, append and test immediately: <img> with attributes width=50% height=25%
+FAIL Computed style test: img with {"width":"10","height":"20"} assert_equals: expected "auto 10 / 20" but got "auto"
+FAIL Computed style test: input with {"type":"image","width":"10","height":"20"} assert_equals: expected "auto 10 / 20" but got "auto"
+PASS Computed style test: input with {"type":"submit","width":"10","height":"20"}
+FAIL Computed style test: img with {"width":"0","height":"1"} assert_equals: expected "auto 0 / 1" but got "auto"
+FAIL Computed style test: input with {"type":"image","width":"0","height":"1"} assert_equals: expected "auto 0 / 1" but got "auto"
+PASS Computed style test: input with {"type":"submit","width":"0","height":"1"}
+FAIL Computed style test: img with {"width":"1","height":"0"} assert_equals: expected "auto 1 / 0" but got "auto"
+FAIL Computed style test: input with {"type":"image","width":"1","height":"0"} assert_equals: expected "auto 1 / 0" but got "auto"
+PASS Computed style test: input with {"type":"submit","width":"1","height":"0"}
+FAIL Computed style test: img with {"width":"0","height":"0"} assert_equals: expected "auto 0 / 0" but got "auto"
+FAIL Computed style test: input with {"type":"image","width":"0","height":"0"} assert_equals: expected "auto 0 / 0" but got "auto"
+PASS Computed style test: input with {"type":"submit","width":"0","height":"0"}
+FAIL Computed style test: img with {"width":"0.5","height":"1.5"} assert_equals: expected "auto 0.5 / 1.5" but got "auto"
+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"
+PASS Computed style test: input with {"type":"submit","width":"0.5","height":"1.5"}
+PASS Computed style test: img with {"width":null,"height":null}
+PASS Computed style test: input with {"type":"image","width":null,"height":null}
+PASS Computed style test: input with {"type":"submit","width":null,"height":null}
+PASS Computed style test: img with {"width":"10","height":null}
+PASS Computed style test: input with {"type":"image","width":"10","height":null}
+PASS Computed style test: input with {"type":"submit","width":"10","height":null}
+PASS Computed style test: img with {"width":null,"height":"20"}
+PASS Computed style test: input with {"type":"image","width":null,"height":"20"}
+PASS Computed style test: input with {"type":"submit","width":null,"height":"20"}
+PASS Computed style test: img with {"width":"xx","height":"20"}
+PASS Computed style test: input with {"type":"image","width":"xx","height":"20"}
+PASS Computed style test: input with {"type":"submit","width":"xx","height":"20"}
+PASS Computed style test: img with {"width":"10%","height":"20"}
+PASS Computed style test: input with {"type":"image","width":"10%","height":"20"}
+PASS Computed style test: input with {"type":"submit","width":"10%","height":"20"}
+PASS Loaded images test: <img> without width height attributes
+PASS Loaded images test: <img> with width and height attributes, but conflicting to the original aspect ratio
+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
+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
+PASS Loaded images test: Error image with width, height and alt attributes
+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
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/img-aspect-ratio.html (276497 => 276498)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/img-aspect-ratio.html	2021-04-23 14:32:36 UTC (rev 276497)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/img-aspect-ratio.html	2021-04-23 15:16:30 UTC (rev 276498)
@@ -17,7 +17,7 @@
 <img src=""
 <img src="" alt="Alt text" width=100 height=500>
 <script>
-let t = async_test("Image width and height attributes are used to infer aspect-ratio");
+let guard = async_test("Image width and height attributes are used to infer aspect-ratio");
 function assert_ratio(img, expected, description) {
   let epsilon = 0.001;
   assert_approx_equals(parseFloat(getComputedStyle(img).width, 10) / parseFloat(getComputedStyle(img).height, 10),
@@ -34,7 +34,8 @@
 // Create and append a new image and immediately check the ratio.
 // This is not racy because the spec requires the user agent to queue a task:
 // https://html.spec.whatwg.org/multipage/images.html#updating-the-image-data
-t.step(function() {
+test(function() {
+  // This img will be tested again after loaded. In order to locate it correctly, body should append it first.
   var img = new Image();
   img.width = 250;
   img.height = 100;
@@ -41,7 +42,9 @@
   img.src = ""
   document.body.appendChild(img);
   assert_ratio(img, 2.5);
+}, "Create, append and test immediately: <img> with attributes width=250, height=100");
 
+test(function () {
   img = new Image();
   img.setAttribute("width", "0.8");
   img.setAttribute("height", "0.2");
@@ -48,7 +51,9 @@
   img.src = ""
   document.body.appendChild(img);
   assert_ratio(img, 4);
+}, "Create, append and test immediately: <img> with attributes width=0.8, height=0.2");
 
+test(function () {
   img = new Image();
   img.setAttribute("width", "50%");
   img.setAttribute("height", "25%");
@@ -56,18 +61,8 @@
   document.body.appendChild(img);
   // Percentages should be  ignored.
   assert_equals(getComputedStyle(img).height, "0px");
-});
+}, "Create, append and test immediately: <img> with attributes width=50% height=25%");
 
-_onload_ = t.step_func_done(function() {
-  let images = document.querySelectorAll("img");
-  assert_ratio(images[0], 2.0, "2.0 is the original aspect ratio of green.png");
-  assert_ratio(images[1], 2.0, "Loaded image's aspect ratio, at least by default, overrides width / height ratio.");
-  assert_ratio(images[2], 100/125, "aspect-ratio should override intrinsic size of images that don't have any src.");
-  assert_ratio(images[3], 100/125, "aspect-ratio should affect the size of error images.");
-  assert_not_equals(images[5].offsetHeight, 500, "Images with alt text should be inline and ignore the aspect ratio");
-  assert_ratio(images[6], 133/106, "The original aspect ratio of blue.png");
-});
-
 test_computed_style("10", "20", "auto 10 / 20");
 // These are invalid per spec, but see
 // https://github.com/whatwg/html/issues/4961
@@ -84,4 +79,33 @@
 test_computed_style("xx", "20", "auto");
 test_computed_style("10%", "20", "auto");
 
+_onload_ = function() {
+  let images = document.querySelectorAll("img");
+  // Tests for images finished loading.
+  test(function() {
+    assert_ratio(images[0], 2.0, "2.0 is the original aspect ratio of green.png");
+  }, "Loaded images test: <img> without width height attributes");
+
+  test(function() {
+    assert_ratio(images[1], 2.0, "Loaded image's aspect ratio, at least by default, overrides width / height ratio.");
+  }, "Loaded images test: <img> with width and height attributes, but conflicting to the original aspect ratio");
+
+  test(function () {
+    assert_ratio(images[2], 100 / 125, "aspect-ratio should override intrinsic size of images that don't have any src.");
+  }, "Loaded images test: <img> with width, height and empty src attributes");
+
+  test(function () {
+    assert_ratio(images[3], 100 / 125, "aspect-ratio should affect the size of error images.");
+  }, "Loaded images test: Error image with width and height attributes");
+
+  test(function () {
+    assert_not_equals(images[5].offsetHeight, 500, "Images with alt text should be inline and ignore the aspect ratio");
+  }, "Loaded images test: Error image with width, height and alt attributes");
+
+  test(function () {
+    assert_ratio(images[6], 133 / 106, "The original aspect ratio of blue.png");
+  }, "Loaded images test: <img> with width and height attributes, but not equal to the original aspect ratio");
+
+  guard.done();
+};
 </script>

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/picture-aspect-ratio-expected.txt (276497 => 276498)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/picture-aspect-ratio-expected.txt	2021-04-23 14:32:36 UTC (rev 276497)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/picture-aspect-ratio-expected.txt	2021-04-23 15:16:30 UTC (rev 276498)
@@ -2,15 +2,19 @@
 
 
 
-FAIL source width and height attributes are used to infer aspect-ratio in <picture> assert_equals: expected "auto 100 / 100" but got "auto"
+PASS source width and height attributes are used to infer aspect-ratio in <picture>
 FAIL Computed style for width/height/aspect-ratio assert_approx_equals: expected 1 +/- 0.001 but got Infinity
 FAIL Source width/height should take precedence over img attributes. assert_approx_equals: expected 2 +/- 0.001 but got 5
 FAIL Make sure style gets invalidated correctly when the source gets removed. assert_equals: expected "auto 250 / 50" but got "auto"
 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"
 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"
-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"
+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"
+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"
 FAIL Dynamically changing width/height should change computed style assert_equals: expected "auto 100 / 100" but got "auto"
 FAIL Changing which <source> matches should change computed style assert_equals: expected "auto 100 / 100" but got "auto"
 FAIL Percentages on source should be ignored for aspect-ratio but used for width/height. assert_equals: expected 100 but got 0
 FAIL Trailing garbage should be ignored but not make the attribute invalid assert_equals: expected 100 but got 0
+PASS Loaded picture test: Both <source> and <img> are without width and height attributes
+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"
+FAIL Loaded picture test: Both <source> and <img> are with width and height attributes assert_equals: expected "auto 100 / 100" but got "auto"
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/picture-aspect-ratio.html (276497 => 276498)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/picture-aspect-ratio.html	2021-04-23 14:32:36 UTC (rev 276497)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/picture-aspect-ratio.html	2021-04-23 15:16:30 UTC (rev 276498)
@@ -43,7 +43,7 @@
 </picture>
 
 <script>
-let t = async_test("source width and height attributes are used to infer aspect-ratio in <picture>");
+let guard = async_test("source width and height attributes are used to infer aspect-ratio in <picture>");
 function assert_ratio(img, expected, description) {
   let epsilon = 0.001;
   assert_approx_equals(parseFloat(getComputedStyle(img).width, 10) / parseFloat(getComputedStyle(img).height, 10),
@@ -138,7 +138,9 @@
   assert_cs(img, "auto");
   assert_equals(getComputedStyle(img).width, "100px");
   assert_equals(getComputedStyle(img).height, "auto");
+}, "If we only have one width attribute, we should get width mapped but no aspect ratio, even if <img> has attributes.");
 
+test(function() {
   img = createPicture(undefined, 100);
   img.parentNode.style.display = "none";
   img.setAttribute("width", "200");
@@ -147,7 +149,7 @@
   assert_cs(img, "auto");
   assert_equals(getComputedStyle(img).width, "auto");
   assert_equals(getComputedStyle(img).height, "100px");
-}, "If we only have one width/height attribute, we should get that attribute mapped but no aspect ratio, even if <img> has attributes.");
+}, "If we only have height attribute, we should get height mapped but no aspect ratio, even if <img> has attributes.");
 
 test(function() {
   img = createPicture(100, 100);
@@ -203,28 +205,38 @@
   assert_equals(getComputedStyle(img).height, "50px");
 }, "Trailing garbage should be ignored but not make the attribute invalid");
 
-_onload_ = t.step_func_done(function() {
+_onload_ = function() {
   let images = document.querySelectorAll("img");
-  var img = images[0];
-  assert_ratio(img, 2.0, "2.0 is the original aspect ratio of green-100x50.png");
-  assert_cs(img, "auto");
-  img.style.display = "none";
-  img.setAttribute("nowidth", "true");
-  assert_equals(getComputedStyle(img).width, "auto");
-  assert_equals(getComputedStyle(img).height, "auto");
-  img = images[1];
-  assert_ratio(img, 2.0, "Loaded image's aspect ratio, at least by default, overrides width / height ratio.");
-  assert_cs(img, "auto 100 / 100");
-  img.style.display = "none";
-  img.setAttribute("nowidth", "true");
-  assert_equals(getComputedStyle(img).width, "100px");
-  assert_equals(getComputedStyle(img).height, "100px");
-  img = images[2];
-  assert_ratio(img, 2.0, "Loaded image's aspect ratio, at least by default, overrides width / height ratio (2).");
-  assert_cs(img, "auto 100 / 100");
-  img.style.display = "none";
-  img.setAttribute("nowidth", "true");
-  assert_equals(getComputedStyle(img).width, "100px");
-  assert_equals(getComputedStyle(img).height, "100px");
-});
+  test(function() {
+    var img = images[0];
+    assert_ratio(img, 2.0, "2.0 is the original aspect ratio of green-100x50.png");
+    assert_cs(img, "auto");
+    img.style.display = "none";
+    img.setAttribute("nowidth", "true");
+    assert_equals(getComputedStyle(img).width, "auto");
+    assert_equals(getComputedStyle(img).height, "auto");
+  }, "Loaded picture test: Both <source> and <img> are without width and height attributes");
+
+  test(function () {
+    img = images[1];
+    assert_ratio(img, 2.0, "Loaded image's aspect ratio, at least by default, overrides width / height ratio.");
+    assert_cs(img, "auto 100 / 100");
+    img.style.display = "none";
+    img.setAttribute("nowidth", "true");
+    assert_equals(getComputedStyle(img).width, "100px");
+    assert_equals(getComputedStyle(img).height, "100px");
+  }, "Loaded picture test: <source> with width and height attributes, <img> without width and height attributes");
+
+  test(function () {
+    img = images[2];
+    assert_ratio(img, 2.0, "Loaded image's aspect ratio, at least by default, overrides width / height ratio (2).");
+    assert_cs(img, "auto 100 / 100");
+    img.style.display = "none";
+    img.setAttribute("nowidth", "true");
+    assert_equals(getComputedStyle(img).width, "100px");
+    assert_equals(getComputedStyle(img).height, "100px");
+  }, "Loaded picture test: Both <source> and <img> are with width and height attributes");
+
+  guard.done();
+};
 </script>

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/resources/aspect-ratio.js (276497 => 276498)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/resources/aspect-ratio.js	2021-04-23 14:32:36 UTC (rev 276497)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/resources/aspect-ratio.js	2021-04-23 15:16:30 UTC (rev 276498)
@@ -14,5 +14,5 @@
       assert_equals(aspectRatio, expected);
     }
     elem.remove();
-  }, `${tag} with ${JSON.stringify(attributes)}`);
+  }, `Computed style test: ${tag} with ${JSON.stringify(attributes)}`);
 }

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/video-aspect-ratio-expected.txt (276497 => 276498)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/video-aspect-ratio-expected.txt	2021-04-23 14:32:36 UTC (rev 276497)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/video-aspect-ratio-expected.txt	2021-04-23 15:16:30 UTC (rev 276498)
@@ -1,14 +1,14 @@
 
 
 FAIL Video width and height attributes are not used to infer aspect-ratio assert_approx_equals: expected 2.5 +/- 0.001 but got 2
-FAIL video with {"width":"10","height":"20"} assert_equals: expected "auto 10 / 20" but got "auto"
-FAIL video with {"width":"0.5","height":"1.5"} assert_equals: expected "auto 0.5 / 1.5" but got "auto"
-PASS video with {"width":"0","height":"1"}
-PASS video with {"width":"1","height":"0"}
-PASS video with {"width":"0","height":"0"}
-PASS video with {"width":null,"height":null}
-PASS video with {"width":"10","height":null}
-PASS video with {"width":null,"height":"20"}
-PASS video with {"width":"xx","height":"20"}
-PASS video with {"width":"10%","height":"20"}
+FAIL Computed style test: video with {"width":"10","height":"20"} assert_equals: expected "auto 10 / 20" but got "auto"
+FAIL Computed style test: video with {"width":"0.5","height":"1.5"} assert_equals: expected "auto 0.5 / 1.5" but got "auto"
+PASS Computed style test: video with {"width":"0","height":"1"}
+PASS Computed style test: video with {"width":"1","height":"0"}
+PASS Computed style test: video with {"width":"0","height":"0"}
+PASS Computed style test: video with {"width":null,"height":null}
+PASS Computed style test: video with {"width":"10","height":null}
+PASS Computed style test: video with {"width":null,"height":"20"}
+PASS Computed style test: video with {"width":"xx","height":"20"}
+PASS Computed style test: video with {"width":"10%","height":"20"}
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to