Bug 1277756 part.1 Make anonymous enum for NS_TEXTRANGE_* to an enum class named "TextRangeType" r=smaug

For making our code clearer by the stronger type check, we should change the anonymous enum for NS_TEXTRANGE_* to enum class whose name is "TextRangeType" and whose type is "RawTextRangeType" which is an alias of uint8_t.

Additionally, this also adds some utility methods for them.

Note that some lines which are changed by this patch become over 80 characters but it will be fixed by the following patches.

MozReview-Commit-ID: 76izA1WqTkp
This commit is contained in:
Masayuki Nakano
2016-06-04 09:49:21 +09:00
parent 89e835de7b
commit afa7c7379f
16 changed files with 155 additions and 150 deletions

View File

@@ -422,11 +422,13 @@ TextInputProcessor::AppendClauseToPendingComposition(uint32_t aLength,
{
MOZ_RELEASE_ASSERT(nsContentUtils::IsCallerChrome());
RefPtr<TextEventDispatcher> kungfuDeathGrip(mDispatcher);
TextRangeType textRangeType;
switch (aAttribute) {
case ATTR_RAW_CLAUSE:
case ATTR_SELECTED_RAW_CLAUSE:
case ATTR_CONVERTED_CLAUSE:
case ATTR_SELECTED_CLAUSE:
textRangeType = ToTextRangeType(aAttribute);
break;
default:
return NS_ERROR_INVALID_ARG;
@@ -435,7 +437,7 @@ TextInputProcessor::AppendClauseToPendingComposition(uint32_t aLength,
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
return mDispatcher->AppendClauseToPendingComposition(aLength, aAttribute);
return mDispatcher->AppendClauseToPendingComposition(aLength, textRangeType);
}
NS_IMETHODIMP