Forward Windows events to APZ directly from nsWindow. (bug 1109985 part 2, r=kats)

This commit is contained in:
David Anderson 2014-12-15 23:31:12 -08:00
Родитель d666dd017d
Коммит 537e832f5a
3 изменённых файлов: 31 добавлений и 3 удалений

Просмотреть файл

@ -19,6 +19,7 @@
#include "mozilla/Hal.h"
#include "mozilla/ipc/DocumentRendererParent.h"
#include "mozilla/layers/CompositorParent.h"
#include "mozilla/layers/InputAPZContext.h"
#include "mozilla/layout/RenderFrameParent.h"
#include "mozilla/MouseEvents.h"
#include "mozilla/net/NeckoChild.h"
@ -2103,6 +2104,20 @@ TabParent::MaybeForwardEventToRenderFrame(WidgetInputEvent& aEvent,
ScrollableLayerGuid* aOutTargetGuid,
uint64_t* aOutInputBlockId)
{
if (aEvent.mClass == eWheelEventClass) {
// Wheel events must be sent to APZ directly from the widget. New APZ-
// aware events should follow suit and move there as well. However, we
// do need to inform the child process of the correct target and block
// id.
if (aOutTargetGuid) {
*aOutTargetGuid = InputAPZContext::GetTargetLayerGuid();
}
if (aOutInputBlockId) {
*aOutInputBlockId = InputAPZContext::GetInputBlockId();
}
return nsEventStatus_eIgnore;
}
if (RenderFrameParent* rfp = GetRenderFrame()) {
return rfp->NotifyInputEvent(aEvent, aOutTargetGuid, aOutInputBlockId);
}

Просмотреть файл

@ -55,8 +55,8 @@ InputQueue::ReceiveInputEvent(const nsRefPtr<AsyncPanZoomController>& aTarget,
bool
InputQueue::MaybeHandleCurrentBlock(const nsRefPtr<AsyncPanZoomController>& aTarget,
CancelableBlockState *block,
const InputData& aEvent) {
CancelableBlockState *block,
const InputData& aEvent) {
if (block == CurrentBlock() && block->IsReadyForHandling()) {
INPQ_LOG("current block is ready with target %p preventdefault %d\n",
aTarget.get(), block->IsDefaultPrevented());
@ -162,7 +162,7 @@ InputQueue::ReceiveScrollWheelInput(const nsRefPtr<AsyncPanZoomController>& aTar
block->AddEvent(aEvent.AsScrollWheelInput());
}
return nsEventStatus_eIgnore;
return nsEventStatus_eConsumeDoDefault;
}
void

Просмотреть файл

@ -187,6 +187,7 @@
#endif
#include "mozilla/layers/APZCTreeManager.h"
#include "mozilla/layers/InputAPZContext.h"
using namespace mozilla;
using namespace mozilla::dom;
@ -3741,6 +3742,18 @@ bool nsWindow::DispatchKeyboardEvent(WidgetGUIEvent* event)
bool nsWindow::DispatchScrollEvent(WidgetGUIEvent* aEvent)
{
uint64_t inputBlockId = 0;
ScrollableLayerGuid guid;
if (mAPZC && aEvent->mClass == eWheelEventClass) {
nsEventStatus status = mAPZC->ReceiveInputEvent(*aEvent->AsWheelEvent(), &guid, &inputBlockId);
if (status == nsEventStatus_eConsumeNoDefault) {
return true;
}
}
InputAPZContext context(guid, inputBlockId);
nsEventStatus status;
DispatchEvent(aEvent, status);
return ConvertStatus(status);