Bug 1323400 - Part 1: Mark Touch::Equals as a const method; r=smaug
authorEdgar Chen <echen@mozilla.com>
Fri, 15 Feb 2019 16:28:35 +0000
changeset 459609 fe21a09ef43fe601d454ff07e2d172a58d215958
parent 459608 6a145b0bf8e4a9e1a227b2327f6fbbbe948fbae8
child 459610 b526bd5802158ed9e6951b5b28548750eb69bc87
push id35563
push userccoroiu@mozilla.com
push dateSat, 16 Feb 2019 09:36:04 +0000
treeherdermozilla-central@1cfd69d05aa1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1323400
milestone67.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 1323400 - Part 1: Mark Touch::Equals as a const method; r=smaug Differential Revision: https://phabricator.services.mozilla.com/D18232
dom/events/Touch.cpp
dom/events/Touch.h
layout/base/TouchManager.cpp
--- a/dom/events/Touch.cpp
+++ b/dom/events/Touch.cpp
@@ -175,17 +175,17 @@ void Touch::InitializePoints(nsPresConte
   mPointsInitialized = true;
 }
 
 void Touch::SetTouchTarget(EventTarget* aTarget) {
   mOriginalTarget = aTarget;
   mTarget = aTarget;
 }
 
-bool Touch::Equals(Touch* aTouch) {
+bool Touch::Equals(Touch* aTouch) const {
   return mRefPoint == aTouch->mRefPoint && mForce == aTouch->mForce &&
          mRotationAngle == aTouch->mRotationAngle &&
          mRadius.x == aTouch->mRadius.x && mRadius.y == aTouch->mRadius.y;
 }
 
 JSObject* Touch::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) {
   return Touch_Binding::Wrap(aCx, this, aGivenProto);
 }
--- a/dom/events/Touch.h
+++ b/dom/events/Touch.h
@@ -43,17 +43,17 @@ class Touch final : public nsISupports,
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(Touch)
 
   void InitializePoints(nsPresContext* aPresContext, WidgetEvent* aEvent);
 
   // Note, this sets both mOriginalTarget and mTarget.
   void SetTouchTarget(EventTarget* aTarget);
 
-  bool Equals(Touch* aTouch);
+  bool Equals(Touch* aTouch) const;
 
   virtual JSObject* WrapObject(JSContext* aCx,
                                JS::Handle<JSObject*> aGivenProto) override;
 
   nsIGlobalObject* GetParentObject();
 
   // WebIDL
   int32_t Identifier() const { return mIdentifier; }
--- a/layout/base/TouchManager.cpp
+++ b/layout/base/TouchManager.cpp
@@ -268,18 +268,18 @@ bool TouchManager::PreHandleEvent(Widget
         int32_t id = touch->Identifier();
         touch->mMessage = aEvent->mMessage;
 
         TouchInfo info;
         if (!sCaptureTouchList->Get(id, &info)) {
           touches.RemoveElementAt(i);
           continue;
         }
-        RefPtr<Touch> oldTouch = info.mTouch;
-        if (!touch->Equals(oldTouch)) {
+        const RefPtr<Touch> oldTouch = info.mTouch;
+        if (!oldTouch->Equals(touch)) {
           touch->mChanged = true;
           haveChanged = true;
         }
 
         nsCOMPtr<EventTarget> targetPtr = oldTouch->mOriginalTarget;
         if (!targetPtr) {
           touches.RemoveElementAt(i);
           continue;