Bug 750111 - mozMovementX is transient and becomes zero later, r=smaug, a=akeybl
authordavid.humphrey@senecacollege.ca
Sun, 17 Jun 2012 00:08:58 +0300
changeset 96100 d54548c3b0817b7ca6ec6dbdd9ccdfc00f3639e6
parent 96099 f72a8cf9834daa640fa81eac65670b4b37160c79
child 96101 aa1fd608d88a154b4231443879bf422068e5cf64
push id992
push useropettay@mozilla.com
push dateSat, 16 Jun 2012 21:12:02 +0000
treeherdermozilla-beta@d54548c3b081 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug, akeybl
bugs750111
milestone14.0
Bug 750111 - mozMovementX is transient and becomes zero later, r=smaug, a=akeybl
content/events/src/nsDOMUIEvent.cpp
content/events/src/nsDOMUIEvent.h
--- a/content/events/src/nsDOMUIEvent.cpp
+++ b/content/events/src/nsDOMUIEvent.cpp
@@ -51,17 +51,17 @@
 #include "nsIFrame.h"
 #include "nsIScrollableFrame.h"
 #include "DictionaryHelpers.h"
 
 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 {
@@ -123,16 +123,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);
@@ -404,16 +408,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
@@ -141,17 +141,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;
 };
 
 #define NS_FORWARD_TO_NSDOMUIEVENT \
   NS_FORWARD_NSIDOMUIEVENT(nsDOMUIEvent::) \
   NS_FORWARD_TO_NSDOMEVENT