Bug 1211352 part.2 PuppetWidget shouldn't send notifications which are not wanted by the parent process r=m_kato

This commit is contained in:
Masayuki Nakano 2015-10-10 10:21:01 +09:00
parent e2f56bd5c4
commit 8c675f448e
2 changed files with 17 additions and 19 deletions

View File

@ -2267,14 +2267,7 @@ TabParent::RecvNotifyIMESelection(const ContentCache& aContentCache,
return true;
mContentCache.AssignContent(aContentCache, &aIMENotification);
const nsIMEUpdatePreference updatePreference =
widget->GetIMEUpdatePreference();
if (updatePreference.WantSelectionChange() &&
(updatePreference.WantChangesCausedByComposition() ||
!aIMENotification.mSelectionChangeData.mCausedByComposition)) {
mContentCache.MaybeNotifyIME(widget, aIMENotification);
}
mContentCache.MaybeNotifyIME(widget, aIMENotification);
return true;
}
@ -2316,12 +2309,7 @@ TabParent::RecvNotifyIMEPositionChange(const ContentCache& aContentCache,
}
mContentCache.AssignContent(aContentCache, &aIMENotification);
const nsIMEUpdatePreference updatePreference =
widget->GetIMEUpdatePreference();
if (updatePreference.WantPositionChanged()) {
mContentCache.MaybeNotifyIME(widget, aIMENotification);
}
mContentCache.MaybeNotifyIME(widget, aIMENotification);
return true;
}

View File

@ -733,7 +733,10 @@ nsIMEUpdatePreference
PuppetWidget::GetIMEUpdatePreference()
{
#ifdef MOZ_CROSS_PROCESS_IME
// e10s requires IME information cache into TabParent
// e10s requires IME content cache in in the TabParent for handling query
// 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.
return nsIMEUpdatePreference(mIMEPreferenceOfParent.mWantUpdates |
nsIMEUpdatePreference::NOTIFY_SELECTION_CHANGE |
nsIMEUpdatePreference::NOTIFY_TEXT_CHANGE |
@ -800,7 +803,13 @@ PuppetWidget::NotifyIMEOfSelectionChange(
aIMENotification.mSelectionChangeData.mReversed,
aIMENotification.mSelectionChangeData.GetWritingMode());
mTabChild->SendNotifyIMESelection(mContentCache, aIMENotification);
if (mIMEPreferenceOfParent.WantSelectionChange() &&
(mIMEPreferenceOfParent.WantChangesCausedByComposition() ||
!aIMENotification.mSelectionChangeData.mCausedByComposition)) {
mTabChild->SendNotifyIMESelection(mContentCache, aIMENotification);
} else {
mTabChild->SendUpdateContentCache(mContentCache);
}
return NS_OK;
}
@ -835,9 +844,10 @@ PuppetWidget::NotifyIMEOfPositionChange(const IMENotification& aIMENotification)
NS_WARN_IF(!mContentCache.CacheSelection(this, &aIMENotification))) {
return NS_ERROR_FAILURE;
}
if (!mTabChild->SendNotifyIMEPositionChange(mContentCache,
aIMENotification)) {
return NS_ERROR_FAILURE;
if (mIMEPreferenceOfParent.WantPositionChanged()) {
mTabChild->SendNotifyIMEPositionChange(mContentCache, aIMENotification);
} else {
mTabChild->SendUpdateContentCache(mContentCache);
}
return NS_OK;
}