If APZ is enabled, do not handle wheel-event scrolling in layout. (bug 1126090 part 1, r=smaug)

This commit is contained in:
dvander@alliedmods.net 2015-03-06 14:26:59 -08:00
Родитель cdb738f18d
Коммит 4691a243e2
3 изменённых файлов: 30 добавлений и 4 удалений

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

@ -87,6 +87,7 @@
#include "mozilla/LookAndFeel.h"
#include "GeckoProfiler.h"
#include "Units.h"
#include "mozilla/layers/APZCTreeManager.h"
#ifdef XP_MACOSX
#import <ApplicationServices/ApplicationServices.h>
@ -3007,7 +3008,18 @@ EventStateManager::PostHandleEvent(nsPresContext* aPresContext,
}
WidgetWheelEvent* wheelEvent = aEvent->AsWheelEvent();
switch (WheelPrefs::GetInstance()->ComputeActionFor(wheelEvent)) {
// When APZ is enabled, the actual scroll animation might be handled by
// the compositor.
WheelPrefs::Action action;
if (gfxPrefs::AsyncPanZoomEnabled() &&
layers::APZCTreeManager::WillHandleWheelEvent(wheelEvent))
{
action = WheelPrefs::ACTION_NONE;
} else {
action = WheelPrefs::GetInstance()->ComputeActionFor(wheelEvent);
}
switch (action) {
case WheelPrefs::ACTION_SCROLL: {
// For scrolling of default action, we should honor the mouse wheel
// transaction.

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

@ -854,6 +854,13 @@ APZCTreeManager::ProcessWheelEvent(WidgetWheelEvent& aEvent,
return status;
}
bool
APZCTreeManager::WillHandleWheelEvent(WidgetWheelEvent* aEvent)
{
return EventStateManager::WheelEventIsScrollAction(aEvent) &&
aEvent->deltaMode == nsIDOMWheelEvent::DOM_DELTA_LINE;
}
nsEventStatus
APZCTreeManager::ReceiveInputEvent(WidgetInputEvent& aEvent,
ScrollableLayerGuid* aOutTargetGuid,
@ -891,9 +898,7 @@ APZCTreeManager::ReceiveInputEvent(WidgetInputEvent& aEvent,
}
case eWheelEventClass: {
WidgetWheelEvent& wheelEvent = *aEvent.AsWheelEvent();
if (wheelEvent.deltaMode != nsIDOMWheelEvent::DOM_DELTA_LINE ||
!EventStateManager::WheelEventIsScrollAction(&wheelEvent))
{
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);

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

@ -382,6 +382,15 @@ public:
*/
nsRefPtr<const OverscrollHandoffChain> BuildOverscrollHandoffChain(const nsRefPtr<AsyncPanZoomController>& aInitialTarget);
public:
// 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);
protected:
// Protected destructor, to discourage deletion outside of Release():
virtual ~APZCTreeManager();