Backed out changeset c608c6fd9a9a (bug 1400143) for failing mochitest dom/events/test/pointerevents/pointerlock/test_pointerevent_pointerlock_supercedes_capture-manual.html on Windows 7 without e10s. r=backout

This commit is contained in:
Sebastian Hengst 2017-10-08 11:53:23 +02:00
parent 194330515b
commit e7f32cc32f
6 changed files with 5 additions and 177 deletions

View File

@ -4276,8 +4276,7 @@ EventStateManager::GeneratePointerEnterExit(EventMessage aMessage,
/* static */ void /* static */ void
EventStateManager::UpdateLastRefPointOfMouseEvent(WidgetMouseEvent* aMouseEvent) EventStateManager::UpdateLastRefPointOfMouseEvent(WidgetMouseEvent* aMouseEvent)
{ {
if (aMouseEvent->mMessage != eMouseMove && if (aMouseEvent->mMessage != eMouseMove) {
aMouseEvent->mMessage != ePointerMove) {
return; return;
} }
@ -4310,15 +4309,10 @@ EventStateManager::ResetPointerToWindowCenterWhilePointerLocked(
WidgetMouseEvent* aMouseEvent) WidgetMouseEvent* aMouseEvent)
{ {
MOZ_ASSERT(sIsPointerLocked); MOZ_ASSERT(sIsPointerLocked);
if ((aMouseEvent->mMessage != eMouseMove && if (aMouseEvent->mMessage != eMouseMove || !aMouseEvent->mWidget) {
aMouseEvent->mMessage != ePointerMove) || !aMouseEvent->mWidget) {
return; return;
} }
// We generate pointermove from mousemove event, so only synthesize native
// mouse move and update sSynthCenteringPoint by mousemove event.
bool updateSynthCenteringPoint = aMouseEvent->mMessage == eMouseMove;
// The pointer is locked. If the pointer is not located at the center of // The pointer is locked. If the pointer is not located at the center of
// the window, dispatch a synthetic mousemove to return the pointer there. // the window, dispatch a synthetic mousemove to return the pointer there.
// Doing this between "real" pointer moves gives the impression that the // Doing this between "real" pointer moves gives the impression that the
@ -4328,7 +4322,7 @@ EventStateManager::ResetPointerToWindowCenterWhilePointerLocked(
LayoutDeviceIntPoint center = LayoutDeviceIntPoint center =
GetWindowClientRectCenter(aMouseEvent->mWidget); GetWindowClientRectCenter(aMouseEvent->mWidget);
if (aMouseEvent->mRefPoint != center && updateSynthCenteringPoint) { if (aMouseEvent->mRefPoint != center) {
// Mouse move doesn't finish at the center of the window. Dispatch a // Mouse move doesn't finish at the center of the window. Dispatch a
// synthetic native mouse event to move the pointer back to the center // synthetic native mouse event to move the pointer back to the center
// of the window, to faciliate more movement. But first, record that // of the window, to faciliate more movement. But first, record that
@ -4343,9 +4337,7 @@ EventStateManager::ResetPointerToWindowCenterWhilePointerLocked(
aMouseEvent->StopPropagation(); aMouseEvent->StopPropagation();
// Clear sSynthCenteringPoint so we don't cancel other events // Clear sSynthCenteringPoint so we don't cancel other events
// targeted at the center. // targeted at the center.
if (updateSynthCenteringPoint) { sSynthCenteringPoint = kInvalidRefPoint;
sSynthCenteringPoint = kInvalidRefPoint;
}
} }
} }

View File

@ -124,7 +124,7 @@ UIEvent::GetMovementPoint()
} }
if (!mEvent || !mEvent->AsGUIEvent()->mWidget || if (!mEvent || !mEvent->AsGUIEvent()->mWidget ||
(mEvent->mMessage != eMouseMove && mEvent->mMessage != ePointerMove)) { (mEvent->mMessage != eMouseMove)) {
// Pointer Lock spec defines that movementX/Y must be zero for all mouse // Pointer Lock spec defines that movementX/Y must be zero for all mouse
// events except mousemove. // events except mousemove.
return nsIntPoint(0, 0); return nsIntPoint(0, 0);

View File

@ -6,10 +6,6 @@ support-files =
../pointerevent_styles.css ../pointerevent_styles.css
../pointerevent_support.js ../pointerevent_support.js
[test_pointerevent_movementxy-manual.html]
support-files =
pointerevent_movementxy-manual.html
./resources/pointerevent_movementxy-iframe.html
[test_pointerevent_pointerlock_after_pointercapture-manual.html] [test_pointerevent_pointerlock_after_pointercapture-manual.html]
support-files = pointerevent_pointerlock_after_pointercapture-manual.html support-files = pointerevent_pointerlock_after_pointercapture-manual.html
disabled = disabled # We don't allow pointer lock in mousemove handlers. disabled = disabled # We don't allow pointer lock in mousemove handlers.

View File

@ -1,99 +0,0 @@
<!doctype html>
<html>
<head>
<title>Pointer Events properties tests</title>
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" type="text/css" href="../pointerevent_styles.css">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<!-- Additional helper script for common checks across event types -->
<script type="text/javascript" src="../pointerevent_support.js"></script>
<style>
#testContainer {
touch-action: none;
user-select: none;
position: relative;
}
#box1 {
top: 30px;
left: 50px;
background: black;
}
#box2 {
top: 70px;
left: 250px;
background: red;
}
#innerFrame {
top: 10px;
left: 100px;
}
#square2 {
visibility: block;
}
</style>
<script>
var expectedPointerId = NaN;
var startSummation = false;
var lastScreenX = 0;
var lastScreenY = 0;
function resetTestState() {
startSummation = false;
lastScreenX = 0;
lastScreenY = 0;
}
function run() {
var test_pointerEvent = setup_pointerevent_test("pointerevent attributes", ['mouse', 'touch']);
[document, document.getElementById('innerFrame').contentDocument].forEach(function(element) {
on_event(element, 'pointermove', function (event) {
if (startSummation) {
test_pointerEvent.step(function() {
assert_equals(event.movementX, event.screenX - lastScreenX, "movementX should be the delta between current event's and last event's screenX");
assert_equals(event.movementY, event.screenY - lastScreenY, "movementY should be the delta between current event's and last event's screenY");
});
lastScreenX = event.screenX;
lastScreenY = event.screenY;
}
});
});
on_event(document.querySelector('#box1'), 'pointerdown', function(event) {
event.target.releasePointerCapture(event.pointerId);
test_pointerEvent.step(function() {
assert_equals(event.pointerType, expectedPointerType, "Use the instructed pointer type.");
});
startSummation = true;
lastScreenX = event.screenX;
lastScreenY = event.screenY;
});
on_event(document.querySelector('#box2'), 'pointerup', function(event) {
startSummation = false;
test_pointerEvent.done();
});
}
</script>
</head>
<body onload="run()">
<h1>Pointer Events movementX/Y attribute test</h1>
<h2 id="pointerTypeDescription"></h2>
<h4>
Test Description: This test checks the properties of pointer events that do not support hover.
<ol>
<li>Press down on the black square.</li>
<li>Move your pointer slowly along a straight line to the red square.</li>
<li>Release the pointer when you are over the red square.</li>
</ol>
Test passes if the proper behavior of the events is observed.
</h4>
<div id="testContainer">
<div id="box1" class="square"></div>
<div id="box2" class="square"></div>
<iframe id="innerFrame" src="resources/pointerevent_movementxy-iframe.html"></iframe>
</div>
<div class="spacer"></div>
</body>
</html>

View File

@ -1,8 +0,0 @@
<!doctype html>
<html>
<head>
<meta name="viewport" content="width=device-width">
</head>
<body>
</body>
</html>

View File

@ -1,53 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1399740
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 1399740</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
<script type="text/javascript" src="mochitest_support_external.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="text/javascript">
SimpleTest.waitForExplicitFinish();
function startTest() {
runTestInNewWindow("pointerevent_movementxy-manual.html");
}
function executeTest(int_win) {
let box1 = int_win.document.getElementById("box1");
let box2 = int_win.document.getElementById("box2");
let rect1 = box1.getBoundingClientRect();
let rect2 = box2.getBoundingClientRect();
let offsetX = rect1.left + rect1.width / 2;
let offsetY = rect1.top + rect1.height / 2;
let stepX = (rect2.left + rect2.width / 2 - offsetX) / 10;
let stepY = (rect2.top + rect2.height / 2 - offsetY) / 10;
sendMouseEventAtPoint(int_win, offsetX, offsetY, "mousemove", {inputSource:MouseEvent.MOZ_SOURCE_MOUSE});
sendMouseEventAtPoint(int_win, offsetX, offsetY, "mousedown", {inputSource:MouseEvent.MOZ_SOURCE_MOUSE});
sendMouseEventAtPoint(int_win, offsetX, offsetY, "mousemove", {inputSource:MouseEvent.MOZ_SOURCE_MOUSE});
for (var i = 0; i < 10; ++i) {
offsetX += stepX;
offsetY += stepY;
sendMouseEventAtPoint(int_win, offsetX, offsetY, "mousemove", {inputSource:MouseEvent.MOZ_SOURCE_MOUSE});
}
sendMouseEventAtPoint(int_win, offsetX, offsetY, "mouseup", {inputSource:MouseEvent.MOZ_SOURCE_MOUSE});
offsetX = rect1.left + rect1.width / 2;
offsetY = rect1.top + rect1.height / 2;
sendMouseEventAtPoint(int_win, offsetX, offsetY, "mousemove", {inputSource:MouseEvent.MOZ_SOURCE_TOUCH});
sendMouseEventAtPoint(int_win, offsetX, offsetY, "mousedown", {inputSource:MouseEvent.MOZ_SOURCE_TOUCH});
sendMouseEventAtPoint(int_win, offsetX, offsetY, "mousemove", {inputSource:MouseEvent.MOZ_SOURCE_TOUCH});
for (var i = 0; i < 10; ++i) {
offsetX += stepX;
offsetY += stepY;
sendMouseEventAtPoint(int_win, offsetX, offsetY, "mousemove", {inputSource:MouseEvent.MOZ_SOURCE_TOUCH});
}
sendMouseEventAtPoint(int_win, offsetX, offsetY, "mouseup", {inputSource:MouseEvent.MOZ_SOURCE_TOUCH});
}
</script>
</head>
<body>
</body>
</html>