diff options
author | Moonchild <moonchild@palemoon.org> | 2020-08-31 05:54:39 +0000 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2020-08-31 05:54:39 +0000 |
commit | a6f632714fcb1be3dd00b0fc76fbf6bfc693155b (patch) | |
tree | b04c82f9af4a0d288a6d4350d774ad8fe6dac903 /testing/web-platform/tests | |
parent | 2ed0607c747b21cadaf7401d4ba706097578e74d (diff) | |
parent | b28effe2ea93e43e362f7ce263d23b55adcb6da7 (diff) | |
download | UXP-a6f632714fcb1be3dd00b0fc76fbf6bfc693155b.tar UXP-a6f632714fcb1be3dd00b0fc76fbf6bfc693155b.tar.gz UXP-a6f632714fcb1be3dd00b0fc76fbf6bfc693155b.tar.lz UXP-a6f632714fcb1be3dd00b0fc76fbf6bfc693155b.tar.xz UXP-a6f632714fcb1be3dd00b0fc76fbf6bfc693155b.zip |
Merge branch 'redwood' into releaseRELBASE_20200831
Diffstat (limited to 'testing/web-platform/tests')
4 files changed, 176 insertions, 0 deletions
diff --git a/testing/web-platform/tests/css-backgrounds/background-size-cover-003-ref.html b/testing/web-platform/tests/css-backgrounds/background-size-cover-003-ref.html new file mode 100644 index 000000000..bd965cfec --- /dev/null +++ b/testing/web-platform/tests/css-backgrounds/background-size-cover-003-ref.html @@ -0,0 +1,21 @@ +<!doctype html> +<title>CSS Test Reference</title> +<style> +body { margin: 0 } +.first { + width: 100px; + height: 50px; + background: lime; +} +.space { + height: 50px; +} +.second { + width: 100px; + height: 100px; + background: lime; +} +</style> +<div class="first"></div> +<div class="space"></div> +<div class="second"></div> diff --git a/testing/web-platform/tests/css-backgrounds/background-size-cover-003.html b/testing/web-platform/tests/css-backgrounds/background-size-cover-003.html new file mode 100644 index 000000000..4d2b6b125 --- /dev/null +++ b/testing/web-platform/tests/css-backgrounds/background-size-cover-003.html @@ -0,0 +1,38 @@ +<!DOCTYPE html> +<title>CSS Test: background-size: cover with zero-sized background positioning area.</title> +<link rel="help" href="https://drafts.csswg.org/css-backgrounds/#valdef-background-size-cover"> +<link rel="help" href="https://github.com/w3c/csswg-drafts/issues/4049"> +<link rel="help" href=" https://bugzilla.mozilla.org/show_bug.cgi?id=1559094"> +<link rel="author" href="mailto:emilio@crisal.io" title="Emilio Cobos Álvarez"> +<link rel="author" href="https://mozilla.org" title="Mozilla"> +<link rel="match" href="background-size-cover-003-ref.html"> +<style> +body { margin: 0 } +div { + background-size: cover; + background-repeat: no-repeat; + background-position: top left; + background-origin: content-box; + background-image: url(/images/green-100x50.png); +} +#test1 { + height: 0; + width: 100px; + padding-bottom: 100px; +} + +#test2 { + height: 100px; + width: 0; + padding-right: 100px; +} +#test3 { + height: 0; + width: 0; + padding-right: 100px; + padding-bottom: 100px; +} +</style> +<div id="test1"></div> +<div id="test2"></div> +<div id="test3"></div> diff --git a/testing/web-platform/tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/img-aspect-ratio.html b/testing/web-platform/tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/img-aspect-ratio.html new file mode 100644 index 000000000..9ae87be9c --- /dev/null +++ b/testing/web-platform/tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/img-aspect-ratio.html @@ -0,0 +1,60 @@ +<!doctype html> +<title>Image width and height attributes are used to infer aspect-ratio</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<style> + img { + width: 100%; + max-width: 100px; + height: auto; + } +</style> +<img src="/images/green.png"> +<img src="/images/green.png" width=100 height=125> +<img src="" width=100 height=125> +<img src="error.png" width=100 height=125> +<img src="error.png"> +<script> +let t = async_test("Image width and height attributes are used to infer aspect-ratio"); +function assert_ratio(img, expected) { + let epsilon = 0.001; + assert_approx_equals(parseFloat(getComputedStyle(img).width, 10) / parseFloat(getComputedStyle(img).height, 10), expected, epsilon); +} +// 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() { + var img = new Image(); + img.width = 250; + img.height = 100; + img.src = "/images/blue.png"; + document.body.appendChild(img); + assert_ratio(img, 2.5); + + img = new Image(); + img.setAttribute("width", "0.8"); + img.setAttribute("height", "0.2"); + img.src = "/images/blue.png"; + document.body.appendChild(img); + // Decimals are apparently ignored? + assert_equals(getComputedStyle(img).height, "0px"); + + img = new Image(); + img.setAttribute("width", "50%"); + img.setAttribute("height", "25%"); + img.src = "/images/blue.png"; + document.body.appendChild(img); + // Percentages should be ignored. + assert_equals(getComputedStyle(img).height, "0px"); +}); + +onload = t.step_func_done(function() { + let images = document.querySelectorAll("img"); + assert_ratio(images[0], 2.0); // Loaded image's aspect ratio, at least by default, overrides width / height ratio. + assert_ratio(images[1], 2.0); // 2.0 is the original aspect ratio of green.png + assert_equals(getComputedStyle(images[2]).height, "0px"); // aspect-ratio doesn't override intrinsic size of images that don't have any src. + assert_equals(getComputedStyle(images[3]).height, "125px"); // what intrinsic size? + assert_equals(getComputedStyle(images[4]).height, "100px"); // what aspect ratio? + assert_ratio(images[5], 133/106); // The original aspect ratio of blue.png +}); +</script> diff --git a/testing/web-platform/tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/object_intrinsic_size_vertical.html b/testing/web-platform/tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/object_intrinsic_size_vertical.html new file mode 100644 index 000000000..0dca4c377 --- /dev/null +++ b/testing/web-platform/tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/object_intrinsic_size_vertical.html @@ -0,0 +1,57 @@ +<!doctype html>
+<title>Frame width and height attributes as they apply in a vertical writing mode</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<style>
+ #horiz
+ {
+ writing-mode: horizontal-tb;
+ display: inline-block;
+ }
+ #vert
+ {
+ writing-mode: vertical-rl;
+ display: inline-block;
+ }
+ object
+ {
+ border: 1px solid red;
+ margin: 5px;
+ }
+</style>
+<div id="horiz">
+<object data="/images/green.png" width=300></object>
+<object data="/images/green.png" height=50></object>
+</div>
+<div id="vert">
+<object data="/images/green.png" width=300></object>
+<object data="/images/green.png" height=50></object>
+</div>
+<script>
+let t = async_test("Frame width and height attributes as they apply in a vertical writing mode");
+function assert_dimensions(obj, expectedX, expectedY) {
+ assert_equals(getComputedStyle(obj).width, expectedX);
+ assert_equals(getComputedStyle(obj).height, expectedY);
+}
+t.step(function() {
+ var obj = document.createElement('object');
+ obj.width = 133;
+ obj.data = '/images/blue.png';
+ document.getElementById('horiz').appendChild(obj);
+
+ obj = document.createElement('object');
+ obj.width = 133;
+ obj.data = '/images/blue.png';
+ document.getElementById('vert').appendChild(obj);
+});
+
+onload = t.step_func_done(function() {
+ let objects = document.querySelectorAll("object");
+ assert_dimensions(objects[0], '300px', '150px');
+ assert_dimensions(objects[1], '100px', '50px');
+ assert_dimensions(objects[2], '133px', '106px');
+ assert_dimensions(objects[3], '300px', '150px');
+ assert_dimensions(objects[4], '100px', '50px');
+ assert_dimensions(objects[5], '133px', '106px');
+});
+</script>
|