Bug 1053053 part.3 Notify child process's IMEStateManager of menu key event listener being installed r=smaug

This commit is contained in:
Masayuki Nakano 2015-07-01 22:19:11 +09:00
parent 52a95fd7ea
commit 0aae336afc
5 changed files with 33 additions and 2 deletions

View File

@ -463,7 +463,16 @@ IMEStateManager::OnChangeFocusInternal(nsPresContext* aPresContext,
bool setIMEState = true;
if (newTabParent) {
if (focusActuallyChanging) {
if (aAction.mFocusChange == InputContextAction::MENU_GOT_PSEUDO_FOCUS ||
aAction.mFocusChange == InputContextAction::MENU_LOST_PSEUDO_FOCUS) {
// XXX When menu keyboard listener is being uninstalled, IME state needs
// to be restored by the child process asynchronously. Therefore,
// some key events which are fired immediately after closing menu
// may not be handled by IME.
unused << newTabParent->
SendMenuKeyboardListenerInstalled(sInstalledMenuKeyboardListener);
setIMEState = sInstalledMenuKeyboardListener;
} else if (focusActuallyChanging) {
InputContext context = widget->GetInputContext();
if (context.mIMEState.mEnabled == IMEState::DISABLED) {
setIMEState = false;

View File

@ -50,7 +50,14 @@ public:
* managed by the focused content (sContent). If the focused content isn't
* managing another process, this returns nullptr.
*/
static TabParent* GetActiveTabParent() { return sActiveTabParent.get(); }
static TabParent* GetActiveTabParent()
{
// If menu has pseudo focus, we should ignore active child process.
if (sInstalledMenuKeyboardListener) {
return nullptr;
}
return sActiveTabParent.get();
}
/**
* OnTabParentDestroying() is called when aTabParent is being destroyed.

View File

@ -582,6 +582,12 @@ child:
*/
StopIMEStateManagement();
/**
* MenuKeyboardListenerInstalled() is called when menu keyboard listener
* is installed in the parent process.
*/
MenuKeyboardListenerInstalled(bool aInstalled);
/**
* @see nsIDOMWindowUtils sendMouseEvent.
*/

View File

@ -2207,6 +2207,13 @@ TabChild::RecvStopIMEStateManagement()
return true;
}
bool
TabChild::RecvMenuKeyboardListenerInstalled(const bool& aInstalled)
{
IMEStateManager::OnInstalledMenuKeyboardListener(aInstalled);
return true;
}
bool
TabChild::RecvMouseEvent(const nsString& aType,
const float& aX,

View File

@ -530,6 +530,8 @@ protected:
virtual bool RecvParentActivated(const bool& aActivated) override;
virtual bool RecvStopIMEStateManagement() override;
virtual bool RecvMenuKeyboardListenerInstalled(
const bool& aInstalled) override;
#ifdef MOZ_WIDGET_GONK
void MaybeRequestPreinitCamera();