Skip to content
This repository has been archived by the owner on Aug 4, 2022. It is now read-only.

Commit

Permalink
Detect wheel zoom via WheelPrefs instead of the Ctrl modifier. (bug 1…
Browse files Browse the repository at this point in the history
…127700, r=smaug)
  • Loading branch information
David Anderson committed Feb 2, 2015
1 parent 2d4ab4c commit 9525198
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
6 changes: 6 additions & 0 deletions dom/events/EventStateManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5489,6 +5489,12 @@ EventStateManager::WheelPrefs::NeedToComputeLineOrPageDelta(
(mMultiplierY[index] != 1.0 && mMultiplierY[index] != -1.0);
}

bool
EventStateManager::WheelEventIsScrollAction(WidgetWheelEvent* aEvent)
{
return WheelPrefs::GetInstance()->ComputeActionFor(aEvent) == WheelPrefs::ACTION_SCROLL;
}

bool
EventStateManager::WheelPrefs::IsOverOnePageScrollAllowedX(
WidgetWheelEvent* aEvent)
Expand Down
3 changes: 3 additions & 0 deletions dom/events/EventStateManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,9 @@ class EventStateManager : public nsSupportsWeakReference,
static LayoutDeviceIntPoint GetChildProcessOffset(nsFrameLoader* aFrameLoader,
const WidgetEvent& aEvent);

// Returns true if the given WidgetWheelEvent will resolve to a scroll action.
static bool WheelEventIsScrollAction(WidgetWheelEvent* aEvent);

// Holds the point in screen coords that a mouse event was dispatched to,
// before we went into pointer lock mode. This is constantly updated while
// the pointer is not locked, but we don't update it while the pointer is
Expand Down
9 changes: 5 additions & 4 deletions gfx/layers/apz/src/APZCTreeManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "mozilla/mozalloc.h" // for operator new
#include "mozilla/TouchEvents.h"
#include "mozilla/Preferences.h" // for Preferences
#include "mozilla/EventStateManager.h" // for WheelPrefs
#include "nsDebug.h" // for NS_WARNING
#include "nsPoint.h" // for nsIntPoint
#include "nsThreadUtils.h" // for NS_IsMainThread
Expand Down Expand Up @@ -891,11 +892,11 @@ APZCTreeManager::ReceiveInputEvent(WidgetInputEvent& aEvent,
}
case eWheelEventClass: {
WidgetWheelEvent& wheelEvent = *aEvent.AsWheelEvent();
if (wheelEvent.IsControl() ||
wheelEvent.deltaMode != nsIDOMWheelEvent::DOM_DELTA_LINE)
if (wheelEvent.deltaMode != nsIDOMWheelEvent::DOM_DELTA_LINE ||
!EventStateManager::WheelEventIsScrollAction(&wheelEvent))
{
// Don't send through APZ if we could be ctrl+zooming or if the delta
// mode is not line-based.
// Don't send through APZ if we're not scrolling or if the delta mode
// is not line-based.
return ProcessEvent(aEvent, aOutTargetGuid, aOutInputBlockId);
}
return ProcessWheelEvent(wheelEvent, aOutTargetGuid, aOutInputBlockId);
Expand Down

0 comments on commit 9525198

Please sign in to comment.