Bug 1277756 part.3 Rename TextRangeType::NS_TEXTRANGE_CARETPOSITION to TextRangeType::eCaret r=smaug
authorMasayuki Nakano <masayuki@d-toybox.com>
Fri, 03 Jun 2016 18:40:06 +0900
changeset 300524 41c18a6bdd84280957714167a4f7dc2b7408167e
parent 300523 93278105babfbc4ad72a55fd421df8fbc47f4dc5
child 300525 04cc8a274c7f36536aaacea7fc4657250d5b527a
push id30313
push usercbook@mozilla.com
push dateMon, 06 Jun 2016 09:56:25 +0000
treeherdermozilla-central@0a3b6e2df656 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1277756
milestone49.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 1277756 part.3 Rename TextRangeType::NS_TEXTRANGE_CARETPOSITION to TextRangeType::eCaret r=smaug MozReview-Commit-ID: CaqmOSxYYU7
editor/libeditor/IMETextTxn.cpp
widget/TextEventDispatcher.cpp
widget/TextRange.h
widget/WidgetEventImpl.cpp
widget/cocoa/TextInputHandler.mm
widget/gtk/IMContextWrapper.cpp
widget/windows/IMMHandler.cpp
widget/windows/TSFTextStore.cpp
--- a/editor/libeditor/IMETextTxn.cpp
+++ b/editor/libeditor/IMETextTxn.cpp
@@ -208,17 +208,17 @@ IMETextTxn::SetIMESelection(nsEditor& aE
   // NOTE: composition string may be truncated when it's committed and
   //       maxlength attribute value doesn't allow input of all text of this
   //       composition.
   for (uint32_t i = 0; i < countOfRanges; ++i) {
     const TextRange& textRange = aRanges->ElementAt(i);
 
     // Caret needs special handling since its length may be 0 and if it's not
     // specified explicitly, we need to handle it ourselves later.
-    if (textRange.mRangeType == TextRangeType::NS_TEXTRANGE_CARETPOSITION) {
+    if (textRange.mRangeType == TextRangeType::eCaret) {
       NS_ASSERTION(!setCaret, "The ranges already has caret position");
       NS_ASSERTION(!textRange.Length(), "nsEditor doesn't support wide caret");
       int32_t caretOffset = static_cast<int32_t>(
         aOffsetInNode +
           std::min(textRange.mStartOffset, aLengthOfCompositionString));
       MOZ_ASSERT(caretOffset >= 0 &&
                  static_cast<uint32_t>(caretOffset) <= maxOffset);
       rv = selection->Collapse(aTextNode, caretOffset);
--- a/widget/TextEventDispatcher.cpp
+++ b/widget/TextEventDispatcher.cpp
@@ -643,17 +643,17 @@ TextEventDispatcher::PendingComposition:
 }
 
 nsresult
 TextEventDispatcher::PendingComposition::SetCaret(uint32_t aOffset,
                                                   uint32_t aLength)
 {
   mCaret.mStartOffset = aOffset;
   mCaret.mEndOffset = mCaret.mStartOffset + aLength;
-  mCaret.mRangeType = TextRangeType::NS_TEXTRANGE_CARETPOSITION;
+  mCaret.mRangeType = TextRangeType::eCaret;
   return NS_OK;
 }
 
 nsresult
 TextEventDispatcher::PendingComposition::Set(const nsAString& aString,
                                              const TextRangeArray* aRanges)
 {
   Clear();
@@ -694,17 +694,17 @@ TextEventDispatcher::PendingComposition:
       range.mEndOffset = range.mStartOffset;
     } else {
       nsAutoString clause(
         Substring(aString, nativeRange.mStartOffset, nativeRange.Length()));
       clause.ReplaceSubstring(NS_LITERAL_STRING("\r\n"),
                               NS_LITERAL_STRING("\n"));
       range.mEndOffset = range.mStartOffset + clause.Length();
     }
-    if (range.mRangeType == TextRangeType::NS_TEXTRANGE_CARETPOSITION) {
+    if (range.mRangeType == TextRangeType::eCaret) {
       mCaret = range;
     } else {
       EnsureClauseArray();
       mClauses->AppendElement(range);
     }
   }
   return NS_OK;
 }
@@ -724,17 +724,17 @@ TextEventDispatcher::PendingComposition:
 
   if (mClauses && !mClauses->IsEmpty() &&
       mClauses->LastElement().mEndOffset != mString.Length()) {
     NS_WARNING("Sum of length of the all clauses must be same as the string "
                "length");
     Clear();
     return NS_ERROR_ILLEGAL_VALUE;
   }
-  if (mCaret.mRangeType == TextRangeType::NS_TEXTRANGE_CARETPOSITION) {
+  if (mCaret.mRangeType == TextRangeType::eCaret) {
     if (mCaret.mEndOffset > mString.Length()) {
       NS_WARNING("Caret position is out of the composition string");
       Clear();
       return NS_ERROR_ILLEGAL_VALUE;
     }
     EnsureClauseArray();
     mClauses->AppendElement(mCaret);
   }
--- a/widget/TextRange.h
+++ b/widget/TextRange.h
@@ -126,17 +126,17 @@ struct TextRangeStyle
 
 /******************************************************************************
  * mozilla::TextRange
  ******************************************************************************/
 
 enum class TextRangeType : RawTextRangeType
 {
   eUninitialized = 0x00,
-  NS_TEXTRANGE_CARETPOSITION = 0x01,
+  eCaret = 0x01,
   NS_TEXTRANGE_RAWINPUT =
     nsITextInputProcessor::ATTR_RAW_CLAUSE,
   NS_TEXTRANGE_SELECTEDRAWTEXT =
     nsITextInputProcessor::ATTR_SELECTED_RAW_CLAUSE,
   NS_TEXTRANGE_CONVERTEDTEXT =
     nsITextInputProcessor::ATTR_CONVERTED_CLAUSE,
   NS_TEXTRANGE_SELECTEDCONVERTEDTEXT =
     nsITextInputProcessor::ATTR_SELECTED_CLAUSE
@@ -164,17 +164,17 @@ struct TextRange
   TextRangeStyle mRangeStyle;
 
   TextRangeType mRangeType;
 
   uint32_t Length() const { return mEndOffset - mStartOffset; }
 
   bool IsClause() const
   {
-    return mRangeType != TextRangeType::NS_TEXTRANGE_CARETPOSITION;
+    return mRangeType != TextRangeType::eCaret;
   }
 
   bool Equals(const TextRange& aOther) const
   {
     return mStartOffset == aOther.mStartOffset &&
            mEndOffset == aOther.mEndOffset &&
            mRangeType == aOther.mRangeType &&
            mRangeStyle == aOther.mRangeStyle;
@@ -260,27 +260,27 @@ public:
     for (size_t i = 0, len = Length(); i < len; i++) {
       ElementAt(i).RemoveCharacter(aOffset);
     }
   }
 
   bool HasCaret() const
   {
     for (const TextRange& range : *this) {
-      if (range.mRangeType == TextRangeType::NS_TEXTRANGE_CARETPOSITION) {
+      if (range.mRangeType == TextRangeType::eCaret) {
         return true;
       }
     }
     return false;
   }
 
   uint32_t GetCaretPosition() const
   {
     for (const TextRange& range : *this) {
-      if (range.mRangeType == TextRangeType::NS_TEXTRANGE_CARETPOSITION) {
+      if (range.mRangeType == TextRangeType::eCaret) {
         return range.mStartOffset;
       }
     }
     return UINT32_MAX;
   }
 };
 
 } // namespace mozilla
--- a/widget/WidgetEventImpl.cpp
+++ b/widget/WidgetEventImpl.cpp
@@ -57,17 +57,17 @@ ToChar(EventClassID aEventClassID)
   }
 }
 
 bool
 IsValidRawTextRangeValue(RawTextRangeType aRawTextRangeType)
 {
   switch (static_cast<TextRangeType>(aRawTextRangeType)) {
     case TextRangeType::eUninitialized:
-    case TextRangeType::NS_TEXTRANGE_CARETPOSITION:
+    case TextRangeType::eCaret:
     case TextRangeType::NS_TEXTRANGE_RAWINPUT:
     case TextRangeType::NS_TEXTRANGE_SELECTEDRAWTEXT:
     case TextRangeType::NS_TEXTRANGE_CONVERTEDTEXT:
     case TextRangeType::NS_TEXTRANGE_SELECTEDCONVERTEDTEXT:
       return true;
     default:
       return false;
   }
@@ -87,18 +87,18 @@ ToTextRangeType(RawTextRangeType aRawTex
 }
 
 const char*
 ToChar(TextRangeType aTextRangeType)
 {
   switch (aTextRangeType) {
     case TextRangeType::eUninitialized:
       return "TextRangeType::eUninitialized";
-    case TextRangeType::NS_TEXTRANGE_CARETPOSITION:
-      return "NS_TEXTRANGE_CARETPOSITION";
+    case TextRangeType::eCaret:
+      return "TextRangeType::eCaret";
     case TextRangeType::NS_TEXTRANGE_RAWINPUT:
       return "NS_TEXTRANGE_RAWINPUT";
     case TextRangeType::NS_TEXTRANGE_SELECTEDRAWTEXT:
       return "NS_TEXTRANGE_SELECTEDRAWTEXT";
     case TextRangeType::NS_TEXTRANGE_CONVERTEDTEXT:
       return "NS_TEXTRANGE_CONVERTEDTEXT";
     case TextRangeType::NS_TEXTRANGE_SELECTEDCONVERTEDTEXT:
       return "NS_TEXTRANGE_SELECTEDCONVERTEDTEXT";
--- a/widget/cocoa/TextInputHandler.mm
+++ b/widget/cocoa/TextInputHandler.mm
@@ -2828,17 +2828,17 @@ IMEInputHandler::CreateTextRangeArray(NS
       NSMakeRange(NSMaxRange(effectiveRange), 
                   NSMaxRange(limitRange) - NSMaxRange(effectiveRange));
   }
 
   // Get current caret position.
   TextRange range;
   range.mStartOffset = aSelectedRange.location + aSelectedRange.length;
   range.mEndOffset = range.mStartOffset;
-  range.mRangeType = TextRangeType::NS_TEXTRANGE_CARETPOSITION;
+  range.mRangeType = TextRangeType::eCaret;
   textRangeArray->AppendElement(range);
 
   MOZ_LOG(gLog, LogLevel::Info,
     ("%p IMEInputHandler::CreateTextRangeArray, "
      "range={ mStartOffset=%llu, mEndOffset=%llu, mRangeType=%s }",
      this, range.mStartOffset, range.mEndOffset,
      ToChar(range.mRangeType)));
 
--- a/widget/gtk/IMContextWrapper.cpp
+++ b/widget/gtk/IMContextWrapper.cpp
@@ -1667,17 +1667,17 @@ IMContextWrapper::CreateTextRangeArray(G
         if (!SetTextRange(iter, preedit_string, caretOffsetInUTF16, range)) {
             continue;
         }
         textRangeArray->AppendElement(range);
     } while (pango_attr_iterator_next(iter));
 
     TextRange range;
     range.mStartOffset = range.mEndOffset = caretOffsetInUTF16;
-    range.mRangeType = TextRangeType::NS_TEXTRANGE_CARETPOSITION;
+    range.mRangeType = TextRangeType::eCaret;
     textRangeArray->AppendElement(range);
     MOZ_LOG(gGtkIMLog, LogLevel::Debug,
         ("GTKIM: %p   CreateTextRangeArray(), mStartOffset=%u, "
          "mEndOffset=%u, mRangeType=%s",
          this, range.mStartOffset, range.mEndOffset,
          ToChar(range.mRangeType)));
 
     pango_attr_iterator_destroy(iter);
--- a/widget/windows/IMMHandler.cpp
+++ b/widget/windows/IMMHandler.cpp
@@ -1900,17 +1900,17 @@ PlatformToNSAttr(uint8_t aAttr)
     case ATTR_CONVERTED:
       return TextRangeType::NS_TEXTRANGE_CONVERTEDTEXT;
     case ATTR_TARGET_NOTCONVERTED:
       return TextRangeType::NS_TEXTRANGE_SELECTEDRAWTEXT;
     case ATTR_TARGET_CONVERTED:
       return TextRangeType::NS_TEXTRANGE_SELECTEDCONVERTEDTEXT;
     default:
       NS_ASSERTION(false, "unknown attribute");
-      return TextRangeType::NS_TEXTRANGE_CARETPOSITION;
+      return TextRangeType::eCaret;
   }
 }
 
 // static
 void
 IMMHandler::DispatchEvent(nsWindow* aWindow, WidgetGUIEvent& aEvent)
 {
   MOZ_LOG(gIMMLog, LogLevel::Info,
--- a/widget/windows/TSFTextStore.cpp
+++ b/widget/windows/TSFTextStore.cpp
@@ -2274,17 +2274,17 @@ TSFTextStore::RestartComposition(ITfComp
                                 commitString);
   // Record a compositionupdate action for commit the part of composing string.
   PendingAction* action = LastOrNewPendingCompositionUpdate();
   action->mData = mComposition.mString;
   action->mRanges->Clear();
   TextRange caretRange;
   caretRange.mStartOffset = caretRange.mEndOffset =
     uint32_t(oldComposition.mStart + commitString.Length());
-  caretRange.mRangeType = TextRangeType::NS_TEXTRANGE_CARETPOSITION;
+  caretRange.mRangeType = TextRangeType::eCaret;
   action->mRanges->AppendElement(caretRange);
   action->mIncomplete = false;
 
   // Record compositionend action.
   RecordCompositionEndAction();
 
   // Record compositionstart action only with the new start since this method
   // hasn't restored composing string yet.
@@ -2536,17 +2536,17 @@ TSFTextStore::RecordCompositionUpdateAct
   // shouldn't be in selection range on Windows, we shouldn't append caret
   // range in such case.
   const TextRange* targetClause = action->mRanges->GetTargetClause();
   if (!targetClause || targetClause->mRangeStyle.IsDefined() ||
       caretPosition < targetClause->mStartOffset ||
       caretPosition > targetClause->mEndOffset) {
     TextRange caretRange;
     caretRange.mStartOffset = caretRange.mEndOffset = caretPosition;
-    caretRange.mRangeType = TextRangeType::NS_TEXTRANGE_CARETPOSITION;
+    caretRange.mRangeType = TextRangeType::eCaret;
     action->mRanges->AppendElement(caretRange);
   }
 
   action->mIncomplete = false;
 
   MOZ_LOG(sTextStoreLog, LogLevel::Info,
          ("TSF: 0x%p   TSFTextStore::RecordCompositionUpdateAction() "
           "succeeded", this));