зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1469875
- Make nsPluginInstanceOwner::RequestCommitOrCancel() call IMEStateManager::NotifyIME() rather than calling nsIWidget::NotifyIME() r=m_kato
Any content code except TextComposition shouldn't call nsIWidget::NotifyIM() since IMEStateManager and TextComposition manage state of the composition. Therefore, we need to make nsPluginInstanceOwner::RequestCommitOrCancel() call IMEStateManager::NotifyIME() instead. Additionally, this method should ignore the request if composition has already been gone. This patch makes check whether there is a TextComposition instance for the widget and the composition is handled in the plugin owner element. MozReview-Commit-ID: 5cx5X2hGfek --HG-- extra : rebase_source : 3ff55f877a47ffa74b82af827f1500432b8c272b
This commit is contained in:
Родитель
7d0fb9784f
Коммит
09e0a5196b
|
@ -892,11 +892,37 @@ nsPluginInstanceOwner::RequestCommitOrCancel(bool aCommitted)
|
|||
}
|
||||
}
|
||||
|
||||
if (aCommitted) {
|
||||
widget->NotifyIME(widget::REQUEST_TO_COMMIT_COMPOSITION);
|
||||
} else {
|
||||
widget->NotifyIME(widget::REQUEST_TO_CANCEL_COMPOSITION);
|
||||
// Retrieve TextComposition for the widget with IMEStateManager instead of
|
||||
// using GetTextComposition() because we cannot know whether the method
|
||||
// failed due to no widget or no composition.
|
||||
RefPtr<TextComposition> composition =
|
||||
IMEStateManager::GetTextCompositionFor(widget);
|
||||
if (!composition) {
|
||||
// If there is composition, we should just ignore this request since
|
||||
// the composition may have been committed after the plugin process
|
||||
// sent this request.
|
||||
return true;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIContent> content = do_QueryReferent(mContent);
|
||||
if (content != composition->GetEventTargetNode()) {
|
||||
// If the composition is handled in different node, that means that
|
||||
// the composition for the plugin has gone and new composition has
|
||||
// already started. So, request from the plugin should be ignored
|
||||
// since user inputs different text now.
|
||||
return true;
|
||||
}
|
||||
|
||||
// If active composition is being handled in the plugin, let's request to
|
||||
// commit/cancel the composition via both IMEStateManager and TextComposition
|
||||
// for avoid breaking the status management of composition. I.e., don't
|
||||
// call nsIWidget::NotifyIME() directly from here.
|
||||
IMEStateManager::NotifyIME(aCommitted ?
|
||||
widget::REQUEST_TO_COMMIT_COMPOSITION :
|
||||
widget::REQUEST_TO_CANCEL_COMPOSITION,
|
||||
widget, composition->GetTabParent());
|
||||
// FYI: This instance may have been destroyed. Be careful if you need to
|
||||
// access members of this class.
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче