Bug 1277756 part.7 Rename TextRangeType::NS_TEXTRANGE_SELECTEDCONVERTEDTEXT to TextRangeType::eSelectedClause r?smaug draft
authorMasayuki Nakano <masayuki@d-toybox.com>
Fri, 03 Jun 2016 19:15:21 +0900
changeset 375351 51b69fdbdbc9eff618b08c745db57bce8448bcf6
parent 375350 6c66c1b00dc08deb6e85817edd0b369b5040994e
child 522843 b55ad7676fe332d1c8ae8f3c7c841852f88078b4
push id20248
push usermasayuki@d-toybox.com
push dateSat, 04 Jun 2016 00:57:57 +0000
reviewerssmaug
bugs1277756
milestone49.0a1
Bug 1277756 part.7 Rename TextRangeType::NS_TEXTRANGE_SELECTEDCONVERTEDTEXT to TextRangeType::eSelectedClause r?smaug MozReview-Commit-ID: GyRYWzfeWrm
dom/plugins/base/nsPluginInstanceOwner.cpp
editor/libeditor/IMETextTxn.cpp
widget/TextEventDispatcher.cpp
widget/TextEventDispatcher.h
widget/TextRange.h
widget/WidgetEventImpl.cpp
widget/cocoa/TextInputHandler.mm
widget/gtk/IMContextWrapper.cpp
widget/windows/IMMHandler.cpp
widget/windows/TSFTextStore.cpp
--- a/dom/plugins/base/nsPluginInstanceOwner.cpp
+++ b/dom/plugins/base/nsPluginInstanceOwner.cpp
@@ -890,17 +890,17 @@ nsPluginInstanceOwner::GetCompositionStr
             type = ATTR_INPUT;
             break;
           case TextRangeType::eSelectedRawClause:
             type = ATTR_TARGET_NOTCONVERTED;
             break;
           case TextRangeType::eConvertedClause:
             type = ATTR_CONVERTED;
             break;
-          case TextRangeType::NS_TEXTRANGE_SELECTEDCONVERTEDTEXT:
+          case TextRangeType::eSelectedClause:
             type = ATTR_TARGET_CONVERTED;
             break;
           default:
             continue;
         }
 
         size_t minLen = std::min<size_t>(range.mEndOffset, aDist->Length());
         for (size_t i = range.mStartOffset; i < minLen; i++) {
--- a/editor/libeditor/IMETextTxn.cpp
+++ b/editor/libeditor/IMETextTxn.cpp
@@ -139,17 +139,17 @@ ToSelectionType(TextRangeType aTextRange
 {
   switch (aTextRangeType) {
     case TextRangeType::eRawClause:
       return nsISelectionController::SELECTION_IME_RAWINPUT;
     case TextRangeType::eSelectedRawClause:
       return nsISelectionController::SELECTION_IME_SELECTEDRAWTEXT;
     case TextRangeType::eConvertedClause:
       return nsISelectionController::SELECTION_IME_CONVERTEDTEXT;
-    case TextRangeType::NS_TEXTRANGE_SELECTEDCONVERTEDTEXT:
+    case TextRangeType::eSelectedClause:
       return nsISelectionController::SELECTION_IME_SELECTEDCONVERTEDTEXT;
     default:
       MOZ_CRASH("Selection type is invalid");
       return nsISelectionController::SELECTION_NORMAL;
   }
 }
 
 nsresult
--- a/widget/TextEventDispatcher.cpp
+++ b/widget/TextEventDispatcher.cpp
@@ -622,17 +622,17 @@ TextEventDispatcher::PendingComposition:
   if (NS_WARN_IF(!aLength)) {
     return NS_ERROR_INVALID_ARG;
   }
 
   switch (aTextRangeType) {
     case TextRangeType::eRawClause:
     case TextRangeType::eSelectedRawClause:
     case TextRangeType::eConvertedClause:
-    case TextRangeType::NS_TEXTRANGE_SELECTEDCONVERTEDTEXT: {
+    case TextRangeType::eSelectedClause: {
       EnsureClauseArray();
       TextRange textRange;
       textRange.mStartOffset =
         mClauses->IsEmpty() ? 0 : mClauses->LastElement().mEndOffset;
       textRange.mEndOffset = textRange.mStartOffset + aLength;
       textRange.mRangeType = aTextRangeType;
       mClauses->AppendElement(textRange);
       return NS_OK;
--- a/widget/TextEventDispatcher.h
+++ b/widget/TextEventDispatcher.h
@@ -150,17 +150,17 @@ public:
   /**
    * AppendClauseToPendingComposition() appends a clause information to
    * the pending composition string.
    *
    * @param aLength         Length of the clause.
    * @param aTextRangeType  One of TextRangeType::eRawClause,
    *                        TextRangeType::eSelectedRawClause,
    *                        TextRangeType::eConvertedClause or
-   *                        NS_TEXTRANGE_SELECTEDCONVERTEDTEXT.
+   *                        TextRangeType::eSelectedClause.
    */
   nsresult AppendClauseToPendingComposition(uint32_t aLength,
                                             TextRangeType aTextRangeType)
   {
     return mPendingComposition.AppendClause(aLength, aTextRangeType);
   }
 
   /**
--- a/widget/TextRange.h
+++ b/widget/TextRange.h
@@ -125,23 +125,22 @@ struct TextRangeStyle
 };
 
 /******************************************************************************
  * mozilla::TextRange
  ******************************************************************************/
 
 enum class TextRangeType : RawTextRangeType
 {
-  eUninitialized = 0x00,
-  eCaret = 0x01,
-  eRawClause = nsITextInputProcessor::ATTR_RAW_CLAUSE,
+  eUninitialized     = 0x00,
+  eCaret             = 0x01,
+  eRawClause         = nsITextInputProcessor::ATTR_RAW_CLAUSE,
   eSelectedRawClause = nsITextInputProcessor::ATTR_SELECTED_RAW_CLAUSE,
-  eConvertedClause = nsITextInputProcessor::ATTR_CONVERTED_CLAUSE,
-  NS_TEXTRANGE_SELECTEDCONVERTEDTEXT =
-    nsITextInputProcessor::ATTR_SELECTED_CLAUSE
+  eConvertedClause   = nsITextInputProcessor::ATTR_CONVERTED_CLAUSE,
+  eSelectedClause    = nsITextInputProcessor::ATTR_SELECTED_CLAUSE
 };
 
 bool IsValidRawTextRangeValue(RawTextRangeType aRawTextRangeValue);
 RawTextRangeType ToRawTextRangeType(TextRangeType aTextRangeType);
 TextRangeType ToTextRangeType(RawTextRangeType aRawTextRangeType);
 const char* ToChar(TextRangeType aTextRangeType);
 
 struct TextRange
@@ -199,17 +198,17 @@ class TextRangeArray final : public Auto
 
   NS_INLINE_DECL_REFCOUNTING(TextRangeArray)
 
   const TextRange* GetTargetClause() const
   {
     for (uint32_t i = 0; i < Length(); ++i) {
       const TextRange& range = ElementAt(i);
       if (range.mRangeType == TextRangeType::eSelectedRawClause ||
-          range.mRangeType == TextRangeType::NS_TEXTRANGE_SELECTEDCONVERTEDTEXT) {
+          range.mRangeType == TextRangeType::eSelectedClause) {
         return &range;
       }
     }
     return nullptr;
   }
 
   // Returns target clause offset.  If there are selected clauses, this returns
   // the first selected clause offset.  Otherwise, 0.
--- a/widget/WidgetEventImpl.cpp
+++ b/widget/WidgetEventImpl.cpp
@@ -61,17 +61,17 @@ bool
 IsValidRawTextRangeValue(RawTextRangeType aRawTextRangeType)
 {
   switch (static_cast<TextRangeType>(aRawTextRangeType)) {
     case TextRangeType::eUninitialized:
     case TextRangeType::eCaret:
     case TextRangeType::eRawClause:
     case TextRangeType::eSelectedRawClause:
     case TextRangeType::eConvertedClause:
-    case TextRangeType::NS_TEXTRANGE_SELECTEDCONVERTEDTEXT:
+    case TextRangeType::eSelectedClause:
       return true;
     default:
       return false;
   }
 }
 
 RawTextRangeType
 ToRawTextRangeType(TextRangeType aTextRangeType)
@@ -95,18 +95,18 @@ ToChar(TextRangeType aTextRangeType)
     case TextRangeType::eCaret:
       return "TextRangeType::eCaret";
     case TextRangeType::eRawClause:
       return "TextRangeType::eRawClause";
     case TextRangeType::eSelectedRawClause:
       return "TextRangeType::eSelectedRawClause";
     case TextRangeType::eConvertedClause:
       return "TextRangeType::eConvertedClause";
-    case TextRangeType::NS_TEXTRANGE_SELECTEDCONVERTEDTEXT:
-      return "NS_TEXTRANGE_SELECTEDCONVERTEDTEXT";
+    case TextRangeType::eSelectedClause:
+      return "TextRangeType::eSelectedClause";
     default:
       return "Invalid TextRangeType";
   }
 }
 
 /******************************************************************************
  * As*Event() implementation
  ******************************************************************************/
--- a/widget/cocoa/TextInputHandler.mm
+++ b/widget/cocoa/TextInputHandler.mm
@@ -2748,20 +2748,20 @@ IMEInputHandler::ConvertToTextRangeType(
         return TextRangeType::eSelectedRawClause;
     }
   }
 
   switch (aUnderlineStyle) {
     case NSUnderlineStyleSingle:
       return TextRangeType::eConvertedClause;
     case NSUnderlineStyleThick:
-      return TextRangeType::NS_TEXTRANGE_SELECTEDCONVERTEDTEXT;
+      return TextRangeType::eSelectedClause;
     default:
       NS_WARNING("Unexpected line style");
-      return TextRangeType::NS_TEXTRANGE_SELECTEDCONVERTEDTEXT;
+      return TextRangeType::eSelectedClause;
   }
 }
 
 uint32_t
 IMEInputHandler::GetRangeCount(NSAttributedString *aAttrString)
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
 
--- a/widget/gtk/IMContextWrapper.cpp
+++ b/widget/gtk/IMContextWrapper.cpp
@@ -1819,17 +1819,17 @@ IMContextWrapper::SetTextRange(PangoAttr
         style.mDefinedStyles |= TextRangeStyle::DEFINED_BACKGROUND_COLOR;
     }
 
     /**
      * We need to judge the meaning of the clause for a11y.  Before we support
      * IME specific composition string style, we used following rules:
      *
      *   1: If attrUnderline and attrForground are specified, we assumed the
-     *      clause is NS_TEXTRANGE_SELECTEDCONVERTEDTEXT.
+     *      clause is TextRangeType::eSelectedClause.
      *   2: If only attrUnderline is specified, we assumed the clause is
      *      TextRangeType::eConvertedClause.
      *   3: If only attrForground is specified, we assumed the clause is
      *      TextRangeType::eSelectedRawClause.
      *   4: If neither attrUnderline nor attrForeground is specified, we assumed
      *      the clause is TextRangeType::eRawClause.
      *
      * However, this rules are odd since there can be two or more selected
@@ -1854,17 +1854,17 @@ IMContextWrapper::SetTextRange(PangoAttr
         aTextRange.mEndOffset == aUTF16CaretOffset) {
         aTextRange.mRangeType = TextRangeType::eRawClause;
     }
     // Typically, the caret is set at the start of the selected clause.
     // So, if the caret is in the clause, we can assume that the clause is
     // selected.
     else if (aTextRange.mStartOffset <= aUTF16CaretOffset &&
              aTextRange.mEndOffset > aUTF16CaretOffset) {
-        aTextRange.mRangeType = TextRangeType::NS_TEXTRANGE_SELECTEDCONVERTEDTEXT;
+        aTextRange.mRangeType = TextRangeType::eSelectedClause;
     }
     // Otherwise, we should assume that the clause is converted but not
     // selected.
     else {
         aTextRange.mRangeType = TextRangeType::eConvertedClause;
     }
 
     MOZ_LOG(gGtkIMLog, LogLevel::Debug,
--- a/widget/windows/IMMHandler.cpp
+++ b/widget/windows/IMMHandler.cpp
@@ -1897,17 +1897,17 @@ PlatformToNSAttr(uint8_t aAttr)
     // case ATTR_FIXEDCONVERTED:
     case ATTR_INPUT:
       return TextRangeType::eRawClause;
     case ATTR_CONVERTED:
       return TextRangeType::eConvertedClause;
     case ATTR_TARGET_NOTCONVERTED:
       return TextRangeType::eSelectedRawClause;
     case ATTR_TARGET_CONVERTED:
-      return TextRangeType::NS_TEXTRANGE_SELECTEDCONVERTEDTEXT;
+      return TextRangeType::eSelectedClause;
     default:
       NS_ASSERTION(false, "unknown attribute");
       return TextRangeType::eCaret;
   }
 }
 
 // static
 void
--- a/widget/windows/TSFTextStore.cpp
+++ b/widget/windows/TSFTextStore.cpp
@@ -2045,17 +2045,17 @@ GetRangeExtent(ITfRange* aRange, LONG* a
   return rangeACP->GetExtent(aStart, aLength);
 }
 
 static TextRangeType
 GetGeckoSelectionValue(TF_DISPLAYATTRIBUTE& aDisplayAttr)
 {
   switch (aDisplayAttr.bAttr) {
     case TF_ATTR_TARGET_CONVERTED:
-      return TextRangeType::NS_TEXTRANGE_SELECTEDCONVERTEDTEXT;
+      return TextRangeType::eSelectedClause;
     case TF_ATTR_CONVERTED:
       return TextRangeType::eConvertedClause;
     case TF_ATTR_TARGET_NOTCONVERTED:
       return TextRangeType::eSelectedRawClause;
     default:
       return TextRangeType::eRawClause;
   }
 }