Files
palemoon27/widget/InputData.h
T
roytam1 f7d677cddd import changes from `dev' branch of rmottola/Arctic-Fox:
- Bug 1168263 - Exclude perspective transforms from the transform used to convert from screen coordinates to an APZC's coordinate space. r=kats (dab02eb359)
- Bug 1225950 - Remove unnecessary parameter from SetNeedsComposite. r=mchang (0fb6099bd5)
- Bug 1225950 - Make mNeedsComposite a counter rather than a boolean. r=mchang (4d46dba314)
- Bug 1225950 - Force a composite if we have requested one but haven't gotten a vsync in a while. r=mchang (06f0d4553e)
- Bug 1221697 - Add a telemetry probe for time-to-composite. r=kats (c333e2ea87)
- Bug 1213120 - Ensure we don't try to use an uninitialized map. r=BenWa (99069b78fe)
- Bug 1228133 - Guard against a race condition that could result in an illegal pointer access. r=BenWa (65e1393908)
- update, mostly shadow warnings (5ca9c8ec0c)
- Bug 1119106 - Increase the radio button rendering bottom margin on 10.10 so that the button hits its frame more accurately. r=smichaud (2b55533095)
- Bug 1221451: Don't pass nil when an argument is required. r=spohl (7adfcf2543)
- Bug 1153579 - Fix -Wpointer-bool-conversion warning by removing null check of an array address. r=mstange (8c7ad82e8f)
- Bug 1204620 - Don't prepend 'image.' to CUIDraw image names on 10.11. r=stefanh (9a4794ecd4)
- Bug 1181289 - Specify size: small when drawing small scrollbars with CoreUI. r=smichaud (e75bff6036)
- Bug 1138359 - Make the margins of native-themed Cocoa buttons aware of writing mode. r=smontagu (49afef0f00)
- Bug 1220358 - Fix -Wunreachable-code warnings in widget/cocoa. r=spohl (720c720afc)
- fixup widget/ios from EventMessage change (no bug, NPOTB) (ab33d61f95)
- Bug 1217818 - Add support for the mHandledByAPZ flag on touch events as well. r=botond (d4658c671a)
- Bug 1209772 - 'mozregression was installed. please re-run your command.' when running ./mach mozregression. r=ahal (5febef290b)
- Bug 1204787 - Add |mach power|. r=glandium. (5a0d84f480)
- Bug 1214924 - Add "WindowServer" and "kernel" processes to |mach power|'s output. r=BenWa. (89c3a515f7)
- Bug 1197694 - fflush() rapl output so it always appears immediately.  r=erahm. (052568f395)
- Bug 1194560 (follow-up) - Only build rapl on Linux if the arch is x86 or x86-64. r=glandium. (0101937ffa)
- Bug 1198137 - Add some summary stats to tool/power/rapl's output. r=erahm. (53052f366b)
- Bug 1198137 (follow-up) - Add a missing #include to unbreak Mac OS builds on a CLOSED TREE. r=me (27862d34ff)
- Bug 1203834 - Fix's rapl's handling of unsupported power domains. r=glandium. (facb022467)
- Bug 1203811 - Clarify two error messages in tools/power/rapl. r=heycam. (07a6bb847e)
- Bug 1201811 (part 1) - Don't use integer arithmetic when summing totals in rapl. r=erahm. (57a1de1376)
- Bug 1201811 (part 2) - Don't print distribution stats if there was only 1 sample. r=erahm. (e5c085a4df)
- Bug 1222887 - Suppress -Wunreachable-code warning in tools/power. r=njn (4fbbbe81e1)
- Bug 1222352 - Resource Timing - nextHopProtocol does not work in e10s r=nwgh (57029cf33d)
- Bug 1211636 - use ToInteger64 in PopulateFromSuffix. r=bholley (d67e5fe9d1)
- Bug 961049 - Part 2: Remove Utilities.h; r=baku (3c09679a40)
- Bug 961049 - Part 3: Move PersistenceType serializer from indexedDB to quota module; r=baku (021478905a)
- Bug 1186809 (part 1) - Replace nsBaseHashtable::EnumerateRead() calls in dom/quota/ with iterators. r=janv. (8933726851)
- Bug 1186809 (part 2) - Replace nsBaseHashtable::EnumerateRead() calls in dom/quota/ with iterators. r=janv. (cb7c6f27dc)
- Bug 1186809 (part 3) - Replace nsBaseHashtable::EnumerateRead() calls in dom/quota/ with iterators. r=janv. (1ded98347c)
- Bug 1187151 (part 1) - Replace nsBaseHashtable::Enumerate() calls in dom/base/ with iterators. r=khuey. (a409e8590e)
- Bug 1187151 (part 2) - Replace nsBaseHashtable::Enumerate() calls in dom/base/ with iterators. r=janv. (bd4fe93dfc)
- Bug 1187151 (part 3) - Replace nsBaseHashtable::Enumerate() calls in dom/ with iterators. r=khuey. (de0f2dda26)
- Bug 1187151 (part 4) - Replace nsBaseHashtable::Enumerate() calls in dom/ with iterators. r=khuey. (e72d744118)
- Bug 1187151 (part 5) - Replace nsBaseHashtable::Enumerate() calls in dom/ with iterators. r=khuey. (18eddd5225)
- Bug 1187151 (part 6) - Replace nsBaseHashtable::Enumerate() calls in dom/ with iterators. r=khuey. (36fb6272e1)
- Bug 1187151 (part 7) - Replace nsBaseHashtable::Enumerate() calls in dom/ with iterators. r=khuey. (594438d35f)
- Bug 1187151 (part 8) - Replace nsBaseHashtable::Enumerate() calls in dom/ with iterators. r=khuey. (d8de2742d8)
- Bug 1187151 (part 9) - Replace nsBaseHashtable::Enumerate() calls in dom/ with iterators. r=khuey. (d2b4a29111)
- missing namespace (0b0453cc40)
- Bug 1187701 - add_task function for mochitest chrome and plain; r=jmaher (1c31a40c7c)
- Bug 1223831 - SpecialPowers API to create files in an e10s-compatible way. r=jmaher,baku (a04646cb50)
- Bug 1178526 - Create docshell with packageId from TabContext. r=sicking. (c89edfc7ab)
- Bug 1217694 - Signed package should come from the moz-package-origin specified in its manifest. r=valentin (705aeae07a)
- Bug 1225422 - Update the PrivilegedPackageRoot certificate. r=keeler (2a90eed63c)
- Bug 1204301 - HttpChannelParent needs to be able to GetInterface to an nsIPrompt. r=billm. (4937a2fbbe)
2023-03-13 17:37:42 +08:00

621 lines
19 KiB
C++

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef InputData_h__
#define InputData_h__
#include "nsIDOMWheelEvent.h"
#include "nsDebug.h"
#include "nsPoint.h"
#include "nsTArray.h"
#include "Units.h"
#include "mozilla/EventForwards.h"
#include "mozilla/TimeStamp.h"
template<class E> struct already_AddRefed;
class nsIWidget;
namespace mozilla {
namespace dom {
class Touch;
} // namespace dom
namespace gfx {
class Matrix4x4;
} // namespace gfx
enum InputType
{
MULTITOUCH_INPUT,
MOUSE_INPUT,
PANGESTURE_INPUT,
PINCHGESTURE_INPUT,
TAPGESTURE_INPUT,
SCROLLWHEEL_INPUT
};
class MultiTouchInput;
class MouseInput;
class PanGestureInput;
class PinchGestureInput;
class TapGestureInput;
class ScrollWheelInput;
// This looks unnecessary now, but as we add more and more classes that derive
// from InputType (eventually probably almost as many as *Events.h has), it
// will be more and more clear what's going on with a macro that shortens the
// definition of the RTTI functions.
#define INPUTDATA_AS_CHILD_TYPE(type, enumID) \
const type& As##type() const \
{ \
MOZ_ASSERT(mInputType == enumID, "Invalid cast of InputData."); \
return (const type&) *this; \
} \
type& As##type() \
{ \
MOZ_ASSERT(mInputType == enumID, "Invalid cast of InputData."); \
return (type&) *this; \
}
/** Base input data class. Should never be instantiated. */
class InputData
{
public:
InputType mInputType;
// Time in milliseconds that this data is relevant to. This only really
// matters when this data is used as an event. We use uint32_t instead of
// TimeStamp because it is easier to convert from WidgetInputEvent. The time
// is platform-specific but it in the case of B2G and Fennec it is since
// startup.
uint32_t mTime;
// Set in parallel to mTime until we determine it is safe to drop
// platform-specific event times (see bug 77992).
TimeStamp mTimeStamp;
Modifiers modifiers;
INPUTDATA_AS_CHILD_TYPE(MultiTouchInput, MULTITOUCH_INPUT)
INPUTDATA_AS_CHILD_TYPE(MouseInput, MOUSE_INPUT)
INPUTDATA_AS_CHILD_TYPE(PanGestureInput, PANGESTURE_INPUT)
INPUTDATA_AS_CHILD_TYPE(PinchGestureInput, PINCHGESTURE_INPUT)
INPUTDATA_AS_CHILD_TYPE(TapGestureInput, TAPGESTURE_INPUT)
INPUTDATA_AS_CHILD_TYPE(ScrollWheelInput, SCROLLWHEEL_INPUT)
InputData(InputType aInputType)
: mInputType(aInputType),
mTime(0),
modifiers(0)
{
}
protected:
InputData(InputType aInputType, uint32_t aTime, TimeStamp aTimeStamp,
Modifiers aModifiers)
: mInputType(aInputType),
mTime(aTime),
mTimeStamp(aTimeStamp),
modifiers(aModifiers)
{
}
};
/**
* Data container for a single touch input. Similar to dom::Touch, but used in
* off-main-thread situations. This is more for just storing touch data, whereas
* dom::Touch is more useful for dispatching through the DOM (which can only
* happen on the main thread). dom::Touch also bears the problem of storing
* pointers to nsIWidget instances which can only be used on the main thread,
* so if instead we used dom::Touch and ever set these pointers
* off-main-thread, Bad Things Can Happen(tm).
*
* Note that this doesn't inherit from InputData because this itself is not an
* event. It is only a container/struct that should have any number of instances
* within a MultiTouchInput.
*
* fixme/bug 775746: Make dom::Touch inherit from this class.
*/
class SingleTouchData
{
public:
// Construct a SingleTouchData from a Screen point.
// mLocalScreenPoint remains (0,0) unless it's set later.
SingleTouchData(int32_t aIdentifier,
ScreenIntPoint aScreenPoint,
ScreenSize aRadius,
float aRotationAngle,
float aForce)
: mIdentifier(aIdentifier),
mScreenPoint(aScreenPoint),
mRadius(aRadius),
mRotationAngle(aRotationAngle),
mForce(aForce)
{
}
// Construct a SingleTouchData from a ParentLayer point.
// mScreenPoint remains (0,0) unless it's set later.
// Note: if APZ starts using the radius for anything, we should add a local
// version of that too, and have this constructor take it as a ParentLayerSize.
SingleTouchData(int32_t aIdentifier,
ParentLayerPoint aLocalScreenPoint,
ScreenSize aRadius,
float aRotationAngle,
float aForce)
: mIdentifier(aIdentifier),
mLocalScreenPoint(aLocalScreenPoint),
mRadius(aRadius),
mRotationAngle(aRotationAngle),
mForce(aForce)
{
}
SingleTouchData()
{
}
already_AddRefed<dom::Touch> ToNewDOMTouch() const;
// A unique number assigned to each SingleTouchData within a MultiTouchInput so
// that they can be easily distinguished when handling a touch start/move/end.
int32_t mIdentifier;
// Point on the screen that the touch hit, in device pixels. They are
// coordinates on the screen.
ScreenIntPoint mScreenPoint;
// |mScreenPoint| transformed to the local coordinates of the APZC targeted
// by the hit. This is set and used by APZ.
ParentLayerPoint mLocalScreenPoint;
// Radius that the touch covers, i.e. if you're using your thumb it will
// probably be larger than using your pinky, even with the same force.
// Radius can be different along x and y. For example, if you press down with
// your entire finger vertically, the y radius will be much larger than the x
// radius.
ScreenSize mRadius;
float mRotationAngle;
// How hard the screen is being pressed.
float mForce;
};
/**
* Similar to WidgetTouchEvent, but for use off-main-thread. Also only stores a
* screen touch point instead of the many different coordinate spaces
* WidgetTouchEvent stores its touch point in. This includes a way to initialize
* itself from a WidgetTouchEvent by copying all relevant data over. Note that
* this copying from WidgetTouchEvent functionality can only be used on the main
* thread.
*
* Stores an array of SingleTouchData.
*/
class MultiTouchInput : public InputData
{
public:
enum MultiTouchType
{
MULTITOUCH_START,
MULTITOUCH_MOVE,
MULTITOUCH_END,
MULTITOUCH_CANCEL
};
MultiTouchInput(MultiTouchType aType, uint32_t aTime, TimeStamp aTimeStamp,
Modifiers aModifiers)
: InputData(MULTITOUCH_INPUT, aTime, aTimeStamp, aModifiers)
, mType(aType)
, mHandledByAPZ(false)
{
}
MultiTouchInput()
: InputData(MULTITOUCH_INPUT)
, mHandledByAPZ(false)
{
}
MultiTouchInput(const MultiTouchInput& aOther)
: InputData(MULTITOUCH_INPUT, aOther.mTime,
aOther.mTimeStamp, aOther.modifiers)
, mType(aOther.mType)
, mHandledByAPZ(aOther.mHandledByAPZ)
{
mTouches.AppendElements(aOther.mTouches);
}
explicit MultiTouchInput(const WidgetTouchEvent& aTouchEvent);
WidgetTouchEvent ToWidgetTouchEvent(nsIWidget* aWidget) const;
WidgetMouseEvent ToWidgetMouseEvent(nsIWidget* aWidget) const;
// Return the index into mTouches of the SingleTouchData with the given
// identifier, or -1 if there is no such SingleTouchData.
int32_t IndexOfTouch(int32_t aTouchIdentifier);
// This conversion from WidgetMouseEvent to MultiTouchInput is needed because
// on the B2G emulator we can only receive mouse events, but we need to be
// able to pan correctly. To do this, we convert the events into a format that
// the panning code can handle. This code is very limited and only supports
// SingleTouchData. It also sends garbage for the identifier, radius, force
// and rotation angle.
explicit MultiTouchInput(const WidgetMouseEvent& aMouseEvent);
bool TransformToLocal(const gfx::Matrix4x4& aTransform);
MultiTouchType mType;
nsTArray<SingleTouchData> mTouches;
bool mHandledByAPZ;
};
class MouseInput : public InputData
{
public:
enum MouseType
{
MOUSE_MOVE,
MOUSE_DOWN,
MOUSE_UP,
MOUSE_DRAG_START,
MOUSE_DRAG_END,
};
enum ButtonType
{
LEFT_BUTTON,
MIDDLE_BUTTON,
RIGHT_BUTTON,
NONE
};
MouseInput(MouseType aType, ButtonType aButtonType, uint32_t aTime,
TimeStamp aTimeStamp, Modifiers aModifiers)
: InputData(MOUSE_INPUT, aTime, aTimeStamp, aModifiers)
, mType(aType)
, mButtonType(aButtonType)
{}
MouseInput()
: InputData(MOUSE_INPUT)
{}
explicit MouseInput(const WidgetMouseEventBase& aMouseEvent);
bool IsLeftButton() const { return mButtonType == LEFT_BUTTON; }
bool TransformToLocal(const gfx::Matrix4x4& aTransform);
MouseType mType;
ButtonType mButtonType;
ScreenPoint mOrigin;
ParentLayerPoint mLocalOrigin;
};
/**
* Encapsulation class for pan events, can be used off-main-thread.
* These events are currently only used for scrolling on desktop.
*/
class PanGestureInput : public InputData
{
public:
enum PanGestureType
{
// MayStart: Dispatched before any actual panning has occurred but when a
// pan gesture is probably about to start, for example when the user
// starts touching the touchpad. Should interrupt any ongoing APZ
// animation and can be used to trigger scrollability indicators (e.g.
// flashing overlay scrollbars).
PANGESTURE_MAYSTART,
// Cancelled: Dispatched after MayStart when no pan gesture is going to
// happen after all, for example when the user lifts their fingers from a
// touchpad without having done any scrolling.
PANGESTURE_CANCELLED,
// Start: A pan gesture is starting.
// For devices that do not support the MayStart event type, this event can
// be used to interrupt ongoing APZ animations.
PANGESTURE_START,
// Pan: The actual pan motion by mPanDisplacement.
PANGESTURE_PAN,
// End: The pan gesture has ended, for example because the user has lifted
// their fingers from a touchpad after scrolling.
// Any potential momentum events fire after this event.
PANGESTURE_END,
// The following momentum event types are used in order to control the pan
// momentum animation. Using these instead of our own animation ensures
// that the animation curve is OS native and that the animation stops
// reliably if it is cancelled by the user.
// MomentumStart: Dispatched between the End event of the actual
// user-controlled pan, and the first MomentumPan event of the momentum
// animation.
PANGESTURE_MOMENTUMSTART,
// MomentumPan: The actual momentum motion by mPanDisplacement.
PANGESTURE_MOMENTUMPAN,
// MomentumEnd: The momentum animation has ended, for example because the
// momentum velocity has gone below the stopping threshold, or because the
// user has stopped the animation by putting their fingers on a touchpad.
PANGESTURE_MOMENTUMEND
};
PanGestureInput(PanGestureType aType,
uint32_t aTime,
TimeStamp aTimeStamp,
const ScreenPoint& aPanStartPoint,
const ScreenPoint& aPanDisplacement,
Modifiers aModifiers)
: InputData(PANGESTURE_INPUT, aTime, aTimeStamp, aModifiers),
mType(aType),
mPanStartPoint(aPanStartPoint),
mPanDisplacement(aPanDisplacement),
mLineOrPageDeltaX(0),
mLineOrPageDeltaY(0),
mHandledByAPZ(false),
mRequiresContentResponseIfCannotScrollHorizontallyInStartDirection(false)
{
}
bool IsMomentum() const;
WidgetWheelEvent ToWidgetWheelEvent(nsIWidget* aWidget) const;
bool TransformToLocal(const gfx::Matrix4x4& aTransform);
PanGestureType mType;
ScreenPoint mPanStartPoint;
// The delta. This can be non-zero on any type of event.
ScreenPoint mPanDisplacement;
// Versions of |mPanStartPoint| and |mPanDisplacement| in the local
// coordinates of the APZC receiving the pan. These are set and used by APZ.
ParentLayerPoint mLocalPanStartPoint;
ParentLayerPoint mLocalPanDisplacement;
// See lineOrPageDeltaX/Y on WidgetWheelEvent.
int32_t mLineOrPageDeltaX;
int32_t mLineOrPageDeltaY;
bool mHandledByAPZ;
// If this is true, and this event started a new input block that couldn't
// find a scrollable target which is scrollable in the horizontal component
// of the scroll start direction, then this input block needs to be put on
// hold until a content response has arrived, even if the block has a
// confirmed target.
// This is used by events that can result in a swipe instead of a scroll.
bool mRequiresContentResponseIfCannotScrollHorizontallyInStartDirection;
};
/**
* Encapsulation class for pinch events. In general, these will be generated by
* a gesture listener by looking at SingleTouchData/MultiTouchInput instances and
* determining whether or not the user was trying to do a gesture.
*/
class PinchGestureInput : public InputData
{
public:
enum PinchGestureType
{
PINCHGESTURE_START,
PINCHGESTURE_SCALE,
PINCHGESTURE_END
};
// Construct a tap gesture from a Screen point.
// mLocalFocusPoint remains (0,0) unless it's set later.
PinchGestureInput(PinchGestureType aType,
uint32_t aTime,
TimeStamp aTimeStamp,
const ScreenPoint& aFocusPoint,
float aCurrentSpan,
float aPreviousSpan,
Modifiers aModifiers)
: InputData(PINCHGESTURE_INPUT, aTime, aTimeStamp, aModifiers),
mType(aType),
mFocusPoint(aFocusPoint),
mCurrentSpan(aCurrentSpan),
mPreviousSpan(aPreviousSpan)
{
}
// Construct a tap gesture from a ParentLayer point.
// mFocusPoint remains (0,0) unless it's set later.
PinchGestureInput(PinchGestureType aType,
uint32_t aTime,
TimeStamp aTimeStamp,
const ParentLayerPoint& aLocalFocusPoint,
float aCurrentSpan,
float aPreviousSpan,
Modifiers aModifiers)
: InputData(PINCHGESTURE_INPUT, aTime, aTimeStamp, aModifiers),
mType(aType),
mLocalFocusPoint(aLocalFocusPoint),
mCurrentSpan(aCurrentSpan),
mPreviousSpan(aPreviousSpan)
{
}
bool TransformToLocal(const gfx::Matrix4x4& aTransform);
PinchGestureType mType;
// Center point of the pinch gesture. That is, if there are two fingers on the
// screen, it is their midpoint. In the case of more than two fingers, the
// point is implementation-specific, but can for example be the midpoint
// between the very first and very last touch. This is in device pixels and
// are the coordinates on the screen of this midpoint.
ScreenPoint mFocusPoint;
// |mFocusPoint| transformed to the local coordinates of the APZC targeted
// by the hit. This is set and used by APZ.
ParentLayerPoint mLocalFocusPoint;
// The distance in device pixels (though as a float for increased precision
// and because it is the distance along both the x and y axis) between the
// touches responsible for the pinch gesture.
float mCurrentSpan;
// The previous |mCurrentSpan| in the PinchGestureInput preceding this one.
// This is only really relevant during a PINCHGESTURE_SCALE because when it is
// of this type then there must have been a history of spans.
float mPreviousSpan;
};
/**
* Encapsulation class for tap events. In general, these will be generated by
* a gesture listener by looking at SingleTouchData/MultiTouchInput instances and
* determining whether or not the user was trying to do a gesture.
*/
class TapGestureInput : public InputData
{
public:
enum TapGestureType
{
TAPGESTURE_LONG,
TAPGESTURE_LONG_UP,
TAPGESTURE_UP,
TAPGESTURE_CONFIRMED,
TAPGESTURE_DOUBLE,
TAPGESTURE_CANCEL
};
// Construct a tap gesture from a Screen point.
// mLocalPoint remains (0,0) unless it's set later.
TapGestureInput(TapGestureType aType,
uint32_t aTime,
TimeStamp aTimeStamp,
const ScreenIntPoint& aPoint,
Modifiers aModifiers)
: InputData(TAPGESTURE_INPUT, aTime, aTimeStamp, aModifiers),
mType(aType),
mPoint(aPoint)
{
}
// Construct a tap gesture from a ParentLayer point.
// mPoint remains (0,0) unless it's set later.
TapGestureInput(TapGestureType aType,
uint32_t aTime,
TimeStamp aTimeStamp,
const ParentLayerPoint& aLocalPoint,
Modifiers aModifiers)
: InputData(TAPGESTURE_INPUT, aTime, aTimeStamp, aModifiers),
mType(aType),
mLocalPoint(aLocalPoint)
{
}
bool TransformToLocal(const gfx::Matrix4x4& aTransform);
TapGestureType mType;
// The location of the tap in screen pixels.
ScreenIntPoint mPoint;
// The location of the tap in the local coordinates of the APZC receiving it.
// This is set and used by APZ.
ParentLayerPoint mLocalPoint;
};
// Encapsulation class for scroll-wheel events. These are generated by mice
// with physical scroll wheels, and on Windows by most touchpads when using
// scroll gestures.
class ScrollWheelInput : public InputData
{
public:
enum ScrollDeltaType
{
// There are three kinds of scroll delta modes in Gecko: "page", "line" and
// "pixel". For apz, we currently only support the "line" and "pixel" modes.
SCROLLDELTA_LINE,
SCROLLDELTA_PIXEL
};
static ScrollDeltaType
DeltaTypeForDeltaMode(uint32_t aDeltaMode)
{
switch (aDeltaMode) {
case nsIDOMWheelEvent::DOM_DELTA_LINE:
return SCROLLDELTA_LINE;
case nsIDOMWheelEvent::DOM_DELTA_PIXEL:
return SCROLLDELTA_PIXEL;
default:
MOZ_CRASH();
}
return SCROLLDELTA_LINE;
}
enum ScrollMode
{
SCROLLMODE_INSTANT,
SCROLLMODE_SMOOTH
};
ScrollWheelInput(uint32_t aTime,
TimeStamp aTimeStamp,
Modifiers aModifiers,
ScrollMode aScrollMode,
ScrollDeltaType aDeltaType,
const ScreenPoint& aOrigin,
double aDeltaX,
double aDeltaY)
: InputData(SCROLLWHEEL_INPUT, aTime, aTimeStamp, aModifiers),
mDeltaType(aDeltaType),
mScrollMode(aScrollMode),
mOrigin(aOrigin),
mHandledByAPZ(false),
mDeltaX(aDeltaX),
mDeltaY(aDeltaY),
mLineOrPageDeltaX(0),
mLineOrPageDeltaY(0),
mIsMomentum(false)
{}
explicit ScrollWheelInput(const WidgetWheelEvent& aEvent);
WidgetWheelEvent ToWidgetWheelEvent(nsIWidget* aWidget) const;
bool TransformToLocal(const gfx::Matrix4x4& aTransform);
ScrollDeltaType mDeltaType;
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.
// For pixel deltas, these values are in ScreenCoords.
//
// The horizontal (X) delta is > 0 for scrolling right and < 0 for scrolling
// left. The vertical (Y) delta is < 0 for scrolling up and > 0 for
// scrolling down.
double mDeltaX;
double mDeltaY;
// The location of the scroll in local coordinates. This is set and used by
// APZ.
ParentLayerPoint mLocalOrigin;
// See lineOrPageDeltaX/Y on WidgetWheelEvent.
int32_t mLineOrPageDeltaX;
int32_t mLineOrPageDeltaY;
bool mIsMomentum;
};
} // namespace mozilla
#endif // InputData_h__