Bug 911573 - Stablize the pointerlock test. r=smaug

This commit is contained in:
Masatoshi Kimura 2013-09-05 01:02:34 +09:00
parent e2bd26bb53
commit 36af32abb5

View File

@ -48,7 +48,10 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=633602
}
function moveUnlocked(e) {
div.removeEventListener("mousemove", moveUnlocked, false);
var firstCall = !unLockedCoords;
if (!firstCall) {
todo(false, "mousemove is fired twice.");
}
isUnlocked = !document.mozPointerLockElement;
unLockedCoords = {
@ -58,6 +61,10 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=633602
clientY: e.clientY
};
if (!firstCall) {
return;
}
div.mozRequestPointerLock();
}
@ -77,6 +84,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=633602
document.addEventListener("mozpointerlockchange", function (e) {
if (document.mozPointerLockElement === div) {
div.removeEventListener("mousemove", moveUnlocked, false);
div.addEventListener("mousemove", moveLocked, false);
divRect = div.getBoundingClientRect();
synthesizeMouse(div, (divRect.width / 4) * 3, (divRect.height / 4) * 3, {