--- a/widget/windows/TSFTextStore.cpp
+++ b/widget/windows/TSFTextStore.cpp
@@ -854,16 +854,85 @@ public:
bool IsATOKActive() const
{
// FYI: Name of ATOK includes the release year like "ATOK 2015".
return StringBeginsWith(mActiveTIPKeyboardDescription,
NS_LITERAL_STRING("ATOK "));
}
+ bool IsATOK2011Active() const
+ {
+ // {F9C24A5C-8A53-499D-9572-93B2FF582115}
+ static const GUID kGUID = {
+ 0xF9C24A5C, 0x8A53, 0x499D,
+ { 0x95, 0x72, 0x93, 0xB2, 0xFF, 0x58, 0x21, 0x15 }
+ };
+ return mActiveTIPGUID == kGUID;
+ }
+
+ bool IsATOK2012Active() const
+ {
+ // {1DE01562-F445-401B-B6C3-E5B18DB79461}
+ static const GUID kGUID = {
+ 0x1DE01562, 0xF445, 0x401B,
+ { 0xB6, 0xC3, 0xE5, 0xB1, 0x8D, 0xB7, 0x94, 0x61 }
+ };
+ return mActiveTIPGUID == kGUID;
+ }
+
+ bool IsATOK2013Active() const
+ {
+ // {3C4DB511-189A-4168-B6EA-BFD0B4C85615}
+ static const GUID kGUID = {
+ 0x3C4DB511, 0x189A, 0x4168,
+ { 0xB6, 0xEA, 0xBF, 0xD0, 0xB4, 0xC8, 0x56, 0x15 }
+ };
+ return mActiveTIPGUID == kGUID;
+ }
+
+ bool IsATOK2014Active() const
+ {
+ // {4EF33B79-6AA9-4271-B4BF-9321C279381B}
+ static const GUID kGUID = {
+ 0x4EF33B79, 0x6AA9, 0x4271,
+ { 0xB4, 0xBF, 0x93, 0x21, 0xC2, 0x79, 0x38, 0x1B }
+ };
+ return mActiveTIPGUID == kGUID;
+ }
+
+ bool IsATOK2015Active() const
+ {
+ // {EAB4DC00-CE2E-483D-A86A-E6B99DA9599A}
+ static const GUID kGUID = {
+ 0xEAB4DC00, 0xCE2E, 0x483D,
+ { 0xA8, 0x6A, 0xE6, 0xB9, 0x9D, 0xA9, 0x59, 0x9A }
+ };
+ return mActiveTIPGUID == kGUID;
+ }
+
+ bool IsATOK2016Active() const
+ {
+ // {0B557B4C-5740-4110-A60A-1493FA10BF2B}
+ static const GUID kGUID = {
+ 0x0B557B4C, 0x5740, 0x4110,
+ { 0xA6, 0x0A, 0x14, 0x93, 0xFA, 0x10, 0xBF, 0x2B }
+ };
+ return mActiveTIPGUID == kGUID;
+ }
+
+ // Note that ATOK 2011 - 2016 refers native caret position for deciding its
+ // popup window position.
+ bool IsATOKReferringNativeCaretActive() const
+ {
+ return IsATOKActive() &&
+ (IsATOK2011Active() || IsATOK2012Active() || IsATOK2013Active() ||
+ IsATOK2014Active() || IsATOK2015Active() || IsATOK2016Active());
+ }
+
/****************************************************************************
* Traditional Chinese TIP
****************************************************************************/
bool IsMSChangJieActive() const
{
return mActiveTIPKeyboardDescription.EqualsLiteral("Microsoft ChangJie") ||
mActiveTIPKeyboardDescription.Equals(
@@ -1189,17 +1258,17 @@ StaticRefPtr<ITfKeystrokeMgr> TSFTextSto
StaticRefPtr<ITfDisplayAttributeMgr> TSFTextStore::sDisplayAttrMgr;
StaticRefPtr<ITfCategoryMgr> TSFTextStore::sCategoryMgr;
StaticRefPtr<ITfDocumentMgr> TSFTextStore::sDisabledDocumentMgr;
StaticRefPtr<ITfContext> TSFTextStore::sDisabledContext;
StaticRefPtr<ITfInputProcessorProfiles> TSFTextStore::sInputProcessorProfiles;
StaticRefPtr<TSFTextStore> TSFTextStore::sEnabledTextStore;
DWORD TSFTextStore::sClientId = 0;
-bool TSFTextStore::sCreateNativeCaretForATOK = false;
+bool TSFTextStore::sCreateNativeCaretForLegacyATOK = false;
bool TSFTextStore::sDoNotReturnNoLayoutErrorToMSSimplifiedTIP = false;
bool TSFTextStore::sDoNotReturnNoLayoutErrorToMSTraditionalTIP = false;
bool TSFTextStore::sDoNotReturnNoLayoutErrorToFreeChangJie = false;
bool TSFTextStore::sDoNotReturnNoLayoutErrorToEasyChangjei = false;
bool TSFTextStore::sDoNotReturnNoLayoutErrorToMSJapaneseIMEAtFirstChar = false;
bool TSFTextStore::sDoNotReturnNoLayoutErrorToMSJapaneseIMEAtCaret = false;
bool TSFTextStore::sHackQueryInsertForMSSimplifiedTIP = false;
bool TSFTextStore::sHackQueryInsertForMSTraditionalTIP = false;
@@ -3833,20 +3902,22 @@ TSFTextStore::GetTextExt(TsViewCookie vc
event.mReply.mRect.XMost(), event.mReply.mRect.YMost());
if (!::IntersectRect(prc, prc, &textRect))
// Text is not visible
::SetRectEmpty(prc);
// not equal if text rect was clipped
*pfClipped = !::EqualRect(prc, &textRect);
- // 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 && kSink->IsATOKActive() &&
+ // ATOK 2011 - 2016 refers native caret position and size on windows whose
+ // class name is one of Mozilla's windows for deciding candidate window
+ // position. Therefore, we need to create native caret only when ATOK 2011 -
+ // 2016 is active.
+ if (sCreateNativeCaretForLegacyATOK &&
+ kSink->IsATOKReferringNativeCaretActive() &&
mComposition.IsComposing() &&
mComposition.mStart <= acpStart && mComposition.EndOffset() >= acpStart &&
mComposition.mStart <= acpEnd && mComposition.EndOffset() >= acpEnd) {
CreateNativeCaret();
}
MOZ_LOG(sTextStoreLog, LogLevel::Info,
("0x%p TSFTextStore::GetTextExt() succeeded: "
@@ -5673,17 +5744,17 @@ TSFTextStore::Initialize()
sThreadMgr = threadMgr;
sMessagePump = messagePump;
sKeystrokeMgr = keystrokeMgr;
sDisplayAttrMgr = displayAttributeMgr;
sCategoryMgr = categoryMgr;
sDisabledDocumentMgr = disabledDocumentMgr;
sDisabledContext = disabledContext;
- sCreateNativeCaretForATOK =
+ sCreateNativeCaretForLegacyATOK =
Preferences::GetBool("intl.tsf.hack.atok.create_native_caret", true);
sDoNotReturnNoLayoutErrorToMSSimplifiedTIP =
Preferences::GetBool(
"intl.tsf.hack.ms_simplified_chinese.do_not_return_no_layout_error",
true);
sDoNotReturnNoLayoutErrorToMSTraditionalTIP =
Preferences::GetBool(
"intl.tsf.hack.ms_traditional_chinese.do_not_return_no_layout_error",
@@ -5708,24 +5779,24 @@ TSFTextStore::Initialize()
sHackQueryInsertForMSTraditionalTIP =
Preferences::GetBool(
"intl.tsf.hack.ms_traditional_chinese.query_insert_result", true);
MOZ_LOG(sTextStoreLog, LogLevel::Info,
(" TSFTextStore::Initialize(), sThreadMgr=0x%p, "
"sClientId=0x%08X, sDisplayAttrMgr=0x%p, "
"sCategoryMgr=0x%p, sDisabledDocumentMgr=0x%p, sDisabledContext=%p, "
- "sCreateNativeCaretForATOK=%s, "
+ "sCreateNativeCaretForLegacyATOK=%s, "
"sDoNotReturnNoLayoutErrorToFreeChangJie=%s, "
"sDoNotReturnNoLayoutErrorToEasyChangjei=%s, "
"sDoNotReturnNoLayoutErrorToMSJapaneseIMEAtFirstChar=%s, "
"sDoNotReturnNoLayoutErrorToMSJapaneseIMEAtCaret=%s",
sThreadMgr.get(), sClientId, sDisplayAttrMgr.get(),
sCategoryMgr.get(), sDisabledDocumentMgr.get(), sDisabledContext.get(),
- GetBoolName(sCreateNativeCaretForATOK),
+ GetBoolName(sCreateNativeCaretForLegacyATOK),
GetBoolName(sDoNotReturnNoLayoutErrorToFreeChangJie),
GetBoolName(sDoNotReturnNoLayoutErrorToEasyChangjei),
GetBoolName(sDoNotReturnNoLayoutErrorToMSJapaneseIMEAtFirstChar),
GetBoolName(sDoNotReturnNoLayoutErrorToMSJapaneseIMEAtCaret)));
}
// static
void