Bug 1277756 part.4 Rename TextRangeType::NS_TEXTRANGE_RAWINPUT to TextRangeType::eRawClause r?smaug
MozReview-Commit-ID: KLC1VPiYTdz
--- a/dom/plugins/base/nsPluginInstanceOwner.cpp
+++ b/dom/plugins/base/nsPluginInstanceOwner.cpp
@@ -881,17 +881,17 @@ nsPluginInstanceOwner::GetCompositionStr
}
aDist->SetLength(composition->LastData().Length());
memset(aDist->Elements(), ATTR_INPUT, aDist->Length());
for (TextRange& range : *ranges) {
uint8_t type = ATTR_INPUT;
switch(range.mRangeType) {
- case TextRangeType::NS_TEXTRANGE_RAWINPUT:
+ case TextRangeType::eRawClause:
type = ATTR_INPUT;
break;
case TextRangeType::NS_TEXTRANGE_SELECTEDRAWTEXT:
type = ATTR_TARGET_NOTCONVERTED;
break;
case TextRangeType::NS_TEXTRANGE_CONVERTEDTEXT:
type = ATTR_CONVERTED;
break;
--- a/editor/libeditor/IMETextTxn.cpp
+++ b/editor/libeditor/IMETextTxn.cpp
@@ -133,17 +133,17 @@ IMETextTxn::GetTxnDescription(nsAString&
return NS_OK;
}
/* ============ private methods ================== */
static SelectionType
ToSelectionType(TextRangeType aTextRangeType)
{
switch (aTextRangeType) {
- case TextRangeType::NS_TEXTRANGE_RAWINPUT:
+ case TextRangeType::eRawClause:
return nsISelectionController::SELECTION_IME_RAWINPUT;
case TextRangeType::NS_TEXTRANGE_SELECTEDRAWTEXT:
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:
--- a/editor/libeditor/nsEditor.cpp
+++ b/editor/libeditor/nsEditor.cpp
@@ -2417,17 +2417,17 @@ nsEditor::InsertTextIntoTextNodeImpl(con
mIMETextNode = &aTextNode;
mIMETextOffset = aOffset;
}
// Modify mPhonetic with raw text input clauses.
const TextRangeArray* ranges = mComposition->GetRanges();
for (uint32_t i = 0; i < (ranges ? ranges->Length() : 0); ++i) {
const TextRange& textRange = ranges->ElementAt(i);
if (!textRange.Length() ||
- textRange.mRangeType != TextRangeType::NS_TEXTRANGE_RAWINPUT) {
+ textRange.mRangeType != TextRangeType::eRawClause) {
continue;
}
if (!mPhonetic) {
mPhonetic = new nsString();
}
nsAutoString stringToInsert(aStringToInsert);
stringToInsert.Mid(*mPhonetic,
textRange.mStartOffset, textRange.Length());
--- a/widget/TextEventDispatcher.cpp
+++ b/widget/TextEventDispatcher.cpp
@@ -619,17 +619,17 @@ TextEventDispatcher::PendingComposition:
uint32_t aLength,
TextRangeType aTextRangeType)
{
if (NS_WARN_IF(!aLength)) {
return NS_ERROR_INVALID_ARG;
}
switch (aTextRangeType) {
- case TextRangeType::NS_TEXTRANGE_RAWINPUT:
+ case TextRangeType::eRawClause:
case TextRangeType::NS_TEXTRANGE_SELECTEDRAWTEXT:
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;
@@ -664,17 +664,17 @@ TextEventDispatcher::PendingComposition:
nsresult rv = SetString(str);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
if (!aRanges || aRanges->IsEmpty()) {
// Create dummy range if aString isn't empty.
if (!aString.IsEmpty()) {
- rv = AppendClause(str.Length(), TextRangeType::NS_TEXTRANGE_RAWINPUT);
+ rv = AppendClause(str.Length(), TextRangeType::eRawClause);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
}
return NS_OK;
}
// Adjust offsets in the ranges for XP linefeed character (only \n).
--- a/widget/TextEventDispatcher.h
+++ b/widget/TextEventDispatcher.h
@@ -147,17 +147,17 @@ public:
return mPendingComposition.SetString(aString);
}
/**
* AppendClauseToPendingComposition() appends a clause information to
* the pending composition string.
*
* @param aLength Length of the clause.
- * @param aTextRangeType One of NS_TEXTRANGE_RAWINPUT,
+ * @param aTextRangeType One of TextRangeType::eRawClause,
* NS_TEXTRANGE_SELECTEDRAWTEXT,
* 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
@@ -127,18 +127,17 @@ struct TextRangeStyle
/******************************************************************************
* mozilla::TextRange
******************************************************************************/
enum class TextRangeType : RawTextRangeType
{
eUninitialized = 0x00,
eCaret = 0x01,
- NS_TEXTRANGE_RAWINPUT =
- nsITextInputProcessor::ATTR_RAW_CLAUSE,
+ eRawClause = 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
};
--- a/widget/WidgetEventImpl.cpp
+++ b/widget/WidgetEventImpl.cpp
@@ -58,17 +58,17 @@ ToChar(EventClassID aEventClassID)
}
bool
IsValidRawTextRangeValue(RawTextRangeType aRawTextRangeType)
{
switch (static_cast<TextRangeType>(aRawTextRangeType)) {
case TextRangeType::eUninitialized:
case TextRangeType::eCaret:
- case TextRangeType::NS_TEXTRANGE_RAWINPUT:
+ case TextRangeType::eRawClause:
case TextRangeType::NS_TEXTRANGE_SELECTEDRAWTEXT:
case TextRangeType::NS_TEXTRANGE_CONVERTEDTEXT:
case TextRangeType::NS_TEXTRANGE_SELECTEDCONVERTEDTEXT:
return true;
default:
return false;
}
}
@@ -89,18 +89,18 @@ ToTextRangeType(RawTextRangeType aRawTex
const char*
ToChar(TextRangeType aTextRangeType)
{
switch (aTextRangeType) {
case TextRangeType::eUninitialized:
return "TextRangeType::eUninitialized";
case TextRangeType::eCaret:
return "TextRangeType::eCaret";
- case TextRangeType::NS_TEXTRANGE_RAWINPUT:
- return "NS_TEXTRANGE_RAWINPUT";
+ case TextRangeType::eRawClause:
+ return "TextRangeType::eRawClause";
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";
default:
return "Invalid TextRangeType";
--- a/widget/android/nsWindow.cpp
+++ b/widget/android/nsWindow.cpp
@@ -3142,17 +3142,17 @@ nsWindow::GeckoViewSupport::OnImeReplace
event.mRanges = new TextRangeArray();
mIMERanges.swap(event.mRanges);
} else if (event.mData.Length()) {
// Include proper text ranges to make the editor happy.
TextRange range;
range.mStartOffset = 0;
range.mEndOffset = event.mData.Length();
- range.mRangeType = TextRangeType::NS_TEXTRANGE_RAWINPUT;
+ range.mRangeType = TextRangeType::eRawClause;
event.mRanges = new TextRangeArray();
event.mRanges->AppendElement(range);
}
window.DispatchEvent(&event);
} else if (composing) {
// Ensure IME ranges are empty.
--- a/widget/cocoa/TextInputHandler.mm
+++ b/widget/cocoa/TextInputHandler.mm
@@ -2735,17 +2735,17 @@ IMEInputHandler::ConvertToTextRangeType(
// We assume that aUnderlineStyle is NSUnderlineStyleSingle or
// NSUnderlineStyleThick. NSUnderlineStyleThick should indicate a selected
// clause. Otherwise, should indicate non-selected clause.
if (aSelectedRange.length == 0) {
switch (aUnderlineStyle) {
case NSUnderlineStyleSingle:
- return TextRangeType::NS_TEXTRANGE_RAWINPUT;
+ return TextRangeType::eRawClause;
case NSUnderlineStyleThick:
return TextRangeType::NS_TEXTRANGE_SELECTEDRAWTEXT;
default:
NS_WARNING("Unexpected line style");
return TextRangeType::NS_TEXTRANGE_SELECTEDRAWTEXT;
}
}
--- a/widget/gtk/IMContextWrapper.cpp
+++ b/widget/gtk/IMContextWrapper.cpp
@@ -1825,17 +1825,17 @@ IMContextWrapper::SetTextRange(PangoAttr
*
* 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.
* 4: If neither attrUnderline nor attrForeground is specified, we assumed
- * the clause is NS_TEXTRANGE_RAWINPUT.
+ * 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.
*/
@@ -1847,17 +1847,17 @@ IMContextWrapper::SetTextRange(PangoAttr
return false;
}
// If the range covers whole of composition string and the caret is at
// the end of the composition string, the range is probably not converted.
if (!utf8ClauseStart &&
utf8ClauseEnd == static_cast<gint>(strlen(aUTF8CompositionString)) &&
aTextRange.mEndOffset == aUTF16CaretOffset) {
- aTextRange.mRangeType = TextRangeType::NS_TEXTRANGE_RAWINPUT;
+ 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;
}
--- a/widget/windows/IMMHandler.cpp
+++ b/widget/windows/IMMHandler.cpp
@@ -1891,17 +1891,17 @@ IMMHandler::CommitCompositionOnPreviousW
static TextRangeType
PlatformToNSAttr(uint8_t aAttr)
{
switch (aAttr)
{
case ATTR_INPUT_ERROR:
// case ATTR_FIXEDCONVERTED:
case ATTR_INPUT:
- return TextRangeType::NS_TEXTRANGE_RAWINPUT;
+ return TextRangeType::eRawClause;
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");
--- a/widget/windows/TSFTextStore.cpp
+++ b/widget/windows/TSFTextStore.cpp
@@ -2051,17 +2051,17 @@ GetGeckoSelectionValue(TF_DISPLAYATTRIBU
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;
default:
- return TextRangeType::NS_TEXTRANGE_RAWINPUT;
+ return TextRangeType::eRawClause;
}
}
HRESULT
TSFTextStore::GetDisplayAttribute(ITfProperty* aAttrProperty,
ITfRange* aRange,
TF_DISPLAYATTRIBUTE* aResult)
{
@@ -2423,17 +2423,17 @@ TSFTextStore::RecordCompositionUpdateAct
// information.
action->mRanges->Clear();
TextRange newRange;
// No matter if we have display attribute info or not,
// we always pass in at least one range to eCompositionChange
newRange.mStartOffset = 0;
newRange.mEndOffset = action->mData.Length();
- newRange.mRangeType = TextRangeType::NS_TEXTRANGE_RAWINPUT;
+ newRange.mRangeType = TextRangeType::eRawClause;
action->mRanges->AppendElement(newRange);
RefPtr<ITfRange> range;
while (S_OK == enumRanges->Next(1, getter_AddRefs(range), nullptr) && range) {
LONG rangeStart = 0, rangeLength = 0;
if (FAILED(GetRangeExtent(range, &rangeStart, &rangeLength))) {
continue;
@@ -2468,17 +2468,17 @@ TSFTextStore::RecordCompositionUpdateAct
newRange.mStartOffset = uint32_t(start - mComposition.mStart);
// The end of the last range in the array is
// always kept at the end of composition
newRange.mEndOffset = mComposition.mString.Length();
TF_DISPLAYATTRIBUTE attr;
hr = GetDisplayAttribute(attrPropetry, range, &attr);
if (FAILED(hr)) {
- newRange.mRangeType = TextRangeType::NS_TEXTRANGE_RAWINPUT;
+ newRange.mRangeType = TextRangeType::eRawClause;
} else {
newRange.mRangeType = GetGeckoSelectionValue(attr);
if (GetColor(attr.crText, newRange.mRangeStyle.mForegroundColor)) {
newRange.mRangeStyle.mDefinedStyles |=
TextRangeStyle::DEFINED_FOREGROUND_COLOR;
}
if (GetColor(attr.crBk, newRange.mRangeStyle.mBackgroundColor)) {
newRange.mRangeStyle.mDefinedStyles |=