Bug 1208944 - Part 10-a. Call CallWindowProc when WidgetPluginEvent isn't handled by plugin. r=masayuki

This commit is contained in:
Makoto Kato 2015-12-29 22:57:38 +09:00
parent b27d1a5baf
commit 3317a4cbfe
10 changed files with 66 additions and 4 deletions

View File

@ -286,6 +286,11 @@ parent:
*/
async SetCandidateWindowForPlugin(int32_t aX, int32_t aY);
/**
* When plugin event isn't consumed, call this
*/
async DefaultProcOfPluginEvent(WidgetPluginEvent aEvent);
/**
* Request that the parent process move focus to the browser's frame. If
* canRaise is true, the window can be raised if it is inactive.

View File

@ -1948,8 +1948,11 @@ TabChild::RecvPluginEvent(const WidgetPluginEvent& aEvent)
{
WidgetPluginEvent localEvent(aEvent);
localEvent.widget = mPuppetWidget;
APZCCallbackHelper::DispatchWidgetEvent(localEvent);
// XXX If not consumed, we should call default action (ex. DefWindowProc)?
nsEventStatus status = APZCCallbackHelper::DispatchWidgetEvent(localEvent);
if (status != nsEventStatus_eConsumeNoDefault) {
// If not consumed, we should call default action
SendDefaultProcOfPluginEvent(aEvent);
}
return true;
}

View File

@ -2409,6 +2409,18 @@ TabParent::RecvSetCandidateWindowForPlugin(const int32_t& aX,
return true;
}
bool
TabParent::RecvDefaultProcOfPluginEvent(const WidgetPluginEvent& aEvent)
{
nsCOMPtr<nsIWidget> widget = GetWidget();
if (!widget) {
return true;
}
widget->DefaultProcOfPluginEvent(aEvent);
return true;
}
bool
TabParent::RecvGetInputContext(int32_t* aIMEEnabled,
int32_t* aIMEOpen)

View File

@ -198,6 +198,8 @@ public:
virtual bool RecvSetPluginFocused(const bool& aFocused) override;
virtual bool RecvSetCandidateWindowForPlugin(const int32_t& aX,
const int32_t& aY) override;
virtual bool RecvDefaultProcOfPluginEvent(
const WidgetPluginEvent& aEvent) override;
virtual bool RecvGetInputContext(int32_t* aIMEEnabled,
int32_t* aIMEOpen) override;
virtual bool RecvSetInputContext(const int32_t& aIMEEnabled,

View File

@ -687,6 +687,15 @@ PuppetWidget::SetPluginFocused(bool& aFocused)
return NS_OK;
}
void
PuppetWidget::DefaultProcOfPluginEvent(const WidgetPluginEvent& aEvent)
{
if (!mTabChild) {
return;
}
mTabChild->SendDefaultProcOfPluginEvent(aEvent);
}
NS_IMETHODIMP_(void)
PuppetWidget::SetInputContext(const InputContext& aContext,
const InputContextAction& aAction)

View File

@ -220,6 +220,8 @@ public:
nsString& aCommitted) override;
NS_IMETHOD SetPluginFocused(bool& aFocused) override;
virtual void DefaultProcOfPluginEvent(
const mozilla::WidgetPluginEvent& aEvent) override;
virtual nsresult SynthesizeNativeKeyEvent(int32_t aNativeKeyboardLayout,
int32_t aNativeKeyCode,

View File

@ -220,6 +220,9 @@ public:
virtual void SetCandidateWindowForPlugin(int32_t aX,
int32_t aY) override
{ }
virtual void DefaultProcOfPluginEvent(
const mozilla::WidgetPluginEvent& aEvent) override
{ }
NS_IMETHOD AttachNativeKeyEvent(mozilla::WidgetKeyboardEvent& aEvent) override { return NS_ERROR_NOT_IMPLEMENTED; }
NS_IMETHOD_(bool) ExecuteNativeKeyBinding(
NativeKeyBindingsType aType,

View File

@ -133,8 +133,8 @@ typedef void* nsNativeWidget;
#endif
#define NS_IWIDGET_IID \
{ 0xa3db64d2, 0x5a73, 0x425f, \
{ 0x9b, 0xb0, 0x57, 0x7f, 0xe5, 0x56, 0x43, 0x15 } }
{ 0x73c0a475, 0x450f, 0x4202, \
{ 0xab, 0xb4, 0x62, 0xf8, 0x9d, 0xbe, 0xf7, 0x9a } }
/*
* Window shadow styles
@ -1804,6 +1804,12 @@ public:
*/
virtual void SetCandidateWindowForPlugin(int32_t aX, int32_t aY) = 0;
/**
* Handle default action when PluginEvent isn't handled
*/
virtual void DefaultProcOfPluginEvent(
const mozilla::WidgetPluginEvent& aEvent) = 0;
/*
* Notifies the input context changes.
*/

View File

@ -7763,6 +7763,24 @@ nsWindow::SetCandidateWindowForPlugin(int32_t aX, int32_t aY)
IMEHandler::SetCandidateWindow(this, &form);
}
void
nsWindow::DefaultProcOfPluginEvent(const WidgetPluginEvent& aEvent)
{
const NPEvent* pPluginEvent =
static_cast<const NPEvent*>(aEvent.mPluginEvent);
if (NS_WARN_IF(!pPluginEvent)) {
return;
}
if (!mWnd) {
return;
}
CallWindowProcW(GetPrevWindowProc(), mWnd, pPluginEvent->event,
pPluginEvent->wParam, pPluginEvent->lParam);
}
/**************************************************************
**************************************************************
**

View File

@ -299,6 +299,8 @@ public:
virtual void SetCandidateWindowForPlugin(int32_t aX,
int32_t aY) override;
virtual void DefaultProcOfPluginEvent(
const mozilla::WidgetPluginEvent& aEvent) override;
protected:
virtual ~nsWindow();