Bug 1609675 - Enable a `TS_E_NOLAYOUT` hack for MS-IME even if running on Win10 Build 17643 or later r=m_kato

MS-IME should get `TS_E_NOLAYOUT` error correctly when it's running on Win10
Build 17643 or later.  However, according to the bug report, MS-IME itself
does not handle it correctly.  Therefore, we need to enable a hack for MS-IME
for Japanese even when
`intl.tsf.hack.allow_to_stop_hacking_on_build_17643_or_later` is true.

Differential Revision: https://phabricator.services.mozilla.com/D63045

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Masayuki Nakano 2020-02-18 04:59:10 +00:00
Родитель 410a57c757
Коммит df94cd5ba4
1 изменённых файлов: 9 добавлений и 6 удалений

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

@ -4728,25 +4728,28 @@ bool TSFTextStore::MaybeHackNoErrorLayoutBugs(LONG& aACPStart, LONG& aACPEnd) {
// mode on Win7. So, we should never return TS_E_NOLAYOUT to MS IME for
// Japanese.
case TextInputProcessorID::eMicrosoftIMEForJapanese:
if (sAlllowToStopHackingIfFine) {
return false;
}
// Basically, MS-IME tries to retrieve whole composition string rect
// at deciding suggest window immediately after unlocking the document.
// However, in e10s mode, the content hasn't updated yet in most cases.
// Therefore, if the first character at the retrieving range rect is
// available, we should use it as the result.
// Note that according to bug 1609675, MS-IME for Japanese itself does
// not handle TS_E_NOLAYOUT correctly at least on Build 18363.657 (1909).
if (TSFPrefs::DoNotReturnNoLayoutErrorToMSJapaneseIMEAtFirstChar() &&
aACPStart < aACPEnd) {
aACPEnd = aACPStart;
break;
}
if (sAlllowToStopHackingIfFine) {
return false;
}
// Although, the condition is not clear, MS-IME sometimes retrieves the
// caret rect immediately after modifying the composition string but
// before unlocking the document. In such case, we should return the
// nearest character rect.
else if (TSFPrefs::DoNotReturnNoLayoutErrorToMSJapaneseIMEAtCaret() &&
aACPStart == aACPEnd && selectionForTSF.IsCollapsed() &&
selectionForTSF.EndOffset() == aACPEnd) {
if (TSFPrefs::DoNotReturnNoLayoutErrorToMSJapaneseIMEAtCaret() &&
aACPStart == aACPEnd && selectionForTSF.IsCollapsed() &&
selectionForTSF.EndOffset() == aACPEnd) {
int32_t minOffsetOfLayoutChanged =
static_cast<int32_t>(mContentForTSF.MinOffsetOfLayoutChanged());
aACPEnd = aACPStart = std::max(minOffsetOfLayoutChanged - 1, 0);