diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:47:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:47:29 +0000 |
commit | 0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d (patch) | |
tree | a31f07c9bcca9d56ce61e9a1ffd30ef350d513aa /layout/base/tests/bug977003_inner_6.html | |
parent | Initial commit. (diff) | |
download | firefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.tar.xz firefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.zip |
Adding upstream version 115.8.0esr.upstream/115.8.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'layout/base/tests/bug977003_inner_6.html')
-rw-r--r-- | layout/base/tests/bug977003_inner_6.html | 105 |
1 files changed, 105 insertions, 0 deletions
diff --git a/layout/base/tests/bug977003_inner_6.html b/layout/base/tests/bug977003_inner_6.html new file mode 100644 index 0000000000..b4a05122a5 --- /dev/null +++ b/layout/base/tests/bug977003_inner_6.html @@ -0,0 +1,105 @@ +<!DOCTYPE HTML> +<html> +<!-- +https://bugzilla.mozilla.org/show_bug.cgi?id=977003 +https://bugzilla.mozilla.org/show_bug.cgi?id=1073563 +--> +<head> + <meta charset="utf-8"> + <title>Test for Bugs 977003, 1073563</title> + <meta name="author" content="Maksim Lebedev" /> + <script src="/tests/SimpleTest/SimpleTest.js"></script> + <script src="/tests/SimpleTest/EventUtils.js"></script> + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> + <style> + #target, #listener { background: yellow; } + </style> + <script type="application/javascript"> + var target = undefined; + var listener = undefined; + var test_target = false; + var test_move = false; + var test_over = false; + var test_listener = false; + var receive_lostpointercapture = false; + + function TargetDownHandler(event) { + logger("Target receive event: " + event.type); + logger("Send setPointerCapture to listener"); + listener.setPointerCapture(event.pointerId); + logger("set/release was executed"); + test_target = true; + } + function ListenerHandler(event) { + logger("Receive event on Listener: " + event.type); + if("gotpointercapture" == event.type) { + logger("Send releasePointerCapture from listener"); + listener.releasePointerCapture(event.pointerId); + } else if(event.type == "lostpointercapture") { + // Set/release pointer capture in the event listeners of got/lostpointercapture won't take effect immediately + parent.is(receive_lostpointercapture, false, "Part 6: listener should receive only one lostpointercapture"); + if (!receive_lostpointercapture) { + receive_lostpointercapture = true; + logger("Send setPointerCapture to listener"); + listener.setPointerCapture(event.pointerId); + } + } else if(event.type == "pointermove") { + test_move = true; + } else if(event.type == "pointerover") { + test_over = true; + } else { + test_listener = true; + } + } + function logger(message) { + console.log(message); + var log = document.getElementById('log'); + log.innerHTML = message + "<br>" + log.innerHTML; + } + + function prepareTest() { + SimpleTest.executeSoon(executeTest); + } + function executeTest() + { + logger("executeTest"); + target = document.getElementById("target"); + listener = document.getElementById("listener"); + target.addEventListener("pointerdown", TargetDownHandler); + listener.addEventListener("gotpointercapture", ListenerHandler); + listener.addEventListener("pointerdown", ListenerHandler); + listener.addEventListener("pointerover", ListenerHandler); + listener.addEventListener("pointermove", ListenerHandler); + listener.addEventListener("pointerup", ListenerHandler); + listener.addEventListener("pointerout", ListenerHandler); + listener.addEventListener("lostpointercapture", ListenerHandler); + var rect = target.getBoundingClientRect(); + synthesizeMouse(target, rect.width/2, rect.height/2, {type: "mousedown"}); + synthesizeMouse(target, rect.width/2, rect.height/2, {type: "mousemove"}); + synthesizeMouse(target, rect.width/2, rect.height/2, {type: "mouseup"}); + finishTest(); + } + function finishTest() { + parent.is(test_target, true, "Part 6: pointerdown event should be received by target"); + // PE level 2 defines that the pending pointer capture is processed when firing next pointer events. + // In this test case, pointer capture release is processed when firing pointermove + parent.is(test_move, true, "Part 6: gotpointercapture should be triggered by pointermove"); + parent.is(test_over, true, "Part 6: pointerover should be received when capturing pointer"); + parent.is(test_listener, false, "Part 6: no other pointerevents should be fired before gotpointercapture except pointerover"); + logger("finishTest"); + parent.finishTest(); + } + </script> +</head> +<body onload="prepareTest()"> + <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=977003">Mozilla Bug 977003 Test 6</a> + <br><a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1073563">Mozilla Bug 1073563</a> + <p id="display"></p> + <div id="content" style="display: none"> + </div> + <div id="listener">div id=listener</div> + <div id="target">div id=target</div> + <pre id="log"> + </pre> +</body> +</html> |