Bug 1242690 - Squash together DispatchAPZAwareEvent and DispatchInputEvent. r=dvander

This commit is contained in:
Kartikaya Gupta 2016-01-29 16:31:15 -05:00
parent 8d55e0c5a1
commit 4d5851e1c1
11 changed files with 28 additions and 61 deletions

View File

@ -811,7 +811,7 @@ nsDOMWindowUtils::SendWheelEvent(float aX,
wheelEvent.refPoint = nsContentUtils::ToWidgetPoint(CSSPoint(aX, aY), offset, presContext);
widget->DispatchAPZAwareEvent(&wheelEvent);
widget->DispatchInputEvent(&wheelEvent);
if (widget->AsyncPanZoomEnabled()) {
// Computing overflow deltas is not compatible with APZ, so if APZ is

View File

@ -1450,7 +1450,7 @@ bool TabParent::RecvDispatchWheelEvent(const mozilla::WidgetWheelEvent& aEvent)
localEvent.widget = widget;
localEvent.refPoint -= GetChildProcessOffset();
widget->DispatchAPZAwareEvent(&localEvent);
widget->DispatchInputEvent(&localEvent);
return true;
}

View File

@ -353,29 +353,6 @@ PuppetWidget::DispatchEvent(WidgetGUIEvent* event, nsEventStatus& aStatus)
nsEventStatus
PuppetWidget::DispatchInputEvent(WidgetInputEvent* aEvent)
{
if (!mTabChild) {
return nsEventStatus_eIgnore;
}
switch (aEvent->mClass) {
case eMouseEventClass:
Unused <<
mTabChild->SendDispatchMouseEvent(*aEvent->AsMouseEvent());
break;
case eKeyboardEventClass:
Unused <<
mTabChild->SendDispatchKeyboardEvent(*aEvent->AsKeyboardEvent());
break;
default:
MOZ_ASSERT_UNREACHABLE("unsupported event type");
}
return nsEventStatus_eIgnore;
}
nsEventStatus
PuppetWidget::DispatchAPZAwareEvent(WidgetInputEvent* aEvent)
{
if (!AsyncPanZoomEnabled()) {
nsEventStatus status = nsEventStatus_eIgnore;
@ -392,6 +369,14 @@ PuppetWidget::DispatchAPZAwareEvent(WidgetInputEvent* aEvent)
Unused <<
mTabChild->SendDispatchWheelEvent(*aEvent->AsWheelEvent());
break;
case eMouseEventClass:
Unused <<
mTabChild->SendDispatchMouseEvent(*aEvent->AsMouseEvent());
break;
case eKeyboardEventClass:
Unused <<
mTabChild->SendDispatchKeyboardEvent(*aEvent->AsKeyboardEvent());
break;
default:
MOZ_ASSERT_UNREACHABLE("unsupported event type");
}

View File

@ -132,7 +132,6 @@ public:
LayoutDeviceIntPoint* aPoint = nullptr);
NS_IMETHOD DispatchEvent(WidgetGUIEvent* aEvent, nsEventStatus& aStatus) override;
nsEventStatus DispatchAPZAwareEvent(WidgetInputEvent* aEvent) override;
nsEventStatus DispatchInputEvent(WidgetInputEvent* aEvent) override;
void SetConfirmedTargetAPZC(uint64_t aInputBlockId,
const nsTArray<ScrollableLayerGuid>& aTargets) const override;

View File

@ -4538,7 +4538,7 @@ NSEvent* gLastDragMouseDownEvent = nil;
else
geckoEvent.button = WidgetMouseEvent::eLeftButton;
mGeckoChild->DispatchAPZAwareEvent(&geckoEvent);
mGeckoChild->DispatchInputEvent(&geckoEvent);
mBlockedLastMouseDown = NO;
// XXX maybe call markedTextSelectionChanged:client: here?
@ -4565,7 +4565,7 @@ NSEvent* gLastDragMouseDownEvent = nil;
// This might destroy our widget (and null out mGeckoChild).
bool defaultPrevented =
(mGeckoChild->DispatchAPZAwareEvent(&geckoEvent) == nsEventStatus_eConsumeNoDefault);
(mGeckoChild->DispatchInputEvent(&geckoEvent) == nsEventStatus_eConsumeNoDefault);
// Check to see if we are double-clicking in the titlebar.
CGFloat locationInTitlebar = [[self window] frame].size.height - [theEvent locationInWindow].y;
@ -4686,7 +4686,7 @@ NewCGSRegionFromRegion(const LayoutDeviceIntRegion& aRegion,
WidgetMouseEvent::eReal);
[self convertCocoaMouseEvent:theEvent toGeckoEvent:&geckoEvent];
mGeckoChild->DispatchAPZAwareEvent(&geckoEvent);
mGeckoChild->DispatchInputEvent(&geckoEvent);
NS_OBJC_END_TRY_ABORT_BLOCK;
}
@ -4732,7 +4732,7 @@ NewCGSRegionFromRegion(const LayoutDeviceIntRegion& aRegion,
geckoEvent.button = WidgetMouseEvent::eRightButton;
geckoEvent.clickCount = [theEvent clickCount];
mGeckoChild->DispatchAPZAwareEvent(&geckoEvent);
mGeckoChild->DispatchInputEvent(&geckoEvent);
if (!mGeckoChild)
return;
@ -4756,7 +4756,7 @@ NewCGSRegionFromRegion(const LayoutDeviceIntRegion& aRegion,
geckoEvent.clickCount = [theEvent clickCount];
nsAutoRetainCocoaObject kungFuDeathGrip(self);
mGeckoChild->DispatchAPZAwareEvent(&geckoEvent);
mGeckoChild->DispatchInputEvent(&geckoEvent);
NS_OBJC_END_TRY_ABORT_BLOCK;
}
@ -4840,7 +4840,7 @@ static int32_t RoundUp(double aDouble)
WidgetWheelEvent wheelEvent(true, msg, mGeckoChild);
[self convertCocoaMouseWheelEvent:theEvent toGeckoEvent:&wheelEvent];
mExpectingWheelStop = (msg == eWheelOperationStart);
mGeckoChild->DispatchAPZAwareEvent(wheelEvent.AsInputEvent());
mGeckoChild->DispatchInputEvent(wheelEvent.AsInputEvent());
}
- (void)sendWheelCondition:(BOOL)condition

View File

@ -2695,7 +2695,7 @@ nsWindow::DispatchMissedButtonReleases(GdkEventCrossing *aGdkEvent)
WidgetMouseEvent synthEvent(true, eMouseUp, this,
WidgetMouseEvent::eSynthesized);
synthEvent.button = buttonType;
DispatchAPZAwareEvent(&synthEvent);
DispatchInputEvent(&synthEvent);
}
}
}
@ -2817,7 +2817,7 @@ nsWindow::OnButtonPressEvent(GdkEventButton *aEvent)
InitButtonEvent(event, aEvent);
event.pressure = mLastMotionPressure;
DispatchAPZAwareEvent(&event);
DispatchInputEvent(&event);
// right menu click on linux should also pop up a context menu
if (domButton == WidgetMouseEvent::eRightButton &&
@ -2860,7 +2860,7 @@ nsWindow::OnButtonReleaseEvent(GdkEventButton *aEvent)
gdk_event_get_axis ((GdkEvent*)aEvent, GDK_AXIS_PRESSURE, &pressure);
event.pressure = pressure ? pressure : mLastMotionPressure;
DispatchAPZAwareEvent(&event);
DispatchInputEvent(&event);
mLastMotionPressure = pressure;
}
@ -3228,7 +3228,7 @@ nsWindow::OnScrollEvent(GdkEventScroll *aEvent)
wheelEvent.time = aEvent->time;
wheelEvent.timeStamp = GetEventTimeStamp(aEvent->time);
DispatchAPZAwareEvent(&wheelEvent);
DispatchInputEvent(&wheelEvent);
}
void
@ -3445,7 +3445,7 @@ nsWindow::OnTouchEvent(GdkEventTouch* aEvent)
*event.touches.AppendElement() = touch.forget();
}
DispatchAPZAwareEvent(&event);
DispatchInputEvent(&event);
return TRUE;
}
#endif

View File

@ -1063,12 +1063,6 @@ nsBaseWidget::ProcessUntransformedAPZEvent(WidgetInputEvent* aEvent,
return status;
}
nsEventStatus
nsBaseWidget::DispatchInputEvent(WidgetInputEvent* aEvent)
{
return DispatchAPZAwareEvent(aEvent);
}
class DispatchWheelEventOnMainThread : public Task
{
public:
@ -1136,7 +1130,7 @@ private:
};
nsEventStatus
nsBaseWidget::DispatchAPZAwareEvent(WidgetInputEvent* aEvent)
nsBaseWidget::DispatchInputEvent(WidgetInputEvent* aEvent)
{
MOZ_ASSERT(NS_IsMainThread());
if (mAPZC) {

View File

@ -252,12 +252,8 @@ public:
const FrameMetrics::ViewID& aViewId,
const CSSRect& aRect,
const uint32_t& aFlags) override;
// Helper function for dispatching events which are not processed by APZ,
// but need to be transformed by APZ.
nsEventStatus DispatchInputEvent(mozilla::WidgetInputEvent* aEvent) override;
// Dispatch an event that must be first be routed through APZ.
nsEventStatus DispatchAPZAwareEvent(mozilla::WidgetInputEvent* aEvent) override;
nsEventStatus DispatchInputEvent(mozilla::WidgetInputEvent* aEvent) override;
void SetConfirmedTargetAPZC(uint64_t aInputBlockId,
const nsTArray<ScrollableLayerGuid>& aTargets) const override;

View File

@ -1415,13 +1415,6 @@ class nsIWidget : public nsISupports {
* enabled. If invoked in the child process, it is forwarded to the
* parent process synchronously.
*/
virtual nsEventStatus DispatchAPZAwareEvent(mozilla::WidgetInputEvent* aEvent) = 0;
/**
* Dispatches an event that must be transformed by APZ first, but is not
* actually handled by APZ. If invoked in the child process, it is
* forwarded to the parent process synchronously.
*/
virtual nsEventStatus DispatchInputEvent(mozilla::WidgetInputEvent* aEvent) = 0;
/**

View File

@ -185,7 +185,7 @@ private:
event.refPoint = loc;
event.touches.AppendElement(t);
}
aWindow->DispatchAPZAwareEvent(&event);
aWindow->DispatchInputEvent(&event);
}
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event

View File

@ -3928,7 +3928,7 @@ bool nsWindow::DispatchContentCommandEvent(WidgetContentCommandEvent* aEvent)
bool nsWindow::DispatchWheelEvent(WidgetWheelEvent* aEvent)
{
nsEventStatus status = DispatchAPZAwareEvent(aEvent->AsInputEvent());
nsEventStatus status = DispatchInputEvent(aEvent->AsInputEvent());
return ConvertStatus(status);
}
@ -4266,7 +4266,7 @@ nsWindow::DispatchMouseEvent(EventMessage aEventMessage, WPARAM wParam,
}
}
result = ConvertStatus(DispatchAPZAwareEvent(&event));
result = ConvertStatus(DispatchInputEvent(&event));
// Release the widget with NS_IF_RELEASE() just in case
// the context menu key code in EventListenerManager::HandleEvent()
@ -6507,13 +6507,13 @@ bool nsWindow::OnTouch(WPARAM wParam, LPARAM lParam)
if (!touchInput.mTimeStamp.IsNull()) {
// Convert MultiTouchInput to WidgetTouchEvent interface.
WidgetTouchEvent widgetTouchEvent = touchInput.ToWidgetTouchEvent(this);
DispatchAPZAwareEvent(&widgetTouchEvent);
DispatchInputEvent(&widgetTouchEvent);
}
// Dispatch touch end event if we have one.
if (!touchEndInput.mTimeStamp.IsNull()) {
// Convert MultiTouchInput to WidgetTouchEvent interface.
WidgetTouchEvent widgetTouchEvent = touchEndInput.ToWidgetTouchEvent(this);
DispatchAPZAwareEvent(&widgetTouchEvent);
DispatchInputEvent(&widgetTouchEvent);
}
}