Bug 1185316 TabParent should flush pending IME notifications after child process handles all sending events r=smaug

This commit is contained in:
Masayuki Nakano 2015-07-22 14:51:36 +09:00
parent 3c3b507f8d
commit 7155d8167a
6 changed files with 14 additions and 14 deletions

View File

@ -260,13 +260,13 @@ parent:
returns (bool noCompositionEvent, nsString composition);
/**
* OnEventNeedingAckReceived() is called when a child process dispatches a
* OnEventNeedingAckHandled() is called after a child process dispatches a
* composition event or a selection event which is sent from the parent
* process.
*
* message The message value of the received event.
* message The message value of the handled event.
*/
prio(urgent) async OnEventNeedingAckReceived(uint32_t message);
prio(urgent) async OnEventNeedingAckHandled(uint32_t message);
/**
* Tells chrome to start plugin IME. If this results in a string getting

View File

@ -2230,20 +2230,20 @@ TabChild::RecvKeyEvent(const nsString& aType,
bool
TabChild::RecvCompositionEvent(const WidgetCompositionEvent& event)
{
unused << SendOnEventNeedingAckReceived(event.message);
WidgetCompositionEvent localEvent(event);
localEvent.widget = mPuppetWidget;
APZCCallbackHelper::DispatchWidgetEvent(localEvent);
unused << SendOnEventNeedingAckHandled(event.message);
return true;
}
bool
TabChild::RecvSelectionEvent(const WidgetSelectionEvent& event)
{
unused << SendOnEventNeedingAckReceived(event.message);
WidgetSelectionEvent localEvent(event);
localEvent.widget = mPuppetWidget;
APZCCallbackHelper::DispatchWidgetEvent(localEvent);
unused << SendOnEventNeedingAckHandled(event.message);
return true;
}

View File

@ -2099,7 +2099,7 @@ TabParent::RecvNotifyIMEPositionChange(const ContentCache& aContentCache,
}
bool
TabParent::RecvOnEventNeedingAckReceived(const uint32_t& aMessage)
TabParent::RecvOnEventNeedingAckHandled(const uint32_t& aMessage)
{
// This is called when the child process receives WidgetCompositionEvent or
// WidgetSelectionEvent.
@ -2108,10 +2108,10 @@ TabParent::RecvOnEventNeedingAckReceived(const uint32_t& aMessage)
return true;
}
// While calling OnEventNeedingAckReceived(), TabParent *might* be destroyed
// While calling OnEventNeedingAckHandled(), TabParent *might* be destroyed
// since it may send notifications to IME.
nsRefPtr<TabParent> kungFuDeathGrip(this);
mContentCache.OnEventNeedingAckReceived(widget, aMessage);
mContentCache.OnEventNeedingAckHandled(widget, aMessage);
return true;
}

View File

@ -177,7 +177,7 @@ public:
bool* aConsumedByIME) override;
virtual bool RecvNotifyIMEPositionChange(const ContentCache& aContentCache,
const widget::IMENotification& aEventMessage) override;
virtual bool RecvOnEventNeedingAckReceived(const uint32_t& aMessage) override;
virtual bool RecvOnEventNeedingAckHandled(const uint32_t& aMessage) override;
virtual bool RecvEndIMEComposition(const bool& aCancel,
bool* aNoCompositionEvent,
nsString* aComposition) override;

View File

@ -914,14 +914,14 @@ ContentCacheInParent::OnSelectionEvent(
}
void
ContentCacheInParent::OnEventNeedingAckReceived(nsIWidget* aWidget,
ContentCacheInParent::OnEventNeedingAckHandled(nsIWidget* aWidget,
uint32_t aMessage)
{
// This is called when the child process receives WidgetCompositionEvent or
// WidgetSelectionEvent.
MOZ_LOG(sContentCacheLog, LogLevel::Info,
("ContentCacheInParent: 0x%p OnEventNeedingAckReceived(aWidget=0x%p, "
("ContentCacheInParent: 0x%p OnEventNeedingAckHandled(aWidget=0x%p, "
"aMessage=%s), mPendingEventsNeedingAck=%u",
this, aWidget, GetEventMessageName(aMessage), mPendingEventsNeedingAck));

View File

@ -315,14 +315,14 @@ public:
void OnSelectionEvent(const WidgetSelectionEvent& aSelectionEvent);
/**
* OnEventNeedingAckReceived() should be called when the child process
* receives a sent event which needs acknowledging.
* OnEventNeedingAckHandled() should be called after the child process
* handles a sent event which needs acknowledging.
*
* WARNING: This may send notifications to IME. That might cause destroying
* TabParent or aWidget. Therefore, the caller must not destroy
* this instance during a call of this method.
*/
void OnEventNeedingAckReceived(nsIWidget* aWidget, uint32_t aMessage);
void OnEventNeedingAckHandled(nsIWidget* aWidget, uint32_t aMessage);
/**
* RequestToCommitComposition() requests to commit or cancel composition to