Bug 1273510 part.1 TSFTextStore should use native caret hack only when ATOK 2011 - 2016 is active r=m_kato

ATOK 2011 - 2016 check focused window class name if it's a Mozilla's window.  Then, they refer native caret position for deciding its popup window.  However, future ATOK release will stop referring native caret position on Mozilla's windows.  Therefore, we can stop creating native caret for new ATOK.

MozReview-Commit-ID: HPh3DVqTkvc

--HG--
extra : rebase_source : 00b75b75df2ba1bace328cfb75172c78c6bea29d
This commit is contained in:
Masayuki Nakano 2016-08-09 16:53:00 +09:00
Родитель 2cc8f66f57
Коммит 1f206a7c93
2 изменённых файлов: 80 добавлений и 9 удалений

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

@ -859,6 +859,75 @@ public:
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
****************************************************************************/
@ -1194,7 +1263,7 @@ 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;
@ -3838,10 +3907,12 @@ TSFTextStore::GetTextExt(TsViewCookie vcView,
// 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) {
@ -5678,7 +5749,7 @@ TSFTextStore::Initialize()
sDisabledDocumentMgr = disabledDocumentMgr;
sDisabledContext = disabledContext;
sCreateNativeCaretForATOK =
sCreateNativeCaretForLegacyATOK =
Preferences::GetBool("intl.tsf.hack.atok.create_native_caret", true);
sDoNotReturnNoLayoutErrorToMSSimplifiedTIP =
Preferences::GetBool(
@ -5713,14 +5784,14 @@ TSFTextStore::Initialize()
(" 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),

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

@ -985,7 +985,7 @@ protected:
static DWORD sClientId;
// Enables/Disables hack for specific TIP.
static bool sCreateNativeCaretForATOK;
static bool sCreateNativeCaretForLegacyATOK;
static bool sDoNotReturnNoLayoutErrorToMSSimplifiedTIP;
static bool sDoNotReturnNoLayoutErrorToMSTraditionalTIP;
static bool sDoNotReturnNoLayoutErrorToFreeChangJie;