--- a/widget/windows/TSFTextStore.cpp
+++ b/widget/windows/TSFTextStore.cpp
@@ -1092,23 +1092,32 @@ public:
DECL_AND_IMPL_IS_TIP_ACTIVE(IsATOKActive)
DECL_AND_IMPL_IS_TIP_ACTIVE(IsATOK2011Active)
DECL_AND_IMPL_IS_TIP_ACTIVE(IsATOK2012Active)
DECL_AND_IMPL_IS_TIP_ACTIVE(IsATOK2013Active)
DECL_AND_IMPL_IS_TIP_ACTIVE(IsATOK2014Active)
DECL_AND_IMPL_IS_TIP_ACTIVE(IsATOK2015Active)
DECL_AND_IMPL_IS_TIP_ACTIVE(IsATOK2016Active)
+ DECL_AND_IMPL_IS_TIP_ACTIVE(IsMSBopomofoActive)
DECL_AND_IMPL_IS_TIP_ACTIVE(IsMSChangJieActive)
+ DECL_AND_IMPL_IS_TIP_ACTIVE(IsMSPhoneticActive)
DECL_AND_IMPL_IS_TIP_ACTIVE(IsMSQuickActive)
+ DECL_AND_IMPL_IS_TIP_ACTIVE(IsMSNewChangJieActive)
+ DECL_AND_IMPL_IS_TIP_ACTIVE(IsMSNewPhoneticActive)
+ DECL_AND_IMPL_IS_TIP_ACTIVE(IsMSNewQuickActive)
DECL_AND_IMPL_IS_TIP_ACTIVE(IsFreeChangJieActive)
DECL_AND_IMPL_IS_TIP_ACTIVE(IsMSPinyinActive)
+ DECL_AND_IMPL_IS_TIP_ACTIVE(IsMSPinyinNewExperienceInputStyleActive)
DECL_AND_IMPL_IS_TIP_ACTIVE(IsMSWubiActive)
+ DECL_AND_IMPL_IS_TIP_ACTIVE(IsMSKoreanIMEActive)
+ DECL_AND_IMPL_IS_TIP_ACTIVE(IsMSOldHangulActive)
+
#undef DECL_AND_IMPL_IS_TIP_ACTIVE
// Note that ATOK 2011 - 2016 refers native caret position for deciding its
// popup window position.
static bool IsATOKReferringNativeCaretActive()
{
RefPtr<TSFStaticSink> staticSink = GetInstance();
if (NS_WARN_IF(!staticSink) ||
@@ -1233,51 +1242,91 @@ private:
// * ATOK 2017
// - {6DBFD8F5-701D-11E6-920F-782BCBA6348F}
/****************************************************************************
* Traditional Chinese TIP
****************************************************************************/
+ bool IsMSBopomofoActiveInternal() const
+ {
+ // {B2F9C502-1742-11D4-9790-0080C882687E} (Win8.1, Win10)
+ static const GUID kGUID = {
+ 0xB2F9C502, 0x1742, 0x11D4,
+ { 0x97, 0x90, 0x00, 0x80, 0xC8, 0x82, 0x68, 0x7E }
+ };
+ return mActiveTIPGUID == kGUID;
+ }
+
bool IsMSChangJieActiveInternal() const
{
// {4BDF9F03-C7D3-11D4-B2AB-0080C882687E} (Win7, Win8.1, Win10)
static const GUID kGUID = {
0x4BDF9F03, 0xC7D3, 0x11D4,
{ 0xB2, 0xAB, 0x00, 0x80, 0xC8, 0x82, 0x68, 0x7E }
};
return mActiveTIPGUID == kGUID;
}
+ bool IsMSPhoneticActiveInternal() const
+ {
+ // {761309DE-317A-11D4-9B5D-0080C882687E} (Win7)
+ static const GUID kGUID = {
+ 0x761309DE, 0x317A, 0x11D4,
+ { 0x9B, 0x5D, 0x00, 0x80, 0xC8, 0x82, 0x68, 0x7E }
+ };
+ return mActiveTIPGUID == kGUID;
+ }
+
bool IsMSQuickActiveInternal() const
{
// {6024B45F-5C54-11D4-B921-0080C882687E} (Win7, Win8.1, Win10)
static const GUID kGUID = {
0x6024B45F, 0x5C54, 0x11D4,
{ 0xB9, 0x21, 0x00, 0x80, 0xC8, 0x82, 0x68, 0x7E }
};
return mActiveTIPGUID == kGUID;
}
+ bool IsMSNewChangJieActiveInternal() const
+ {
+ // {F3BA907A-6C7E-11D4-97FA-0080C882687E} (Win7)
+ static const GUID kGUID = {
+ 0xF3BA907A, 0x6C7E, 0x11D4,
+ { 0x97, 0xFA, 0x00, 0x80, 0xC8, 0x82, 0x68, 0x7E }
+ };
+ return mActiveTIPGUID == kGUID;
+ }
+
+ bool IsMSNewPhoneticActiveInternal() const
+ {
+ // {B2F9C502-1742-11D4-9790-0080C882687E} (Win7)
+ static const GUID kGUID = {
+ 0xB2F9C502, 0x1742, 0x11D4,
+ { 0x97, 0x90, 0x00, 0x80, 0xC8, 0x82, 0x68, 0x7E }
+ };
+ return mActiveTIPGUID == kGUID;
+ }
+
+ bool IsMSNewQuickActiveInternal() const
+ {
+ // {0B883BA0-C1C7-11D4-87F9-0080C882687E} (Win7)
+ static const GUID kGUID = {
+ 0x0B883BA0, 0xC1C7, 0x11D4,
+ { 0x87, 0xF9, 0x00, 0x80, 0xC8, 0x82, 0x68, 0x7E }
+ };
+ return mActiveTIPGUID == kGUID;
+ }
+
// NOTE: There are some other Traditional Chinese TIPs installed in Windows:
- // * Microsoft Bopomofo
- // - {B2F9C502-1742-11D4-9790-0080C882687E} (Win8.1, Win10)
// * Chinese Traditional Array (version 6.0)
// - {D38EFF65-AA46-4FD5-91A7-67845FB02F5B} (Win7, Win8.1)
// * Chinese Traditional DaYi (version 6.0)
// - {037B2C25-480C-4D7F-B027-D6CA6B69788A} (Win7, Win8.1)
- // * Phonetic
- // - {761309DE-317A-11D4-9B5D-0080C882687E} (Win7)
- // * New ChangJie
- // - {F3BA907A-6C7E-11D4-97FA-0080C882687E} (Win7)
- // * New Phonetic
- // - {B2F9C502-1742-11D4-9790-0080C882687E} (Win7)
- // * New Quick
- // - {0B883BA0-C1C7-11D4-87F9-0080C882687E} (Win7)
bool IsFreeChangJieActiveInternal() const
{
// {B58630B5-0ED3-4335-BBC9-E77BBCB43CAD}
static const GUID kGUID = {
0xB58630B5, 0x0ED3, 0x4335,
{ 0xBB, 0xC9, 0xE7, 0x7B, 0xBC, 0xB4, 0x3C, 0xAD }
};
@@ -1296,16 +1345,26 @@ private:
// {FA550B04-5AD7-411F-A5AC-CA038EC515D7} (Win8.1, Win10)
static const GUID kGUID = {
0xFA550B04, 0x5AD7, 0x411F,
{ 0xA5, 0xAC, 0xCA, 0x03, 0x8E, 0xC5, 0x15, 0xD7 }
};
return mActiveTIPGUID == kGUID;
}
+ bool IsMSPinyinNewExperienceInputStyleActiveInternal() const
+ {
+ // {F3BA9077-6C7E-11D4-97FA-0080C882687E} (Win7)
+ static const GUID kGUID = {
+ 0xF3BA9077, 0x6C7E, 0x11D4,
+ { 0x97, 0xFA, 0x00, 0x80, 0xC8, 0x82, 0x68, 0x7E }
+ };
+ return mActiveTIPGUID == kGUID;
+ }
+
bool IsMSWubiActiveInternal() const
{
// {82590C13-F4DD-44F4-BA1D-8667246FDF8E} (Win8.1, Win10)
static const GUID kGUID = {
0x82590C13, 0xF4DD, 0x44F4,
{ 0xBA, 0x1D, 0x86, 0x67, 0x24, 0x6F, 0xDF, 0x8E }
};
return mActiveTIPGUID == kGUID;
@@ -1315,18 +1374,44 @@ private:
// * Chinese Simplified QuanPin (version 6.0)
// - {54FC610E-6ABD-4685-9DDD-A130BDF1B170} (Win8.1)
// * Chinese Simplified ZhengMa (version 6.0)
// - {733B4D81-3BC3-4132-B91A-E9CDD5E2BFC9} (Win8.1)
// * Chinese Simplified ShuangPin (version 6.0)
// - {EF63706D-31C4-490E-9DBB-BD150ADC454B} (Win8.1)
// * Microsoft Pinyin ABC Input Style
// - {FCA121D2-8C6D-41FB-B2DE-A2AD110D4820} (Win7)
- // * Microsoft Pinyin New Experience Input Style
- // - {F3BA9077-6C7E-11D4-97FA-0080C882687E} (Win7)
+
+ /****************************************************************************
+ * Korean TIP
+ ****************************************************************************/
+
+ bool IsMSKoreanIMEActiveInternal() const
+ {
+ // {B5FE1F02-D5F2-4445-9C03-C568F23C99A1} (Win7, Win8.1, Win10)
+ static const GUID kGUID = {
+ 0xB5FE1F02, 0xD5F2, 0x4445,
+ { 0x9C, 0x03, 0xC5, 0x68, 0xF2, 0x3C, 0x99, 0xA1 }
+ };
+ return mActiveTIPGUID == kGUID;
+ }
+
+ bool IsMSOldHangulActiveInternal() const
+ {
+ // {B60AF051-257A-46BC-B9D3-84DAD819BAFB} (Win8.1, Win10)
+ static const GUID kGUID = {
+ 0xB60AF051, 0x257A, 0x46BC,
+ { 0xB9, 0xD3, 0x84, 0xDA, 0xD8, 0x19, 0xBA, 0xFB }
+ };
+ return mActiveTIPGUID == kGUID;
+ }
+
+ // NOTE: There is the other Korean TIP installed in Windows:
+ // * Microsoft IME 2010
+ // - {48878C45-93F9-4aaf-A6A1-272CD863C4F5} (Win7)
public: // ITfInputProcessorProfileActivationSink
STDMETHODIMP OnActivated(DWORD, LANGID, REFCLSID, REFGUID, REFGUID,
HKL, DWORD);
private:
TSFStaticSink();
virtual ~TSFStaticSink() {}
@@ -1600,16 +1685,19 @@ public:
static bool aName () \
{ \
static bool s ## aName ## Value = \
Preferences::GetBool(aPref, aDefaultValue); \
return s ## aName ## Value; \
}
DECL_AND_IMPL_BOOL_PREF(
+ "intl.ime.hack.set_input_scope_of_url_bar_to_default",
+ ShouldSetInputScopeOfURLBarToDefault, true)
+ DECL_AND_IMPL_BOOL_PREF(
"intl.tsf.hack.atok.create_native_caret",
NeedToCreateNativeCaretForLegacyATOK, true)
DECL_AND_IMPL_BOOL_PREF(
"intl.tsf.hack.atok.do_not_return_no_layout_error_of_composition_string",
DoNotReturnNoLayoutErrorToATOKOfCompositionString, true)
DECL_AND_IMPL_BOOL_PREF(
"intl.tsf.hack.ms_simplified_chinese.do_not_return_no_layout_error",
DoNotReturnNoLayoutErrorToMSSimplifiedTIP, true)
@@ -3614,43 +3702,64 @@ TSFTextStore::InsertEmbedded(DWORD dwFla
MOZ_LOG(sTextStoreLog, LogLevel::Info,
("0x%p TSFTextStore::InsertEmbedded() called "
"but not supported (E_NOTIMPL)", this));
// embedded objects are not supported
return E_NOTIMPL;
}
+// static
+bool
+TSFTextStore::ShouldSetInputScopeOfURLBarToDefault()
+{
+ // FYI: Google Japanese Input may be an IMM-IME. If it's installed on
+ // Win7, it's always IMM-IME. Otherwise, basically, it's a TIP.
+ // However, if it's installed on Win7 and has not been updated yet
+ // after the OS is upgraded to Win8 or later, it's still an IMM-IME.
+ // Therefore, we also need to check with IMMHandler here.
+ return TSFPrefs::ShouldSetInputScopeOfURLBarToDefault() &&
+ (IMMHandler::IsGoogleJapaneseInputActive() ||
+ (!TSFTextStore::IsIMM_IMEActive() &&
+ (TSFStaticSink::IsMSJapaneseIMEActive() ||
+ TSFStaticSink::IsGoogleJapaneseInputActive() ||
+ TSFStaticSink::IsMSBopomofoActive() ||
+ TSFStaticSink::IsMSChangJieActive() ||
+ TSFStaticSink::IsMSPhoneticActive() ||
+ TSFStaticSink::IsMSQuickActive() ||
+ TSFStaticSink::IsMSNewChangJieActive() ||
+ TSFStaticSink::IsMSNewPhoneticActive() ||
+ TSFStaticSink::IsMSNewQuickActive() ||
+ TSFStaticSink::IsMSPinyinActive() ||
+ TSFStaticSink::IsMSPinyinNewExperienceInputStyleActive() ||
+ (IsWin8OrLater() && TSFStaticSink::IsMSKoreanIMEActive()) ||
+ TSFStaticSink::IsMSOldHangulActive() ||
+ TSFStaticSink::IsMSWubiActive())));
+}
+
void
TSFTextStore::SetInputScope(const nsString& aHTMLInputType,
const nsString& aHTMLInputInputMode)
{
mInputScopes.Clear();
if (aHTMLInputType.IsEmpty() || aHTMLInputType.EqualsLiteral("text")) {
if (aHTMLInputInputMode.EqualsLiteral("url")) {
mInputScopes.AppendElement(IS_URL);
} else if (aHTMLInputInputMode.EqualsLiteral("mozAwesomebar")) {
// Even if Awesomebar has focus, user may not input URL directly.
// However, on-screen keyboard for URL should be shown because it has
// some useful additional keys like ".com" and they are not hindrances
// even when inputting non-URL text, e.g., words to search something in
- // the web. On the other hand, MS-IME for Japanese and Google Japanese
- // Input make their open state "closed" automatically if we notify them
- // of URL as the input scope. However, this is very annoying for the
- // users when they try to input some words to search the web or
+ // the web. On the other hand, a lot of Microsoft's IMEs and Google
+ // Japanese Input make their open state "closed" automatically if we
+ // notify them of URL as the input scope. However, this is very annoying
+ // for the users when they try to input some words to search the web or
// bookmark/history items. Therefore, if they are active, we need to
// notify them of the default input scope for avoiding this issue.
- // FYI: Google Japanese Input may be an IMM-IME. If it's installed on
- // Win7, it's always IMM-IME. Otherwise, basically, it's a TIP.
- // However, if it's installed on Win7 and has not been updated yet
- // after the OS is upgraded to Win8 or later, it's still an IMM-IME.
- // Therefore, we also need to check with IMMHandler here.
- if (TSFStaticSink::IsMSJapaneseIMEActive() ||
- TSFStaticSink::IsGoogleJapaneseInputActive() ||
- IMMHandler::IsGoogleJapaneseInputActive()) {
+ if (TSFTextStore::ShouldSetInputScopeOfURLBarToDefault()) {
return;
}
// Don't append IS_SEARCH here for showing on-screen keyboard for URL.
mInputScopes.AppendElement(IS_URL);
} else if (aHTMLInputInputMode.EqualsLiteral("email")) {
mInputScopes.AppendElement(IS_EMAIL_SMTPEMAILADDRESS);
} else if (aHTMLInputType.EqualsLiteral("tel")) {
mInputScopes.AppendElement(IS_TELEPHONE_FULLTELEPHONENUMBER);