Bug 895274 part.244 Rename NS_TOUCH_CANCEL to eTouchCancel r=smaug
authorMasayuki Nakano <masayuki@d-toybox.com>
Tue, 15 Sep 2015 00:14:35 +0900
changeset 262348 641727472a5c88c547a87e64ea6a9bd1124a2af1
parent 262347 aa8e1b6f6753c7f5d8413944b353bc2b18570a04
child 262349 2bbed060054e5118b27dfc6a3faf7b4c94dc101e
push idunknown
push userunknown
push dateunknown
reviewerssmaug
bugs895274
milestone43.0a1
Bug 895274 part.244 Rename NS_TOUCH_CANCEL to eTouchCancel r=smaug
dom/base/nsDOMWindowUtils.cpp
dom/events/EventNameList.h
dom/events/EventStateManager.cpp
dom/events/TouchEvent.cpp
dom/html/HTMLInputElement.cpp
dom/ipc/TabChild.cpp
dom/ipc/TabParent.cpp
gfx/layers/apz/util/APZEventState.cpp
layout/base/AccessibleCaretEventHub.cpp
layout/base/SelectionCarets.cpp
layout/base/TouchCaret.cpp
layout/base/TouchManager.cpp
layout/base/nsPresShell.cpp
widget/EventMessageList.h
widget/InputData.cpp
widget/TouchEvents.h
widget/android/AndroidJavaWrappers.cpp
widget/android/nsWindow.cpp
widget/uikit/nsWindow.mm
--- a/dom/base/nsDOMWindowUtils.cpp
+++ b/dom/base/nsDOMWindowUtils.cpp
@@ -963,17 +963,17 @@ nsDOMWindowUtils::SendTouchEventCommon(c
   EventMessage msg;
   if (aType.EqualsLiteral("touchstart")) {
     msg = eTouchStart;
   } else if (aType.EqualsLiteral("touchmove")) {
     msg = eTouchMove;
   } else if (aType.EqualsLiteral("touchend")) {
     msg = eTouchEnd;
   } else if (aType.EqualsLiteral("touchcancel")) {
-    msg = NS_TOUCH_CANCEL;
+    msg = eTouchCancel;
   } else {
     return NS_ERROR_UNEXPECTED;
   }
   WidgetTouchEvent event(true, msg, widget);
   event.modifiers = nsContentUtils::GetWidgetModifiers(aModifiers);
   event.widget = widget;
   event.time = PR_Now();
 
--- a/dom/events/EventNameList.h
+++ b/dom/events/EventNameList.h
@@ -575,17 +575,17 @@ TOUCH_EVENT(touchend,
             eTouchEnd,
             EventNameType_All,
             eTouchEventClass)
 TOUCH_EVENT(touchmove,
             eTouchMove,
             EventNameType_All,
             eTouchEventClass )
 TOUCH_EVENT(touchcancel,
-            NS_TOUCH_CANCEL,
+            eTouchCancel,
             EventNameType_All,
             eTouchEventClass)
 
 DOCUMENT_ONLY_EVENT(readystatechange,
                     eReadyStateChange,
                     EventNameType_HTMLXUL,
                     eBasicEventClass)
 DOCUMENT_ONLY_EVENT(selectionchange,
--- a/dom/events/EventStateManager.cpp
+++ b/dom/events/EventStateManager.cpp
@@ -1151,17 +1151,17 @@ CrossProcessSafeEvent(const WidgetEvent&
     default:
       return false;
     }
   case eTouchEventClass:
     switch (aEvent.mMessage) {
     case eTouchStart:
     case eTouchMove:
     case eTouchEnd:
-    case NS_TOUCH_CANCEL:
+    case eTouchCancel:
       return true;
     default:
       return false;
     }
   case eDragEventClass:
     switch (aEvent.mMessage) {
     case eDragOver:
     case eDragExit:
--- a/dom/events/TouchEvent.cpp
+++ b/dom/events/TouchEvent.cpp
@@ -117,18 +117,17 @@ TouchEvent::InitTouchEvent(const nsAStri
   mChangedTouches = aChangedTouches;
 }
 
 TouchList*
 TouchEvent::Touches()
 {
   if (!mTouches) {
     WidgetTouchEvent* touchEvent = mEvent->AsTouchEvent();
-    if (mEvent->mMessage == eTouchEnd ||
-        mEvent->mMessage == NS_TOUCH_CANCEL) {
+    if (mEvent->mMessage == eTouchEnd || mEvent->mMessage == eTouchCancel) {
       // for touchend events, remove any changed touches from the touches array
       WidgetTouchEvent::AutoTouchArray unchangedTouches;
       const WidgetTouchEvent::TouchArray& touches = touchEvent->touches;
       for (uint32_t i = 0; i < touches.Length(); ++i) {
         if (!touches[i]->mChanged) {
           unchangedTouches.AppendElement(touches[i]);
         }
       }
@@ -145,18 +144,18 @@ TouchEvent::TargetTouches()
 {
   if (!mTargetTouches) {
     WidgetTouchEvent::AutoTouchArray targetTouches;
     WidgetTouchEvent* touchEvent = mEvent->AsTouchEvent();
     const WidgetTouchEvent::TouchArray& touches = touchEvent->touches;
     for (uint32_t i = 0; i < touches.Length(); ++i) {
       // for touchend/cancel events, don't append to the target list if this is a
       // touch that is ending
-      if ((mEvent->mMessage != eTouchEnd &&
-           mEvent->mMessage != NS_TOUCH_CANCEL) || !touches[i]->mChanged) {
+      if ((mEvent->mMessage != eTouchEnd && mEvent->mMessage != eTouchCancel) ||
+          !touches[i]->mChanged) {
         if (touches[i]->mTarget == mEvent->originalTarget) {
           targetTouches.AppendElement(touches[i]);
         }
       }
     }
     mTargetTouches = new TouchList(ToSupports(this), targetTouches);
   }
   return mTargetTouches;
--- a/dom/html/HTMLInputElement.cpp
+++ b/dom/html/HTMLInputElement.cpp
@@ -4148,17 +4148,17 @@ HTMLInputElement::PostHandleEventForRang
 
     case eKeyPress:
       if (mIsDraggingRange &&
           aVisitor.mEvent->AsKeyboardEvent()->keyCode == NS_VK_ESCAPE) {
         CancelRangeThumbDrag();
       }
       break;
 
-    case NS_TOUCH_CANCEL:
+    case eTouchCancel:
       if (mIsDraggingRange) {
         CancelRangeThumbDrag();
       }
       break;
 
     default:
       break;
   }
--- a/dom/ipc/TabChild.cpp
+++ b/dom/ipc/TabChild.cpp
@@ -2056,17 +2056,17 @@ TabChild::UpdateTapState(const WidgetTou
       APZCCallbackHelper::DispatchSynthesizedMouseEvent(
         eMouseMove, time, currentPoint, 0, mPuppetWidget);
       APZCCallbackHelper::DispatchSynthesizedMouseEvent(
         eMouseDown, time, currentPoint, 0, mPuppetWidget);
       APZCCallbackHelper::DispatchSynthesizedMouseEvent(
         eMouseUp, time, currentPoint, 0, mPuppetWidget);
     }
     // fall through
-  case NS_TOUCH_CANCEL:
+  case eTouchCancel:
     CancelTapTracking();
     return;
 
   default:
     NS_WARNING("Unknown touch event type");
   }
 }
 
--- a/dom/ipc/TabParent.cpp
+++ b/dom/ipc/TabParent.cpp
@@ -1829,17 +1829,17 @@ bool TabParent::SendRealTouchEvent(Widge
   if (mIsDestroyed) {
     return false;
   }
 
   // PresShell::HandleEventInternal adds touches on touch end/cancel.  This
   // confuses remote content and the panning and zooming logic into thinking
   // that the added touches are part of the touchend/cancel, when actually
   // they're not.
-  if (event.mMessage == eTouchEnd || event.mMessage == NS_TOUCH_CANCEL) {
+  if (event.mMessage == eTouchEnd || event.mMessage == eTouchCancel) {
     for (int i = event.touches.Length() - 1; i >= 0; i--) {
       if (!event.touches[i]->mChanged) {
         event.touches.RemoveElementAt(i);
       }
     }
   }
 
   ScrollableLayerGuid guid;
@@ -2985,17 +2985,17 @@ TabParent::InjectTouchEvent(const nsAStr
                             float* aRotationAngles,
                             float* aForces,
                             uint32_t aCount,
                             int32_t aModifiers)
 {
   EventMessage msg;
   nsContentUtils::GetEventMessageAndAtom(aType, eTouchEventClass, &msg);
   if (msg != eTouchStart && msg != eTouchMove &&
-      msg != eTouchEnd && msg != NS_TOUCH_CANCEL) {
+      msg != eTouchEnd && msg != eTouchCancel) {
     return NS_ERROR_FAILURE;
   }
 
   nsCOMPtr<nsIWidget> widget = GetWidget();
   if (!widget) {
     return NS_ERROR_FAILURE;
   }
 
--- a/gfx/layers/apz/util/APZEventState.cpp
+++ b/gfx/layers/apz/util/APZEventState.cpp
@@ -284,17 +284,17 @@ APZEventState::ProcessTouchEvent(const W
   }
 
   case eTouchEnd:
     if (isTouchPrevented) {
       mTouchEndCancelled = true;
       mEndTouchIsClick = false;
     }
     // fall through
-  case NS_TOUCH_CANCEL:
+  case eTouchCancel:
     mActiveElementManager->HandleTouchEndEvent(mEndTouchIsClick);
     // fall through
   case eTouchMove: {
     if (mPendingTouchPreventedResponse) {
       MOZ_ASSERT(aGuid == mPendingTouchPreventedGuid);
     }
     sentContentResponse = SendPendingTouchPreventedResponse(isTouchPrevented);
     break;
@@ -303,18 +303,18 @@ APZEventState::ProcessTouchEvent(const W
   default:
     NS_WARNING("Unknown touch event type");
   }
 
   if (sentContentResponse &&
         aApzResponse == nsEventStatus_eConsumeDoDefault &&
         gfxPrefs::PointerEventsEnabled()) {
     WidgetTouchEvent cancelEvent(aEvent);
-    cancelEvent.mMessage = NS_TOUCH_CANCEL;
-    cancelEvent.mFlags.mCancelable = false; // mMessage != NS_TOUCH_CANCEL;
+    cancelEvent.mMessage = eTouchCancel;
+    cancelEvent.mFlags.mCancelable = false; // mMessage != eTouchCancel;
     for (uint32_t i = 0; i < cancelEvent.touches.Length(); ++i) {
       if (mozilla::dom::Touch* touch = cancelEvent.touches[i]) {
         touch->convertToPointer = true;
       }
     }
     nsEventStatus status;
     cancelEvent.widget->DispatchEvent(&cancelEvent, status);
   }
--- a/layout/base/AccessibleCaretEventHub.cpp
+++ b/layout/base/AccessibleCaretEventHub.cpp
@@ -582,20 +582,20 @@ AccessibleCaretEventHub::HandleTouchEven
     break;
 
   case eTouchEnd:
     AC_LOGV("Before eTouchEnd, state: %s", mState->Name());
     rv = mState->OnRelease(this);
     AC_LOGV("After eTouchEnd, state: %s, consume: %d", mState->Name(), rv);
     break;
 
-  case NS_TOUCH_CANCEL:
-    AC_LOGV("Before NS_TOUCH_CANCEL, state: %s", mState->Name());
+  case eTouchCancel:
+    AC_LOGV("Before eTouchCancel, state: %s", mState->Name());
     rv = mState->OnRelease(this);
-    AC_LOGV("After NS_TOUCH_CANCEL, state: %s, consume: %d", mState->Name(),
+    AC_LOGV("After eTouchCancel, state: %s, consume: %d", mState->Name(),
             rv);
     break;
 
   default:
     break;
   }
 
   return rv;
--- a/layout/base/SelectionCarets.cpp
+++ b/layout/base/SelectionCarets.cpp
@@ -227,17 +227,17 @@ SelectionCarets::HandleEvent(WidgetEvent
       SetSelectionDragState(true);
       return nsEventStatus_eConsumeNoDefault;
     } else {
       mDragMode = NONE;
       mActiveTouchId = -1;
       LaunchLongTapDetector();
     }
   } else if (aEvent->mMessage == eTouchEnd ||
-             aEvent->mMessage == NS_TOUCH_CANCEL ||
+             aEvent->mMessage == eTouchCancel ||
              aEvent->mMessage == eMouseUp) {
     CancelLongTapDetector();
     if (mDragMode != NONE) {
       // Only care about same id
       if (mActiveTouchId == nowTouchId) {
         SetSelectionDragState(false);
         mDragMode = NONE;
         mActiveTouchId = -1;
--- a/layout/base/TouchCaret.cpp
+++ b/layout/base/TouchCaret.cpp
@@ -773,17 +773,17 @@ TouchCaret::HandleEvent(WidgetEvent* aEv
       status = HandleMouseUpEvent(aEvent->AsMouseEvent());
       break;
     case eTouchMove:
       status = HandleTouchMoveEvent(aEvent->AsTouchEvent());
       break;
     case eMouseMove:
       status = HandleMouseMoveEvent(aEvent->AsMouseEvent());
       break;
-    case NS_TOUCH_CANCEL:
+    case eTouchCancel:
       mTouchesId.Clear();
       SetState(TOUCHCARET_NONE);
       LaunchExpirationTimer();
       break;
     case eKeyUp:
     case eKeyDown:
     case eKeyPress:
     case eWheel:
--- a/layout/base/TouchManager.cpp
+++ b/layout/base/TouchManager.cpp
@@ -188,17 +188,17 @@ TouchManager::PreHandleEvent(WidgetEvent
           return false;
         }
       }
       break;
     }
     case eTouchEnd:
       aIsHandlingUserInput = true;
       // Fall through to touchcancel code
-    case NS_TOUCH_CANCEL: {
+    case eTouchCancel: {
       // Remove the changed touches
       // need to make sure we only remove touches that are ending here
       WidgetTouchEvent* touchEvent = aEvent->AsTouchEvent();
       WidgetTouchEvent::TouchArray& touches = touchEvent->touches;
       for (uint32_t i = 0; i < touches.Length(); ++i) {
         dom::Touch* touch = touches[i];
         if (!touch) {
           continue;
--- a/layout/base/nsPresShell.cpp
+++ b/layout/base/nsPresShell.cpp
@@ -6681,17 +6681,17 @@ DispatchPointerFromMouseOrTouch(PresShel
       pointerMessage = ePointerMove;
       break;
     case eTouchEnd:
       pointerMessage = ePointerUp;
       break;
     case eTouchStart:
       pointerMessage = ePointerDown;
       break;
-    case NS_TOUCH_CANCEL:
+    case eTouchCancel:
       pointerMessage = ePointerCancel;
       break;
     default:
       return NS_OK;
     }
 
     for (uint32_t i = 0; i < touchEvent->touches.Length(); ++i) {
       mozilla::dom::Touch* touch = touchEvent->touches[i];
@@ -7474,17 +7474,17 @@ PresShell::HandleEvent(nsIFrame* aFrame,
       NS_WARNING("Nothing to handle this event!");
       return NS_OK;
     }
 
     PresShell* shell =
         static_cast<PresShell*>(frame->PresContext()->PresShell());
     switch (aEvent->mMessage) {
       case eTouchMove:
-      case NS_TOUCH_CANCEL:
+      case eTouchCancel:
       case eTouchEnd: {
         // get the correct shell to dispatch to
         WidgetTouchEvent* touchEvent = aEvent->AsTouchEvent();
         for (dom::Touch* touch : touchEvent->touches) {
           if (!touch) {
             break;
           }
 
--- a/widget/EventMessageList.h
+++ b/widget/EventMessageList.h
@@ -368,17 +368,17 @@ NS_EVENT_MESSAGE(NS_SHOW_EVENT,         
 NS_EVENT_MESSAGE(eFullscreenEventFirst,  5100)
 NS_EVENT_MESSAGE(eFullscreenChange,      eFullscreenEventFirst)
 NS_EVENT_MESSAGE(eFullscreenError,       eFullscreenEventFirst + 1)
 
 NS_EVENT_MESSAGE(eTouchEventFirst,       5200)
 NS_EVENT_MESSAGE(eTouchStart,            eTouchEventFirst)
 NS_EVENT_MESSAGE(eTouchMove,             eTouchEventFirst + 1)
 NS_EVENT_MESSAGE(eTouchEnd,              eTouchEventFirst + 2)
-NS_EVENT_MESSAGE(NS_TOUCH_CANCEL,        eTouchEventFirst + 3)
+NS_EVENT_MESSAGE(eTouchCancel,           eTouchEventFirst + 3)
 
 // Pointerlock DOM API
 NS_EVENT_MESSAGE(ePointerLockEventFirst, 5300)
 NS_EVENT_MESSAGE(ePointerLockChange,     ePointerLockEventFirst)
 NS_EVENT_MESSAGE(ePointerLockError,      ePointerLockEventFirst + 1)
 
 NS_EVENT_MESSAGE(eWheelEventFirst,       5400)
 // eWheel is the event message of DOM wheel event.
--- a/widget/InputData.cpp
+++ b/widget/InputData.cpp
@@ -40,17 +40,17 @@ MultiTouchInput::MultiTouchInput(const W
       mType = MULTITOUCH_START;
       break;
     case eTouchMove:
       mType = MULTITOUCH_MOVE;
       break;
     case eTouchEnd:
       mType = MULTITOUCH_END;
       break;
-    case NS_TOUCH_CANCEL:
+    case eTouchCancel:
       mType = MULTITOUCH_CANCEL;
       break;
     default:
       MOZ_ASSERT_UNREACHABLE("Did not assign a type to a MultiTouchInput");
       break;
   }
 
   for (size_t i = 0; i < aTouchEvent.touches.Length(); i++) {
@@ -88,17 +88,17 @@ MultiTouchInput::ToWidgetTouchEvent(nsIW
     break;
   case MULTITOUCH_MOVE:
     touchEventMessage = eTouchMove;
     break;
   case MULTITOUCH_END:
     touchEventMessage = eTouchEnd;
     break;
   case MULTITOUCH_CANCEL:
-    touchEventMessage = NS_TOUCH_CANCEL;
+    touchEventMessage = eTouchCancel;
     break;
   default:
     MOZ_ASSERT_UNREACHABLE("Did not assign a type to WidgetTouchEvent in MultiTouchInput");
     break;
   }
 
   WidgetTouchEvent event(true, touchEventMessage, aWidget);
   if (touchEventMessage == eVoidEvent) {
--- a/widget/TouchEvents.h
+++ b/widget/TouchEvents.h
@@ -168,25 +168,25 @@ public:
   WidgetTouchEvent(const WidgetTouchEvent& aOther)
     : WidgetInputEvent(aOther.mFlags.mIsTrusted, aOther.mMessage, aOther.widget,
                        eTouchEventClass)
   {
     modifiers = aOther.modifiers;
     time = aOther.time;
     timeStamp = aOther.timeStamp;
     touches.AppendElements(aOther.touches);
-    mFlags.mCancelable = mMessage != NS_TOUCH_CANCEL;
+    mFlags.mCancelable = mMessage != eTouchCancel;
     MOZ_COUNT_CTOR(WidgetTouchEvent);
   }
 
   WidgetTouchEvent(bool aIsTrusted, EventMessage aMessage, nsIWidget* aWidget)
     : WidgetInputEvent(aIsTrusted, aMessage, aWidget, eTouchEventClass)
   {
     MOZ_COUNT_CTOR(WidgetTouchEvent);
-    mFlags.mCancelable = mMessage != NS_TOUCH_CANCEL;
+    mFlags.mCancelable = mMessage != eTouchCancel;
   }
 
   virtual ~WidgetTouchEvent()
   {
     MOZ_COUNT_DTOR(WidgetTouchEvent);
   }
 
   virtual WidgetEvent* Duplicate() const override
--- a/widget/android/AndroidJavaWrappers.cpp
+++ b/widget/android/AndroidJavaWrappers.cpp
@@ -724,17 +724,17 @@ AndroidGeckoEvent::MakeTouchEvent(nsIWid
             // for pointer-up events we only want the data from
             // the one pointer that went up
             startIndex = PointerIndex();
             endIndex = startIndex + 1;
             break;
         }
         case AndroidMotionEvent::ACTION_OUTSIDE:
         case AndroidMotionEvent::ACTION_CANCEL: {
-            type = NS_TOUCH_CANCEL;
+            type = eTouchCancel;
             break;
         }
     }
 
     WidgetTouchEvent event(true, type, widget);
     if (type == eVoidEvent) {
         // An event we don't know about
         return event;
--- a/widget/android/nsWindow.cpp
+++ b/widget/android/nsWindow.cpp
@@ -999,17 +999,17 @@ nsWindow::OnContextmenuEvent(AndroidGeck
     nsEventStatus contextMenuStatus;
     DispatchEvent(&contextMenuEvent, contextMenuStatus);
 
     // If the contextmenu event was consumed (preventDefault issued), we follow with a
     // touchcancel event. This avoids followup touchend events passsing through and
     // triggering further element behaviour such as link-clicks.
     if (contextMenuStatus == nsEventStatus_eConsumeNoDefault) {
         WidgetTouchEvent canceltouchEvent = ae->MakeTouchEvent(this);
-        canceltouchEvent.mMessage = NS_TOUCH_CANCEL;
+        canceltouchEvent.mMessage = eTouchCancel;
         DispatchEvent(&canceltouchEvent);
         return true;
     }
 
     return false;
 }
 
 void
--- a/widget/uikit/nsWindow.mm
+++ b/widget/uikit/nsWindow.mm
@@ -204,17 +204,17 @@ private:
     [self sendTouchEvent:eTouchStart
                  touches:[event allTouches]
                   widget:mGeckoChild];
 }
 
 - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event
 {
     ALOG("[ChildView[%p] touchesCancelled", self);
-    [self sendTouchEvent:NS_TOUCH_CANCEL touches:touches widget:mGeckoChild];
+    [self sendTouchEvent:eTouchCancel touches:touches widget:mGeckoChild];
     for (UITouch* touch : touches) {
         CFDictionaryRemoveValue(mTouches, touch);
     }
     if (CFDictionaryGetCount(mTouches) == 0) {
         mNextTouchID = 0;
     }
 }