Files
firefox/testing/web-platform/tests/css/cssom-view/scrollIntoView-shadow.html
Kartikaya Gupta e1becf7ff3 Bug 1648796 - Mark a handful of tests with user-scalable=no. r=hiro
On Android, if user-scalable=no is not set, Gecko uses the "minimum scale size"
as the scrollport size, to allow for the user zooming out all the way to the
minimum allowed scale. This has a number of effects, such as dropping the
layout scroll range to zero for the root scrollframe. This can causes a
number of WPT tests to fail; they currently pass only because the minimum
scale size changes take effect after the test is already done. However,
moving the minimum scale size changes to happen earlier causes these tests
to fail. It's better to modify the tests to disable this behaviour, so that the
assumptions in the test are not invalidated.

Differential Revision: https://phabricator.services.mozilla.com/D81355
2020-06-26 22:22:49 +00:00

35 lines
1.3 KiB
HTML

<!DOCTYPE HTML>
<meta name="viewport" content="user-scalable=no">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<title>Check End Position of scrollIntoView of shadow elements</title>
<div id="container">
<div id="space1" style="height: 2000px; width: 2000px;background-color: yellow">
</div>
<div id="shadow"></div>
<div id="space2" style="height: 2000px; width: 2000px;background-color: blue">
</div>
</div>
<script>
add_completion_callback(() => document.getElementById("container").remove());
test(t => {
var shadow = document.getElementById("shadow");
var shadowRoot = shadow.attachShadow({ mode: "open" });
var shadowDiv = document.createElement("div");
shadowDiv.style.height = "200px";
shadowDiv.style.width = "200px";
shadowDiv.style.backgroundColor = "green";
shadowRoot.appendChild(shadowDiv);
window.scrollTo(0, 0);
var expected_x = shadowDiv.offsetLeft;
var expected_y = shadowDiv.offsetTop;
assert_not_equals(window.scrollX, expected_x);
assert_not_equals(window.scrollY, expected_y);
shadowDiv.scrollIntoView({block: "start", inline: "start"});
assert_approx_equals(window.scrollX, expected_x, 1);
assert_approx_equals(window.scrollY, expected_y, 1);
}, "scrollIntoView should behave correctly if applies to shadow dom elements");
</script>