Files
sousa-gecko/widget/windows/TSFTextInputProcessorList.h
Masayuki Nakano f15f8cc1c7 Bug 2040148 - Make TSFTextStore hack the wrong TS_E_NOLAYOUT error handling of WeChat Input Method r=m_kato
When we return `TS_E_NOLAYOUT` from `ITextStoreACP::GetTextExt()`,
WeChat Input Method does not handle the error correctly and shows its
UI to the top-left corner of the screen. Therefore, we need not to
return `TS_E_NOLAYOUT` if it's the active TIP.

However, I found 2 extant bugs and they block fixing this bug.

First one is, `TSFTextStore::MaybeHackNoErrorLayoutBugs()` does nothing
if `IsHandlingCompositionInContent()` return `false`. [1] This means
that we don't hack `GetTextExt()` behavior when the composition starts
and not yet dispatched the first event. So, this causes temporarily
appear the UI in odd place, like top-left corner of the screen even with
some other IMEs.

The other one is, `TSFTextStore::GetTextExt()` may query a line break
rect when the user starts composition at end of a line. [2] So, only
when starting composition, the UI may (maybe temporarily) appear at
start of next line. Therefore, if the line scanning range in the
original content has a linefeed, we should query a rect before the
first linefeed, i.e., only the text rect in the start line even if it's
0-length. The difference between the caret rect and the new character
rect should be smaller than the difference from the start of the next
line.

1. https://searchfox.org/firefox-main/rev/e28b34ab33dbf49364999070168cbb7e11e8e5bd/widget/windows/TSFTextStore.cpp#2156,2172,2175
2. https://searchfox.org/firefox-main/rev/e28b34ab33dbf49364999070168cbb7e11e8e5bd/widget/windows/TSFTextStore.cpp#2070

Differential Revision: https://phabricator.services.mozilla.com/D303266
2026-06-01 03:37:56 +00:00

61 lines
1.3 KiB
C++

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef TSFTextInputProcessorList_h
#define TSFTextInputProcessorList_h
namespace mozilla::widget {
enum class TextInputProcessorID {
// Internal use only. This won't be returned by TSFStaticSink::ActiveTIP().
NotComputed,
// Not a TIP. E.g., simple keyboard layout or IMM-IME.
None,
// Used for other TIPs, i.e., any TIPs which we don't support specifically.
Unknown,
// TIP for Japanese.
MicrosoftIMEForJapanese,
MicrosoftOfficeIME2010ForJapanese,
GoogleJapaneseInput,
ATOK2011,
ATOK2012,
ATOK2013,
ATOK2014,
ATOK2015,
ATOK2016,
ATOKUnknown,
Japanist10,
// TIP for Traditional Chinese.
MicrosoftBopomofo,
MicrosoftChangJie,
MicrosoftPhonetic,
MicrosoftQuick,
MicrosoftNewChangJie,
MicrosoftNewPhonetic,
MicrosoftNewQuick,
FreeChangJie,
// TIP for Simplified Chinese.
MicrosoftPinyin,
MicrosoftPinyinNewExperienceInputStyle,
MicrosoftWubi,
Sogou,
WeChat,
// TIP for Korean.
MicrosoftIMEForKorean,
MicrosoftOldHangul,
// Keyman Desktop, which can install various language keyboards.
KeymanDesktop,
};
} // namespace mozilla::widget
#endif // #ifndef TSFTextInputProcessorList_h