Bug 1137539 part.2 Implement TSFStaticSink::IsATOKActive() r=emk

This commit is contained in:
Masayuki Nakano 2015-04-01 12:54:53 +09:00
Родитель cee1d456ce
Коммит 53729141ed
1 изменённых файлов: 8 добавлений и 5 удалений

Просмотреть файл

@ -774,6 +774,13 @@ public:
mActiveTIPKeyboardDescription.EqualsLiteral("Google Japanese Input");
}
bool IsATOKActive() const
{
// FYI: Name of ATOK includes the release year like "ATOK 2015".
return StringBeginsWith(mActiveTIPKeyboardDescription,
NS_LITERAL_STRING("ATOK "));
}
public: // ITfActiveLanguageProfileNotifySink
STDMETHODIMP OnActivated(REFCLSID clsid, REFGUID guidProfile,
BOOL fActivated);
@ -1174,8 +1181,6 @@ bool nsTextStore::sDoNotReturnNoLayoutErrorToEasyChangjei = false;
bool nsTextStore::sDoNotReturnNoLayoutErrorToGoogleJaInputAtFirstChar = false;
bool nsTextStore::sDoNotReturnNoLayoutErrorToGoogleJaInputAtCaret = false;
#define TIP_NAME_BEGINS_WITH_ATOK \
(NS_LITERAL_STRING("ATOK "))
// NOTE: Free ChangJie 2010 missspells its name...
#define TIP_NAME_FREE_CHANG_JIE_2010 \
(NS_LITERAL_STRING("Free CangJie IME 10"))
@ -3301,9 +3306,7 @@ nsTextStore::GetTextExt(TsViewCookie vcView,
// ATOK refers native caret position and size on Desktop applications for
// deciding candidate window. Therefore, we need to create native caret
// for hacking the bug.
if (sCreateNativeCaretForATOK &&
StringBeginsWith(
activeTIPKeyboardDescription, TIP_NAME_BEGINS_WITH_ATOK) &&
if (sCreateNativeCaretForATOK && kSink->IsATOKActive() &&
mComposition.IsComposing() &&
mComposition.mStart <= acpStart && mComposition.EndOffset() >= acpStart &&
mComposition.mStart <= acpEnd && mComposition.EndOffset() >= acpEnd) {