2012-07-20 10:48:25 +04:00
|
|
|
/* -*- 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 "nsDebug.h"
|
2013-01-24 03:30:48 +04:00
|
|
|
#include "nsPoint.h"
|
|
|
|
#include "nsTArray.h"
|
2013-06-12 02:13:11 +04:00
|
|
|
#include "Units.h"
|
2020-01-30 12:13:19 +03:00
|
|
|
#include "mozilla/ScrollTypes.h"
|
2017-07-01 04:18:55 +03:00
|
|
|
#include "mozilla/DefineEnum.h"
|
2013-09-24 14:04:14 +04:00
|
|
|
#include "mozilla/EventForwards.h"
|
2014-06-06 09:29:49 +04:00
|
|
|
#include "mozilla/TimeStamp.h"
|
2018-03-16 14:23:53 +03:00
|
|
|
#include "mozilla/WheelHandlingHelper.h" // for WheelDeltaAdjustmentStrategy
|
2015-12-03 02:52:00 +03:00
|
|
|
#include "mozilla/gfx/MatrixFwd.h"
|
2018-05-02 19:57:23 +03:00
|
|
|
#include "mozilla/layers/APZUtils.h"
|
2017-06-06 12:47:10 +03:00
|
|
|
#include "mozilla/layers/KeyboardScrollAction.h"
|
2020-03-20 20:13:51 +03:00
|
|
|
#include "mozilla/TextEvents.h"
|
2012-07-20 10:48:25 +04:00
|
|
|
|
2014-06-26 04:11:20 +04:00
|
|
|
template <class E>
|
|
|
|
struct already_AddRefed;
|
2014-08-09 02:15:37 +04:00
|
|
|
class nsIWidget;
|
2014-06-26 04:11:20 +04:00
|
|
|
|
2012-07-20 10:48:25 +04:00
|
|
|
namespace mozilla {
|
|
|
|
|
2016-07-20 14:37:00 +03:00
|
|
|
namespace layers {
|
2018-03-16 23:28:19 +03:00
|
|
|
class APZInputBridgeChild;
|
|
|
|
class PAPZInputBridgeParent;
|
2016-07-20 14:37:00 +03:00
|
|
|
} // namespace layers
|
|
|
|
|
2014-06-26 04:11:20 +04:00
|
|
|
namespace dom {
|
|
|
|
class Touch;
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace dom
|
2012-07-20 10:48:25 +04:00
|
|
|
|
2018-11-28 12:14:19 +03:00
|
|
|
// clang-format off
|
2017-07-01 04:18:55 +03:00
|
|
|
MOZ_DEFINE_ENUM(
|
|
|
|
InputType, (
|
|
|
|
MULTITOUCH_INPUT,
|
|
|
|
MOUSE_INPUT,
|
|
|
|
PANGESTURE_INPUT,
|
|
|
|
PINCHGESTURE_INPUT,
|
|
|
|
TAPGESTURE_INPUT,
|
|
|
|
SCROLLWHEEL_INPUT,
|
|
|
|
KEYBOARD_INPUT
|
|
|
|
));
|
2018-11-28 12:14:19 +03:00
|
|
|
// clang-format on
|
2012-07-20 10:48:25 +04:00
|
|
|
|
|
|
|
class MultiTouchInput;
|
2015-09-28 17:32:05 +03:00
|
|
|
class MouseInput;
|
2014-06-07 02:49:49 +04:00
|
|
|
class PanGestureInput;
|
2012-07-20 10:48:25 +04:00
|
|
|
class PinchGestureInput;
|
|
|
|
class TapGestureInput;
|
2014-11-18 07:56:18 +03:00
|
|
|
class ScrollWheelInput;
|
2017-06-06 02:09:40 +03:00
|
|
|
class KeyboardInput;
|
2012-07-20 10:48:25 +04:00
|
|
|
|
|
|
|
// This looks unnecessary now, but as we add more and more classes that derive
|
2013-09-25 15:21:22 +04:00
|
|
|
// from InputType (eventually probably almost as many as *Events.h has), it
|
2012-07-20 10:48:25 +04:00
|
|
|
// 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 { \
|
2015-02-10 01:34:50 +03:00
|
|
|
MOZ_ASSERT(mInputType == enumID, "Invalid cast of InputData."); \
|
2012-07-20 10:48:25 +04:00
|
|
|
return (const type&)*this; \
|
2014-07-08 22:55:52 +04:00
|
|
|
} \
|
|
|
|
type& As##type() { \
|
2015-02-10 01:34:50 +03:00
|
|
|
MOZ_ASSERT(mInputType == enumID, "Invalid cast of InputData."); \
|
2014-07-08 22:55:52 +04:00
|
|
|
return (type&)*this; \
|
2012-07-20 10:48:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/** Base input data class. Should never be instantiated. */
|
|
|
|
class InputData {
|
|
|
|
public:
|
2016-07-20 14:37:00 +03:00
|
|
|
// Warning, this class is serialized and sent over IPC. Any change to its
|
|
|
|
// fields must be reflected in its ParamTraits<>, in nsGUIEventIPC.h
|
2012-07-20 10:48:25 +04:00
|
|
|
InputType mInputType;
|
|
|
|
// Time in milliseconds that this data is relevant to. This only really
|
2012-08-22 19:56:38 +04:00
|
|
|
// matters when this data is used as an event. We use uint32_t instead of
|
2013-10-01 11:23:02 +04:00
|
|
|
// 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.
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mTime;
|
2014-06-06 09:29:49 +04:00
|
|
|
// Set in parallel to mTime until we determine it is safe to drop
|
|
|
|
// platform-specific event times (see bug 77992).
|
|
|
|
TimeStamp mTimeStamp;
|
2017-06-06 03:45:31 +03:00
|
|
|
// The sequence number of the last potentially focus changing event handled
|
|
|
|
// by APZ. This is used to track when that event has been processed by
|
|
|
|
// content, and focus can be reconfirmed for async keyboard scrolling.
|
|
|
|
uint64_t mFocusSequenceNumber;
|
2012-07-20 10:48:25 +04:00
|
|
|
|
2019-02-26 10:15:43 +03:00
|
|
|
// The LayersId of the content process that the corresponding WidgetEvent
|
|
|
|
// should be dispatched to.
|
|
|
|
layers::LayersId mLayersId;
|
|
|
|
|
2013-11-26 08:30:26 +04:00
|
|
|
Modifiers modifiers;
|
|
|
|
|
2012-07-20 10:48:25 +04:00
|
|
|
INPUTDATA_AS_CHILD_TYPE(MultiTouchInput, MULTITOUCH_INPUT)
|
2015-09-28 17:32:05 +03:00
|
|
|
INPUTDATA_AS_CHILD_TYPE(MouseInput, MOUSE_INPUT)
|
2014-06-07 02:49:49 +04:00
|
|
|
INPUTDATA_AS_CHILD_TYPE(PanGestureInput, PANGESTURE_INPUT)
|
2012-07-20 10:48:25 +04:00
|
|
|
INPUTDATA_AS_CHILD_TYPE(PinchGestureInput, PINCHGESTURE_INPUT)
|
|
|
|
INPUTDATA_AS_CHILD_TYPE(TapGestureInput, TAPGESTURE_INPUT)
|
2014-11-18 07:56:18 +03:00
|
|
|
INPUTDATA_AS_CHILD_TYPE(ScrollWheelInput, SCROLLWHEEL_INPUT)
|
2017-06-06 02:09:40 +03:00
|
|
|
INPUTDATA_AS_CHILD_TYPE(KeyboardInput, KEYBOARD_INPUT)
|
2012-07-20 10:48:25 +04:00
|
|
|
|
2016-09-14 14:54:36 +03:00
|
|
|
virtual ~InputData();
|
2016-09-12 16:47:01 +03:00
|
|
|
explicit InputData(InputType aInputType);
|
2013-01-24 03:30:48 +04:00
|
|
|
|
2012-07-20 10:48:25 +04:00
|
|
|
protected:
|
2014-06-06 09:29:49 +04:00
|
|
|
InputData(InputType aInputType, uint32_t aTime, TimeStamp aTimeStamp,
|
2016-09-12 16:47:01 +03:00
|
|
|
Modifiers aModifiers);
|
2012-07-20 10:48:25 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2013-04-05 12:49:00 +04:00
|
|
|
* Data container for a single touch input. Similar to dom::Touch, but used in
|
2012-07-20 10:48:25 +04:00
|
|
|
* off-main-thread situations. This is more for just storing touch data, whereas
|
2013-08-05 08:51:22 +04:00
|
|
|
* 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).
|
2012-07-20 10:48:25 +04:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
2013-04-05 12:49:00 +04:00
|
|
|
* fixme/bug 775746: Make dom::Touch inherit from this class.
|
2012-07-20 10:48:25 +04:00
|
|
|
*/
|
|
|
|
class SingleTouchData {
|
|
|
|
public:
|
2014-11-10 22:35:11 +03:00
|
|
|
// Construct a SingleTouchData from a Screen point.
|
|
|
|
// mLocalScreenPoint remains (0,0) unless it's set later.
|
2012-08-22 19:56:38 +04:00
|
|
|
SingleTouchData(int32_t aIdentifier, ScreenIntPoint aScreenPoint,
|
2012-07-20 10:48:25 +04:00
|
|
|
ScreenSize aRadius, float aRotationAngle, float aForce);
|
|
|
|
|
2014-11-10 22:35:11 +03:00
|
|
|
// 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);
|
|
|
|
|
2016-09-12 16:47:01 +03:00
|
|
|
SingleTouchData();
|
2013-01-24 03:30:48 +04:00
|
|
|
|
2014-08-09 02:15:37 +04:00
|
|
|
already_AddRefed<dom::Touch> ToNewDOMTouch() const;
|
2014-06-26 04:11:20 +04:00
|
|
|
|
2016-07-20 14:37:00 +03:00
|
|
|
// Warning, this class is serialized and sent over IPC. Any change to its
|
|
|
|
// fields must be reflected in its ParamTraits<>, in nsGUIEventIPC.h
|
|
|
|
|
2012-07-20 10:48:25 +04:00
|
|
|
// A unique number assigned to each SingleTouchData within a MultiTouchInput
|
|
|
|
// so that they can be easily distinguished when handling a touch
|
|
|
|
// start/move/end.
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t mIdentifier;
|
2012-07-20 10:48:25 +04:00
|
|
|
|
|
|
|
// Point on the screen that the touch hit, in device pixels. They are
|
|
|
|
// coordinates on the screen.
|
2013-06-12 02:13:11 +04:00
|
|
|
ScreenIntPoint mScreenPoint;
|
2012-07-20 10:48:25 +04:00
|
|
|
|
2014-11-10 22:35:11 +03:00
|
|
|
// |mScreenPoint| transformed to the local coordinates of the APZC targeted
|
|
|
|
// by the hit. This is set and used by APZ.
|
|
|
|
ParentLayerPoint mLocalScreenPoint;
|
|
|
|
|
2012-07-20 10:48:25 +04:00
|
|
|
// 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.
|
2013-06-12 02:13:11 +04:00
|
|
|
ScreenSize mRadius;
|
2012-07-20 10:48:25 +04:00
|
|
|
|
|
|
|
float mRotationAngle;
|
|
|
|
|
|
|
|
// How hard the screen is being pressed.
|
|
|
|
float mForce;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2013-09-27 10:20:57 +04:00
|
|
|
* 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.
|
2012-07-20 10:48:25 +04:00
|
|
|
*
|
|
|
|
* Stores an array of SingleTouchData.
|
|
|
|
*/
|
|
|
|
class MultiTouchInput : public InputData {
|
|
|
|
public:
|
2018-11-28 12:14:19 +03:00
|
|
|
// clang-format off
|
2017-07-01 04:18:55 +03:00
|
|
|
MOZ_DEFINE_ENUM_AT_CLASS_SCOPE(
|
|
|
|
MultiTouchType, (
|
|
|
|
MULTITOUCH_START,
|
|
|
|
MULTITOUCH_MOVE,
|
|
|
|
MULTITOUCH_END,
|
|
|
|
MULTITOUCH_CANCEL
|
|
|
|
));
|
2018-11-28 12:14:19 +03:00
|
|
|
// clang-format on
|
2012-07-20 10:48:25 +04:00
|
|
|
|
2014-06-06 09:29:49 +04:00
|
|
|
MultiTouchInput(MultiTouchType aType, uint32_t aTime, TimeStamp aTimeStamp,
|
2016-09-12 16:47:01 +03:00
|
|
|
Modifiers aModifiers);
|
|
|
|
MultiTouchInput();
|
|
|
|
MultiTouchInput(const MultiTouchInput& aOther);
|
2014-08-20 08:58:22 +04:00
|
|
|
explicit MultiTouchInput(const WidgetTouchEvent& aTouchEvent);
|
2017-04-06 01:42:50 +03:00
|
|
|
void Translate(const ScreenPoint& aTranslation);
|
2012-07-20 10:48:25 +04:00
|
|
|
|
2016-09-12 16:47:01 +03:00
|
|
|
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);
|
|
|
|
|
2015-12-01 04:14:31 +03:00
|
|
|
bool TransformToLocal(const ScreenToParentLayerMatrix4x4& aTransform);
|
2015-01-09 21:39:08 +03:00
|
|
|
|
2016-07-20 14:37:00 +03:00
|
|
|
// Warning, this class is serialized and sent over IPC. Any change to its
|
|
|
|
// fields must be reflected in its ParamTraits<>, in nsGUIEventIPC.h
|
2012-07-20 10:48:25 +04:00
|
|
|
MultiTouchType mType;
|
|
|
|
nsTArray<SingleTouchData> mTouches;
|
2019-01-31 19:46:10 +03:00
|
|
|
// The screen offset of the root widget. This can be changing along with
|
|
|
|
// the touch interaction, so we sstore it in the event.
|
|
|
|
ExternalPoint mScreenOffset;
|
2015-10-28 19:53:34 +03:00
|
|
|
bool mHandledByAPZ;
|
2012-07-20 10:48:25 +04:00
|
|
|
};
|
|
|
|
|
2015-09-28 17:32:05 +03:00
|
|
|
class MouseInput : public InputData {
|
2016-07-20 14:37:00 +03:00
|
|
|
protected:
|
2018-03-16 23:28:19 +03:00
|
|
|
friend mozilla::layers::APZInputBridgeChild;
|
|
|
|
friend mozilla::layers::PAPZInputBridgeParent;
|
2016-07-20 14:37:00 +03:00
|
|
|
|
2016-09-12 16:47:01 +03:00
|
|
|
MouseInput();
|
2016-07-20 14:37:00 +03:00
|
|
|
|
2015-09-28 17:32:05 +03:00
|
|
|
public:
|
2018-11-28 12:14:19 +03:00
|
|
|
// clang-format off
|
2017-07-01 04:18:55 +03:00
|
|
|
MOZ_DEFINE_ENUM_AT_CLASS_SCOPE(
|
|
|
|
MouseType, (
|
|
|
|
MOUSE_NONE,
|
|
|
|
MOUSE_MOVE,
|
|
|
|
MOUSE_DOWN,
|
|
|
|
MOUSE_UP,
|
|
|
|
MOUSE_DRAG_START,
|
|
|
|
MOUSE_DRAG_END,
|
|
|
|
MOUSE_WIDGET_ENTER,
|
2017-11-30 07:16:26 +03:00
|
|
|
MOUSE_WIDGET_EXIT,
|
|
|
|
MOUSE_HITTEST
|
2017-07-01 04:18:55 +03:00
|
|
|
));
|
|
|
|
|
|
|
|
MOZ_DEFINE_ENUM_AT_CLASS_SCOPE(
|
|
|
|
ButtonType, (
|
|
|
|
LEFT_BUTTON,
|
|
|
|
MIDDLE_BUTTON,
|
|
|
|
RIGHT_BUTTON,
|
|
|
|
NONE
|
|
|
|
));
|
2018-11-28 12:14:19 +03:00
|
|
|
// clang-format on
|
2015-09-28 17:32:05 +03:00
|
|
|
|
2016-09-12 16:47:01 +03:00
|
|
|
MouseInput(MouseType aType, ButtonType aButtonType, uint16_t aInputSource,
|
|
|
|
int16_t aButtons, const ScreenPoint& aPoint, uint32_t aTime,
|
|
|
|
TimeStamp aTimeStamp, Modifiers aModifiers);
|
2015-09-28 17:32:05 +03:00
|
|
|
explicit MouseInput(const WidgetMouseEventBase& aMouseEvent);
|
|
|
|
|
2016-09-12 16:47:01 +03:00
|
|
|
bool IsLeftButton() const;
|
2015-09-28 17:32:05 +03:00
|
|
|
|
2015-12-01 04:14:31 +03:00
|
|
|
bool TransformToLocal(const ScreenToParentLayerMatrix4x4& aTransform);
|
2016-02-18 00:56:28 +03:00
|
|
|
WidgetMouseEvent ToWidgetMouseEvent(nsIWidget* aWidget) const;
|
2015-09-28 21:44:37 +03:00
|
|
|
|
2016-07-20 14:37:00 +03:00
|
|
|
// Warning, this class is serialized and sent over IPC. Any change to its
|
|
|
|
// fields must be reflected in its ParamTraits<>, in nsGUIEventIPC.h
|
2015-09-28 17:32:05 +03:00
|
|
|
MouseType mType;
|
|
|
|
ButtonType mButtonType;
|
2016-03-12 02:29:50 +03:00
|
|
|
uint16_t mInputSource;
|
2016-02-18 00:56:28 +03:00
|
|
|
int16_t mButtons;
|
2015-09-28 17:32:05 +03:00
|
|
|
ScreenPoint mOrigin;
|
|
|
|
ParentLayerPoint mLocalOrigin;
|
2016-06-07 18:07:55 +03:00
|
|
|
bool mHandledByAPZ;
|
2015-09-28 17:32:05 +03:00
|
|
|
};
|
|
|
|
|
2014-06-07 02:49:49 +04:00
|
|
|
/**
|
|
|
|
* 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 {
|
2016-07-20 14:37:00 +03:00
|
|
|
protected:
|
2018-03-16 23:28:19 +03:00
|
|
|
friend mozilla::layers::APZInputBridgeChild;
|
|
|
|
friend mozilla::layers::PAPZInputBridgeParent;
|
2016-07-20 14:37:00 +03:00
|
|
|
|
2016-09-12 16:47:01 +03:00
|
|
|
PanGestureInput();
|
2016-07-20 14:37:00 +03:00
|
|
|
|
2014-06-07 02:49:49 +04:00
|
|
|
public:
|
2018-11-28 12:14:19 +03:00
|
|
|
// clang-format off
|
2017-07-01 04:18:55 +03:00
|
|
|
MOZ_DEFINE_ENUM_AT_CLASS_SCOPE(
|
|
|
|
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
|
|
|
|
));
|
2019-06-20 23:18:45 +03:00
|
|
|
|
|
|
|
MOZ_DEFINE_ENUM_AT_CLASS_SCOPE(
|
|
|
|
PanDeltaType, (
|
|
|
|
// There are three kinds of scroll delta modes in Gecko: "page", "line"
|
|
|
|
// and "pixel". Touchpad pan gestures only support "page" and "pixel".
|
|
|
|
//
|
|
|
|
// NOTE: PANDELTA_PAGE currently replicates Gtk behavior
|
|
|
|
// (see AsyncPanZoomController::OnPan).
|
|
|
|
PANDELTA_PAGE,
|
|
|
|
PANDELTA_PIXEL
|
|
|
|
));
|
2018-11-28 12:14:19 +03:00
|
|
|
// clang-format on
|
2014-06-07 02:49:49 +04:00
|
|
|
|
|
|
|
PanGestureInput(PanGestureType aType, uint32_t aTime, TimeStamp aTimeStamp,
|
|
|
|
const ScreenPoint& aPanStartPoint,
|
|
|
|
const ScreenPoint& aPanDisplacement, Modifiers aModifiers);
|
|
|
|
|
2015-08-26 06:21:41 +03:00
|
|
|
bool IsMomentum() const;
|
|
|
|
|
|
|
|
WidgetWheelEvent ToWidgetWheelEvent(nsIWidget* aWidget) const;
|
|
|
|
|
2015-12-01 04:14:31 +03:00
|
|
|
bool TransformToLocal(const ScreenToParentLayerMatrix4x4& aTransform);
|
2015-01-09 21:39:08 +03:00
|
|
|
|
2016-05-03 16:09:10 +03:00
|
|
|
ScreenPoint UserMultipliedPanDisplacement() const;
|
|
|
|
ParentLayerPoint UserMultipliedLocalPanDisplacement() const;
|
|
|
|
|
2016-07-20 14:37:00 +03:00
|
|
|
// Warning, this class is serialized and sent over IPC. Any change to its
|
|
|
|
// fields must be reflected in its ParamTraits<>, in nsGUIEventIPC.h
|
2014-06-07 02:49:49 +04:00
|
|
|
PanGestureType mType;
|
|
|
|
ScreenPoint mPanStartPoint;
|
|
|
|
|
2015-08-11 22:57:47 +03:00
|
|
|
// The delta. This can be non-zero on any type of event.
|
2014-06-07 02:49:49 +04:00
|
|
|
ScreenPoint mPanDisplacement;
|
2014-11-10 22:35:11 +03:00
|
|
|
|
|
|
|
// 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;
|
2015-08-26 06:21:41 +03:00
|
|
|
|
|
|
|
// See lineOrPageDeltaX/Y on WidgetWheelEvent.
|
|
|
|
int32_t mLineOrPageDeltaX;
|
|
|
|
int32_t mLineOrPageDeltaY;
|
2015-08-12 01:04:55 +03:00
|
|
|
|
2016-05-03 16:09:10 +03:00
|
|
|
// User-set delta multipliers.
|
|
|
|
double mUserDeltaMultiplierX;
|
|
|
|
double mUserDeltaMultiplierY;
|
|
|
|
|
2019-06-20 23:18:45 +03:00
|
|
|
PanDeltaType mDeltaType = PANDELTA_PIXEL;
|
|
|
|
|
2019-07-06 11:18:28 +03:00
|
|
|
bool mHandledByAPZ : 1;
|
2015-08-12 07:11:54 +03:00
|
|
|
|
2016-03-28 21:56:28 +03:00
|
|
|
// true if this is a PANGESTURE_END event that will be followed by a
|
|
|
|
// PANGESTURE_MOMENTUMSTART event.
|
2019-07-06 11:18:28 +03:00
|
|
|
bool mFollowedByMomentum : 1;
|
2016-03-28 21:56:28 +03:00
|
|
|
|
2015-08-28 23:50:00 +03:00
|
|
|
// 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.
|
2019-07-06 11:18:28 +03:00
|
|
|
bool mRequiresContentResponseIfCannotScrollHorizontallyInStartDirection : 1;
|
2017-10-24 01:27:24 +03:00
|
|
|
|
|
|
|
// This is used by APZ to communicate to the macOS widget code whether
|
|
|
|
// the overscroll-behavior of the scroll frame handling this swipe allows
|
|
|
|
// non-local overscroll behaviors in the horizontal direction (such as
|
|
|
|
// swipe navigation).
|
2019-07-06 11:18:28 +03:00
|
|
|
bool mOverscrollBehaviorAllowsSwipe : 1;
|
2019-06-20 23:18:45 +03:00
|
|
|
|
|
|
|
// true if APZ should do a fling animation after this pan ends, like
|
2019-07-06 11:18:28 +03:00
|
|
|
// it would with touchscreens. (For platforms that don't emit momentum
|
|
|
|
// events.)
|
|
|
|
bool mSimulateMomentum : 1;
|
2017-10-24 01:27:24 +03:00
|
|
|
|
2019-06-20 23:18:45 +03:00
|
|
|
void SetHandledByAPZ(bool aHandled) { mHandledByAPZ = aHandled; }
|
2019-07-06 11:18:28 +03:00
|
|
|
void SetFollowedByMomentum(bool aFollowed) {
|
|
|
|
mFollowedByMomentum = aFollowed;
|
|
|
|
}
|
|
|
|
void SetRequiresContentResponseIfCannotScrollHorizontallyInStartDirection(
|
|
|
|
bool aRequires) {
|
|
|
|
mRequiresContentResponseIfCannotScrollHorizontallyInStartDirection =
|
|
|
|
aRequires;
|
|
|
|
}
|
|
|
|
void SetOverscrollBehaviorAllowsSwipe(bool aAllows) {
|
|
|
|
mOverscrollBehaviorAllowsSwipe = aAllows;
|
2019-06-20 23:18:45 +03:00
|
|
|
}
|
|
|
|
void SetSimulateMomentum(bool aSimulate) { mSimulateMomentum = aSimulate; }
|
2014-06-07 02:49:49 +04:00
|
|
|
};
|
|
|
|
|
2012-07-20 10:48:25 +04:00
|
|
|
/**
|
|
|
|
* 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 {
|
2016-07-20 14:37:00 +03:00
|
|
|
protected:
|
2018-03-16 23:28:19 +03:00
|
|
|
friend mozilla::layers::APZInputBridgeChild;
|
|
|
|
friend mozilla::layers::PAPZInputBridgeParent;
|
2016-07-20 14:37:00 +03:00
|
|
|
|
2016-09-12 16:47:01 +03:00
|
|
|
PinchGestureInput();
|
2016-07-20 14:37:00 +03:00
|
|
|
|
2012-07-20 10:48:25 +04:00
|
|
|
public:
|
2018-11-28 12:14:19 +03:00
|
|
|
// clang-format off
|
2017-07-01 04:18:55 +03:00
|
|
|
MOZ_DEFINE_ENUM_AT_CLASS_SCOPE(
|
|
|
|
PinchGestureType, (
|
|
|
|
PINCHGESTURE_START,
|
|
|
|
PINCHGESTURE_SCALE,
|
|
|
|
PINCHGESTURE_END
|
|
|
|
));
|
2018-11-28 12:14:19 +03:00
|
|
|
// clang-format on
|
2012-07-20 10:48:25 +04:00
|
|
|
|
2018-05-02 23:41:47 +03:00
|
|
|
// Construct a pinch gesture from a Screen point.
|
|
|
|
PinchGestureInput(PinchGestureType aType, uint32_t aTime,
|
2019-01-31 19:46:10 +03:00
|
|
|
TimeStamp aTimeStamp, const ExternalPoint& aScreenOffset,
|
|
|
|
const ScreenPoint& aFocusPoint, ScreenCoord aCurrentSpan,
|
|
|
|
ScreenCoord aPreviousSpan, Modifiers aModifiers);
|
2012-07-20 10:48:25 +04:00
|
|
|
|
2015-12-01 04:14:31 +03:00
|
|
|
bool TransformToLocal(const ScreenToParentLayerMatrix4x4& aTransform);
|
2015-01-09 21:39:08 +03:00
|
|
|
|
2016-07-20 14:37:00 +03:00
|
|
|
// Warning, this class is serialized and sent over IPC. Any change to its
|
|
|
|
// fields must be reflected in its ParamTraits<>, in nsGUIEventIPC.h
|
2012-07-20 10:48:25 +04:00
|
|
|
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.
|
2015-11-22 16:57:45 +03:00
|
|
|
// For PINCHGESTURE_END events, this instead will hold the coordinates of
|
|
|
|
// the remaining finger, if there is one. If there isn't one then it will
|
2018-05-02 23:36:17 +03:00
|
|
|
// store |BothFingersLifted()|.
|
2013-06-12 02:13:11 +04:00
|
|
|
ScreenPoint mFocusPoint;
|
2012-07-20 10:48:25 +04:00
|
|
|
|
2019-01-31 19:46:10 +03:00
|
|
|
// The screen offset of the root widget. This can be changing along with
|
|
|
|
// the touch interaction, so we sstore it in the event.
|
|
|
|
ExternalPoint mScreenOffset;
|
|
|
|
|
2014-11-10 22:35:11 +03:00
|
|
|
// |mFocusPoint| transformed to the local coordinates of the APZC targeted
|
|
|
|
// by the hit. This is set and used by APZ.
|
|
|
|
ParentLayerPoint mLocalFocusPoint;
|
|
|
|
|
2016-09-24 16:46:01 +03:00
|
|
|
// The distance between the touches responsible for the pinch gesture.
|
2019-01-31 19:45:53 +03:00
|
|
|
ScreenCoord mCurrentSpan;
|
2012-07-20 10:48:25 +04:00
|
|
|
|
|
|
|
// 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.
|
2019-01-31 19:45:53 +03:00
|
|
|
ScreenCoord mPreviousSpan;
|
2018-05-02 23:36:17 +03:00
|
|
|
|
|
|
|
// A special value for mFocusPoint used in PINCHGESTURE_END events to
|
|
|
|
// indicate that both fingers have been lifted. If only one finger has
|
|
|
|
// been lifted, the coordinates of the remaining finger are expected to
|
|
|
|
// be stored in mFocusPoint.
|
|
|
|
// For pinch events that were not triggered by touch gestures, the
|
|
|
|
// value of mFocusPoint in a PINCHGESTURE_END event is always expected
|
|
|
|
// to be this value.
|
|
|
|
// For convenience, we allow retrieving this value in any coordinate system.
|
|
|
|
// Since it's a special value, no conversion is needed.
|
|
|
|
template <typename Units = ParentLayerPixel>
|
|
|
|
static gfx::PointTyped<Units> BothFingersLifted() {
|
|
|
|
return gfx::PointTyped<Units>{-1, -1};
|
|
|
|
}
|
2012-07-20 10:48:25 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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 {
|
2016-07-20 14:37:00 +03:00
|
|
|
protected:
|
2018-03-16 23:28:19 +03:00
|
|
|
friend mozilla::layers::APZInputBridgeChild;
|
|
|
|
friend mozilla::layers::PAPZInputBridgeParent;
|
2016-07-20 14:37:00 +03:00
|
|
|
|
2016-09-12 16:47:01 +03:00
|
|
|
TapGestureInput();
|
2016-07-20 14:37:00 +03:00
|
|
|
|
2012-07-20 10:48:25 +04:00
|
|
|
public:
|
2018-11-28 12:14:19 +03:00
|
|
|
// clang-format off
|
2017-07-01 04:18:55 +03:00
|
|
|
MOZ_DEFINE_ENUM_AT_CLASS_SCOPE(
|
|
|
|
TapGestureType, (
|
|
|
|
TAPGESTURE_LONG,
|
|
|
|
TAPGESTURE_LONG_UP,
|
|
|
|
TAPGESTURE_UP,
|
|
|
|
TAPGESTURE_CONFIRMED,
|
|
|
|
TAPGESTURE_DOUBLE,
|
|
|
|
TAPGESTURE_SECOND, // See GeckoContentController::TapType::eSecondTap
|
|
|
|
TAPGESTURE_CANCEL
|
|
|
|
));
|
2018-11-28 12:14:19 +03:00
|
|
|
// clang-format on
|
2012-07-20 10:48:25 +04:00
|
|
|
|
2014-11-10 22:35:11 +03:00
|
|
|
// Construct a tap gesture from a Screen point.
|
|
|
|
// mLocalPoint remains (0,0) unless it's set later.
|
2016-09-12 16:47:01 +03:00
|
|
|
TapGestureInput(TapGestureType aType, uint32_t aTime, TimeStamp aTimeStamp,
|
|
|
|
const ScreenIntPoint& aPoint, Modifiers aModifiers);
|
2012-07-20 10:48:25 +04:00
|
|
|
|
2014-11-10 22:35:11 +03:00
|
|
|
// Construct a tap gesture from a ParentLayer point.
|
|
|
|
// mPoint remains (0,0) unless it's set later.
|
2016-09-12 16:47:01 +03:00
|
|
|
TapGestureInput(TapGestureType aType, uint32_t aTime, TimeStamp aTimeStamp,
|
|
|
|
const ParentLayerPoint& aLocalPoint, Modifiers aModifiers);
|
2012-07-20 10:48:25 +04:00
|
|
|
|
2015-12-01 04:14:31 +03:00
|
|
|
bool TransformToLocal(const ScreenToParentLayerMatrix4x4& aTransform);
|
2015-01-09 21:39:08 +03:00
|
|
|
|
2016-07-20 14:37:00 +03:00
|
|
|
// Warning, this class is serialized and sent over IPC. Any change to its
|
|
|
|
// fields must be reflected in its ParamTraits<>, in nsGUIEventIPC.h
|
2012-07-20 10:48:25 +04:00
|
|
|
TapGestureType mType;
|
2014-11-10 22:35:11 +03:00
|
|
|
|
|
|
|
// The location of the tap in screen pixels.
|
2013-06-12 02:13:11 +04:00
|
|
|
ScreenIntPoint mPoint;
|
2014-11-10 22:35:11 +03:00
|
|
|
|
|
|
|
// The location of the tap in the local coordinates of the APZC receiving it.
|
|
|
|
// This is set and used by APZ.
|
|
|
|
ParentLayerPoint mLocalPoint;
|
2012-07-20 10:48:25 +04:00
|
|
|
};
|
|
|
|
|
2014-11-18 07:56:18 +03:00
|
|
|
// 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 {
|
2016-07-20 14:37:00 +03:00
|
|
|
protected:
|
2018-03-16 23:28:19 +03:00
|
|
|
friend mozilla::layers::APZInputBridgeChild;
|
|
|
|
friend mozilla::layers::PAPZInputBridgeParent;
|
2016-07-20 14:37:00 +03:00
|
|
|
|
2018-05-02 19:57:23 +03:00
|
|
|
typedef mozilla::layers::APZWheelAction APZWheelAction;
|
|
|
|
|
2016-09-12 16:47:01 +03:00
|
|
|
ScrollWheelInput();
|
2016-07-20 14:37:00 +03:00
|
|
|
|
2014-11-18 07:56:18 +03:00
|
|
|
public:
|
2018-11-28 12:14:19 +03:00
|
|
|
// clang-format off
|
2017-07-01 04:18:55 +03:00
|
|
|
MOZ_DEFINE_ENUM_AT_CLASS_SCOPE(
|
|
|
|
ScrollDeltaType, (
|
2018-11-28 12:14:19 +03:00
|
|
|
// There are three kinds of scroll delta modes in Gecko: "page", "line"
|
|
|
|
// and "pixel".
|
2017-07-01 04:18:55 +03:00
|
|
|
SCROLLDELTA_LINE,
|
|
|
|
SCROLLDELTA_PAGE,
|
|
|
|
SCROLLDELTA_PIXEL
|
|
|
|
));
|
|
|
|
|
|
|
|
MOZ_DEFINE_ENUM_AT_CLASS_SCOPE(
|
|
|
|
ScrollMode, (
|
|
|
|
SCROLLMODE_INSTANT,
|
|
|
|
SCROLLMODE_SMOOTH
|
|
|
|
)
|
|
|
|
);
|
2018-11-28 12:14:19 +03:00
|
|
|
// clang-format on
|
2014-11-18 07:56:18 +03:00
|
|
|
|
2016-09-12 16:47:01 +03:00
|
|
|
ScrollWheelInput(uint32_t aTime, TimeStamp aTimeStamp, Modifiers aModifiers,
|
|
|
|
ScrollMode aScrollMode, ScrollDeltaType aDeltaType,
|
|
|
|
const ScreenPoint& aOrigin, double aDeltaX, double aDeltaY,
|
2018-03-16 14:23:53 +03:00
|
|
|
bool aAllowToOverrideSystemScrollSpeed,
|
|
|
|
WheelDeltaAdjustmentStrategy aWheelDeltaAdjustmentStrategy);
|
2015-11-19 03:32:37 +03:00
|
|
|
explicit ScrollWheelInput(const WidgetWheelEvent& aEvent);
|
|
|
|
|
2016-09-12 16:47:01 +03:00
|
|
|
static ScrollDeltaType DeltaTypeForDeltaMode(uint32_t aDeltaMode);
|
|
|
|
static uint32_t DeltaModeForDeltaType(ScrollDeltaType aDeltaType);
|
2020-01-30 12:13:19 +03:00
|
|
|
static mozilla::ScrollUnit ScrollUnitForDeltaType(ScrollDeltaType aDeltaType);
|
2016-09-12 16:47:01 +03:00
|
|
|
|
2015-08-26 06:21:41 +03:00
|
|
|
WidgetWheelEvent ToWidgetWheelEvent(nsIWidget* aWidget) const;
|
2015-12-01 04:14:31 +03:00
|
|
|
bool TransformToLocal(const ScreenToParentLayerMatrix4x4& aTransform);
|
2015-01-09 21:39:08 +03:00
|
|
|
|
2015-12-02 00:46:07 +03:00
|
|
|
bool IsCustomizedByUserPrefs() const;
|
|
|
|
|
2018-03-16 14:23:53 +03:00
|
|
|
// The following two functions are for auto-dir scrolling. For detailed
|
|
|
|
// information on auto-dir, @see mozilla::WheelDeltaAdjustmentStrategy
|
|
|
|
bool IsAutoDir() const {
|
|
|
|
switch (mWheelDeltaAdjustmentStrategy) {
|
|
|
|
case WheelDeltaAdjustmentStrategy::eAutoDir:
|
|
|
|
case WheelDeltaAdjustmentStrategy::eAutoDirWithRootHonour:
|
|
|
|
return true;
|
|
|
|
default:
|
|
|
|
// Prevent compilation errors generated by -Werror=switch
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
// Indicates which element this scroll honours if it's an auto-dir scroll.
|
|
|
|
// If true, honour the root element; otherwise, honour the currently scrolling
|
|
|
|
// target.
|
|
|
|
// Note that if IsAutoDir() returns false, then this function also returns
|
|
|
|
// false, but false in this case is meaningless as IsAutoDir() indicates it's
|
|
|
|
// not an auto-dir scroll.
|
|
|
|
// For detailed information on auto-dir,
|
|
|
|
// @see mozilla::WheelDeltaAdjustmentStrategy
|
|
|
|
bool HonoursRoot() const {
|
|
|
|
return WheelDeltaAdjustmentStrategy::eAutoDirWithRootHonour ==
|
|
|
|
mWheelDeltaAdjustmentStrategy;
|
|
|
|
}
|
|
|
|
|
2016-07-20 14:37:00 +03:00
|
|
|
// Warning, this class is serialized and sent over IPC. Any change to its
|
|
|
|
// fields must be reflected in its ParamTraits<>, in nsGUIEventIPC.h
|
2014-11-18 07:56:18 +03:00
|
|
|
ScrollDeltaType mDeltaType;
|
|
|
|
ScrollMode mScrollMode;
|
|
|
|
ScreenPoint mOrigin;
|
|
|
|
|
2015-08-12 01:04:55 +03:00
|
|
|
bool mHandledByAPZ;
|
|
|
|
|
2014-11-18 07:56:18 +03:00
|
|
|
// 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.
|
2015-08-26 18:14:33 +03:00
|
|
|
// For pixel deltas, these values are in ScreenCoords.
|
2014-11-18 07:56:18 +03:00
|
|
|
//
|
|
|
|
// 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;
|
2015-08-26 06:21:41 +03:00
|
|
|
|
|
|
|
// See lineOrPageDeltaX/Y on WidgetWheelEvent.
|
|
|
|
int32_t mLineOrPageDeltaX;
|
|
|
|
int32_t mLineOrPageDeltaY;
|
|
|
|
|
2015-12-02 00:45:49 +03:00
|
|
|
// Indicates the order in which this event was added to a transaction. The
|
|
|
|
// first event is 1; if not a member of a transaction, this is 0.
|
|
|
|
uint32_t mScrollSeriesNumber;
|
|
|
|
|
2015-12-02 00:46:07 +03:00
|
|
|
// User-set delta multipliers.
|
|
|
|
double mUserDeltaMultiplierX;
|
|
|
|
double mUserDeltaMultiplierY;
|
|
|
|
|
2016-01-07 18:39:37 +03:00
|
|
|
bool mMayHaveMomentum;
|
2015-08-26 06:21:41 +03:00
|
|
|
bool mIsMomentum;
|
2016-01-27 09:09:13 +03:00
|
|
|
bool mAllowToOverrideSystemScrollSpeed;
|
2018-03-16 14:23:53 +03:00
|
|
|
|
|
|
|
// Sometimes a wheel event input's wheel delta should be adjusted. This member
|
|
|
|
// specifies how to adjust the wheel delta.
|
|
|
|
WheelDeltaAdjustmentStrategy mWheelDeltaAdjustmentStrategy;
|
2018-05-02 19:57:23 +03:00
|
|
|
|
|
|
|
APZWheelAction mAPZAction;
|
2014-11-18 07:56:18 +03:00
|
|
|
};
|
|
|
|
|
2017-06-06 02:09:40 +03:00
|
|
|
class KeyboardInput : public InputData {
|
|
|
|
public:
|
2017-06-06 12:47:10 +03:00
|
|
|
typedef mozilla::layers::KeyboardScrollAction KeyboardScrollAction;
|
|
|
|
|
2018-03-15 11:31:07 +03:00
|
|
|
// Note that if you change the first member in this enum(I.e. KEY_DOWN) to one
|
|
|
|
// other member, don't forget to update the minimum value in
|
|
|
|
// ContiguousEnumSerializer for KeyboardEventType in widget/nsGUIEventIPC
|
|
|
|
// accordingly.
|
2017-06-06 02:09:40 +03:00
|
|
|
enum KeyboardEventType {
|
|
|
|
KEY_DOWN,
|
|
|
|
KEY_PRESS,
|
|
|
|
KEY_UP,
|
|
|
|
// Any other key event such as eKeyDownOnPlugin
|
|
|
|
KEY_OTHER,
|
|
|
|
|
|
|
|
// Used as an upper bound for ContiguousEnumSerializer
|
|
|
|
KEY_SENTINEL,
|
|
|
|
};
|
|
|
|
|
|
|
|
explicit KeyboardInput(const WidgetKeyboardEvent& aEvent);
|
|
|
|
|
|
|
|
// Warning, this class is serialized and sent over IPC. Any change to its
|
|
|
|
// fields must be reflected in its ParamTraits<>, in nsGUIEventIPC.h
|
|
|
|
|
|
|
|
KeyboardEventType mType;
|
|
|
|
uint32_t mKeyCode;
|
|
|
|
uint32_t mCharCode;
|
|
|
|
nsTArray<ShortcutKeyCandidate> mShortcutCandidates;
|
|
|
|
|
|
|
|
bool mHandledByAPZ;
|
|
|
|
|
2017-06-06 12:47:10 +03:00
|
|
|
// The scroll action to perform on a layer for this keyboard input. This is
|
|
|
|
// only used in APZ and is NOT serialized over IPC.
|
|
|
|
KeyboardScrollAction mAction;
|
|
|
|
|
2017-06-06 02:09:40 +03:00
|
|
|
protected:
|
2018-03-16 23:28:19 +03:00
|
|
|
friend mozilla::layers::APZInputBridgeChild;
|
|
|
|
friend mozilla::layers::PAPZInputBridgeParent;
|
2017-06-06 02:09:40 +03:00
|
|
|
|
|
|
|
KeyboardInput();
|
|
|
|
};
|
|
|
|
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace mozilla
|
2012-07-20 10:48:25 +04:00
|
|
|
|
|
|
|
#endif // InputData_h__
|