Bug 1211352 part.3 nsIWidget::GetIMEupdatePreference() for each platform should not request any notifications while a plugin has focus r=m_kato

This commit is contained in:
Masayuki Nakano 2015-10-10 10:21:02 +09:00
parent 7783be638e
commit c892b229d9
5 changed files with 24 additions and 2 deletions

View File

@ -2486,6 +2486,11 @@ nsWindow::AddIMETextChange(const IMEChange& aChange) {
nsIMEUpdatePreference
nsWindow::GetIMEUpdatePreference()
{
// While a plugin has focus, nsWindow for Android doesn't need any
// notifications.
if (mInputContext.mIMEState.mEnabled == IMEState::PLUGIN) {
return nsIMEUpdatePreference();
}
return nsIMEUpdatePreference(
nsIMEUpdatePreference::NOTIFY_SELECTION_CHANGE |
nsIMEUpdatePreference::NOTIFY_TEXT_CHANGE);

View File

@ -1876,6 +1876,10 @@ nsChildView::ExecuteNativeKeyBinding(NativeKeyBindingsType aType,
nsIMEUpdatePreference
nsChildView::GetIMEUpdatePreference()
{
// While a plugin has focus, IMEInputHandler doesn't need any notifications.
if (mInputContext.mIMEState.mEnabled == IMEState::PLUGIN) {
return nsIMEUpdatePreference();
}
return nsIMEUpdatePreference(nsIMEUpdatePreference::NOTIFY_SELECTION_CHANGE);
}

View File

@ -277,6 +277,12 @@ IMContextWrapper::~IMContextWrapper()
nsIMEUpdatePreference
IMContextWrapper::GetIMEUpdatePreference() const
{
// While a plugin has focus, IMContextWrapper doesn't need any
// notifications.
if (mInputContext.mIMEState.mEnabled == IMEState::PLUGIN) {
return nsIMEUpdatePreference();
}
nsIMEUpdatePreference::Notifications notifications =
nsIMEUpdatePreference::NOTIFY_SELECTION_CHANGE;
// If it's not enabled, we don't need position change notification.

View File

@ -38,10 +38,10 @@ namespace widget {
* IMEHandler
******************************************************************************/
bool IMEHandler::sPluginHasFocus = false;
#ifdef NS_ENABLE_TSF
bool IMEHandler::sIsInTSFMode = false;
bool IMEHandler::sIsIMMEnabled = true;
bool IMEHandler::sPluginHasFocus = false;
bool IMEHandler::sShowingOnScreenKeyboard = false;
decltype(SetInputScopes)* IMEHandler::sSetInputScopes = nullptr;
#endif // #ifdef NS_ENABLE_TSF
@ -295,6 +295,12 @@ IMEHandler::NotifyIME(nsWindow* aWindow,
nsIMEUpdatePreference
IMEHandler::GetUpdatePreference()
{
// While a plugin has focus, neither TSFTextStore nor IMMHandler needs
// notifications.
if (sPluginHasFocus) {
return nsIMEUpdatePreference();
}
#ifdef NS_ENABLE_TSF
if (IsTSFAvailable()) {
return TSFTextStore::GetIMEUpdatePreference();

View File

@ -111,6 +111,8 @@ public:
#endif // #ifdef DEBUG
private:
static bool sPluginHasFocus;
#ifdef NS_ENABLE_TSF
static decltype(SetInputScopes)* sSetInputScopes;
static void SetInputScopeForIMM32(nsWindow* aWindow,
@ -119,7 +121,6 @@ private:
// If sIMMEnabled is false, any IME messages are not handled in TSF mode.
// Additionally, IME context is always disassociated from focused window.
static bool sIsIMMEnabled;
static bool sPluginHasFocus;
static bool sShowingOnScreenKeyboard;
static bool IsTSFAvailable() { return (sIsInTSFMode && !sPluginHasFocus); }