зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 2 changesets (bug 1175585) for test_wheel_transactions.html failures CLOSED TREE
Backed out changeset 5b56c3d0e379 (bug 1175585) Backed out changeset 89b4c0b06ff3 (bug 1175585) --HG-- extra : rebase_source : f25dd69111041d0d23e09c6a3bd70926c953fffd
This commit is contained in:
Родитель
a91d171b6e
Коммит
d0c7c545ac
|
@ -124,23 +124,3 @@ function synthesizeNativeMouseMoveAndWaitForMoveEvent(aElement, aX, aY, aCallbac
|
|||
});
|
||||
return synthesizeNativeMouseMove(aElement, aX, aY);
|
||||
}
|
||||
|
||||
// Scroll the mouse wheel (in the vertical direction) by |aWheelDelta| over |aElement|,
|
||||
// calling |aCallback| when the first resulting scroll event is received.
|
||||
function scrollWheelOver(aElement, aWheelDelta, aCallback) {
|
||||
var scale = window.devicePixelRatio;
|
||||
var rect = aElement.getBoundingClientRect();
|
||||
var x = (rect.left + 10) * scale;
|
||||
var y = (rect.top + 10) * scale;
|
||||
// Move the mouse to the desired wheel location.
|
||||
// Not doing so can result in the wheel events from two consecutive
|
||||
// scrollWheelOver() calls on different elements being incorrectly considered
|
||||
// as part of the same wheel transaction.
|
||||
// We also wait for the mouse move event to be processed before sending the
|
||||
// wheel event, otherwise there is a chance they might get reordered, and
|
||||
// we have the transaction problem again.
|
||||
synthesizeNativeMouseMoveAndWaitForMoveEvent(aElement, x, y, function() {
|
||||
synthesizeNativeWheelAndWaitForScrollEvent(aElement, x, y, 0, aWheelDelta, aCallback);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -14,8 +14,6 @@ skip-if = toolkit != 'gonk' # bug 991198
|
|||
skip-if = toolkit != 'gonk' # bug 991198
|
||||
[test_wheel_scroll.html]
|
||||
skip-if = (os == 'android') || (os == 'b2g') || (buildapp == 'mulet') # wheel events not supported on mobile; see bug 1164274 for mulet
|
||||
[test_wheel_transactions.html]
|
||||
skip-if = (os == 'android') || (os == 'b2g') || (buildapp == 'mulet') # wheel events not supported on mobile; see bug 1164274 for mulet
|
||||
[test_bug1151667.html]
|
||||
skip-if = (os == 'android') || (os == 'b2g') # wheel events not supported on mobile
|
||||
[test_layerization.html]
|
||||
|
|
|
@ -50,8 +50,22 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1173580
|
|||
<pre id="test">
|
||||
<script type="application/javascript;version=1.7">
|
||||
|
||||
function scrollWheel(element) {
|
||||
scrollWheelOver(element, -10, driveTest);
|
||||
// Scroll the mouse wheel over |element|.
|
||||
function scrollWheelOver(element) {
|
||||
var scale = window.devicePixelRatio;
|
||||
var rect = element.getBoundingClientRect();
|
||||
var x = (rect.left + 10) * scale;
|
||||
var y = (rect.top + 10) * scale;
|
||||
// Move the mouse to the desired wheel location.
|
||||
// Not doing so can result in the wheel events from two consecutive
|
||||
// scrollWheelOver() calls on different elements being incorrectly considered
|
||||
// as part of the same wheel transaction.
|
||||
// We also wait for the mouse move event to be processed before sending the
|
||||
// wheel event, otherwise there is a chance they might get reordered, and
|
||||
// we have the transaction problem again.
|
||||
synthesizeNativeMouseMoveAndWaitForMoveEvent(element, x, y, function() {
|
||||
synthesizeNativeWheelAndWaitForScrollEvent(element, x, y, 0, -10, driveTest);
|
||||
});
|
||||
}
|
||||
|
||||
var gTestContinuation = null;
|
||||
|
@ -90,12 +104,12 @@ function* runTest() {
|
|||
ok(!isLayerized('inner4'), "initially 'inner4' should not be layerized");
|
||||
|
||||
// Scrolling over outer1 should layerize outer1, but not inner1.
|
||||
yield scrollWheel(document.getElementById('outer1'));
|
||||
yield scrollWheelOver(document.getElementById('outer1'));
|
||||
ok(isLayerized('outer1'), "scrolling 'outer1' should cause it to be layerized");
|
||||
ok(!isLayerized('inner1'), "scrolling 'outer1' should not cause 'inner1' to be layerized");
|
||||
|
||||
// Scrolling over inner2 should layerize both outer2 and inner2.
|
||||
yield scrollWheel(document.getElementById('inner2'));
|
||||
yield scrollWheelOver(document.getElementById('inner2'));
|
||||
ok(isLayerized('inner2'), "scrolling 'inner2' should cause it to be layerized");
|
||||
ok(isLayerized('outer2'), "scrolling 'inner2' should also cause 'outer2' to be layerized");
|
||||
|
||||
|
@ -103,12 +117,12 @@ function* runTest() {
|
|||
// but with an iframe as the outer scrollable frame.
|
||||
|
||||
// Scrolling over outer3 should layerize outer3, but not inner3.
|
||||
yield scrollWheel(document.getElementById('outer3').contentDocument.documentElement);
|
||||
yield scrollWheelOver(document.getElementById('outer3').contentDocument.documentElement);
|
||||
ok(isLayerized('outer3'), "scrolling 'outer3' should cause it to be layerized");
|
||||
ok(!isLayerized('inner3'), "scrolling 'outer3' should not cause 'inner3' to be layerized");
|
||||
|
||||
// Scrolling over outer4 should layerize both outer4 and inner4.
|
||||
yield scrollWheel(document.getElementById('outer4').contentDocument.getElementById('inner4'));
|
||||
yield scrollWheelOver(document.getElementById('outer4').contentDocument.getElementById('inner4'));
|
||||
ok(isLayerized('inner4'), "scrolling 'inner4' should cause it to be layerized");
|
||||
ok(isLayerized('outer4'), "scrolling 'inner4' should also cause 'outer4' to be layerized");
|
||||
}
|
||||
|
|
|
@ -1,131 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=1175585
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 1175585</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
||||
<script type="application/javascript" src="apz_test_native_event_utils.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
<style>
|
||||
#outer-frame {
|
||||
height: 500px;
|
||||
overflow: scroll;
|
||||
background: repeating-linear-gradient(#CCC, #CCC 100px, #BBB 100px, #BBB 200px);
|
||||
}
|
||||
#inner-frame {
|
||||
margin-top: 25%;
|
||||
height: 200%;
|
||||
width: 75%;
|
||||
overflow: scroll;
|
||||
}
|
||||
#inner-content {
|
||||
height: 200%;
|
||||
width: 200%;
|
||||
background: repeating-linear-gradient(#EEE, #EEE 100px, #DDD 100px, #DDD 200px);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1175585">APZ wheel transactions test</a>
|
||||
<p id="display"></p>
|
||||
<div id="outer-frame">
|
||||
<div id="inner-frame">
|
||||
<div id="inner-content"></div>
|
||||
</div>
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript;version=1.7">
|
||||
|
||||
function* runTest() {
|
||||
var outer = document.getElementById('outer-frame');
|
||||
var inner = document.getElementById('inner-frame');
|
||||
var innerContent = document.getElementById('inner-content');
|
||||
|
||||
// Register a wheel event listener that records the target of
|
||||
// the last wheel event, so that we can make assertions about it.
|
||||
var lastWheelTarget;
|
||||
var wheelTargetRecorder = function(e) { lastWheelTarget = e.target; };
|
||||
window.addEventListener("wheel", wheelTargetRecorder);
|
||||
|
||||
// Scroll |outer| to the bottom.
|
||||
while (outer.scrollTop < outer.scrollTopMax) {
|
||||
yield scrollWheelOver(outer, -10, driveTest);
|
||||
}
|
||||
|
||||
// Verify that this has brought |inner| under the wheel.
|
||||
is(lastWheelTarget, innerContent, "'inner-content' should have been brought under the wheel");
|
||||
window.removeEventListener("wheel", wheelTargetRecorder);
|
||||
|
||||
// Immediately after, scroll it back up a bit.
|
||||
yield scrollWheelOver(outer, 10, driveTest);
|
||||
|
||||
// Check that it was |outer| that scrolled back, and |inner| didn't
|
||||
// scroll at all, as all the above scrolls should be in the same
|
||||
// transaction.
|
||||
ok(outer.scrollTop < outer.scrollTopMax, "'outer' should have scrolled back a bit");
|
||||
is(inner.scrollTop, 0, "'inner' should not have scrolled");
|
||||
|
||||
// The next part of the test is related to the transaction timeout.
|
||||
// Turn it down a bit so waiting for the timeout to elapse doesn't
|
||||
// slow down the test harness too much.
|
||||
var timeout = 5;
|
||||
yield SpecialPowers.pushPrefEnv({"set": [["mousewheel.transaction.timeout", timeout]]}, driveTest);
|
||||
SimpleTest.requestFlakyTimeout("we are testing code that measures actual elapsed time between two events");
|
||||
|
||||
// Scroll up a bit more. It's still |outer| scrolling because
|
||||
// |inner| is still scrolled all the way to the top.
|
||||
yield scrollWheelOver(outer, 10, driveTest);
|
||||
|
||||
// Wait for the transaction timeout to elapse.
|
||||
yield window.setTimeout(driveTest, timeout);
|
||||
|
||||
// Now scroll down. The transaction having timed out, the event
|
||||
// should pick up a new target, and that should be |inner|.
|
||||
yield scrollWheelOver(outer, -10, driveTest);
|
||||
ok(inner.scrollTop > 0, "'inner' should have been scrolled");
|
||||
|
||||
// Finally, test scroll handoff after a timeout.
|
||||
|
||||
// Continue scrolling |inner| down to the bottom.
|
||||
while (inner.scrollTop < inner.scrollTopMax) {
|
||||
yield scrollWheelOver(outer, -10, driveTest);
|
||||
}
|
||||
|
||||
// Wait for the transaction timeout to elapse.
|
||||
yield window.setTimeout(driveTest, timeout);
|
||||
|
||||
// Continued downward scrolling should scroll |outer| to the bottom.
|
||||
while (outer.scrollTop < outer.scrollTopMax) {
|
||||
yield scrollWheelOver(outer, -10, driveTest);
|
||||
}
|
||||
}
|
||||
|
||||
var gTestContinuation = null;
|
||||
function driveTest() {
|
||||
if (!gTestContinuation) {
|
||||
gTestContinuation = runTest();
|
||||
}
|
||||
var ret = gTestContinuation.next();
|
||||
if (ret.done) {
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}
|
||||
|
||||
function startTest() {
|
||||
// Disable smooth scrolling because it makes the test flaky (we don't have a good
|
||||
// way of detecting when the scrolling is finished).
|
||||
SpecialPowers.pushPrefEnv({"set": [["general.smoothScroll", false]]}, driveTest);
|
||||
}
|
||||
|
||||
SimpleTest.testInChaosMode();
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SimpleTest.waitForFocus(startTest, window);
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
|
||||
</body>
|
||||
</html>
|
Загрузка…
Ссылка в новой задаче