Bug 1175382 TextRangeArray::TargetClauseOffset() and TextRangeArray::TargetClauseLength() shouldn't be public and same name methods of WidgetCompositionEvent should be used r=m_kato

This commit is contained in:
Masayuki Nakano 2015-06-18 13:43:18 +09:00
parent 7edd823b28
commit 360ff0cac8
2 changed files with 15 additions and 13 deletions

View File

@ -191,6 +191,8 @@ struct TextRange
******************************************************************************/
class TextRangeArray final : public nsAutoTArray<TextRange, 10>
{
friend class WidgetCompositionEvent;
~TextRangeArray() {}
NS_INLINE_DECL_REFCOUNTING(TextRangeArray)
@ -207,17 +209,6 @@ class TextRangeArray final : public nsAutoTArray<TextRange, 10>
return nullptr;
}
public:
bool IsComposing() const
{
for (uint32_t i = 0; i < Length(); ++i) {
if (ElementAt(i).IsClause()) {
return true;
}
}
return false;
}
// Returns target clause offset. If there are selected clauses, this returns
// the first selected clause offset. Otherwise, 0.
uint32_t TargetClauseOffset() const
@ -234,6 +225,17 @@ public:
return range ? range->Length() : UINT32_MAX;
}
public:
bool IsComposing() const
{
for (uint32_t i = 0; i < Length(); ++i) {
if (ElementAt(i).IsClause()) {
return true;
}
}
return false;
}
bool Equals(const TextRangeArray& aOther) const
{
size_t len = Length();

View File

@ -1210,7 +1210,7 @@ nsGtkIMModule::DispatchCompositionChangeEvent(
compositionChangeEvent.mRanges =
CreateTextRangeArray(aContext, mDispatchedCompositionString);
targetOffset += compositionChangeEvent.mRanges->TargetClauseOffset();
targetOffset += compositionChangeEvent.TargetClauseOffset();
mCompositionState = eCompositionState_CompositionChangeEventDispatched;
@ -1220,7 +1220,7 @@ nsGtkIMModule::DispatchCompositionChangeEvent(
mLayoutChanged = false;
mCompositionTargetRange.mOffset = targetOffset;
mCompositionTargetRange.mLength =
compositionChangeEvent.mRanges->TargetClauseLength();
compositionChangeEvent.TargetClauseLength();
mLastFocusedWindow->DispatchEvent(&compositionChangeEvent, status);
if (lastFocusedWindow->IsDestroyed() ||