Bug 1277756 part.5 Rename TextRangeType::NS_TEXTRANGE_SELECTEDRAWTEXT to TextRangeType::eSelectedRawClause r?smaug draft
authorMasayuki Nakano <masayuki@d-toybox.com>
Fri, 03 Jun 2016 18:57:21 +0900
changeset 375349 967110e61dc2013eaf0103fe5653e8f1055573e4
parent 375348 090c425d9e858ef8a86927fa1fd4db620feda111
child 375350 6c66c1b00dc08deb6e85817edd0b369b5040994e
push id20248
push usermasayuki@d-toybox.com
push dateSat, 04 Jun 2016 00:57:57 +0000
reviewerssmaug
bugs1277756
milestone49.0a1
Bug 1277756 part.5 Rename TextRangeType::NS_TEXTRANGE_SELECTEDRAWTEXT to TextRangeType::eSelectedRawClause r?smaug MozReview-Commit-ID: MbG4siLb4Q
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
@@ -884,17 +884,17 @@ nsPluginInstanceOwner::GetCompositionStr
       memset(aDist->Elements(), ATTR_INPUT, aDist->Length());
 
       for (TextRange& range : *ranges) {
         uint8_t type = ATTR_INPUT;
         switch(range.mRangeType) {
           case TextRangeType::eRawClause:
             type = ATTR_INPUT;
             break;
-          case TextRangeType::NS_TEXTRANGE_SELECTEDRAWTEXT:
+          case TextRangeType::eSelectedRawClause:
             type = ATTR_TARGET_NOTCONVERTED;
             break;
           case TextRangeType::NS_TEXTRANGE_CONVERTEDTEXT:
             type = ATTR_CONVERTED;
             break;
           case TextRangeType::NS_TEXTRANGE_SELECTEDCONVERTEDTEXT:
             type = ATTR_TARGET_CONVERTED;
             break;
--- a/editor/libeditor/IMETextTxn.cpp
+++ b/editor/libeditor/IMETextTxn.cpp
@@ -135,17 +135,17 @@ IMETextTxn::GetTxnDescription(nsAString&
 
 /* ============ private methods ================== */
 static SelectionType
 ToSelectionType(TextRangeType aTextRangeType)
 {
   switch (aTextRangeType) {
     case TextRangeType::eRawClause:
       return nsISelectionController::SELECTION_IME_RAWINPUT;
-    case TextRangeType::NS_TEXTRANGE_SELECTEDRAWTEXT:
+    case TextRangeType::eSelectedRawClause:
       return nsISelectionController::SELECTION_IME_SELECTEDRAWTEXT;
     case TextRangeType::NS_TEXTRANGE_CONVERTEDTEXT:
       return nsISelectionController::SELECTION_IME_CONVERTEDTEXT;
     case TextRangeType::NS_TEXTRANGE_SELECTEDCONVERTEDTEXT:
       return nsISelectionController::SELECTION_IME_SELECTEDCONVERTEDTEXT;
     default:
       MOZ_CRASH("Selection type is invalid");
       return nsISelectionController::SELECTION_NORMAL;
--- a/widget/TextEventDispatcher.cpp
+++ b/widget/TextEventDispatcher.cpp
@@ -620,17 +620,17 @@ TextEventDispatcher::PendingComposition:
                                            TextRangeType aTextRangeType)
 {
   if (NS_WARN_IF(!aLength)) {
     return NS_ERROR_INVALID_ARG;
   }
 
   switch (aTextRangeType) {
     case TextRangeType::eRawClause:
-    case TextRangeType::NS_TEXTRANGE_SELECTEDRAWTEXT:
+    case TextRangeType::eSelectedRawClause:
     case TextRangeType::NS_TEXTRANGE_CONVERTEDTEXT:
     case TextRangeType::NS_TEXTRANGE_SELECTEDCONVERTEDTEXT: {
       EnsureClauseArray();
       TextRange textRange;
       textRange.mStartOffset =
         mClauses->IsEmpty() ? 0 : mClauses->LastElement().mEndOffset;
       textRange.mEndOffset = textRange.mStartOffset + aLength;
       textRange.mRangeType = aTextRangeType;
--- a/widget/TextEventDispatcher.h
+++ b/widget/TextEventDispatcher.h
@@ -148,17 +148,17 @@ public:
   }
 
   /**
    * AppendClauseToPendingComposition() appends a clause information to
    * the pending composition string.
    *
    * @param aLength         Length of the clause.
    * @param aTextRangeType  One of TextRangeType::eRawClause,
-   *                        NS_TEXTRANGE_SELECTEDRAWTEXT,
+   *                        TextRangeType::eSelectedRawClause,
    *                        NS_TEXTRANGE_CONVERTEDTEXT or
    *                        NS_TEXTRANGE_SELECTEDCONVERTEDTEXT.
    */
   nsresult AppendClauseToPendingComposition(uint32_t aLength,
                                             TextRangeType aTextRangeType)
   {
     return mPendingComposition.AppendClause(aLength, aTextRangeType);
   }
--- a/widget/TextRange.h
+++ b/widget/TextRange.h
@@ -128,18 +128,17 @@ struct TextRangeStyle
  * mozilla::TextRange
  ******************************************************************************/
 
 enum class TextRangeType : RawTextRangeType
 {
   eUninitialized = 0x00,
   eCaret = 0x01,
   eRawClause = nsITextInputProcessor::ATTR_RAW_CLAUSE,
-  NS_TEXTRANGE_SELECTEDRAWTEXT =
-    nsITextInputProcessor::ATTR_SELECTED_RAW_CLAUSE,
+  eSelectedRawClause = nsITextInputProcessor::ATTR_SELECTED_RAW_CLAUSE,
   NS_TEXTRANGE_CONVERTEDTEXT =
     nsITextInputProcessor::ATTR_CONVERTED_CLAUSE,
   NS_TEXTRANGE_SELECTEDCONVERTEDTEXT =
     nsITextInputProcessor::ATTR_SELECTED_CLAUSE
 };
 
 bool IsValidRawTextRangeValue(RawTextRangeType aRawTextRangeValue);
 RawTextRangeType ToRawTextRangeType(TextRangeType aTextRangeType);
@@ -200,17 +199,17 @@ class TextRangeArray final : public Auto
   ~TextRangeArray() {}
 
   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::NS_TEXTRANGE_SELECTEDRAWTEXT ||
+      if (range.mRangeType == TextRangeType::eSelectedRawClause ||
           range.mRangeType == TextRangeType::NS_TEXTRANGE_SELECTEDCONVERTEDTEXT) {
         return &range;
       }
     }
     return nullptr;
   }
 
   // Returns target clause offset.  If there are selected clauses, this returns
--- a/widget/WidgetEventImpl.cpp
+++ b/widget/WidgetEventImpl.cpp
@@ -59,17 +59,17 @@ ToChar(EventClassID aEventClassID)
 
 bool
 IsValidRawTextRangeValue(RawTextRangeType aRawTextRangeType)
 {
   switch (static_cast<TextRangeType>(aRawTextRangeType)) {
     case TextRangeType::eUninitialized:
     case TextRangeType::eCaret:
     case TextRangeType::eRawClause:
-    case TextRangeType::NS_TEXTRANGE_SELECTEDRAWTEXT:
+    case TextRangeType::eSelectedRawClause:
     case TextRangeType::NS_TEXTRANGE_CONVERTEDTEXT:
     case TextRangeType::NS_TEXTRANGE_SELECTEDCONVERTEDTEXT:
       return true;
     default:
       return false;
   }
 }
 
@@ -91,18 +91,18 @@ ToChar(TextRangeType aTextRangeType)
 {
   switch (aTextRangeType) {
     case TextRangeType::eUninitialized:
       return "TextRangeType::eUninitialized";
     case TextRangeType::eCaret:
       return "TextRangeType::eCaret";
     case TextRangeType::eRawClause:
       return "TextRangeType::eRawClause";
-    case TextRangeType::NS_TEXTRANGE_SELECTEDRAWTEXT:
-      return "NS_TEXTRANGE_SELECTEDRAWTEXT";
+    case TextRangeType::eSelectedRawClause:
+      return "TextRangeType::eSelectedRawClause";
     case TextRangeType::NS_TEXTRANGE_CONVERTEDTEXT:
       return "NS_TEXTRANGE_CONVERTEDTEXT";
     case TextRangeType::NS_TEXTRANGE_SELECTEDCONVERTEDTEXT:
       return "NS_TEXTRANGE_SELECTEDCONVERTEDTEXT";
     default:
       return "Invalid TextRangeType";
   }
 }
--- a/widget/cocoa/TextInputHandler.mm
+++ b/widget/cocoa/TextInputHandler.mm
@@ -2737,20 +2737,20 @@ IMEInputHandler::ConvertToTextRangeType(
   // NSUnderlineStyleThick.  NSUnderlineStyleThick should indicate a selected
   // clause.  Otherwise, should indicate non-selected clause.
 
   if (aSelectedRange.length == 0) {
     switch (aUnderlineStyle) {
       case NSUnderlineStyleSingle:
         return TextRangeType::eRawClause;
       case NSUnderlineStyleThick:
-        return TextRangeType::NS_TEXTRANGE_SELECTEDRAWTEXT;
+        return TextRangeType::eSelectedRawClause;
       default:
         NS_WARNING("Unexpected line style");
-        return TextRangeType::NS_TEXTRANGE_SELECTEDRAWTEXT;
+        return TextRangeType::eSelectedRawClause;
     }
   }
 
   switch (aUnderlineStyle) {
     case NSUnderlineStyleSingle:
       return TextRangeType::NS_TEXTRANGE_CONVERTEDTEXT;
     case NSUnderlineStyleThick:
       return TextRangeType::NS_TEXTRANGE_SELECTEDCONVERTEDTEXT;
--- a/widget/gtk/IMContextWrapper.cpp
+++ b/widget/gtk/IMContextWrapper.cpp
@@ -1823,17 +1823,17 @@ IMContextWrapper::SetTextRange(PangoAttr
      * 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.
      *   2: If only attrUnderline is specified, we assumed the clause is
      *      NS_TEXTRANGE_CONVERTEDTEXT.
      *   3: If only attrForground is specified, we assumed the clause is
-     *      NS_TEXTRANGE_SELECTEDRAWTEXT.
+     *      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
      * clauses.  Additionally, our old rules caused that IME developers/users
      * cannot specify composition string style as they want.
      *
      * So, we shouldn't guess the meaning from its visual style.
--- a/widget/windows/IMMHandler.cpp
+++ b/widget/windows/IMMHandler.cpp
@@ -1895,17 +1895,17 @@ PlatformToNSAttr(uint8_t aAttr)
   {
     case ATTR_INPUT_ERROR:
     // case ATTR_FIXEDCONVERTED:
     case ATTR_INPUT:
       return TextRangeType::eRawClause;
     case ATTR_CONVERTED:
       return TextRangeType::NS_TEXTRANGE_CONVERTEDTEXT;
     case ATTR_TARGET_NOTCONVERTED:
-      return TextRangeType::NS_TEXTRANGE_SELECTEDRAWTEXT;
+      return TextRangeType::eSelectedRawClause;
     case ATTR_TARGET_CONVERTED:
       return TextRangeType::NS_TEXTRANGE_SELECTEDCONVERTEDTEXT;
     default:
       NS_ASSERTION(false, "unknown attribute");
       return TextRangeType::eCaret;
   }
 }
 
--- a/widget/windows/TSFTextStore.cpp
+++ b/widget/windows/TSFTextStore.cpp
@@ -2049,17 +2049,17 @@ static TextRangeType
 GetGeckoSelectionValue(TF_DISPLAYATTRIBUTE& aDisplayAttr)
 {
   switch (aDisplayAttr.bAttr) {
     case TF_ATTR_TARGET_CONVERTED:
       return TextRangeType::NS_TEXTRANGE_SELECTEDCONVERTEDTEXT;
     case TF_ATTR_CONVERTED:
       return TextRangeType::NS_TEXTRANGE_CONVERTEDTEXT;
     case TF_ATTR_TARGET_NOTCONVERTED:
-      return TextRangeType::NS_TEXTRANGE_SELECTEDRAWTEXT;
+      return TextRangeType::eSelectedRawClause;
     default:
       return TextRangeType::eRawClause;
   }
 }
 
 HRESULT
 TSFTextStore::GetDisplayAttribute(ITfProperty* aAttrProperty,
                                   ITfRange* aRange,
@@ -2518,17 +2518,17 @@ TSFTextStore::RecordCompositionUpdateAct
     TextRange& range = action->mRanges->ElementAt(0);
     LONG start = currentSel.MinOffset();
     LONG end = currentSel.MaxOffset();
     if ((LONG)range.mStartOffset == start - mComposition.mStart &&
         (LONG)range.mEndOffset == end - mComposition.mStart &&
         range.mRangeStyle.IsNoChangeStyle()) {
       range.mRangeStyle.Clear();
       // The looks of selected type is better than others.
-      range.mRangeType = TextRangeType::NS_TEXTRANGE_SELECTEDRAWTEXT;
+      range.mRangeType = TextRangeType::eSelectedRawClause;
     }
   }
 
   // The caret position has to be collapsed.
   uint32_t caretPosition =
     static_cast<uint32_t>(currentSel.MaxOffset() - mComposition.mStart);
 
   // If caret is in the target clause and it doesn't have specific style,