Events synthesized in the child process must be propagated back to the parent. (bug 1126090 part 3, r=smaug)

This commit is contained in:
dvander@alliedmods.net 2015-03-06 14:26:59 -08:00
parent e72d1f4ac9
commit 92bb3e4117
6 changed files with 43 additions and 3 deletions

View File

@ -1030,9 +1030,7 @@ nsDOMWindowUtils::SendWheelEvent(float aX,
wheelEvent.refPoint = ToWidgetPoint(CSSPoint(aX, aY), offset, presContext);
nsEventStatus status;
nsresult rv = widget->DispatchEvent(&wheelEvent, status);
NS_ENSURE_SUCCESS(rv, rv);
widget->DispatchAPZAwareEvent(&wheelEvent);
bool failedX = false;
if ((aOptions & WHEEL_EVENT_EXPECTED_OVERFLOW_DELTA_X_ZERO) &&

View File

@ -484,6 +484,8 @@ parent:
*/
async SetDimensions(uint32_t aFlags, int32_t aX, int32_t aY, int32_t aCx, int32_t aCy);
prio(high) sync SynthesizedMouseWheelEvent(WidgetWheelEvent event);
child:
/**
* Notify the remote browser that it has been Show()n on this

View File

@ -1232,6 +1232,20 @@ bool TabParent::SendMouseWheelEvent(WidgetWheelEvent& event)
return PBrowserParent::SendMouseWheelEvent(event, guid, blockId);
}
bool TabParent::RecvSynthesizedMouseWheelEvent(const mozilla::WidgetWheelEvent& aEvent)
{
nsCOMPtr<nsIWidget> widget = GetWidget();
if (!widget) {
return true;
}
WidgetWheelEvent localEvent(aEvent);
localEvent.widget = widget;
widget->DispatchAPZAwareEvent(&localEvent);
return true;
}
static void
DoCommandCallback(mozilla::Command aCommand, void* aData)
{

View File

@ -231,6 +231,7 @@ public:
const bool& aPreventDefault) MOZ_OVERRIDE;
virtual bool RecvSetTargetAPZC(const uint64_t& aInputBlockId,
nsTArray<ScrollableLayerGuid>&& aTargets) MOZ_OVERRIDE;
virtual bool RecvSynthesizedMouseWheelEvent(const mozilla::WidgetWheelEvent& aEvent) MOZ_OVERRIDE;
virtual PColorPickerParent*
AllocPColorPickerParent(const nsString& aTitle, const nsString& aInitialColor) MOZ_OVERRIDE;

View File

@ -328,6 +328,30 @@ PuppetWidget::DispatchEvent(WidgetGUIEvent* event, nsEventStatus& aStatus)
}
nsEventStatus
PuppetWidget::DispatchAPZAwareEvent(WidgetInputEvent* aEvent)
{
if (!gfxPrefs::AsyncPanZoomEnabled()) {
nsEventStatus status = nsEventStatus_eIgnore;
DispatchEvent(aEvent, status);
return status;
}
if (!mTabChild) {
return nsEventStatus_eIgnore;
}
switch (aEvent->mClass) {
case eWheelEventClass:
mTabChild->SendSynthesizedMouseWheelEvent(*aEvent->AsWheelEvent());
break;
default:
MOZ_ASSERT_UNREACHABLE("unsupported event type");
}
return nsEventStatus_eIgnore;
}
NS_IMETHODIMP_(bool)
PuppetWidget::ExecuteNativeKeyBinding(NativeKeyBindingsType aType,
const mozilla::WidgetKeyboardEvent& aEvent,

View File

@ -128,6 +128,7 @@ public:
void InitEvent(WidgetGUIEvent& aEvent, nsIntPoint* aPoint = nullptr);
NS_IMETHOD DispatchEvent(WidgetGUIEvent* aEvent, nsEventStatus& aStatus) MOZ_OVERRIDE;
nsEventStatus DispatchAPZAwareEvent(WidgetInputEvent* aEvent) MOZ_OVERRIDE;
NS_IMETHOD CaptureRollupEvents(nsIRollupListener* aListener,
bool aDoCapture) MOZ_OVERRIDE