Bug 895274 part.187 Rename NS_QUERY_TEXT_RECT to eQueryTextRect r=smaug
authorMasayuki Nakano <masayuki@d-toybox.com>
Fri, 11 Sep 2015 21:21:26 +0900
changeset 262004 c8d53164ac16956a6443bfefc71eae50001453d5
parent 262003 5a8d865828391b761cff448445d119ad90a470ed
child 262005 6b29914363f3a7d104ec0d99c32e2b0abac0a8c9
push idunknown
push userunknown
push dateunknown
reviewerssmaug
bugs895274
milestone43.0a1
Bug 895274 part.187 Rename NS_QUERY_TEXT_RECT to eQueryTextRect r=smaug
dom/base/nsDOMWindowUtils.cpp
dom/base/nsQueryContentEventResult.cpp
dom/events/ContentEventHandler.cpp
dom/events/ContentEventHandler.h
dom/events/EventStateManager.cpp
dom/events/IMEContentObserver.cpp
dom/ipc/TabParent.cpp
widget/ContentCache.cpp
widget/ContentCache.h
widget/EventMessageList.h
widget/TextEvents.h
widget/cocoa/TextInputHandler.mm
widget/gtk/IMContextWrapper.cpp
widget/windows/IMMHandler.cpp
widget/windows/TSFTextStore.cpp
--- a/dom/base/nsDOMWindowUtils.cpp
+++ b/dom/base/nsDOMWindowUtils.cpp
@@ -1931,17 +1931,17 @@ nsDOMWindowUtils::SendQueryContentEvent(
       break;
     case QUERY_TEXT_CONTENT:
       message = eQueryTextContent;
       break;
     case QUERY_CARET_RECT:
       message = eQueryCaretRect;
       break;
     case QUERY_TEXT_RECT:
-      message = NS_QUERY_TEXT_RECT;
+      message = eQueryTextRect;
       break;
     case QUERY_EDITOR_RECT:
       message = eQueryEditorRect;
       break;
     case QUERY_CHARACTER_AT_POINT:
       message = eQueryCharacterAtPoint;
       break;
     default:
@@ -1986,17 +1986,17 @@ nsDOMWindowUtils::SendQueryContentEvent(
 
   switch (message) {
     case eQueryTextContent:
       queryEvent.InitForQueryTextContent(aOffset, aLength, useNativeLineBreak);
       break;
     case eQueryCaretRect:
       queryEvent.InitForQueryCaretRect(aOffset, useNativeLineBreak);
       break;
-    case NS_QUERY_TEXT_RECT:
+    case eQueryTextRect:
       queryEvent.InitForQueryTextRect(aOffset, aLength, useNativeLineBreak);
       break;
     default:
       queryEvent.mUseNativeLineBreak = useNativeLineBreak;
       break;
   }
 
   nsEventStatus status;
--- a/dom/base/nsQueryContentEventResult.cpp
+++ b/dom/base/nsQueryContentEventResult.cpp
@@ -53,17 +53,17 @@ nsQueryContentEventResult::GetTentativeC
   }
   *aOffset = mTentativeCaretOffset;
   return NS_OK;
 }
 
 static bool IsRectEnabled(EventMessage aEventMessage)
 {
   return aEventMessage == eQueryCaretRect ||
-         aEventMessage == NS_QUERY_TEXT_RECT ||
+         aEventMessage == eQueryTextRect ||
          aEventMessage == eQueryEditorRect ||
          aEventMessage == eQueryCharacterAtPoint;
 }
 
 NS_IMETHODIMP
 nsQueryContentEventResult::GetReversed(bool *aReversed)
 {
   NS_ENSURE_TRUE(mSucceeded, NS_ERROR_NOT_AVAILABLE);
--- a/dom/events/ContentEventHandler.cpp
+++ b/dom/events/ContentEventHandler.cpp
@@ -797,17 +797,17 @@ ContentEventHandler::HandleQueryContentE
 {
   switch (aEvent->mMessage) {
     case eQuerySelectedText:
       return OnQuerySelectedText(aEvent);
     case eQueryTextContent:
       return OnQueryTextContent(aEvent);
     case eQueryCaretRect:
       return OnQueryCaretRect(aEvent);
-    case NS_QUERY_TEXT_RECT:
+    case eQueryTextRect:
       return OnQueryTextRect(aEvent);
     case eQueryEditorRect:
       return OnQueryEditorRect(aEvent);
     case eQueryContentState:
       return OnQueryContentState(aEvent);
     case eQuerySelectionAsTransferable:
       return OnQuerySelectionAsTransferable(aEvent);
     case eQueryCharacterAtPoint:
@@ -1325,17 +1325,17 @@ ContentEventHandler::OnQueryCharacterAtP
     textframe->GetCharacterOffsetAtFramePoint(ptInTarget);
   NS_ENSURE_TRUE(contentOffsets.content, NS_ERROR_FAILURE);
   uint32_t offset;
   rv = GetFlatTextOffsetOfRange(mRootContent, contentOffsets.content,
                                 contentOffsets.offset, &offset,
                                 GetLineBreakType(aEvent));
   NS_ENSURE_SUCCESS(rv, rv);
 
-  WidgetQueryContentEvent textRect(true, NS_QUERY_TEXT_RECT, aEvent->widget);
+  WidgetQueryContentEvent textRect(true, eQueryTextRect, aEvent->widget);
   textRect.InitForQueryTextRect(offset, 1, aEvent->mUseNativeLineBreak);
   rv = OnQueryTextRect(&textRect);
   NS_ENSURE_SUCCESS(rv, rv);
   NS_ENSURE_TRUE(textRect.mSucceeded, NS_ERROR_FAILURE);
 
   // currently, we don't need to get the actual text.
   aEvent->mReply.mOffset = offset;
   aEvent->mReply.mRect = textRect.mReply.mRect;
--- a/dom/events/ContentEventHandler.h
+++ b/dom/events/ContentEventHandler.h
@@ -43,17 +43,17 @@ public:
   nsresult HandleQueryContentEvent(WidgetQueryContentEvent* aEvent);
 
   // eQuerySelectedText event handler
   nsresult OnQuerySelectedText(WidgetQueryContentEvent* aEvent);
   // eQueryTextContent event handler
   nsresult OnQueryTextContent(WidgetQueryContentEvent* aEvent);
   // eQueryCaretRect event handler
   nsresult OnQueryCaretRect(WidgetQueryContentEvent* aEvent);
-  // NS_QUERY_TEXT_RECT event handler
+  // eQueryTextRect event handler
   nsresult OnQueryTextRect(WidgetQueryContentEvent* aEvent);
   // eQueryEditorRect event handler
   nsresult OnQueryEditorRect(WidgetQueryContentEvent* aEvent);
   // eQueryContentState event handler
   nsresult OnQueryContentState(WidgetQueryContentEvent* aEvent);
   // eQuerySelectionAsTransferable event handler
   nsresult OnQuerySelectionAsTransferable(WidgetQueryContentEvent* aEvent);
   // eQueryCharacterAtPoint event handler
--- a/dom/events/EventStateManager.cpp
+++ b/dom/events/EventStateManager.cpp
@@ -779,17 +779,17 @@ EventStateManager::PreHandleEvent(nsPres
 
 void
 EventStateManager::HandleQueryContentEvent(WidgetQueryContentEvent* aEvent)
 {
   switch (aEvent->mMessage) {
     case eQuerySelectedText:
     case eQueryTextContent:
     case eQueryCaretRect:
-    case NS_QUERY_TEXT_RECT:
+    case eQueryTextRect:
     case eQueryEditorRect:
       if (!IsTargetCrossProcess(aEvent)) {
         break;
       }
       // Will not be handled locally, remote the event
       GetCrossProcessTarget()->HandleQueryContentEvent(*aEvent);
       return;
     // Following events have not been supported in e10s mode yet.
--- a/dom/events/IMEContentObserver.cpp
+++ b/dom/events/IMEContentObserver.cpp
@@ -52,18 +52,18 @@ ToChar(EventMessage aEventMessage)
 {
   switch (aEventMessage) {
     case eQuerySelectedText:
       return "eQuerySelectedText";
     case eQueryTextContent:
       return "eQueryTextContent";
     case eQueryCaretRect:
       return "eQueryCaretRect";
-    case NS_QUERY_TEXT_RECT:
-      return "NS_QUERY_TEXT_RECT";
+    case eQueryTextRect:
+      return "eQueryTextRect";
     case eQueryEditorRect:
       return "eQueryEditorRect";
     case eQueryContentState:
       return "eQueryContentState";
     case eQuerySelectionAsTransferable:
       return "eQuerySelectionAsTransferable";
     case eQueryCharacterAtPoint:
       return "eQueryCharacterAtPoint";
--- a/dom/ipc/TabParent.cpp
+++ b/dom/ipc/TabParent.cpp
@@ -2364,17 +2364,17 @@ TabParent::HandleQueryContentEvent(Widge
   if (!widget) {
     return true;
   }
   if (NS_WARN_IF(!mContentCache.HandleQueryContentEvent(aEvent, widget)) ||
       NS_WARN_IF(!aEvent.mSucceeded)) {
     return true;
   }
   switch (aEvent.mMessage) {
-    case NS_QUERY_TEXT_RECT:
+    case eQueryTextRect:
     case eQueryCaretRect:
     case eQueryEditorRect:
       aEvent.mReply.mRect -= GetChildProcessOffset();
       break;
     default:
       break;
   }
   return true;
--- a/widget/ContentCache.cpp
+++ b/widget/ContentCache.cpp
@@ -297,17 +297,17 @@ ContentCacheInChild::CacheText(nsIWidget
 bool
 ContentCacheInChild::QueryCharRect(nsIWidget* aWidget,
                                    uint32_t aOffset,
                                    LayoutDeviceIntRect& aCharRect) const
 {
   aCharRect.SetEmpty();
 
   nsEventStatus status = nsEventStatus_eIgnore;
-  WidgetQueryContentEvent textRect(true, NS_QUERY_TEXT_RECT, aWidget);
+  WidgetQueryContentEvent textRect(true, eQueryTextRect, aWidget);
   textRect.InitForQueryTextRect(aOffset, 1);
   aWidget->DispatchEvent(&textRect, status);
   if (NS_WARN_IF(!textRect.mSucceeded)) {
     return false;
   }
   aCharRect = textRect.mReply.mRect;
 
   // Guarantee the rect is not empty.
@@ -389,17 +389,17 @@ ContentCacheInChild::CacheTextRects(nsIW
          "couldn't retrieve text rect at focus of selection (%u)",
          this, mSelection.mFocus));
     }
     mSelection.mFocusCharRect = charRect;
   }
 
   if (!mSelection.Collapsed()) {
     nsEventStatus status = nsEventStatus_eIgnore;
-    WidgetQueryContentEvent textRect(true, NS_QUERY_TEXT_RECT, aWidget);
+    WidgetQueryContentEvent textRect(true, eQueryTextRect, aWidget);
     textRect.InitForQueryTextRect(mSelection.StartOffset(),
                                   mSelection.Length());
     aWidget->DispatchEvent(&textRect, status);
     if (NS_WARN_IF(!textRect.mSucceeded)) {
       MOZ_LOG(sContentCacheLog, LogLevel::Error,
         ("ContentCacheInChild: 0x%p CacheTextRects(), FAILED, "
          "couldn't retrieve text rect of whole selected text", this));
     } else {
@@ -578,20 +578,20 @@ ContentCacheInParent::HandleQueryContent
       aEvent.mReply.mString =
         Substring(mText, inputOffset, inputEndOffset - inputOffset);
       MOZ_LOG(sContentCacheLog, LogLevel::Info,
         ("ContentCacheInParent: 0x%p HandleQueryContentEvent(), "
          "Succeeded, aEvent={ mReply={ mOffset=%u, mString.Length()=%u } }",
          this, aEvent.mReply.mOffset, aEvent.mReply.mString.Length()));
       break;
     }
-    case NS_QUERY_TEXT_RECT:
+    case eQueryTextRect:
       MOZ_LOG(sContentCacheLog, LogLevel::Info,
         ("ContentCacheInParent: 0x%p HandleQueryContentEvent("
-         "aEvent={ mMessage=NS_QUERY_TEXT_RECT, mInput={ mOffset=%u, "
+         "aEvent={ mMessage=eQueryTextRect, mInput={ mOffset=%u, "
          "mLength=%u } }, aWidget=0x%p), mText.Length()=%u",
          this, aEvent.mInput.mOffset, aEvent.mInput.mLength, aWidget,
          mText.Length()));
       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(), "
--- a/widget/ContentCache.h
+++ b/widget/ContentCache.h
@@ -288,17 +288,17 @@ public:
    *
    * For eQueryTextContent, fail only if the cache doesn't overlap with
    *  the queried range. Note the difference from above. We use
    *  this behavior because a normal eQueryTextContent 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
    *  the returned offset/length are different from the queried offset/length.
    *
-   * For NS_QUERY_TEXT_RECT, fail if cached offset/length aren't equals to input.
+   * For eQueryTextRect, fail if cached offset/length aren't equals to input.
    *   Cocoa widget always queries selected offset, so it works on it.
    *
    * For eQueryCaretRect, fail if cached offset isn't equals to input
    *
    * For eQueryEditorRect, always success
    */
   bool HandleQueryContentEvent(WidgetQueryContentEvent& aEvent,
                                nsIWidget* aWidget) const;
--- a/widget/EventMessageList.h
+++ b/widget/EventMessageList.h
@@ -221,17 +221,17 @@ NS_EVENT_MESSAGE(eQuerySelectedText,    
 // Returns the entire text if requested length > actual length.
 NS_EVENT_MESSAGE(eQueryTextContent,             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(eQueryCaretRect,               eQueryContentEventFirst + 3)
 // Query for the bounding rect of a range of characters. This works on any
 // valid character range given offset and length. Result is relative to top
 // level widget coordinates
-NS_EVENT_MESSAGE(NS_QUERY_TEXT_RECT,            eQueryContentEventFirst + 4)
+NS_EVENT_MESSAGE(eQueryTextRect,                eQueryContentEventFirst + 4)
 // Query for the bounding rect of the current focused frame. Result is relative
 // to top level widget coordinates
 NS_EVENT_MESSAGE(eQueryEditorRect,              eQueryContentEventFirst + 5)
 // Query for the current state of the content. The particular members of
 // mReply that are set for each query content event will be valid on success.
 NS_EVENT_MESSAGE(eQueryContentState,            eQueryContentEventFirst + 6)
 // Query for the selection in the form of a nsITransferable.
 NS_EVENT_MESSAGE(eQuerySelectionAsTransferable, eQueryContentEventFirst + 7)
--- a/widget/TextEvents.h
+++ b/widget/TextEvents.h
@@ -509,17 +509,17 @@ public:
                  "wrong initializer is called");
     mInput.mOffset = aOffset;
     mUseNativeLineBreak = aUseNativeLineBreak;
   }
 
   void InitForQueryTextRect(uint32_t aOffset, uint32_t aLength,
                             bool aUseNativeLineBreak = true)
   {
-    NS_ASSERTION(mMessage == NS_QUERY_TEXT_RECT,
+    NS_ASSERTION(mMessage == eQueryTextRect,
                  "wrong initializer is called");
     mInput.mOffset = aOffset;
     mInput.mLength = aLength;
     mUseNativeLineBreak = aUseNativeLineBreak;
   }
 
   void InitForQueryDOMWidgetHittest(const mozilla::LayoutDeviceIntPoint& aPoint)
   {
@@ -548,17 +548,17 @@ public:
                  "not querying selection");
     return mReply.mOffset + (mReply.mReversed ? 0 : mReply.mString.Length());
   }
 
   mozilla::WritingMode GetWritingMode(void) const
   {
     NS_ASSERTION(mMessage == eQuerySelectedText ||
                  mMessage == eQueryCaretRect ||
-                 mMessage == NS_QUERY_TEXT_RECT,
+                 mMessage == eQueryTextRect,
                  "not querying selection or text rect");
     return mReply.mWritingMode;
   }
 
   bool mSucceeded;
   bool mUseNativeLineBreak;
   bool mWithFontRanges;
   struct
--- a/widget/cocoa/TextInputHandler.mm
+++ b/widget/cocoa/TextInputHandler.mm
@@ -3181,17 +3181,17 @@ IMEInputHandler::FirstRectForCharacterRa
     return rect;
   }
 
   nsRefPtr<IMEInputHandler> kungFuDeathGrip(this);
 
   LayoutDeviceIntRect r;
   bool useCaretRect = (aRange.length == 0);
   if (!useCaretRect) {
-    WidgetQueryContentEvent charRect(true, NS_QUERY_TEXT_RECT, mWidget);
+    WidgetQueryContentEvent charRect(true, eQueryTextRect, mWidget);
     charRect.InitForQueryTextRect(aRange.location, 1);
     DispatchEvent(charRect);
     if (charRect.mSucceeded) {
       r = charRect.mReply.mRect;
       actualRange.location = charRect.mReply.mOffset;
       actualRange.length = charRect.mReply.mString.Length();
       mWritingMode = charRect.GetWritingMode();
       mRangeForWritingMode = actualRange;
--- a/widget/gtk/IMContextWrapper.cpp
+++ b/widget/gtk/IMContextWrapper.cpp
@@ -1806,17 +1806,17 @@ IMContextWrapper::SetCursorPosition(GtkI
         MOZ_LOG(gGtkIMLog, LogLevel::Error,
             ("GTKIM: %p   SetCursorPosition(), FAILED, due to no context",
              this));
         return;
     }
 
     WidgetQueryContentEvent charRect(true,
                                      useCaret ? eQueryCaretRect :
-                                                NS_QUERY_TEXT_RECT,
+                                                eQueryTextRect,
                                      mLastFocusedWindow);
     if (useCaret) {
         charRect.InitForQueryCaretRect(mSelection.mOffset);
     } else {
         if (mSelection.mWritingMode.IsVertical()) {
             // For preventing the candidate window to overlap the target
             // clause, we should set fake (typically, very tall) caret rect.
             uint32_t length = mCompositionTargetRange.mLength ?
@@ -1828,17 +1828,17 @@ IMContextWrapper::SetCursorPosition(GtkI
         }
     }
     InitEvent(charRect);
     nsEventStatus status;
     mLastFocusedWindow->DispatchEvent(&charRect, status);
     if (!charRect.mSucceeded) {
         MOZ_LOG(gGtkIMLog, LogLevel::Error,
             ("GTKIM: %p   SetCursorPosition(), FAILED, %s was failed",
-             this, useCaret ? "eQueryCaretRect" : "NS_QUERY_TEXT_RECT"));
+             this, useCaret ? "eQueryCaretRect" : "eQueryTextRect"));
         return;
     }
 
     nsWindow* rootWindow =
         static_cast<nsWindow*>(mLastFocusedWindow->GetTopLevelWidget());
 
     // Get the position of the rootWindow in screen.
     LayoutDeviceIntPoint root = rootWindow->WidgetToScreenOffset();
--- a/widget/windows/IMMHandler.cpp
+++ b/widget/windows/IMMHandler.cpp
@@ -2160,17 +2160,17 @@ IMMHandler::GetCharacterRectOfSelectedTe
       // If there is no composition, the selection offset is the caret offset.
       caretOffset = selection.mOffset;
     }
   }
 
   // If there is a caret and retrieving offset is same as the caret offset,
   // we should use the caret rect.
   if (offset != caretOffset) {
-    WidgetQueryContentEvent charRect(true, NS_QUERY_TEXT_RECT, aWindow);
+    WidgetQueryContentEvent charRect(true, eQueryTextRect, aWindow);
     charRect.InitForQueryTextRect(offset, 1);
     aWindow->InitEvent(charRect, &point);
     aWindow->DispatchWindowEvent(&charRect);
     if (charRect.mSucceeded) {
       aCharRect = LayoutDevicePixel::ToUntyped(charRect.mReply.mRect);
       if (aWritingMode) {
         *aWritingMode = charRect.GetWritingMode();
       }
--- a/widget/windows/TSFTextStore.cpp
+++ b/widget/windows/TSFTextStore.cpp
@@ -3419,17 +3419,17 @@ TSFTextStore::GetACPFromPoint(TsViewCook
     // the point.
     offset = charAtPt.mReply.mOffset;
   } else {
     // If the point isn't in any character's bounding box but we need to return
     // the nearest character from the point, we should *guess* the character
     // offset since there is no inexpensive API to check it strictly.
     // XXX If we retrieve 2 bounding boxes, one is before the offset and
     //     the other is after the offset, we could resolve the offset.
-    //     However, dispatching 2 NS_QUERY_TEXT_RECT may be expensive.
+    //     However, dispatching 2 eQueryTextRect may be expensive.
 
     // So, use tentative offset for now.
     offset = charAtPt.mReply.mTentativeCaretOffset;
 
     // However, if it's after the last character, we need to decrement the
     // offset.
     Content& lockedContent = LockedContent();
     if (!lockedContent.IsInitialized()) {
@@ -3578,25 +3578,25 @@ TSFTextStore::GetTextExt(TsViewCookie vc
   if (mLockedContent.IsLayoutChangedAfter(acpEnd)) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
            ("TSF: 0x%p   TSFTextStore::GetTextExt() FAILED due to "
             "layout not recomputed at %d", this, acpEnd));
     mPendingOnLayoutChange = true;
     return TS_E_NOLAYOUT;
   }
 
-  // use NS_QUERY_TEXT_RECT to get rect in system, screen coordinates
-  WidgetQueryContentEvent event(true, NS_QUERY_TEXT_RECT, mWidget);
+  // use eQueryTextRect to get rect in system, screen coordinates
+  WidgetQueryContentEvent event(true, eQueryTextRect, mWidget);
   mWidget->InitEvent(event);
   event.InitForQueryTextRect(acpStart, acpEnd - acpStart);
   DispatchEvent(event);
   if (!event.mSucceeded) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
            ("TSF: 0x%p   TSFTextStore::GetTextExt() FAILED due to "
-            "NS_QUERY_TEXT_RECT failure", this));
+            "eQueryTextRect failure", this));
     return TS_E_INVALIDPOS; // but unexpected failure, maybe.
   }
   // IMEs don't like empty rects, fix here
   if (event.mReply.mRect.width <= 0)
     event.mReply.mRect.width = 1;
   if (event.mReply.mRect.height <= 0)
     event.mReply.mRect.height = 1;