From 2e7b45dab0b7213639b8706115ba66141095ec95 Mon Sep 17 00:00:00 2001 From: John Schoenick Date: Thu, 24 Oct 2013 14:04:36 -0700 Subject: [PATCH] Bug 836786 - Allow mousemove events to propagate from windowless plugins. r=josh --- dom/plugins/base/nsPluginInstanceOwner.cpp | 13 +++++++++---- dom/plugins/base/nsPluginInstanceOwner.h | 3 ++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/dom/plugins/base/nsPluginInstanceOwner.cpp b/dom/plugins/base/nsPluginInstanceOwner.cpp index 2c401a503d35..10c610fc63a9 100644 --- a/dom/plugins/base/nsPluginInstanceOwner.cpp +++ b/dom/plugins/base/nsPluginInstanceOwner.cpp @@ -1682,7 +1682,8 @@ nsPluginInstanceOwner::ProcessMouseDown(nsIDOMEvent* aMouseEvent) return NS_OK; } -nsresult nsPluginInstanceOwner::DispatchMouseToPlugin(nsIDOMEvent* aMouseEvent) +nsresult nsPluginInstanceOwner::DispatchMouseToPlugin(nsIDOMEvent* aMouseEvent, + bool aAllowPropagate) { #if !defined(XP_MACOSX) if (!mPluginWindow || (mPluginWindow->type == NPWindowTypeWindow)) @@ -1699,7 +1700,9 @@ nsresult nsPluginInstanceOwner::DispatchMouseToPlugin(nsIDOMEvent* aMouseEvent) nsEventStatus rv = ProcessEvent(*mouseEvent); if (nsEventStatus_eConsumeNoDefault == rv) { aMouseEvent->PreventDefault(); - aMouseEvent->StopPropagation(); + if (!aAllowPropagate) { + aMouseEvent->StopPropagation(); + } } if (mouseEvent->message == NS_MOUSE_BUTTON_UP) { mLastMouseDownButtonType = -1; @@ -1741,8 +1744,10 @@ nsPluginInstanceOwner::HandleEvent(nsIDOMEvent* aEvent) } return DispatchMouseToPlugin(aEvent); } - if (eventType.EqualsLiteral("mousemove") || - eventType.EqualsLiteral("click") || + if (eventType.EqualsLiteral("mousemove")) { + return DispatchMouseToPlugin(aEvent, true); + } + if (eventType.EqualsLiteral("click") || eventType.EqualsLiteral("dblclick") || eventType.EqualsLiteral("mouseover") || eventType.EqualsLiteral("mouseout")) { diff --git a/dom/plugins/base/nsPluginInstanceOwner.h b/dom/plugins/base/nsPluginInstanceOwner.h index 6ed09facfdcf..d704e8783e78 100644 --- a/dom/plugins/base/nsPluginInstanceOwner.h +++ b/dom/plugins/base/nsPluginInstanceOwner.h @@ -365,7 +365,8 @@ private: nsRefPtr mCXMenuListener; nsresult DispatchKeyToPlugin(nsIDOMEvent* aKeyEvent); - nsresult DispatchMouseToPlugin(nsIDOMEvent* aMouseEvent); + nsresult DispatchMouseToPlugin(nsIDOMEvent* aMouseEvent, + bool aAllowPropagate = false); nsresult DispatchFocusToPlugin(nsIDOMEvent* aFocusEvent); int mLastMouseDownButtonType;