⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 276296 in webkit


Ignore:
Timestamp:
Apr 20, 2021, 3:19:21 AM (5 years ago)
Author:
cathiechen
Message:

Update html/rendering/replaced-elements/attributes-for-embedded-content-and-images/ tests from WPT
https://bugs.webkit.org/show_bug.cgi?id=224748

Reviewed by Rob Buis.

LayoutTests/imported/w3c:

Update the tests for "mapping attribute width and height as the implicit aspect ratio" which are based on the latest agreement
from WPT commit 19445e7b39.

  • 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/canvas-aspect-ratio.html:
  • 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/number-placeholder-right-aligned-expected.html: Added.
  • web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/number-placeholder-right-aligned.html: Added.
  • web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/picture-aspect-ratio-expected.txt: Added.
  • web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/picture-aspect-ratio.html: Added.
  • web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/resources/aspect-ratio.js: Added.

(test_computed_style_aspect_ratio):

  • web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/resources/w3c-import.log: Added.
  • web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/video-aspect-ratio-expected.txt:
  • web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/video-aspect-ratio.html:
  • web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/w3c-import.log:

LayoutTests:

picture-aspect-ratio.html is flaky.

Location:
trunk/LayoutTests
Files:
7 added
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r276293 r276296  
     12021-04-20  Cathie Chen  <cathiechen@igalia.com>
     2
     3        Update html/rendering/replaced-elements/attributes-for-embedded-content-and-images/ tests from WPT
     4        https://bugs.webkit.org/show_bug.cgi?id=224748
     5
     6        Reviewed by Rob Buis.
     7
     8        picture-aspect-ratio.html is flaky.
     9
     10        * TestExpectations:
     11
    1122021-04-20  Tim Nguyen  <ntim@apple.com>
    213
  • trunk/LayoutTests/TestExpectations

    r276240 r276296  
    14171417imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/sizes/parse-a-sizes-attribute-standards-mode.html [ Failure Pass ]
    14181418imported/w3c/web-platform-tests/html/semantics/embedded-content/the-object-element/object-fallback-failed-cross-origin-navigation.sub.html [ Failure Pass ]
     1419
     1420# Newly importing aspect ratio test is flaky.
     1421imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/picture-aspect-ratio.html [ Failure Pass ]
    14191422
    14201423# Newly importing W3C tests needed support for reftest-wait.
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r276293 r276296  
     12021-04-20  Cathie Chen  <cathiechen@igalia.com>
     2
     3        Update html/rendering/replaced-elements/attributes-for-embedded-content-and-images/ tests from WPT
     4        https://bugs.webkit.org/show_bug.cgi?id=224748
     5
     6        Reviewed by Rob Buis.
     7
     8        Update the tests for "mapping attribute width and height as the implicit aspect ratio" which are based on the latest agreement
     9        from WPT commit 19445e7b39.
     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/canvas-aspect-ratio.html:
     13        * web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/img-aspect-ratio-expected.txt:
     14        * web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/img-aspect-ratio.html:
     15        * web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/number-placeholder-right-aligned-expected.html: Added.
     16        * web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/number-placeholder-right-aligned.html: Added.
     17        * web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/picture-aspect-ratio-expected.txt: Added.
     18        * web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/picture-aspect-ratio.html: Added.
     19        * web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/resources/aspect-ratio.js: Added.
     20        (test_computed_style_aspect_ratio):
     21        * web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/resources/w3c-import.log: Added.
     22        * web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/video-aspect-ratio-expected.txt:
     23        * web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/video-aspect-ratio.html:
     24        * web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/w3c-import.log:
     25
    1262021-04-20  Tim Nguyen  <ntim@apple.com>
    227
  • trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/canvas-aspect-ratio-expected.txt

    r267646 r276296  
    11
     2
     3PASS Canvas width and height attributes are used as the surface size with contain:size
    24PASS Canvas width and height attributes are used as the surface size
     5FAIL canvas with {"width":"10","height":"20"} assert_equals: expected "auto 10 / 20" but got "auto"
     6PASS canvas with {"width":"0","height":"1"}
     7PASS canvas with {"width":"1","height":"0"}
     8PASS canvas with {"width":"0","height":"0"}
     9FAIL canvas with {"width":"0.5","height":"1.5"} assert_in_array: value "auto" not in array ["auto 0 / 1", "auto 0.5 / 1.5"]
     10PASS canvas with {"width":"10%","height":"20"}
     11PASS canvas with {"width":null,"height":null}
     12PASS canvas with {"width":"10","height":null}
     13PASS canvas with {"width":null,"height":"20"}
     14PASS canvas with {"width":"xx","height":"20"}
    315
  • trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/canvas-aspect-ratio.html

    r269360 r276296  
    11<!doctype html><!-- webkit-test-runner [ AspectRatioOfImgFromWidthAndHeightEnabled=true ] -->
    2 <title>Canvas width and height attributes are used as the surface size</title>
     2<title>Canvas width and height attributes are used as the surface size, and also to infer aspect ratio</title>
    33<script src="/resources/testharness.js"></script>
    44<script src="/resources/testharnessreport.js"></script>
     5<script src="resources/aspect-ratio.js"></script>
    56<style>
    67  canvas {
     
    1112</style>
    1213<body>
     14<canvas id="contained" width="250" height="100" style="contain: size;"></canvas>
    1315<script>
    14 let t = async_test("Canvas width and height attributes are used as the surface size");
    1516function assert_ratio(img, expected) {
    1617  let epsilon = 0.001;
    1718  assert_approx_equals(parseInt(getComputedStyle(img).width, 10) / parseInt(getComputedStyle(img).height, 10), expected, epsilon);
    1819}
     20
     21function test_computed_style(width, height, expected) {
     22  test_computed_style_aspect_ratio("canvas", {width: width, height: height}, expected);
     23}
     24
     25test(function() {
     26  canvas = document.getElementById("contained");
     27  assert_ratio(canvas, 2.5);
     28}, "Canvas width and height attributes are used as the surface size with contain:size");
     29
    1930// Create and append a new canvas and immediately check the ratio.
    20 t.step(function() {
     31test(function() {
    2132  var canvas = document.createElement("canvas");
    2233  canvas.setAttribute("width", "250");
     
    2536  // Canvases always use the aspect ratio from their surface size.
    2637  assert_ratio(canvas, 2.5);
     38}, "Canvas width and height attributes are used as the surface size");
    2739
    28   t.done();
    29 });
     40test_computed_style("10", "20", "auto 10 / 20");
     41// These are invalid per spec, but see
     42// https://github.com/whatwg/html/issues/4961
     43test_computed_style("0", "1", ["auto", "auto 0 / 1"]);
     44test_computed_style("1", "0", ["auto", "auto 1 / 0"]);
     45test_computed_style("0", "0", ["auto", "auto 0 / 0"]);
     46
     47// See https://github.com/whatwg/html/issues/4961:
     48// https://html.spec.whatwg.org/#attr-canvas-width
     49// https://html.spec.whatwg.org/#rules-for-parsing-non-negative-integers
     50test_computed_style("0.5", "1.5", ["auto 0 / 1", "auto 0.5 / 1.5"]);
     51test_computed_style("10%", "20", ["auto", "auto 10 / 20"]);
     52
     53test_computed_style(null, null, "auto");
     54test_computed_style("10", null, "auto");
     55test_computed_style(null, "20", "auto");
     56test_computed_style("xx", "20", "auto");
     57
    3058</script>
  • trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/img-aspect-ratio-expected.txt

    r276228 r276296  
    11
    22
    3 FAIL Image width and height attributes are used to infer aspect-ratio assert_approx_equals: expected 1.2547169811320755 +/- 0.001 but got 1.25
     3FAIL 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
     4FAIL img with {"width":"10","height":"20"} assert_equals: expected "auto 10 / 20" but got "auto"
     5FAIL input with {"type":"image","width":"10","height":"20"} assert_equals: expected "auto 10 / 20" but got "auto"
     6PASS input with {"type":"submit","width":"10","height":"20"}
     7FAIL img with {"width":"0","height":"1"} assert_equals: expected "auto 0 / 1" but got "auto"
     8FAIL input with {"type":"image","width":"0","height":"1"} assert_equals: expected "auto 0 / 1" but got "auto"
     9PASS input with {"type":"submit","width":"0","height":"1"}
     10FAIL img with {"width":"1","height":"0"} assert_equals: expected "auto 1 / 0" but got "auto"
     11FAIL input with {"type":"image","width":"1","height":"0"} assert_equals: expected "auto 1 / 0" but got "auto"
     12PASS input with {"type":"submit","width":"1","height":"0"}
     13FAIL img with {"width":"0","height":"0"} assert_equals: expected "auto 0 / 0" but got "auto"
     14FAIL input with {"type":"image","width":"0","height":"0"} assert_equals: expected "auto 0 / 0" but got "auto"
     15PASS input with {"type":"submit","width":"0","height":"0"}
     16FAIL img with {"width":"0.5","height":"1.5"} assert_equals: expected "auto 0.5 / 1.5" but got "auto"
     17FAIL input with {"type":"image","width":"0.5","height":"1.5"} assert_equals: expected "auto 0.5 / 1.5" but got "auto"
     18PASS input with {"type":"submit","width":"0.5","height":"1.5"}
     19PASS img with {"width":null,"height":null}
     20PASS input with {"type":"image","width":null,"height":null}
     21PASS input with {"type":"submit","width":null,"height":null}
     22PASS img with {"width":"10","height":null}
     23PASS input with {"type":"image","width":"10","height":null}
     24PASS input with {"type":"submit","width":"10","height":null}
     25PASS img with {"width":null,"height":"20"}
     26PASS input with {"type":"image","width":null,"height":"20"}
     27PASS input with {"type":"submit","width":null,"height":"20"}
     28PASS img with {"width":"xx","height":"20"}
     29PASS input with {"type":"image","width":"xx","height":"20"}
     30PASS input with {"type":"submit","width":"xx","height":"20"}
     31PASS img with {"width":"10%","height":"20"}
     32PASS input with {"type":"image","width":"10%","height":"20"}
     33PASS input with {"type":"submit","width":"10%","height":"20"}
    434
  • trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/img-aspect-ratio.html

    r269360 r276296  
    33<script src="/resources/testharness.js"></script>
    44<script src="/resources/testharnessreport.js"></script>
     5<script src="resources/aspect-ratio.js"></script>
    56<style>
    67  img {
     
    1516<img src="error.png" width=100 height=125>
    1617<img src="error.png">
     18<img src="error.png" alt="Alt text" width=100 height=500>
    1719<script>
    1820let t = async_test("Image width and height attributes are used to infer aspect-ratio");
    19 function assert_ratio(img, expected) {
     21function assert_ratio(img, expected, description) {
    2022  let epsilon = 0.001;
    21   assert_approx_equals(parseFloat(getComputedStyle(img).width, 10) / parseFloat(getComputedStyle(img).height, 10), expected, epsilon);
     23  assert_approx_equals(parseFloat(getComputedStyle(img).width, 10) / parseFloat(getComputedStyle(img).height, 10),
     24                       expected, epsilon, description);
    2225}
     26
     27function test_computed_style(width, height, expected) {
     28  test_computed_style_aspect_ratio("img", {width: width, height: height}, expected);
     29  test_computed_style_aspect_ratio("input", {type: "image", width: width, height: height}, expected);
     30  // input type=submit should not do this mapping.
     31  test_computed_style_aspect_ratio("input", {type: "submit", width: width, height: height}, "auto");
     32}
     33
    2334// Create and append a new image and immediately check the ratio.
    2435// This is not racy because the spec requires the user agent to queue a task:
     
    5061onload = t.step_func_done(function() {
    5162  let images = document.querySelectorAll("img");
    52   assert_ratio(images[0], 2.0); // Loaded image's aspect ratio, at least by default, overrides width / height ratio.
    53   assert_ratio(images[1], 2.0); // 2.0 is the original aspect ratio of green.png
    54   assert_equals(getComputedStyle(images[2]).height, "0px"); // aspect-ratio doesn't override intrinsic size of images that don't have any src.
    55   assert_equals(getComputedStyle(images[3]).height, getComputedStyle(images[4]).height); // aspect-ratio doesn't override intrinsic size of error images.
    56   assert_ratio(images[5], 133/106); // The original aspect ratio of blue.png
     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");
    5769});
     70
     71test_computed_style("10", "20", "auto 10 / 20");
     72// These are invalid per spec, but see
     73// https://github.com/whatwg/html/issues/4961
     74test_computed_style("0", "1", "auto 0 / 1");
     75test_computed_style("1", "0", "auto 1 / 0");
     76test_computed_style("0", "0", "auto 0 / 0");
     77// https://html.spec.whatwg.org/#map-to-the-aspect-ratio-property
     78// https://html.spec.whatwg.org/#rules-for-parsing-non-zero-dimension-values
     79test_computed_style("0.5", "1.5", "auto 0.5 / 1.5");
     80
     81test_computed_style(null, null, "auto");
     82test_computed_style("10", null, "auto");
     83test_computed_style(null, "20", "auto");
     84test_computed_style("xx", "20", "auto");
     85test_computed_style("10%", "20", "auto");
     86
    5887</script>
  • trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/video-aspect-ratio-expected.txt

    r267646 r276296  
    11
    22
    3 PASS Video width and height attributes are not used to infer aspect-ratio
     3FAIL Video width and height attributes are not used to infer aspect-ratio assert_approx_equals: expected 2.5 +/- 0.001 but got 2
     4FAIL video with {"width":"10","height":"20"} assert_equals: expected "auto 10 / 20" but got "auto"
     5FAIL video with {"width":"0.5","height":"1.5"} assert_equals: expected "auto 0.5 / 1.5" but got "auto"
     6PASS video with {"width":"0","height":"1"}
     7PASS video with {"width":"1","height":"0"}
     8PASS video with {"width":"0","height":"0"}
     9PASS video with {"width":null,"height":null}
     10PASS video with {"width":"10","height":null}
     11PASS video with {"width":null,"height":"20"}
     12PASS video with {"width":"xx","height":"20"}
     13PASS video with {"width":"10%","height":"20"}
    414
  • trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/video-aspect-ratio.html

    r269360 r276296  
    11<!doctype html><!-- webkit-test-runner [ AspectRatioOfImgFromWidthAndHeightEnabled=true ] -->
    2 <title>Video width and height attributes are not used to infer aspect-ratio</title>
     2<title>Video width and height attributes are used to infer aspect-ratio</title>
    33<script src="/resources/testharness.js"></script>
    44<script src="/resources/testharnessreport.js"></script>
    55<script src="/common/media.js"></script>
     6<script src="resources/aspect-ratio.js"></script>
    67<style>
    78  video {
     
    1213</style>
    1314<body>
     15<video width="250" height="100" id="contained" style="contain: size;"></video>
    1416<script>
    1517let t = async_test("Video width and height attributes are not used to infer aspect-ratio");
     
    1820  assert_approx_equals(parseInt(getComputedStyle(img).width, 10) / parseInt(getComputedStyle(img).height, 10), expected, epsilon);
    1921}
     22
     23function test_computed_style(width, height, expected) {
     24  test_computed_style_aspect_ratio("video", {width: width, height: height}, expected);
     25}
     26
     27t.step(function() {
     28  var video = document.getElementById("contained");
     29  video.src = getVideoURI('/media/2x2-green');
     30  assert_ratio(video, 2.5);
     31}, "contain:size aspect ratio");
     32
    2033// Create and append a new video and immediately check the ratio.
    2134// This is not racy because the spec requires the user agent to queue a task:
    2235// https://html.spec.whatwg.org/multipage/media.html#concept-media-load-algorithm
    2336t.step(function() {
    24   var video = document.createElement("video");
     37  video = document.createElement("video");
    2538  video.setAttribute("width", "250");
    2639  video.setAttribute("height", "100");
     
    3649    assert_ratio(video, 1);
    3750  });
    38 });
     51}, "aspect ratio for regular video");
     52
     53test_computed_style("10", "20", "auto 10 / 20");
     54test_computed_style("0.5", "1.5", "auto 0.5 / 1.5");
     55
     56// These are invalid per spec, but see
     57// https://github.com/whatwg/html/issues/4961
     58test_computed_style("0", "1", ["auto", "auto 0 / 1"]);
     59test_computed_style("1", "0", ["auto", "auto 1 / 0"]);
     60test_computed_style("0", "0", ["auto", "auto 0 / 0"]);
     61
     62test_computed_style(null, null, "auto");
     63test_computed_style("10", null, "auto");
     64test_computed_style(null, "20", "auto");
     65test_computed_style("xx", "20", "auto");
     66test_computed_style("10%", "20", "auto");
     67
    3968</script>
  • trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/w3c-import.log

    r264117 r276296  
    3939/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/input-type-change-from-image-1-expected.html
    4040/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/input-type-change-from-image-1.html
     41/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/number-placeholder-right-aligned-expected.html
     42/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/number-placeholder-right-aligned.html
    4143/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/object_border_perc-expected.xhtml
    4244/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/object_border_perc.xhtml
    4345/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/object_border_pixel-expected.xhtml
    4446/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/object_border_pixel.xhtml
     47/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/picture-aspect-ratio.html
    4548/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/video-aspect-ratio.html
Note: See TracChangeset for help on using the changeset viewer.