Diff
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (278298 => 278299)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2021-06-01 08:01:43 UTC (rev 278298)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2021-06-01 08:42:48 UTC (rev 278299)
@@ -1,3 +1,20 @@
+2021-06-01 Cathie Chen <[email protected]>
+
+ Update tests of mapping width and height attributes to aspect-ratio from WPT
+ https://bugs.webkit.org/show_bug.cgi?id=226472
+
+ Reviewed by Rob Buis.
+
+ Base commit: https://github.com/web-platform-tests/wpt/commit/da6406b38dae07a8a69c384b72ddd89b48d5194a
+
+ * 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/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.html:
+
2021-05-31 Chris Dumez <[email protected]>
Unreviewed, rebaseline web-platform-tests/webaudio/the-audio-api/the-convolvernode-interface/active-processing.https.html after r278233.
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/canvas-aspect-ratio-expected.txt (278298 => 278299)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/canvas-aspect-ratio-expected.txt 2021-06-01 08:01:43 UTC (rev 278298)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/canvas-aspect-ratio-expected.txt 2021-06-01 08:42:48 UTC (rev 278299)
@@ -3,11 +3,11 @@
FAIL Canvas width and height attributes are used as the surface size with contain:size assert_approx_equals: expected 2.5 +/- 0.001 but got Infinity
PASS Canvas width and height attributes are used as the surface size
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"}
+FAIL Computed style test: canvas with {"width":"0","height":"1"} assert_equals: expected "auto 0 / 1" but got "auto"
+FAIL Computed style test: canvas with {"width":"1","height":"0"} assert_equals: expected "auto 1 / 0" but got "auto"
+FAIL Computed style test: canvas with {"width":"0","height":"0"} assert_equals: expected "auto 0 / 0" but got "auto"
+FAIL Computed style test: canvas with {"width":"0.5","height":"1.5"} assert_equals: expected "auto 0 / 1" but got "auto"
+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":null,"height":null}
PASS Computed style test: canvas with {"width":"10","height":null}
PASS Computed style test: canvas with {"width":null,"height":"20"}
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/canvas-aspect-ratio.html (278298 => 278299)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/canvas-aspect-ratio.html 2021-06-01 08:01:43 UTC (rev 278298)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/canvas-aspect-ratio.html 2021-06-01 08:42:48 UTC (rev 278299)
@@ -38,18 +38,11 @@
}, "Canvas width and height attributes are used as the surface size");
test_computed_style("10", "20", "auto 10 / 20");
-// These are invalid per spec, but see
-// https://github.com/whatwg/html/issues/4961
-test_computed_style("0", "1", ["auto", "auto 0 / 1"]);
-test_computed_style("1", "0", ["auto", "auto 1 / 0"]);
-test_computed_style("0", "0", ["auto", "auto 0 / 0"]);
-
-// See https://github.com/whatwg/html/issues/4961:
-// https://html.spec.whatwg.org/#attr-canvas-width
-// https://html.spec.whatwg.org/#rules-for-parsing-non-negative-integers
-test_computed_style("0.5", "1.5", ["auto 0 / 1", "auto 0.5 / 1.5"]);
-test_computed_style("10%", "20", ["auto", "auto 10 / 20"]);
-
+test_computed_style("0", "1", "auto 0 / 1");
+test_computed_style("1", "0", "auto 1 / 0");
+test_computed_style("0", "0", "auto 0 / 0");
+test_computed_style("0.5", "1.5", "auto 0 / 1");
+test_computed_style("10%", "20", "auto 10 / 20");
test_computed_style(null, null, "auto");
test_computed_style("10", null, "auto");
test_computed_style(null, "20", "auto");
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/img-aspect-ratio-expected.txt (278298 => 278299)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/img-aspect-ratio-expected.txt 2021-06-01 08:01:43 UTC (rev 278298)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/img-aspect-ratio-expected.txt 2021-06-01 08:42:48 UTC (rev 278299)
@@ -4,6 +4,7 @@
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 Create, append and test immediately: <img> with invalid trailing attributes width=50pp height=25xx assert_approx_equals: expected 2 +/- 0.001 but got Infinity
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"}
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/img-aspect-ratio.html (278298 => 278299)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/img-aspect-ratio.html 2021-06-01 08:01:43 UTC (rev 278298)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/img-aspect-ratio.html 2021-06-01 08:42:48 UTC (rev 278299)
@@ -63,16 +63,20 @@
assert_equals(getComputedStyle(img).height, "0px");
}, "Create, append and test immediately: <img> with attributes width=50% height=25%");
+test(function () {
+ img = new Image();
+ img.setAttribute("width", "50pp");
+ img.setAttribute("height", "25xx");
+ img.src = ""
+ document.body.appendChild(img);
+ assert_ratio(img, 2);
+}, "Create, append and test immediately: <img> with invalid trailing attributes width=50pp height=25xx");
+
test_computed_style("10", "20", "auto 10 / 20");
-// These are invalid per spec, but see
-// https://github.com/whatwg/html/issues/4961
test_computed_style("0", "1", "auto 0 / 1");
test_computed_style("1", "0", "auto 1 / 0");
test_computed_style("0", "0", "auto 0 / 0");
-// https://html.spec.whatwg.org/#map-to-the-aspect-ratio-property
-// https://html.spec.whatwg.org/#rules-for-parsing-non-zero-dimension-values
test_computed_style("0.5", "1.5", "auto 0.5 / 1.5");
-
test_computed_style(null, null, "auto");
test_computed_style("10", null, "auto");
test_computed_style(null, "20", "auto");
@@ -100,6 +104,8 @@
test(function () {
assert_not_equals(images[5].offsetHeight, 500, "Images with alt text should be inline and ignore the aspect ratio");
+ // Though aspect-ratio is ignored, its value does not change.
+ assert_equals(getComputedStyle(images[5]).aspectRatio, "auto 100 / 500");
}, "Loaded images test: Error image with width, height and alt attributes");
test(function () {
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/resources/aspect-ratio.js (278298 => 278299)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/resources/aspect-ratio.js 2021-06-01 08:01:43 UTC (rev 278298)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/resources/aspect-ratio.js 2021-06-01 08:42:48 UTC (rev 278299)
@@ -8,11 +8,7 @@
}
document.body.appendChild(elem);
let aspectRatio = getComputedStyle(elem).aspectRatio;
- if (Array.isArray(expected)) {
- assert_in_array(aspectRatio, expected);
- } else {
- assert_equals(aspectRatio, expected);
- }
+ assert_equals(aspectRatio, expected);
elem.remove();
}, `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.html (278298 => 278299)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/video-aspect-ratio.html 2021-06-01 08:01:43 UTC (rev 278298)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/video-aspect-ratio.html 2021-06-01 08:42:48 UTC (rev 278299)
@@ -52,13 +52,9 @@
test_computed_style("10", "20", "auto 10 / 20");
test_computed_style("0.5", "1.5", "auto 0.5 / 1.5");
-
-// These are invalid per spec, but see
-// https://github.com/whatwg/html/issues/4961
-test_computed_style("0", "1", ["auto", "auto 0 / 1"]);
-test_computed_style("1", "0", ["auto", "auto 1 / 0"]);
-test_computed_style("0", "0", ["auto", "auto 0 / 0"]);
-
+test_computed_style("0", "1", "auto 0 / 1");
+test_computed_style("1", "0", "auto 1 / 0");
+test_computed_style("0", "0", "auto 0 / 0");
test_computed_style(null, null, "auto");
test_computed_style("10", null, "auto");
test_computed_style(null, "20", "auto");