зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1193062 - Add mHandledByAPZ on PanGestureInput and ScrollWheelInput, and sync the information to the WidgetWheelEvent. r=kats
--HG-- extra : commitid : 2qlm0ULac3 extra : rebase_source : 52fc5d3930a9b3a941f7e3665ef6b371e8a4b1b5 extra : histedit_source : d99996a3729a1bc78b9f4631f950476321f93c1f
This commit is contained in:
Родитель
a4753aced8
Коммит
4d793f82dd
|
@ -554,6 +554,33 @@ APZCTreeManager::UpdateHitTestingTree(TreeBuildingState& aState,
|
|||
return node;
|
||||
}
|
||||
|
||||
// Returns whether or not a wheel event action will be (or was) performed by
|
||||
// APZ. If this returns true, the event must not perform a synchronous
|
||||
// scroll.
|
||||
//
|
||||
// Even if this returns false, all wheel events in APZ-aware widgets must
|
||||
// be sent through APZ so they are transformed correctly for TabParent.
|
||||
static bool
|
||||
WillHandleWheelEvent(WidgetWheelEvent* aEvent)
|
||||
{
|
||||
return EventStateManager::WheelEventIsScrollAction(aEvent) &&
|
||||
(aEvent->deltaMode == nsIDOMWheelEvent::DOM_DELTA_LINE
|
||||
|| aEvent->deltaMode == nsIDOMWheelEvent::DOM_DELTA_PIXEL) &&
|
||||
!EventStateManager::WheelEventNeedsDeltaMultipliers(aEvent);
|
||||
}
|
||||
|
||||
template<typename PanGestureOrScrollWheelInput>
|
||||
static bool
|
||||
WillHandleInput(const PanGestureOrScrollWheelInput& aPanInput)
|
||||
{
|
||||
if (!NS_IsMainThread()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
WidgetWheelEvent wheelEvent = aPanInput.ToWidgetWheelEvent(nullptr);
|
||||
return WillHandleWheelEvent(&wheelEvent);
|
||||
}
|
||||
|
||||
void
|
||||
APZCTreeManager::FlushApzRepaints(uint64_t aLayersId)
|
||||
{
|
||||
|
@ -591,6 +618,12 @@ APZCTreeManager::ReceiveInputEvent(InputData& aEvent,
|
|||
FlushRepaintsToClearScreenToGeckoTransform();
|
||||
|
||||
ScrollWheelInput& wheelInput = aEvent.AsScrollWheelInput();
|
||||
|
||||
wheelInput.mHandledByAPZ = WillHandleInput(wheelInput);
|
||||
if (!wheelInput.mHandledByAPZ) {
|
||||
return result;
|
||||
}
|
||||
|
||||
nsRefPtr<AsyncPanZoomController> apzc = GetTargetAPZC(wheelInput.mOrigin,
|
||||
&hitResult);
|
||||
if (apzc) {
|
||||
|
@ -623,6 +656,11 @@ APZCTreeManager::ReceiveInputEvent(InputData& aEvent,
|
|||
FlushRepaintsToClearScreenToGeckoTransform();
|
||||
|
||||
PanGestureInput& panInput = aEvent.AsPanGestureInput();
|
||||
panInput.mHandledByAPZ = WillHandleInput(panInput);
|
||||
if (!panInput.mHandledByAPZ) {
|
||||
return result;
|
||||
}
|
||||
|
||||
nsRefPtr<AsyncPanZoomController> apzc = GetTargetAPZC(panInput.mPanStartPoint,
|
||||
&hitResult);
|
||||
if (apzc) {
|
||||
|
@ -914,25 +952,10 @@ APZCTreeManager::ProcessWheelEvent(WidgetWheelEvent& aEvent,
|
|||
nsEventStatus status = ReceiveInputEvent(input, aOutTargetGuid, aOutInputBlockId);
|
||||
aEvent.refPoint.x = input.mOrigin.x;
|
||||
aEvent.refPoint.y = input.mOrigin.y;
|
||||
aEvent.mFlags.mHandledByAPZ = true;
|
||||
aEvent.mFlags.mHandledByAPZ = input.mHandledByAPZ;
|
||||
return status;
|
||||
}
|
||||
|
||||
// Returns whether or not a wheel event action will be (or was) performed by
|
||||
// APZ. If this returns true, the event must not perform a synchronous
|
||||
// scroll.
|
||||
//
|
||||
// Even if this returns false, all wheel events in APZ-aware widgets must
|
||||
// be sent through APZ so they are transformed correctly for TabParent.
|
||||
static bool
|
||||
WillHandleWheelEvent(WidgetWheelEvent* aEvent)
|
||||
{
|
||||
return EventStateManager::WheelEventIsScrollAction(aEvent) &&
|
||||
(aEvent->deltaMode == nsIDOMWheelEvent::DOM_DELTA_LINE
|
||||
|| aEvent->deltaMode == nsIDOMWheelEvent::DOM_DELTA_PIXEL) &&
|
||||
!EventStateManager::WheelEventNeedsDeltaMultipliers(aEvent);
|
||||
}
|
||||
|
||||
nsEventStatus
|
||||
APZCTreeManager::ReceiveInputEvent(WidgetInputEvent& aEvent,
|
||||
ScrollableLayerGuid* aOutTargetGuid,
|
||||
|
@ -970,12 +993,10 @@ APZCTreeManager::ReceiveInputEvent(WidgetInputEvent& aEvent,
|
|||
}
|
||||
case eWheelEventClass: {
|
||||
WidgetWheelEvent& wheelEvent = *aEvent.AsWheelEvent();
|
||||
if (!WillHandleWheelEvent(&wheelEvent)) {
|
||||
// Don't send through APZ if we're not scrolling or if the delta mode
|
||||
// is not line-based.
|
||||
return ProcessEvent(aEvent, aOutTargetGuid, aOutInputBlockId);
|
||||
if (WillHandleWheelEvent(&wheelEvent)) {
|
||||
return ProcessWheelEvent(wheelEvent, aOutTargetGuid, aOutInputBlockId);
|
||||
}
|
||||
return ProcessWheelEvent(wheelEvent, aOutTargetGuid, aOutInputBlockId);
|
||||
return ProcessEvent(aEvent, aOutTargetGuid, aOutInputBlockId);
|
||||
}
|
||||
default: {
|
||||
return ProcessEvent(aEvent, aOutTargetGuid, aOutInputBlockId);
|
||||
|
|
|
@ -255,7 +255,7 @@ PanGestureInput::ToWidgetWheelEvent(nsIWidget* aWidget) const
|
|||
wheelEvent.lineOrPageDeltaY = mLineOrPageDeltaY;
|
||||
wheelEvent.deltaX = mPanDisplacement.x;
|
||||
wheelEvent.deltaY = mPanDisplacement.y;
|
||||
wheelEvent.mFlags.mHandledByAPZ = true;
|
||||
wheelEvent.mFlags.mHandledByAPZ = mHandledByAPZ;
|
||||
return wheelEvent;
|
||||
}
|
||||
|
||||
|
@ -327,7 +327,7 @@ ScrollWheelInput::ToWidgetWheelEvent(nsIWidget* aWidget) const
|
|||
wheelEvent.deltaY = mDeltaY;
|
||||
wheelEvent.lineOrPageDeltaX = mLineOrPageDeltaX;
|
||||
wheelEvent.lineOrPageDeltaY = mLineOrPageDeltaY;
|
||||
wheelEvent.mFlags.mHandledByAPZ = true;
|
||||
wheelEvent.mFlags.mHandledByAPZ = mHandledByAPZ;
|
||||
return wheelEvent;
|
||||
}
|
||||
|
||||
|
|
|
@ -309,7 +309,8 @@ public:
|
|||
mPanStartPoint(aPanStartPoint),
|
||||
mPanDisplacement(aPanDisplacement),
|
||||
mLineOrPageDeltaX(0),
|
||||
mLineOrPageDeltaY(0)
|
||||
mLineOrPageDeltaY(0),
|
||||
mHandledByAPZ(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -333,6 +334,8 @@ public:
|
|||
// See lineOrPageDeltaX/Y on WidgetWheelEvent.
|
||||
int32_t mLineOrPageDeltaX;
|
||||
int32_t mLineOrPageDeltaY;
|
||||
|
||||
bool mHandledByAPZ;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -512,6 +515,7 @@ public:
|
|||
mDeltaType(aDeltaType),
|
||||
mScrollMode(aScrollMode),
|
||||
mOrigin(aOrigin),
|
||||
mHandledByAPZ(false),
|
||||
mDeltaX(aDeltaX),
|
||||
mDeltaY(aDeltaY),
|
||||
mLineOrPageDeltaX(0),
|
||||
|
@ -526,6 +530,8 @@ public:
|
|||
ScrollMode mScrollMode;
|
||||
ScreenPoint mOrigin;
|
||||
|
||||
bool mHandledByAPZ;
|
||||
|
||||
// Deltas are in units corresponding to the delta type. For line deltas, they
|
||||
// are the number of line units to scroll. The number of device pixels for a
|
||||
// horizontal and vertical line unit are in FrameMetrics::mLineScrollAmount.
|
||||
|
|
Загрузка…
Ссылка в новой задаче