author | Chris Pearce <cpearce@mozilla.com> |
Mon, 01 Oct 2012 09:15:29 +1300 | |
changeset 108702 | 288a1c96c20b13a27dc534fef6677818897f91ec |
parent 108701 | 738c9ad0f809bea8941ecc6ffd882b0fd416639e |
child 108703 | 31ae286fff781d9cedf951358c19750543740bc7 |
push id | 23580 |
push user | ryanvm@gmail.com |
push date | Mon, 01 Oct 2012 00:58:26 +0000 |
treeherder | mozilla-central@31ae286fff78 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | smaug |
bugs | 794725 |
milestone | 18.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/content/events/src/nsEventStateManager.cpp +++ b/content/events/src/nsEventStateManager.cpp @@ -106,28 +106,30 @@ using namespace mozilla; using namespace mozilla::dom; //#define DEBUG_DOCSHELL_FOCUS #define NS_USER_INTERACTION_INTERVAL 5000 // ms +static const nsIntPoint kInvalidRefPoint = nsIntPoint(-1,-1); + static bool sLeftClickOnly = true; static bool sKeyCausesActivation = true; static uint32_t sESMInstanceCount = 0; static int32_t sChromeAccessModifier = 0, sContentAccessModifier = 0; int32_t nsEventStateManager::sUserInputEventDepth = 0; bool nsEventStateManager::sNormalLMouseEventInProcess = false; nsEventStateManager* nsEventStateManager::sActiveESM = nullptr; nsIDocument* nsEventStateManager::sMouseOverDocument = nullptr; nsWeakFrame nsEventStateManager::sLastDragOverFrame = nullptr; -nsIntPoint nsEventStateManager::sLastRefPoint = nsIntPoint(0,0); +nsIntPoint nsEventStateManager::sLastRefPoint = kInvalidRefPoint; nsIntPoint nsEventStateManager::sLastScreenPoint = nsIntPoint(0,0); -nsIntPoint nsEventStateManager::sSynthCenteringPoint = nsIntPoint(-1,-1); +nsIntPoint nsEventStateManager::sSynthCenteringPoint = kInvalidRefPoint; nsIntPoint nsEventStateManager::sLastClientPoint = nsIntPoint(0,0); bool nsEventStateManager::sIsPointerLocked = false; // Reference to the pointer locked element. nsWeakPtr nsEventStateManager::sPointerLockedElement; // Reference to the document which requested pointer lock. nsWeakPtr nsEventStateManager::sPointerLockedDoc; nsCOMPtr<nsIContent> nsEventStateManager::sDragOverContent = nullptr; @@ -4157,18 +4159,24 @@ nsEventStateManager::GenerateMouseEnterE aEvent->widget->SynthesizeNativeMouseMove( center + aEvent->widget->WidgetToScreenOffset()); } else if (aEvent->refPoint == sSynthCenteringPoint) { // This is the "synthetic native" event we dispatched to re-center the // pointer. Cancel it so we don't expose the centering move to content. aEvent->flags |= NS_EVENT_FLAG_STOP_DISPATCH; // Clear sSynthCenteringPoint so we don't cancel other events // targeted at the center. - sSynthCenteringPoint = nsIntPoint(-1,-1); + sSynthCenteringPoint = kInvalidRefPoint; } + } else if (sLastRefPoint == kInvalidRefPoint) { + // We don't have a valid previous mousemove refPoint. This is either + // the first move we've encountered, or the mouse has just re-entered + // the application window. We should report (0,0) movement for this + // case, so make the current and previous refPoints the same. + aEvent->lastRefPoint = aEvent->refPoint; } else { aEvent->lastRefPoint = sLastRefPoint; } // Update the last known refPoint with the current refPoint. sLastRefPoint = aEvent->refPoint; // Get the target content target (mousemove target == mouseover target) @@ -4192,16 +4200,20 @@ nsEventStateManager::GenerateMouseEnterE if (mLastMouseOverFrame && nsContentUtils::GetTopLevelWidget(aEvent->widget) != nsContentUtils::GetTopLevelWidget(mLastMouseOverFrame->GetNearestWidget())) { // the MouseOut event widget doesn't have same top widget with // mLastMouseOverFrame, it's a spurious event for mLastMouseOverFrame break; } + // Reset sLastRefPoint, so that we'll know not to report any + // movement the next time we re-enter the window. + sLastRefPoint = kInvalidRefPoint; + NotifyMouseOut(aEvent, nullptr); } break; } // reset mCurretTargetContent to what it was mCurrentTargetContent = targetBeforeEvent; }