Bug 750111 - mozMovementX is transient and becomes zero later. r=smaug
authorDavid Humphrey (:humph) <david.humphrey@senecacollege.ca>
Wed, 09 May 2012 18:54:18 -0400
changeset 93647 4d1a47d43ce589fa6edd925754f590cdc41753a0
parent 93646 d04efcf7237edab883d6958e0f752628e1cf0a91
child 93648 82853146de860fd2b4bcf0594a7609fa471cb0c4
push id9247
push userryanvm@gmail.com
push dateWed, 09 May 2012 22:58:40 +0000
treeherdermozilla-inbound@e7f7305c93e5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs750111
milestone15.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
Bug 750111 - mozMovementX is transient and becomes zero later. r=smaug
content/events/src/nsDOMUIEvent.cpp
content/events/src/nsDOMUIEvent.h
--- a/content/events/src/nsDOMUIEvent.cpp
+++ b/content/events/src/nsDOMUIEvent.cpp
@@ -55,17 +55,17 @@
 #include "mozilla/Assertions.h"
 
 using namespace mozilla;
 
 nsDOMUIEvent::nsDOMUIEvent(nsPresContext* aPresContext, nsGUIEvent* aEvent)
   : nsDOMEvent(aPresContext, aEvent ?
                static_cast<nsEvent *>(aEvent) :
                static_cast<nsEvent *>(new nsUIEvent(false, 0, 0)))
-  , mClientPoint(0, 0), mLayerPoint(0, 0), mPagePoint(0, 0)
+  , mClientPoint(0, 0), mLayerPoint(0, 0), mPagePoint(0, 0), mMovementPoint(0, 0)
   , mIsPointerLocked(nsEventStateManager::sIsPointerLocked)
   , mLastScreenPoint(nsEventStateManager::sLastScreenPoint)
   , mLastClientPoint(nsEventStateManager::sLastClientPoint)
 {
   if (aEvent) {
     mEventIsInternal = false;
   }
   else {
@@ -127,16 +127,20 @@ DOMCI_DATA(UIEvent, nsDOMUIEvent)
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsDOMUIEvent)
   NS_INTERFACE_MAP_ENTRY(nsIDOMUIEvent)
   NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(UIEvent)
 NS_INTERFACE_MAP_END_INHERITING(nsDOMEvent)
 
 nsIntPoint
 nsDOMUIEvent::GetMovementPoint()
 {
+  if (mPrivateDataDuplicated) {
+    return mMovementPoint;
+  }
+
   if (!mEvent ||
        (mEvent->eventStructType != NS_MOUSE_EVENT &&
         mEvent->eventStructType != NS_POPUP_EVENT &&
         mEvent->eventStructType != NS_MOUSE_SCROLL_EVENT &&
         mEvent->eventStructType != NS_MOZTOUCH_EVENT &&
         mEvent->eventStructType != NS_DRAG_EVENT &&
         mEvent->eventStructType != NS_SIMPLE_GESTURE_EVENT)) {
     return nsIntPoint(0, 0);
@@ -408,16 +412,17 @@ nsDOMUIEvent::GetIsChar(bool* aIsChar)
 
 NS_METHOD
 nsDOMUIEvent::DuplicatePrivateData()
 {
   mClientPoint = nsDOMEvent::GetClientCoords(mPresContext,
                                              mEvent,
                                              mEvent->refPoint,
                                              mClientPoint);
+  mMovementPoint = GetMovementPoint();
   mLayerPoint = GetLayerPoint();
   mPagePoint = nsDOMEvent::GetPageCoords(mPresContext,
                                          mEvent,
                                          mEvent->refPoint,
                                          mClientPoint);
   // GetScreenPoint converts mEvent->refPoint to right coordinates.
   nsIntPoint screenPoint = nsDOMEvent::GetScreenCoords(mPresContext,
                                                        mEvent,
--- a/content/events/src/nsDOMUIEvent.h
+++ b/content/events/src/nsDOMUIEvent.h
@@ -142,17 +142,17 @@ protected:
   }
 
   nsCOMPtr<nsIDOMWindow> mView;
   PRInt32 mDetail;
   nsIntPoint mClientPoint;
   // Screenpoint is mEvent->refPoint.
   nsIntPoint mLayerPoint;
   nsIntPoint mPagePoint;
-  nsIntPoint mMovement;
+  nsIntPoint mMovementPoint;
   bool mIsPointerLocked;
   nsIntPoint mLastScreenPoint;
   nsIntPoint mLastClientPoint;
 
   typedef mozilla::widget::Modifiers Modifiers;
   static Modifiers ComputeModifierState(const nsAString& aModifiersList);
   bool GetModifierStateInternal(const nsAString& aKey);
 };