Bug 895274 part.152 Rename NS_QUERY_SELECTED_TEXT to eQuerySelectedText r=smaug
authorMasayuki Nakano <masayuki@d-toybox.com>
Thu, 10 Sep 2015 10:40:05 +0900
changeset 261699 ec614033e8225b089920f84d43d5930a2bef93c9
parent 261698 aaf1002beb949b424841d3fef3c731b25820f600
child 261700 25399075c9efe898cb2b2f137e4affeace30cd47
push idunknown
push userunknown
push dateunknown
reviewerssmaug
bugs895274
milestone43.0a1
Bug 895274 part.152 Rename NS_QUERY_SELECTED_TEXT to eQuerySelectedText r=smaug
dom/base/nsDOMWindowUtils.cpp
dom/base/nsQueryContentEventResult.cpp
dom/base/nsQueryContentEventResult.h
dom/events/ContentEventHandler.cpp
dom/events/ContentEventHandler.h
dom/events/EventStateManager.cpp
dom/events/IMEContentObserver.cpp
dom/events/TextComposition.cpp
widget/ContentCache.cpp
widget/ContentCache.h
widget/EventMessageList.h
widget/TextEvents.h
widget/android/nsWindow.cpp
widget/cocoa/TextInputHandler.mm
widget/cocoa/nsChildView.mm
widget/gtk/IMContextWrapper.cpp
widget/gtk/nsWindow.cpp
widget/tests/TestWinTSF.cpp
widget/windows/IMMHandler.cpp
widget/windows/TSFTextStore.cpp
--- a/dom/base/nsDOMWindowUtils.cpp
+++ b/dom/base/nsDOMWindowUtils.cpp
@@ -1922,17 +1922,17 @@ nsDOMWindowUtils::SendQueryContentEvent(
   nsCOMPtr<nsIWidget> widget = GetWidget();
   if (!widget) {
     return NS_ERROR_FAILURE;
   }
 
   EventMessage message;
   switch (aType) {
     case QUERY_SELECTED_TEXT:
-      message = NS_QUERY_SELECTED_TEXT;
+      message = eQuerySelectedText;
       break;
     case QUERY_TEXT_CONTENT:
       message = NS_QUERY_TEXT_CONTENT;
       break;
     case QUERY_CARET_RECT:
       message = NS_QUERY_CARET_RECT;
       break;
     case QUERY_TEXT_RECT:
--- a/dom/base/nsQueryContentEventResult.cpp
+++ b/dom/base/nsQueryContentEventResult.cpp
@@ -14,18 +14,19 @@ using namespace mozilla;
 NS_INTERFACE_MAP_BEGIN(nsQueryContentEventResult)
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIQueryContentEventResult)
   NS_INTERFACE_MAP_ENTRY(nsIQueryContentEventResult)
 NS_INTERFACE_MAP_END
 
 NS_IMPL_ADDREF(nsQueryContentEventResult)
 NS_IMPL_RELEASE(nsQueryContentEventResult)
 
-nsQueryContentEventResult::nsQueryContentEventResult() :
-  mEventID(0), mSucceeded(false)
+nsQueryContentEventResult::nsQueryContentEventResult()
+  : mEventMessage(eVoidEvent)
+  , mSucceeded(false)
 {
 }
 
 nsQueryContentEventResult::~nsQueryContentEventResult()
 {
 }
 
 NS_IMETHODIMP
@@ -49,130 +50,129 @@ nsQueryContentEventResult::GetTentativeC
   }
   if (NS_WARN_IF(notFound)) {
     return NS_ERROR_NOT_AVAILABLE;
   }
   *aOffset = mTentativeCaretOffset;
   return NS_OK;
 }
 
-static bool IsRectEnabled(uint32_t aEventID)
+static bool IsRectEnabled(EventMessage aEventMessage)
 {
-  return aEventID == NS_QUERY_CARET_RECT ||
-         aEventID == NS_QUERY_TEXT_RECT ||
-         aEventID == NS_QUERY_EDITOR_RECT ||
-         aEventID == NS_QUERY_CHARACTER_AT_POINT;
+  return aEventMessage == NS_QUERY_CARET_RECT ||
+         aEventMessage == NS_QUERY_TEXT_RECT ||
+         aEventMessage == NS_QUERY_EDITOR_RECT ||
+         aEventMessage == NS_QUERY_CHARACTER_AT_POINT;
 }
 
 NS_IMETHODIMP
 nsQueryContentEventResult::GetReversed(bool *aReversed)
 {
   NS_ENSURE_TRUE(mSucceeded, NS_ERROR_NOT_AVAILABLE);
-  NS_ENSURE_TRUE(mEventID == NS_QUERY_SELECTED_TEXT,
-                 NS_ERROR_NOT_AVAILABLE);
+  NS_ENSURE_TRUE(mEventMessage == eQuerySelectedText, NS_ERROR_NOT_AVAILABLE);
   *aReversed = mReversed;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsQueryContentEventResult::GetLeft(int32_t *aLeft)
 {
   NS_ENSURE_TRUE(mSucceeded, NS_ERROR_NOT_AVAILABLE);
-  NS_ENSURE_TRUE(IsRectEnabled(mEventID),
+  NS_ENSURE_TRUE(IsRectEnabled(mEventMessage),
                  NS_ERROR_NOT_AVAILABLE);
   *aLeft = mRect.x;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsQueryContentEventResult::GetWidth(int32_t *aWidth)
 {
   NS_ENSURE_TRUE(mSucceeded, NS_ERROR_NOT_AVAILABLE);
-  NS_ENSURE_TRUE(IsRectEnabled(mEventID),
+  NS_ENSURE_TRUE(IsRectEnabled(mEventMessage),
                  NS_ERROR_NOT_AVAILABLE);
   *aWidth = mRect.width;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsQueryContentEventResult::GetTop(int32_t *aTop)
 {
   NS_ENSURE_TRUE(mSucceeded, NS_ERROR_NOT_AVAILABLE);
-  NS_ENSURE_TRUE(IsRectEnabled(mEventID),
+  NS_ENSURE_TRUE(IsRectEnabled(mEventMessage),
                  NS_ERROR_NOT_AVAILABLE);
   *aTop = mRect.y;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsQueryContentEventResult::GetHeight(int32_t *aHeight)
 {
   NS_ENSURE_TRUE(mSucceeded, NS_ERROR_NOT_AVAILABLE);
-  NS_ENSURE_TRUE(IsRectEnabled(mEventID),
+  NS_ENSURE_TRUE(IsRectEnabled(mEventMessage),
                  NS_ERROR_NOT_AVAILABLE);
   *aHeight = mRect.height;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsQueryContentEventResult::GetText(nsAString &aText)
 {
   NS_ENSURE_TRUE(mSucceeded, NS_ERROR_NOT_AVAILABLE);
-  NS_ENSURE_TRUE(mEventID == NS_QUERY_SELECTED_TEXT ||
-                 mEventID == NS_QUERY_TEXT_CONTENT,
+  NS_ENSURE_TRUE(mEventMessage == eQuerySelectedText ||
+                 mEventMessage == NS_QUERY_TEXT_CONTENT,
                  NS_ERROR_NOT_AVAILABLE);
   aText = mString;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsQueryContentEventResult::GetSucceeded(bool *aSucceeded)
 {
-  NS_ENSURE_TRUE(mEventID != 0, NS_ERROR_NOT_INITIALIZED);
+  NS_ENSURE_TRUE(mEventMessage != eVoidEvent, NS_ERROR_NOT_INITIALIZED);
   *aSucceeded = mSucceeded;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsQueryContentEventResult::GetNotFound(bool *aNotFound)
 {
   NS_ENSURE_TRUE(mSucceeded, NS_ERROR_NOT_AVAILABLE);
-  NS_ENSURE_TRUE(mEventID == NS_QUERY_SELECTED_TEXT ||
-                 mEventID == NS_QUERY_CHARACTER_AT_POINT,
+  NS_ENSURE_TRUE(mEventMessage == eQuerySelectedText ||
+                 mEventMessage == NS_QUERY_CHARACTER_AT_POINT,
                  NS_ERROR_NOT_AVAILABLE);
   *aNotFound = (mOffset == WidgetQueryContentEvent::NOT_FOUND);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsQueryContentEventResult::GetTentativeCaretOffsetNotFound(bool* aNotFound)
 {
   if (NS_WARN_IF(!mSucceeded)) {
     return NS_ERROR_NOT_AVAILABLE;
   }
-  if (NS_WARN_IF(mEventID != NS_QUERY_CHARACTER_AT_POINT)) {
+  if (NS_WARN_IF(mEventMessage != NS_QUERY_CHARACTER_AT_POINT)) {
     return NS_ERROR_NOT_AVAILABLE;
   }
   *aNotFound = (mTentativeCaretOffset == WidgetQueryContentEvent::NOT_FOUND);
   return NS_OK;
 }
 
 void
 nsQueryContentEventResult::SetEventResult(nsIWidget* aWidget,
                                           const WidgetQueryContentEvent &aEvent)
 {
-  mEventID = aEvent.mMessage;
+  mEventMessage = aEvent.mMessage;
   mSucceeded = aEvent.mSucceeded;
   mReversed = aEvent.mReply.mReversed;
   mRect = aEvent.mReply.mRect;
   mOffset = aEvent.mReply.mOffset;
   mTentativeCaretOffset = aEvent.mReply.mTentativeCaretOffset;
   mString = aEvent.mReply.mString;
 
-  if (!IsRectEnabled(mEventID) || !aWidget || !mSucceeded) {
+  if (!IsRectEnabled(mEventMessage) || !aWidget || !mSucceeded) {
     return;
   }
 
   nsIWidget* topWidget = aWidget->GetTopLevelWidget();
   if (!topWidget || topWidget == aWidget) {
     return;
   }
 
--- a/dom/base/nsQueryContentEventResult.h
+++ b/dom/base/nsQueryContentEventResult.h
@@ -24,17 +24,17 @@ public:
   NS_DECL_NSIQUERYCONTENTEVENTRESULT
 
   void SetEventResult(nsIWidget* aWidget,
                       const mozilla::WidgetQueryContentEvent &aEvent);
 
 protected:
   ~nsQueryContentEventResult();
 
-  uint32_t mEventID;
+  mozilla::EventMessage mEventMessage;
 
   uint32_t mOffset;
   uint32_t mTentativeCaretOffset;
   nsString mString;
   mozilla::LayoutDeviceIntRect mRect;
 
   bool mSucceeded;
   bool mReversed;
--- a/dom/events/ContentEventHandler.cpp
+++ b/dom/events/ContentEventHandler.cpp
@@ -791,17 +791,17 @@ ContentEventHandler::GetLineBreakType(bo
   return aUseNativeLineBreak ?
     LINE_BREAK_TYPE_NATIVE : LINE_BREAK_TYPE_XP;
 }
 
 nsresult
 ContentEventHandler::HandleQueryContentEvent(WidgetQueryContentEvent* aEvent)
 {
   switch (aEvent->mMessage) {
-    case NS_QUERY_SELECTED_TEXT:
+    case eQuerySelectedText:
       return OnQuerySelectedText(aEvent);
     case NS_QUERY_TEXT_CONTENT:
       return OnQueryTextContent(aEvent);
     case NS_QUERY_CARET_RECT:
       return OnQueryCaretRect(aEvent);
     case NS_QUERY_TEXT_RECT:
       return OnQueryTextRect(aEvent);
     case NS_QUERY_EDITOR_RECT:
--- a/dom/events/ContentEventHandler.h
+++ b/dom/events/ContentEventHandler.h
@@ -37,17 +37,17 @@ class MOZ_STACK_CLASS ContentEventHandle
 public:
   typedef dom::Selection Selection;
 
   explicit ContentEventHandler(nsPresContext* aPresContext);
 
   // Handle aEvent in the current process.
   nsresult HandleQueryContentEvent(WidgetQueryContentEvent* aEvent);
 
-  // NS_QUERY_SELECTED_TEXT event handler
+  // eQuerySelectedText event handler
   nsresult OnQuerySelectedText(WidgetQueryContentEvent* aEvent);
   // NS_QUERY_TEXT_CONTENT event handler
   nsresult OnQueryTextContent(WidgetQueryContentEvent* aEvent);
   // NS_QUERY_CARET_RECT event handler
   nsresult OnQueryCaretRect(WidgetQueryContentEvent* aEvent);
   // NS_QUERY_TEXT_RECT event handler
   nsresult OnQueryTextRect(WidgetQueryContentEvent* aEvent);
   // NS_QUERY_EDITOR_RECT event handler
--- a/dom/events/EventStateManager.cpp
+++ b/dom/events/EventStateManager.cpp
@@ -763,34 +763,34 @@ EventStateManager::PreHandleEvent(nsPres
       DoContentCommandScrollEvent(aEvent->AsContentCommandEvent());
     }
     break;
   case NS_COMPOSITION_START:
     if (aEvent->mFlags.mIsTrusted) {
       // If the event is trusted event, set the selected text to data of
       // composition event.
       WidgetCompositionEvent* compositionEvent = aEvent->AsCompositionEvent();
-      WidgetQueryContentEvent selectedText(true, NS_QUERY_SELECTED_TEXT,
+      WidgetQueryContentEvent selectedText(true, eQuerySelectedText,
                                            compositionEvent->widget);
       HandleQueryContentEvent(&selectedText);
       NS_ASSERTION(selectedText.mSucceeded, "Failed to get selected text");
       compositionEvent->mData = selectedText.mReply.mString;
     }
     break;
   default:
     break;
   }
   return NS_OK;
 }
 
 void
 EventStateManager::HandleQueryContentEvent(WidgetQueryContentEvent* aEvent)
 {
   switch (aEvent->mMessage) {
-    case NS_QUERY_SELECTED_TEXT:
+    case eQuerySelectedText:
     case NS_QUERY_TEXT_CONTENT:
     case NS_QUERY_CARET_RECT:
     case NS_QUERY_TEXT_RECT:
     case NS_QUERY_EDITOR_RECT:
       if (!IsTargetCrossProcess(aEvent)) {
         break;
       }
       // Will not be handled locally, remote the event
--- a/dom/events/IMEContentObserver.cpp
+++ b/dom/events/IMEContentObserver.cpp
@@ -46,18 +46,18 @@ ToChar(bool aBool)
 {
   return aBool ? "true" : "false";
 }
 
 static const char*
 ToChar(EventMessage aEventMessage)
 {
   switch (aEventMessage) {
-    case NS_QUERY_SELECTED_TEXT:
-      return "NS_QUERY_SELECTED_TEXT";
+    case eQuerySelectedText:
+      return "eQuerySelectedText";
     case NS_QUERY_TEXT_CONTENT:
       return "NS_QUERY_TEXT_CONTENT";
     case NS_QUERY_CARET_RECT:
       return "NS_QUERY_CARET_RECT";
     case NS_QUERY_TEXT_RECT:
       return "NS_QUERY_TEXT_RECT";
     case NS_QUERY_EDITOR_RECT:
       return "NS_QUERY_EDITOR_RECT";
@@ -564,18 +564,17 @@ nsresult
 IMEContentObserver::HandleQueryContentEvent(WidgetQueryContentEvent* aEvent)
 {
   MOZ_LOG(sIMECOLog, LogLevel::Debug,
     ("IMECO: 0x%p IMEContentObserver::HandleQueryContentEvent(aEvent={ "
      "mMessage=%s })", this, ToChar(aEvent->mMessage)));
 
   // If the instance has cache, it should use the cached selection which was
   // sent to the widget.
-  if (aEvent->mMessage == NS_QUERY_SELECTED_TEXT &&
-      aEvent->mUseNativeLineBreak &&
+  if (aEvent->mMessage == eQuerySelectedText && aEvent->mUseNativeLineBreak &&
       mSelectionData.IsValid()) {
     aEvent->mReply.mContentsRoot = mRootContent;
     aEvent->mReply.mHasSelection = !mSelectionData.IsCollapsed();
     aEvent->mReply.mOffset = mSelectionData.mOffset;
     aEvent->mReply.mString = mSelectionData.String();
     aEvent->mReply.mWritingMode = mSelectionData.GetWritingMode();
     aEvent->mReply.mReversed = mSelectionData.mReversed;
     aEvent->mSucceeded = true;
@@ -1104,17 +1103,17 @@ IMEContentObserver::UpdateSelectionCache
   if (!mUpdatePreference.WantSelectionChange()) {
     return false;
   }
 
   mSelectionData.Clear();
 
   // XXX Cannot we cache some information for reducing the cost to compute
   //     selection offset and writing mode?
-  WidgetQueryContentEvent selection(true, NS_QUERY_SELECTED_TEXT, mWidget);
+  WidgetQueryContentEvent selection(true, eQuerySelectedText, mWidget);
   ContentEventHandler handler(GetPresContext());
   handler.OnQuerySelectedText(&selection);
   if (NS_WARN_IF(!selection.mSucceeded)) {
     return false;
   }
 
   mFocusedWidget = selection.mReply.mFocusedWidget;
   mSelectionData.mOffset = selection.mReply.mOffset;
--- a/dom/events/TextComposition.cpp
+++ b/dom/events/TextComposition.cpp
@@ -410,19 +410,17 @@ TextComposition::NotityUpdateComposition
   nsEventStatus status;
 
   // When compositon start, notify the rect of first offset character.
   // When not compositon start, notify the rect of selected composition
   // string if compositionchange event.
   if (aCompositionEvent->mMessage == NS_COMPOSITION_START) {
     nsCOMPtr<nsIWidget> widget = mPresContext->GetRootWidget();
     // Update composition start offset
-    WidgetQueryContentEvent selectedTextEvent(true,
-                                              NS_QUERY_SELECTED_TEXT,
-                                              widget);
+    WidgetQueryContentEvent selectedTextEvent(true, eQuerySelectedText, widget);
     widget->DispatchEvent(&selectedTextEvent, status);
     if (selectedTextEvent.mSucceeded) {
       mCompositionStartOffset = selectedTextEvent.mReply.mOffset;
     } else {
       // Unknown offset
       NS_WARNING("Cannot get start offset of IME composition");
       mCompositionStartOffset = 0;
     }
@@ -610,18 +608,17 @@ TextComposition::CompositionEventDispatc
     return NS_OK; // cannot dispatch any events anymore
   }
 
   nsRefPtr<nsPresContext> presContext = mTextComposition->mPresContext;
   nsEventStatus status = nsEventStatus_eIgnore;
   switch (mEventMessage) {
     case NS_COMPOSITION_START: {
       WidgetCompositionEvent compStart(true, NS_COMPOSITION_START, widget);
-      WidgetQueryContentEvent selectedText(true, NS_QUERY_SELECTED_TEXT,
-                                           widget);
+      WidgetQueryContentEvent selectedText(true, eQuerySelectedText, widget);
       ContentEventHandler handler(presContext);
       handler.OnQuerySelectedText(&selectedText);
       NS_ASSERTION(selectedText.mSucceeded, "Failed to get selected text");
       compStart.mData = selectedText.mReply.mString;
       compStart.mFlags.mIsSynthesizedForTests =
         mTextComposition->IsSynthesizedForTests();
       IMEStateManager::DispatchCompositionEvent(mEventTarget, presContext,
                                                 &compStart, &status, nullptr,
--- a/widget/ContentCache.cpp
+++ b/widget/ContentCache.cpp
@@ -172,17 +172,17 @@ ContentCacheInChild::CacheSelection(nsIW
     ("ContentCacheInChild: 0x%p CacheSelection(aWidget=0x%p, "
      "aNotification=%s)",
      this, aWidget, GetNotificationName(aNotification)));
 
   mCaret.Clear();
   mSelection.Clear();
 
   nsEventStatus status = nsEventStatus_eIgnore;
-  WidgetQueryContentEvent selection(true, NS_QUERY_SELECTED_TEXT, aWidget);
+  WidgetQueryContentEvent selection(true, eQuerySelectedText, aWidget);
   aWidget->DispatchEvent(&selection, status);
   if (NS_WARN_IF(!selection.mSucceeded)) {
     MOZ_LOG(sContentCacheLog, LogLevel::Error,
       ("ContentCache: 0x%p CacheSelection(), FAILED, "
        "couldn't retrieve the selected text", this));
     return false;
   }
   if (selection.mReply.mReversed) {
@@ -511,20 +511,20 @@ ContentCacheInParent::HandleQueryContent
                                               nsIWidget* aWidget) const
 {
   MOZ_ASSERT(aWidget);
 
   aEvent.mSucceeded = false;
   aEvent.mReply.mFocusedWidget = aWidget;
 
   switch (aEvent.mMessage) {
-    case NS_QUERY_SELECTED_TEXT:
+    case eQuerySelectedText:
       MOZ_LOG(sContentCacheLog, LogLevel::Info,
         ("ContentCacheInParent: 0x%p HandleQueryContentEvent("
-         "aEvent={ mMessage=NS_QUERY_SELECTED_TEXT }, aWidget=0x%p)",
+         "aEvent={ mMessage=eQuerySelectedText }, aWidget=0x%p)",
          this, aWidget));
       if (NS_WARN_IF(!IsSelectionValid())) {
         // If content cache hasn't been initialized properly, make the query
         // failed.
         MOZ_LOG(sContentCacheLog, LogLevel::Error,
           ("ContentCacheInParent: 0x%p HandleQueryContentEvent(), "
            "FAILED because mSelection is not valid", this));
         return true;
--- a/widget/ContentCache.h
+++ b/widget/ContentCache.h
@@ -277,17 +277,17 @@ public:
    * it's managed by TabParent itself.
    */
   void AssignContent(const ContentCache& aOther,
                      const IMENotification* aNotification = nullptr);
 
   /**
    * HandleQueryContentEvent() sets content data to aEvent.mReply.
    *
-   * For NS_QUERY_SELECTED_TEXT, fail if the cache doesn't contain the whole
+   * For eQuerySelectedText, fail if the cache doesn't contain the whole
    *  selected range. (This shouldn't happen because PuppetWidget should have
    *  already sent the whole selection.)
    *
    * For NS_QUERY_TEXT_CONTENT, fail only if the cache doesn't overlap with
    *  the queried range. Note the difference from above. We use
    *  this behavior because a normal NS_QUERY_TEXT_CONTENT event is allowed to
    *  have out-of-bounds offsets, so that widget can request content without
    *  knowing the exact length of text. It's up to widget to handle cases when
--- a/widget/EventMessageList.h
+++ b/widget/EventMessageList.h
@@ -210,17 +210,17 @@ NS_EVENT_MESSAGE(eClipboardEventFirst,  
 NS_EVENT_MESSAGE(eCopy,                 eClipboardEventFirst)
 NS_EVENT_MESSAGE(eCut,                  eClipboardEventFirst + 1)
 NS_EVENT_MESSAGE(ePaste,                eClipboardEventFirst + 2)
 
 // Query the content information
 NS_EVENT_MESSAGE(eQueryContentEventFirst,       3200)
 // Query for the selected text information, it return the selection offset,
 // selection length and selected text.
-NS_EVENT_MESSAGE(NS_QUERY_SELECTED_TEXT,        eQueryContentEventFirst)
+NS_EVENT_MESSAGE(eQuerySelectedText,            eQueryContentEventFirst)
 // Query for the text content of specified range, it returns actual lengh (if
 // the specified range is too long) and the text of the specified range.
 // Returns the entire text if requested length > actual length.
 NS_EVENT_MESSAGE(NS_QUERY_TEXT_CONTENT,         eQueryContentEventFirst + 1)
 // Query for the caret rect of nth insertion point. The offset of the result is
 // relative position from the top level widget.
 NS_EVENT_MESSAGE(NS_QUERY_CARET_RECT,           eQueryContentEventFirst + 3)
 // Query for the bounding rect of a range of characters. This works on any
--- a/widget/TextEvents.h
+++ b/widget/TextEvents.h
@@ -532,31 +532,31 @@ public:
   {
     NS_ASSERTION(mMessage == NS_QUERY_TEXT_CONTENT,
                  "not querying text content");
     mWithFontRanges = true;
   }
 
   uint32_t GetSelectionStart(void) const
   {
-    NS_ASSERTION(mMessage == NS_QUERY_SELECTED_TEXT,
+    NS_ASSERTION(mMessage == eQuerySelectedText,
                  "not querying selection");
     return mReply.mOffset + (mReply.mReversed ? mReply.mString.Length() : 0);
   }
 
   uint32_t GetSelectionEnd(void) const
   {
-    NS_ASSERTION(mMessage == NS_QUERY_SELECTED_TEXT,
+    NS_ASSERTION(mMessage == eQuerySelectedText,
                  "not querying selection");
     return mReply.mOffset + (mReply.mReversed ? 0 : mReply.mString.Length());
   }
 
   mozilla::WritingMode GetWritingMode(void) const
   {
-    NS_ASSERTION(mMessage == NS_QUERY_SELECTED_TEXT ||
+    NS_ASSERTION(mMessage == eQuerySelectedText ||
                  mMessage == NS_QUERY_CARET_RECT ||
                  mMessage == NS_QUERY_TEXT_RECT,
                  "not querying selection or text rect");
     return mReply.mWritingMode;
   }
 
   bool mSucceeded;
   bool mUseNativeLineBreak;
--- a/widget/android/nsWindow.cpp
+++ b/widget/android/nsWindow.cpp
@@ -1889,18 +1889,17 @@ nsWindow::OnIMEEvent(AndroidGeckoEvent *
             AutoIMEMask selMask(mIMEMaskSelectionUpdate);
             RemoveIMEComposition();
             WidgetSelectionEvent selEvent(true, eSetSelection, this);
             InitEvent(selEvent, nullptr);
 
             int32_t start = ae->Start(), end = ae->End();
 
             if (start < 0 || end < 0) {
-                WidgetQueryContentEvent event(true, NS_QUERY_SELECTED_TEXT,
-                                              this);
+                WidgetQueryContentEvent event(true, eQuerySelectedText, this);
                 InitEvent(event, nullptr);
                 DispatchEvent(&event);
                 MOZ_ASSERT(event.mSucceeded);
 
                 if (start < 0)
                     start = int32_t(event.GetSelectionStart());
                 if (end < 0)
                     end = int32_t(event.GetSelectionEnd());
@@ -1971,18 +1970,17 @@ nsWindow::OnIMEEvent(AndroidGeckoEvent *
                     InitEvent(event, nullptr);
                     event.mOffset = uint32_t(ae->Start());
                     event.mLength = uint32_t(ae->End() - ae->Start());
                     event.mExpandToClusterBoundary = false;
                     DispatchEvent(&event);
                 }
 
                 {
-                    WidgetQueryContentEvent queryEvent(true,
-                                                       NS_QUERY_SELECTED_TEXT,
+                    WidgetQueryContentEvent queryEvent(true, eQuerySelectedText,
                                                        this);
                     InitEvent(queryEvent, nullptr);
                     DispatchEvent(&queryEvent);
                     MOZ_ASSERT(queryEvent.mSucceeded);
                     event.mData = queryEvent.mReply.mString;
                 }
 
                 {
@@ -2222,17 +2220,17 @@ nsWindow::FlushIMEChanges()
         }
 
         GeckoAppShell::NotifyIMEChange(event.mReply.mString, change.mStart,
                                        change.mOldEnd, change.mNewEnd);
     }
     mIMETextChanges.Clear();
 
     if (mIMESelectionChanged) {
-        WidgetQueryContentEvent event(true, NS_QUERY_SELECTED_TEXT, this);
+        WidgetQueryContentEvent event(true, eQuerySelectedText, this);
         InitEvent(event, nullptr);
 
         DispatchEvent(&event);
         NS_ENSURE_TRUE_VOID(event.mSucceeded);
         NS_ENSURE_TRUE_VOID(event.mReply.mContentsRoot == imeRoot.get());
 
         GeckoAppShell::NotifyIMEChange(EmptyString(),
                                        int32_t(event.GetSelectionStart()),
--- a/widget/cocoa/TextInputHandler.mm
+++ b/widget/cocoa/TextInputHandler.mm
@@ -3093,17 +3093,17 @@ IMEInputHandler::SelectedRange()
 
   if (mSelectedRange.location != NSNotFound) {
     MOZ_ASSERT(mIMEHasFocus);
     return mSelectedRange;
   }
 
   nsRefPtr<IMEInputHandler> kungFuDeathGrip(this);
 
-  WidgetQueryContentEvent selection(true, NS_QUERY_SELECTED_TEXT, mWidget);
+  WidgetQueryContentEvent selection(true, eQuerySelectedText, mWidget);
   DispatchEvent(selection);
 
   MOZ_LOG(gLog, LogLevel::Info,
     ("%p IMEInputHandler::SelectedRange, selection={ mSucceeded=%s, "
      "mReply={ mOffset=%llu, mString.Length()=%llu } }",
      this, TrueOrFalse(selection.mSucceeded), selection.mReply.mOffset,
      selection.mReply.mString.Length()));
 
--- a/widget/cocoa/nsChildView.mm
+++ b/widget/cocoa/nsChildView.mm
@@ -1819,17 +1819,17 @@ nsChildView::ExecuteNativeKeyBinding(Nat
                                      void* aCallbackData)
 {
   // If the key is a cursor-movement arrow, and the current selection has
   // vertical writing-mode, we'll remap so that the movement command
   // generated (in terms of characters/lines) will be appropriate for
   // the physical direction of the arrow.
   if (aEvent.keyCode >= nsIDOMKeyEvent::DOM_VK_LEFT &&
       aEvent.keyCode <= nsIDOMKeyEvent::DOM_VK_DOWN) {
-    WidgetQueryContentEvent query(true, NS_QUERY_SELECTED_TEXT, this);
+    WidgetQueryContentEvent query(true, eQuerySelectedText, this);
     DispatchWindowEvent(query);
 
     if (query.mSucceeded && query.mReply.mWritingMode.IsVertical()) {
       uint32_t geckoKey = 0;
       uint32_t cocoaKey = 0;
 
       switch (aEvent.keyCode) {
       case nsIDOMKeyEvent::DOM_VK_LEFT:
--- a/widget/gtk/IMContextWrapper.cpp
+++ b/widget/gtk/IMContextWrapper.cpp
@@ -2147,17 +2147,17 @@ IMContextWrapper::EnsureToCacheSelection
         MOZ_LOG(gGtkIMLog, LogLevel::Error,
                 ("GTKIM: %p EnsureToCacheSelection(), FAILED, due to "
                  "no focused window",
                  this));
         return false;
     }
 
     nsEventStatus status;
-    WidgetQueryContentEvent selection(true, NS_QUERY_SELECTED_TEXT,
+    WidgetQueryContentEvent selection(true, eQuerySelectedText,
                                       mLastFocusedWindow);
     InitEvent(selection);
     mLastFocusedWindow->DispatchEvent(&selection, status);
     if (NS_WARN_IF(!selection.mSucceeded)) {
         MOZ_LOG(gGtkIMLog, LogLevel::Error,
                 ("GTKIM: %p EnsureToCacheSelection(), FAILED, due to "
                  "failure of query selection event",
                  this));
@@ -2196,17 +2196,17 @@ IMContextWrapper::Selection::Assign(cons
     mOffset = aIMENotification.mSelectionChangeData.mOffset;
     mLength = aIMENotification.mSelectionChangeData.Length();
     mWritingMode = aIMENotification.mSelectionChangeData.GetWritingMode();
 }
 
 void
 IMContextWrapper::Selection::Assign(const WidgetQueryContentEvent& aEvent)
 {
-    MOZ_ASSERT(aEvent.mMessage == NS_QUERY_SELECTED_TEXT);
+    MOZ_ASSERT(aEvent.mMessage == eQuerySelectedText);
     MOZ_ASSERT(aEvent.mSucceeded);
     mOffset = aEvent.mReply.mOffset;
     mLength = aEvent.mReply.mString.Length();
     mWritingMode = aEvent.GetWritingMode();
 }
 
 } // namespace widget
 } // namespace mozilla
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -6197,17 +6197,17 @@ nsWindow::ExecuteNativeKeyBinding(Native
                                   DoCommandCallback aCallback,
                                   void* aCallbackData)
 {
     if (aEvent.keyCode >= nsIDOMKeyEvent::DOM_VK_LEFT &&
         aEvent.keyCode <= nsIDOMKeyEvent::DOM_VK_DOWN) {
 
         // Check if we're targeting content with vertical writing mode,
         // and if so remap the arrow keys.
-        WidgetQueryContentEvent query(true, NS_QUERY_SELECTED_TEXT, this);
+        WidgetQueryContentEvent query(true, eQuerySelectedText, this);
         nsEventStatus status;
         DispatchEvent(&query, status);
 
         if (query.mSucceeded && query.mReply.mWritingMode.IsVertical()) {
             uint32_t geckoCode = 0;
             uint32_t gdkCode = 0;
             switch (aEvent.keyCode) {
             case nsIDOMKeyEvent::DOM_VK_LEFT:
--- a/widget/tests/TestWinTSF.cpp
+++ b/widget/tests/TestWinTSF.cpp
@@ -1881,19 +1881,19 @@ TestApp::TestSelectionInternal(char* aTe
 }
 
 bool
 TestApp::TestSelection(void)
 {
   bool succeeded = true;
 
   /* If these fail the cause is probably one or more of:
-   * nsTextStore::GetSelection not sending NS_QUERY_SELECTED_TEXT
-   * NS_QUERY_SELECTED_TEXT not handled by ContentEventHandler
-   * Bug in NS_QUERY_SELECTED_TEXT handler
+   * nsTextStore::GetSelection not sending eQuerySelectedText
+   * eQuerySelectedText not handled by ContentEventHandler
+   * Bug in eQuerySelectedText handler
    * nsTextStore::SetSelection not sending eSetSelection
    * eSetSelection not handled by ContentEventHandler
    * Bug in eSetSelection handler
    */
 
   TS_SELECTION_ACP testSel;
   ULONG selFetched;
 
--- a/widget/windows/IMMHandler.cpp
+++ b/widget/windows/IMMHandler.cpp
@@ -2748,24 +2748,23 @@ IMMHandler::Selection::Update(const IMEN
   return true;
 }
 
 bool
 IMMHandler::Selection::Init(nsWindow* aWindow)
 {
   Clear();
 
-  WidgetQueryContentEvent selection(true, NS_QUERY_SELECTED_TEXT, aWindow);
+  WidgetQueryContentEvent selection(true, eQuerySelectedText, aWindow);
   nsIntPoint point(0, 0);
   aWindow->InitEvent(selection, &point);
   aWindow->DispatchWindowEvent(&selection);
   if (NS_WARN_IF(!selection.mSucceeded)) {
     MOZ_LOG(gIMMLog, LogLevel::Error,
-      ("IMM: Selection::Init, FAILED, due to NS_QUERY_SELECTED_TEXT "
-       "failure"));
+      ("IMM: Selection::Init, FAILED, due to eQuerySelectedText failure"));
     return false;
   }
   // If the window is destroyed during querying selected text, we shouldn't
   // do anymore.
   if (aWindow->Destroyed()) {
     MOZ_LOG(gIMMLog, LogLevel::Error,
       ("IMM: Selection::Init, FAILED, due to the widget destroyed"));
     return false;
--- a/widget/windows/TSFTextStore.cpp
+++ b/widget/windows/TSFTextStore.cpp
@@ -2104,18 +2104,17 @@ TSFTextStore::CurrentSelection()
 {
   if (mSelection.IsDirty()) {
     // If the window has never been available, we should crash since working
     // with broken values may make TIP confused.
     if (!mWidget || mWidget->Destroyed()) {
       MOZ_CRASH();
     }
 
-    WidgetQueryContentEvent querySelection(true, NS_QUERY_SELECTED_TEXT,
-                                           mWidget);
+    WidgetQueryContentEvent querySelection(true, eQuerySelectedText, mWidget);
     mWidget->InitEvent(querySelection);
     DispatchEvent(querySelection);
     NS_ENSURE_TRUE(querySelection.mSucceeded, mSelection);
 
     mSelection.SetSelection(querySelection.mReply.mOffset,
                             querySelection.mReply.mString.Length(),
                             querySelection.mReply.mReversed,
                             querySelection.GetWritingMode());