summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/cssom-view/image-x-y-zoom.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /testing/web-platform/tests/css/cssom-view/image-x-y-zoom.html
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/css/cssom-view/image-x-y-zoom.html')
-rw-r--r--testing/web-platform/tests/css/cssom-view/image-x-y-zoom.html66
1 files changed, 66 insertions, 0 deletions
diff --git a/testing/web-platform/tests/css/cssom-view/image-x-y-zoom.html b/testing/web-platform/tests/css/cssom-view/image-x-y-zoom.html
new file mode 100644
index 0000000000..4717dcbd9d
--- /dev/null
+++ b/testing/web-platform/tests/css/cssom-view/image-x-y-zoom.html
@@ -0,0 +1,66 @@
+<!DOCTYPE html>
+<title>x and y properties for image elements with css zoom</title>
+<link rel="author" title="Yotam Hacohen" href="mailto:yotha@chromium.org">
+<link rel="author" title="Google" href="http://www.google.com/">
+<link rel="help" href="https://drafts.csswg.org/cssom-view/#dom-element-scroll">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+ <head>
+ <style>
+ img {
+ display: block;
+ }
+ .container {
+ height: 100px;
+ width: 100px;
+ }
+
+ #x4_zoom_container {
+ zoom: 4;
+ }
+
+ </style>
+ </head>
+ <body>
+ <div class="container" id="no_zoom_container">
+ <img src="support/1x1-green.png" id="no_zoom_image_no_zoom_container">
+ <img src="support/1x1-navy.png" style="zoom: 2;" id="x2_zoom_image_no_zoom_container">
+ </div>
+
+ <div class="container" id="x4_zoom_container">
+ <img style="position: relative; top: 10px;" src="support/1x1-maroon.png" id="no_zoom_image_x4_zoom_container">
+ <img src="support/1x1-navy.png" style="zoom: 2;" id="x2_zoom_image_x4_zoom_container">
+ <img src="support/1x1-red.png" style="transform: scale(5);" id="transformed_and_zoomed_image">
+ </div>
+ <script>
+ function compareXYCoordinatesToBoundingBox(object, object_name){
+ assert_equals(object.x, object.getBoundingClientRect().left, object_name + ' x');
+ assert_equals(object.y, object.getBoundingClientRect().top, object_name + ' y');
+ }
+
+ window.onload = function() {
+ test(function() {
+ // Values should be same as values of getBoundingClientRect
+ compareXYCoordinatesToBoundingBox(no_zoom_image_no_zoom_container, 'no-zoom image in a no-zoom container');
+ compareXYCoordinatesToBoundingBox(x2_zoom_image_no_zoom_container, 'image with css zoom in a no zoom container');
+ compareXYCoordinatesToBoundingBox(no_zoom_image_x4_zoom_container, 'no-zoom image in a container with css zoom');
+ compareXYCoordinatesToBoundingBox(x2_zoom_image_x4_zoom_container, 'both image and container have css zoom');
+ });
+ test(function() {
+ // Values should be in the root coordinate system, and affected by zoom
+ assert_equals(no_zoom_image_no_zoom_container.x, 8, 'no zoom image no zoom container x');
+ assert_equals(no_zoom_image_no_zoom_container.y, 8, 'no zoom image no zoom container y');
+ assert_equals(x2_zoom_image_no_zoom_container.x, 8, 'x2 zoom image no zoom container x');
+ assert_equals(x2_zoom_image_no_zoom_container.y, 9, 'x2 zoom image no zoom container y');
+ assert_equals(no_zoom_image_x4_zoom_container.x, 8, 'no zoom image x4 zoom container x');
+ // This element also has a position-top, which is affected by zoom
+ assert_equals(no_zoom_image_x4_zoom_container.y, 148, 'no zoom image x4 zoom container y');
+ assert_equals(x2_zoom_image_x4_zoom_container.x, 8, 'x2 zoom image x4 zoom container x');
+ assert_equals(x2_zoom_image_x4_zoom_container.y, 112, 'x2 zoom image x4 zoom container y');
+ assert_equals(transformed_and_zoomed_image.x, 8, 'image with transform properties x');
+ assert_equals(transformed_and_zoomed_image.y, 120, 'image with transform properties y');
+ });
+ };
+
+ </script>
+ </body>