From ecbd3e99b622254629e136cd4381eb81126f4205 Mon Sep 17 00:00:00 2001 From: Masayuki Nakano Date: Sat, 10 Oct 2015 10:21:02 +0900 Subject: [PATCH] Bug 1211352 part.4 PuppetWidget::GetIMEUpdatePreference() should request only position change notifications while a plugin has focus r=m_kato --- widget/PuppetWidget.cpp | 9 +++++++++ widget/PuppetWidget.h | 1 + 2 files changed, 10 insertions(+) diff --git a/widget/PuppetWidget.cpp b/widget/PuppetWidget.cpp index ed8ab54cd1cb..2bd483241c7b 100644 --- a/widget/PuppetWidget.cpp +++ b/widget/PuppetWidget.cpp @@ -647,6 +647,8 @@ NS_IMETHODIMP_(void) PuppetWidget::SetInputContext(const InputContext& aContext, const InputContextAction& aAction) { + mInputContext = aContext; + #ifndef MOZ_CROSS_PROCESS_IME return; #endif @@ -737,6 +739,13 @@ PuppetWidget::GetIMEUpdatePreference() // content event only with the parent process. Therefore, this process // needs to receive a lot of information from the focused editor to sent // the latest content to the parent process. + if (mInputContext.mIMEState.mEnabled == IMEState::PLUGIN) { + // But if a plugin has focus, we cannot receive text nor selection change + // in the plugin. Therefore, PuppetWidget needs to receive only position + // change event for updating the editor rect cache. + return nsIMEUpdatePreference(mIMEPreferenceOfParent.mWantUpdates | + nsIMEUpdatePreference::NOTIFY_POSITION_CHANGE); + } return nsIMEUpdatePreference(mIMEPreferenceOfParent.mWantUpdates | nsIMEUpdatePreference::NOTIFY_SELECTION_CHANGE | nsIMEUpdatePreference::NOTIFY_TEXT_CHANGE | diff --git a/widget/PuppetWidget.h b/widget/PuppetWidget.h index b8b4b3f9fe59..0206ad3778e8 100644 --- a/widget/PuppetWidget.h +++ b/widget/PuppetWidget.h @@ -320,6 +320,7 @@ private: mozilla::RefPtr mDrawTarget; // IME nsIMEUpdatePreference mIMEPreferenceOfParent; + InputContext mInputContext; ContentCacheInChild mContentCache; bool mNeedIMEStateInit;