Don't route wheel events through APZ if they require custom deltas. (bug 1146674, r=kats)

This commit is contained in:
David Anderson 2015-03-24 14:58:49 -07:00
parent 763f6a896e
commit 0edd0b1707
3 changed files with 28 additions and 1 deletions

View File

@ -5514,12 +5514,28 @@ EventStateManager::WheelPrefs::NeedToComputeLineOrPageDelta(
(mMultiplierY[index] != 1.0 && mMultiplierY[index] != -1.0);
}
bool
EventStateManager::WheelPrefs::HasUserPrefsForDelta(WidgetWheelEvent* aEvent)
{
Index index = GetIndexFor(aEvent);
Init(index);
return mMultiplierX[index] != 1.0 ||
mMultiplierY[index] != 1.0;
}
bool
EventStateManager::WheelEventIsScrollAction(WidgetWheelEvent* aEvent)
{
return WheelPrefs::GetInstance()->ComputeActionFor(aEvent) == WheelPrefs::ACTION_SCROLL;
}
bool
EventStateManager::WheelEventNeedsDeltaMultipliers(WidgetWheelEvent* aEvent)
{
return WheelPrefs::GetInstance()->HasUserPrefsForDelta(aEvent);
}
bool
EventStateManager::WheelPrefs::IsOverOnePageScrollAllowedX(
WidgetWheelEvent* aEvent)

View File

@ -225,6 +225,10 @@ public:
// Returns true if the given WidgetWheelEvent will resolve to a scroll action.
static bool WheelEventIsScrollAction(WidgetWheelEvent* aEvent);
// Returns true if user prefs for wheel deltas apply to the given
// WidgetWheelEvent.
static bool WheelEventNeedsDeltaMultipliers(WidgetWheelEvent* aEvent);
// Returns whether or not a frame can be vertically scrolled with a mouse
// wheel (as opposed to, say, a selection or touch scroll).
static bool CanVerticallyScrollFrameWithWheel(nsIFrame* aFrame);
@ -423,6 +427,12 @@ protected:
*/
void ApplyUserPrefsToDelta(WidgetWheelEvent* aEvent);
/**
* Returns whether or not ApplyUserPrefsToDelta() would change the delta
* values of an event.
*/
bool HasUserPrefsForDelta(WidgetWheelEvent* aEvent);
/**
* If ApplyUserPrefsToDelta() changed the delta values with customized
* prefs, the overflowDelta values would be inflated.

View File

@ -903,7 +903,8 @@ APZCTreeManager::WillHandleWheelEvent(WidgetWheelEvent* aEvent)
{
return EventStateManager::WheelEventIsScrollAction(aEvent) &&
aEvent->deltaMode == nsIDOMWheelEvent::DOM_DELTA_LINE &&
!gfxPrefs::MouseWheelHasScrollDeltaOverride();
!gfxPrefs::MouseWheelHasScrollDeltaOverride() &&
!EventStateManager::WheelEventNeedsDeltaMultipliers(aEvent);
}
nsEventStatus