mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 03:15:11 +00:00
Factor out how APZ-aware events are dispatched from widgets. (bug 1126090 part 2, r=kats)
This commit is contained in:
parent
4691a243e2
commit
bbb91f19dc
@ -326,7 +326,7 @@ nsWindow::DispatchTouchEventForAPZ(const MultiTouchInput& aInput,
|
||||
// for "normal" flow. The event might get sent to the child process still,
|
||||
// but if it doesn't we need to notify the APZ of various things. All of
|
||||
// that happens in DispatchEventForAPZ
|
||||
DispatchEventForAPZ(&event, aGuid, aInputBlockId);
|
||||
ProcessUntransformedAPZEvent(&event, aGuid, aInputBlockId);
|
||||
}
|
||||
|
||||
class DispatchTouchInputOnControllerThread : public Task
|
||||
|
@ -3255,19 +3255,7 @@ nsWindow::OnScrollEvent(GdkEventScroll *aEvent)
|
||||
|
||||
wheelEvent.time = aEvent->time;
|
||||
|
||||
if (mAPZC) {
|
||||
uint64_t inputBlockId = 0;
|
||||
ScrollableLayerGuid guid;
|
||||
|
||||
nsEventStatus result = mAPZC->ReceiveInputEvent(*wheelEvent.AsWheelEvent(), &guid, &inputBlockId);
|
||||
if (result == nsEventStatus_eConsumeNoDefault) {
|
||||
return;
|
||||
}
|
||||
DispatchEventForAPZ(&wheelEvent, guid, inputBlockId);
|
||||
} else {
|
||||
nsEventStatus status;
|
||||
DispatchEvent(&wheelEvent, status);
|
||||
}
|
||||
DispatchAPZAwareEvent(&wheelEvent);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -973,9 +973,9 @@ void nsBaseWidget::ConfigureAPZCTreeManager()
|
||||
}
|
||||
|
||||
nsEventStatus
|
||||
nsBaseWidget::DispatchEventForAPZ(WidgetGUIEvent* aEvent,
|
||||
const ScrollableLayerGuid& aGuid,
|
||||
uint64_t aInputBlockId)
|
||||
nsBaseWidget::ProcessUntransformedAPZEvent(WidgetInputEvent* aEvent,
|
||||
const ScrollableLayerGuid& aGuid,
|
||||
uint64_t aInputBlockId)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
InputAPZContext context(aGuid, aInputBlockId);
|
||||
@ -1015,6 +1015,25 @@ nsBaseWidget::DispatchEventForAPZ(WidgetGUIEvent* aEvent,
|
||||
return status;
|
||||
}
|
||||
|
||||
nsEventStatus
|
||||
nsBaseWidget::DispatchAPZAwareEvent(WidgetInputEvent* aEvent)
|
||||
{
|
||||
if (mAPZC) {
|
||||
uint64_t inputBlockId = 0;
|
||||
ScrollableLayerGuid guid;
|
||||
|
||||
nsEventStatus result = mAPZC->ReceiveInputEvent(*aEvent, &guid, &inputBlockId);
|
||||
if (result == nsEventStatus_eConsumeNoDefault) {
|
||||
return result;
|
||||
}
|
||||
return ProcessUntransformedAPZEvent(aEvent, guid, inputBlockId);
|
||||
}
|
||||
|
||||
nsEventStatus status;
|
||||
DispatchEvent(aEvent, status);
|
||||
return status;
|
||||
}
|
||||
|
||||
void
|
||||
nsBaseWidget::GetPreferredCompositorBackends(nsTArray<LayersBackend>& aHints)
|
||||
{
|
||||
|
@ -232,6 +232,9 @@ public:
|
||||
NS_IMETHOD UnregisterTouchWindow() MOZ_OVERRIDE;
|
||||
NS_IMETHOD_(TextEventDispatcher*) GetTextEventDispatcher() MOZ_OVERRIDE MOZ_FINAL;
|
||||
|
||||
// Dispatch an event that must be first be routed through APZ.
|
||||
nsEventStatus DispatchAPZAwareEvent(mozilla::WidgetInputEvent* aEvent) MOZ_OVERRIDE;
|
||||
|
||||
void NotifyWindowDestroyed();
|
||||
void NotifySizeMoveDone();
|
||||
void NotifyWindowMoved(int32_t aX, int32_t aY);
|
||||
@ -327,11 +330,10 @@ protected:
|
||||
virtual void ConfigureAPZCTreeManager();
|
||||
virtual already_AddRefed<GeckoContentController> CreateRootContentController();
|
||||
|
||||
// Dispatch an event that has been routed through APZ directly from the
|
||||
// widget.
|
||||
nsEventStatus DispatchEventForAPZ(mozilla::WidgetGUIEvent* aEvent,
|
||||
const ScrollableLayerGuid& aGuid,
|
||||
uint64_t aInputBlockId);
|
||||
// Dispatch an event that has already been routed through APZ.
|
||||
nsEventStatus ProcessUntransformedAPZEvent(mozilla::WidgetInputEvent* aEvent,
|
||||
const ScrollableLayerGuid& aGuid,
|
||||
uint64_t aInputBlockId);
|
||||
|
||||
const nsIntRegion RegionFromArray(const nsTArray<nsIntRect>& aRects);
|
||||
void ArrayFromRegion(const nsIntRegion& aRegion, nsTArray<nsIntRect>& aRects);
|
||||
|
@ -1687,6 +1687,13 @@ class nsIWidget : public nsISupports {
|
||||
NS_IMETHOD DispatchEvent(mozilla::WidgetGUIEvent* event,
|
||||
nsEventStatus & aStatus) = 0;
|
||||
|
||||
/**
|
||||
* Dispatches an event that must be handled by APZ first, when APZ is
|
||||
* enabled. If invoked in the child process, it is forwarded to the
|
||||
* parent process synchronously.
|
||||
*/
|
||||
virtual nsEventStatus DispatchAPZAwareEvent(mozilla::WidgetInputEvent* aEvent) = 0;
|
||||
|
||||
/**
|
||||
* Enables the dropping of files to a widget (XXX this is temporary)
|
||||
*
|
||||
|
@ -3666,20 +3666,13 @@ bool nsWindow::DispatchKeyboardEvent(WidgetGUIEvent* event)
|
||||
|
||||
bool nsWindow::DispatchScrollEvent(WidgetGUIEvent* aEvent)
|
||||
{
|
||||
nsEventStatus status;
|
||||
|
||||
if (mAPZC && aEvent->mClass == eWheelEventClass) {
|
||||
uint64_t inputBlockId = 0;
|
||||
ScrollableLayerGuid guid;
|
||||
|
||||
nsEventStatus result = mAPZC->ReceiveInputEvent(*aEvent->AsWheelEvent(), &guid, &inputBlockId);
|
||||
if (result == nsEventStatus_eConsumeNoDefault) {
|
||||
return true;
|
||||
}
|
||||
status = DispatchEventForAPZ(aEvent, guid, inputBlockId);
|
||||
} else {
|
||||
if (aEvent->mClass != eWheelEventClass) {
|
||||
nsEventStatus status;
|
||||
DispatchEvent(aEvent, status);
|
||||
return ConvertStatus(status);
|
||||
}
|
||||
|
||||
nsEventStatus status = DispatchAPZAwareEvent(aEvent->AsInputEvent());
|
||||
return ConvertStatus(status);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user