Bug 917322 part.17 NS_TEXTRANGE_* should be defined with nsITextInputProcessor::ATTR_*_CLAUSE r=smaug
authorMasayuki Nakano <masayuki@d-toybox.com>
Wed, 28 Jan 2015 15:27:33 +0900
changeset 239588 d286a2acd55b03690dee2f7c23bcb01722e71f31
parent 239587 19e2530a986d19036595af59a24f27639258d636
child 239589 b97c59579393f6fbf66ceac4141f3c55e47e560e
push id500
push userjoshua.m.grant@gmail.com
push dateThu, 29 Jan 2015 01:48:36 +0000
reviewerssmaug
bugs917322
milestone38.0a1
Bug 917322 part.17 NS_TEXTRANGE_* should be defined with nsITextInputProcessor::ATTR_*_CLAUSE r=smaug
widget/TextRange.h
--- a/widget/TextRange.h
+++ b/widget/TextRange.h
@@ -5,16 +5,17 @@
 
 #ifndef mozilla_TextRage_h_
 #define mozilla_TextRage_h_
 
 #include <stdint.h>
 
 #include "nsAutoPtr.h"
 #include "nsColor.h"
+#include "nsITextInputProcessor.h"
 #include "nsStyleConsts.h"
 #include "nsTArray.h"
 
 namespace mozilla {
 
 /******************************************************************************
  * mozilla::TextRangeStyle
  ******************************************************************************/
@@ -121,26 +122,35 @@ struct TextRangeStyle
   nscolor mBackgroundColor;  // DEFINED_BACKGROUND_COLOR
   nscolor mUnderlineColor;   // DEFINED_UNDERLINE_COLOR
 };
 
 /******************************************************************************
  * mozilla::TextRange
  ******************************************************************************/
 
-#define NS_TEXTRANGE_CARETPOSITION         0x01
-#define NS_TEXTRANGE_RAWINPUT              0x02
-#define NS_TEXTRANGE_SELECTEDRAWTEXT       0x03
-#define NS_TEXTRANGE_CONVERTEDTEXT         0x04
-#define NS_TEXTRANGE_SELECTEDCONVERTEDTEXT 0x05
+// XXX NS_TEXTRANGE_* should be moved into TextRange as an typed enum.
+enum
+{
+  NS_TEXTRANGE_UNDEFINED = 0x00,
+  NS_TEXTRANGE_CARETPOSITION = 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
+};
 
 struct TextRange
 {
   TextRange() :
-    mStartOffset(0), mEndOffset(0), mRangeType(0)
+    mStartOffset(0), mEndOffset(0), mRangeType(NS_TEXTRANGE_UNDEFINED)
   {
   }
 
   uint32_t mStartOffset;
   // XXX Storing end offset makes the initializing code very complicated.
   //     We should replace it with mLength.
   uint32_t mEndOffset;
   uint32_t mRangeType;