Bug 931445 part 3 - Reset synth centering pointer when unlocking pointer. r=smaug
authorXidorn Quan <me@upsuper.org>
Fri, 27 May 2016 17:13:05 +1000
changeset 372096 ab3d00f4e239cc38d8c692d2854689af11537eda
parent 372095 a350fb7c1dbac7302db5b096de2cde327ba600da
child 372097 daf83079577fa7b8407c18164c6cf490290c8304
push id19437
push userdburns@mozilla.com
push dateFri, 27 May 2016 11:32:28 +0000
reviewerssmaug
bugs931445
milestone49.0a1
Bug 931445 part 3 - Reset synth centering pointer when unlocking pointer. r=smaug MozReview-Commit-ID: LcStCmm4iRV
dom/events/EventStateManager.cpp
--- a/dom/events/EventStateManager.cpp
+++ b/dom/events/EventStateManager.cpp
@@ -4396,16 +4396,19 @@ EventStateManager::SetPointerLock(nsIWid
       dragService->Suppress();
     }
   } else {
     // Unlocking, so return pointer to the original position by firing a
     // synthetic mouse event. We first reset sLastRefPoint to its
     // pre-pointerlock position, so that the synthetic mouse event reports
     // no movement.
     sLastRefPoint = mPreLockPoint;
+    // Reset SynthCenteringPoint to invalid so that next time we start
+    // locking pointer, it has its initial value.
+    sSynthCenteringPoint = kInvalidRefPoint;
     if (aWidget) {
       aWidget->SynthesizeNativeMouseMove(
         mPreLockPoint + aWidget->WidgetToScreenOffset(), nullptr);
     }
 
     // Don't retarget events to this element any more.
     nsIPresShell::SetCapturingContent(nullptr, CAPTURE_POINTERLOCK);