diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /testing/web-platform/tests/css/cssom-view/scroll-zoom.html | |
parent | Initial commit. (diff) | |
download | firefox-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/scroll-zoom.html')
-rw-r--r-- | testing/web-platform/tests/css/cssom-view/scroll-zoom.html | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/testing/web-platform/tests/css/cssom-view/scroll-zoom.html b/testing/web-platform/tests/css/cssom-view/scroll-zoom.html new file mode 100644 index 0000000000..85808887fd --- /dev/null +++ b/testing/web-platform/tests/css/cssom-view/scroll-zoom.html @@ -0,0 +1,86 @@ +<!DOCTYPE html> +<title>scroll properties for 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> + .container { + height: 100px; + width: 100px; + overflow: scroll; + } + .content { + height: 250px; + width: 250px; + background-image: linear-gradient(red, yellow); + } + #x4_zoom_container { + zoom: 4; + } + </style> + </head> + <body> + <div class="container" id="no_zoom_container"> + <div class="content"></div> + </div> + <div class="container" id="x4_zoom_container"> + <div class="content"></div> + </div> + <div class="container" id="container_with_zoomed_content"> + <div class="content" style="zoom: 2;"></div> + </div> + <div style="zoom: 2;"> + <div class="container" id="scroller_in_zoomed_element"> + <div class="content"></div> + </div> + </div> + <script> + setup(() => { + window.noZoom = document.getElementById("no_zoom_container"); + window.withZoom = document.getElementById("x4_zoom_container"); + window.scrollerWithZoomContent = document.getElementById("container_with_zoomed_content"); + window.scrollerInZoomedElement = document.getElementById("scroller_in_zoomed_element"); + }); + test(function() { + assert_true(!!noZoom, "no zoom target exists"); + assert_true(!!withZoom, "zoom target exists"); + }); + test(function() { + // We remove zoom effects for scroll height and scroll width so values + // should be same for elements with and without zoom + // However scroll values should be changed by zoom on content + assert_equals(noZoom.scrollHeight, withZoom.scrollHeight, 'scrollHeight'); + assert_equals(noZoom.scrollWidth, withZoom.scrollWidth, 'scrollWidth'); + assert_equals(noZoom.scrollHeight*2, scrollerWithZoomContent.scrollHeight, 'scroll height for zoomed content'); + assert_equals(noZoom.scrollWidth*2, scrollerWithZoomContent.scrollWidth, 'scroll width for zoomed content'); + assert_equals(noZoom.scrollHeight, scrollerInZoomedElement.scrollHeight, 'scroll height for scroller in zoomed element'); + assert_equals(noZoom.scrollWidth, scrollerInZoomedElement.scrollWidth, 'scroll width for scroller in zoomed element'); + }, `scroll{Width, Height}`); + + test(function() { + assert_equals(noZoom.scrollTop, 0, 'scrollTop should be 0'); + assert_equals(noZoom.scrollLeft, 0, 'scrollLeft should be 0'); + + assert_equals(noZoom.scrollTop, withZoom.scrollTop, 'scrollTop'); + assert_equals(noZoom.scrollLeft, withZoom.scrollLeft, 'scrollLeft'); + + noZoom.scrollTo(noZoom.scrollWidth / 2, noZoom.scrollHeight / 2); + withZoom.scrollTo(withZoom.scrollWidth / 2, withZoom.scrollHeight / 2); + + assert_not_equals(noZoom.scrollTop, 0, 'scrollTop should not be 0'); + assert_not_equals(noZoom.scrollLeft, 0, 'scrollLeft should not be 0'); + + assert_equals(noZoom.scrollTop, withZoom.scrollTop, 'scrollTop after scrollTo'); + assert_equals(noZoom.scrollLeft, withZoom.scrollLeft, 'scrollLeft after scrollTo'); + + noZoom.scrollBy(2, 2); + withZoom.scrollBy(2, 2); + + assert_equals(noZoom.scrollTop, withZoom.scrollTop, 'scrollTop after scrollBy'); + assert_equals(noZoom.scrollLeft, withZoom.scrollLeft, 'scrollLeft after scrollBy'); + }, `scroll{Top, Left}`); + </script> + </body> |