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 /layout/generic/test/test_bug784410.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 'layout/generic/test/test_bug784410.html')
-rw-r--r-- | layout/generic/test/test_bug784410.html | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/layout/generic/test/test_bug784410.html b/layout/generic/test/test_bug784410.html new file mode 100644 index 0000000000..29918b1cc1 --- /dev/null +++ b/layout/generic/test/test_bug784410.html @@ -0,0 +1,86 @@ +<!DOCTYPE HTML> +<html> +<head> + <title>Test bug 784410</title> + <script src="/tests/SimpleTest/SimpleTest.js"></script> + <script src="/tests/SimpleTest/EventUtils.js"></script> + <script src="/tests/SimpleTest/paint_listener.js"></script> + <script src="/tests/gfx/layers/apz/test/mochitest/apz_test_utils.js"></script> + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> +</head> +<body> +<p id="display"></p> +<div id="outer" style="overflow:auto; height:200px; border:2px dotted black; transform: translateY(1px)" onscroll="doneScroll()"> + <div id="d" style="overflow:auto; height:102px;" onscroll="doneScroll()"> + <div id="inner" style="height:100.1px; border:1px solid black; background:yellow;">Hello</div> + </div> + <div style="height:500px;"></div> +</div> +<pre id="test"> +<script class="testbody" type="text/javascript"> +var sel = window.getSelection(); +var outer = document.getElementById("outer"); +var d = document.getElementById("d"); +var inner = document.getElementById("inner"); +var smoothScrollPref = "general.smoothScroll"; + +function innerScrollOffset() { + return inner.getBoundingClientRect().top - d.getBoundingClientRect().top; +} +var innerStartScrollOffset = innerScrollOffset(); + +var step = 0; +var wheelAndPaintDone = false; +async function doneScroll() { + ++step; + switch (step) { + case 1: + is(innerScrollOffset(), innerStartScrollOffset, "Inner element should not have scrolled down"); + ok(outer.scrollTop > 0, "Outer element should have scrolled down"); + + outer.scrollTop = 0; + break; + case 2: + // wait until APZ is ready to handle the wheel event, then send it + await promiseApzFlushedRepaints(); + // Wait for paints to flush, so APZ is notified of the new scroll offset. + sendWheelAndPaint(inner, 4, 4, + { deltaMode: WheelEvent.DOM_DELTA_LINE, deltaY: 1 }, + function() { + wheelAndPaintDone = true; + doneTest(); + }); + break; + case 3: + is(innerScrollOffset(), innerStartScrollOffset, "Inner element should not have scrolled down"); + ok(outer.scrollTop > 0, "Outer element should have scrolled down"); + + doneTest(); + break; + } +} + +function doneTest() { + // wait until wheelAndPaintDone has invoked its callback before we end the + // test, otherwise we might get calls to advanceTimeAndRefresh after we + // restore normal refresh, and that will screw up the next test. + if (wheelAndPaintDone && step == 3) { + SpecialPowers.DOMWindowUtils.restoreNormalRefresh(); + SimpleTest.finish(); + } +} + +function test() { + sel.collapse(inner.firstChild, 2); + synthesizeKey("KEY_PageDown"); +} + +SimpleTest.waitForExplicitFinish(); +SimpleTest.waitForFocus(function() { + SpecialPowers.pushPrefEnv({"set":[[smoothScrollPref, false], + ["test.events.async.enabled", true]]}, test); +}); +</script> +</pre> +</body> +</html> |