Bug 1278084 part.3 TextComposition shouldn't decide composition string which is only an ideographic space as a placeholder r?m_kato
Currently, when TextComposition tries to forcibly commit composition synchronously, it cancels the composition if there is only an ideographic space since legacy Chinese IMEs for Windows were used an ideographic space as a placeholder and shows actual composition string in its owning window (called reading window).
However, Japanese TIPs basically use composition to input an ideographic space. Unfortunately, this intentional input of an ideographic space is always canceled if an editor commits to composition at every input event in TSF mode because TSF cannot commit during a call of ITextStore::RequestLock(). Additionally, we will enable e10s mode, then, on all platforms, requesting commit composition is handled asynchronously.
Therefore, we should make the hack disabled in default settings now. If we'll find a way to distinguish if an ideographic space is a placeholder, we should recover this hack. Note that such input fields cannot handle such legacy IMEs, so, disabling the hack in default settings must be fine.
MozReview-Commit-ID: IdBcfBxeJum
--- a/dom/events/TextComposition.cpp
+++ b/dom/events/TextComposition.cpp
@@ -262,20 +262,23 @@ TextComposition::DispatchCompositionEven
aCompositionEvent->mRanges);
}
if (aCompositionEvent->mMessage == eCompositionCommitAsIs) {
NS_ASSERTION(!aCompositionEvent->mRanges,
"mRanges of eCompositionCommitAsIs should be null");
aCompositionEvent->mRanges = nullptr;
NS_ASSERTION(aCompositionEvent->mData.IsEmpty(),
"mData of eCompositionCommitAsIs should be empty string");
- if (mLastData == IDEOGRAPHIC_SPACE) {
- // If the last data is an ideographic space (FullWidth space), it must be
+ bool removePlaceholderCharacter =
+ Preferences::GetBool("intl.ime.remove_placeholder_character_at_commit",
+ false);
+ if (removePlaceholderCharacter && mLastData == IDEOGRAPHIC_SPACE) {
+ // If the last data is an ideographic space (FullWidth space), it might be
// a placeholder character of some Chinese IME. So, committing with
- // this data must not be expected by users. Let's use empty string.
+ // this data might not be expected by users. Let's use empty string.
aCompositionEvent->mData.Truncate();
} else {
aCompositionEvent->mData = mLastData;
}
} else if (aCompositionEvent->mMessage == eCompositionCommit) {
NS_ASSERTION(!aCompositionEvent->mRanges,
"mRanges of eCompositionCommit should be null");
aCompositionEvent->mRanges = nullptr;
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -1972,16 +1972,22 @@ pref("font.language.group",
// Android-specific pref to use key-events-only mode for IME-unaware webapps.
#ifdef MOZ_WIDGET_ANDROID
pref("intl.ime.hack.on_ime_unaware_apps.fire_key_events_for_composition", true);
#else
pref("intl.ime.hack.on_ime_unaware_apps.fire_key_events_for_composition", false);
#endif
+// If you use legacy Chinese IME which puts an ideographic space to composition
+// string as placeholder, this pref might be useful. If this is true and when
+// web contents forcibly commits composition (e.g., moving focus), the
+// ideographic space will be ignored (i.e., commits with empty string).
+pref("intl.ime.remove_placeholder_character_at_commit", false);
+
// these locales have right-to-left UI
pref("intl.uidirection.ar", "rtl");
pref("intl.uidirection.he", "rtl");
pref("intl.uidirection.fa", "rtl");
pref("intl.uidirection.ug", "rtl");
pref("intl.uidirection.ur", "rtl");
// use en-US hyphenation by default for content tagged with plain lang="en"