Bug 1255968 - Part 2: Implement puppet widget's HasPendingInputEvent() for interruptible reflow to work in content process. r=bz

--HG--
extra : rebase_source : cea071e17ad620a9a958ff897a1f18db73789977
This commit is contained in:
Ting-Yu Chou 2016-03-29 15:03:54 +08:00
parent 9c7a4ca7f0
commit 9ea65b71ed
2 changed files with 41 additions and 0 deletions

View File

@ -1422,5 +1422,43 @@ PuppetWidget::ZoomToRect(const uint32_t& aPresShellId,
mTabChild->ZoomToRect(aPresShellId, aViewId, aRect, aFlags);
}
bool
PuppetWidget::HasPendingInputEvent()
{
if (!mTabChild) {
return false;
}
static const IPC::Message::msgid_t kInputEvents[] = {
mozilla::dom::PBrowser::Msg_RealMouseMoveEvent__ID,
mozilla::dom::PBrowser::Msg_SynthMouseMoveEvent__ID,
mozilla::dom::PBrowser::Msg_RealMouseButtonEvent__ID,
mozilla::dom::PBrowser::Msg_RealKeyEvent__ID,
mozilla::dom::PBrowser::Msg_MouseWheelEvent__ID,
mozilla::dom::PBrowser::Msg_RealTouchEvent__ID,
mozilla::dom::PBrowser::Msg_RealTouchMoveEvent__ID,
mozilla::dom::PBrowser::Msg_RealDragEvent__ID,
mozilla::dom::PBrowser::Msg_UpdateDimensions__ID,
mozilla::dom::PBrowser::Msg_MouseEvent__ID,
mozilla::dom::PBrowser::Msg_KeyEvent__ID
};
bool ret = false;
for (IPC::Message::msgid_t e: kInputEvents) {
mTabChild->GetIPCChannel()->PeekMessages(
e,
[&ret](const IPC::Message& aMsg) -> bool {
ret = true;
return false; // Stop peeking.
}
);
if (ret) {
break;
}
}
return ret;
}
} // namespace widget
} // namespace mozilla

View File

@ -259,6 +259,9 @@ public:
const FrameMetrics::ViewID& aViewId,
const CSSRect& aRect,
const uint32_t& aFlags) override;
virtual bool HasPendingInputEvent() override;
protected:
virtual nsresult NotifyIMEInternal(
const IMENotification& aIMENotification) override;