2013-01-23 23:30:48 +00: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/. */
|
|
|
|
|
|
|
|
#include "InputData.h"
|
|
|
|
|
2013-04-05 08:49:00 +00:00
|
|
|
#include "mozilla/dom/Touch.h"
|
2013-01-23 23:30:48 +00:00
|
|
|
#include "nsDebug.h"
|
2013-05-17 20:17:53 +00:00
|
|
|
#include "nsThreadUtils.h"
|
2013-09-25 11:21:18 +00:00
|
|
|
#include "mozilla/MouseEvents.h"
|
2013-09-25 11:21:16 +00:00
|
|
|
#include "mozilla/TouchEvents.h"
|
2015-01-09 18:39:08 +00:00
|
|
|
#include "UnitTransforms.h"
|
2013-01-23 23:30:48 +00:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
|
2013-04-05 08:49:00 +00:00
|
|
|
using namespace dom;
|
|
|
|
|
2016-09-14 11:54:36 +00:00
|
|
|
InputData::~InputData()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2016-09-12 13:47:01 +00:00
|
|
|
InputData::InputData(InputType aInputType)
|
|
|
|
: mInputType(aInputType)
|
|
|
|
, mTime(0)
|
|
|
|
, modifiers(0)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
InputData::InputData(InputType aInputType, uint32_t aTime, TimeStamp aTimeStamp,
|
|
|
|
Modifiers aModifiers)
|
|
|
|
: mInputType(aInputType)
|
|
|
|
, mTime(aTime)
|
|
|
|
, mTimeStamp(aTimeStamp)
|
|
|
|
, modifiers(aModifiers)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
SingleTouchData::SingleTouchData(int32_t aIdentifier, ScreenIntPoint aScreenPoint,
|
|
|
|
ScreenSize aRadius, float aRotationAngle,
|
|
|
|
float aForce)
|
|
|
|
: mIdentifier(aIdentifier)
|
|
|
|
, mScreenPoint(aScreenPoint)
|
|
|
|
, mRadius(aRadius)
|
|
|
|
, mRotationAngle(aRotationAngle)
|
|
|
|
, mForce(aForce)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
SingleTouchData::SingleTouchData(int32_t aIdentifier,
|
|
|
|
ParentLayerPoint aLocalScreenPoint,
|
|
|
|
ScreenSize aRadius, float aRotationAngle,
|
|
|
|
float aForce)
|
|
|
|
: mIdentifier(aIdentifier)
|
|
|
|
, mLocalScreenPoint(aLocalScreenPoint)
|
|
|
|
, mRadius(aRadius)
|
|
|
|
, mRotationAngle(aRotationAngle)
|
|
|
|
, mForce(aForce)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
SingleTouchData::SingleTouchData()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-08-08 22:15:37 +00:00
|
|
|
already_AddRefed<Touch> SingleTouchData::ToNewDOMTouch() const
|
2014-06-26 00:11:20 +00:00
|
|
|
{
|
2015-02-09 22:34:50 +00:00
|
|
|
MOZ_ASSERT(NS_IsMainThread(),
|
|
|
|
"Can only create dom::Touch instances on main thread");
|
2015-10-18 05:24:48 +00:00
|
|
|
RefPtr<Touch> touch = new Touch(mIdentifier,
|
2016-07-26 14:48:30 +00:00
|
|
|
LayoutDeviceIntPoint::Truncate(mScreenPoint.x, mScreenPoint.y),
|
|
|
|
LayoutDeviceIntPoint::Truncate(mRadius.width, mRadius.height),
|
2015-11-10 05:37:31 +00:00
|
|
|
mRotationAngle,
|
|
|
|
mForce);
|
2014-06-26 00:11:20 +00:00
|
|
|
return touch.forget();
|
|
|
|
}
|
|
|
|
|
2016-09-12 13:47:01 +00:00
|
|
|
MultiTouchInput::MultiTouchInput(MultiTouchType aType, uint32_t aTime,
|
|
|
|
TimeStamp aTimeStamp, Modifiers aModifiers)
|
|
|
|
: InputData(MULTITOUCH_INPUT, aTime, aTimeStamp, aModifiers)
|
|
|
|
, mType(aType)
|
|
|
|
, mHandledByAPZ(false)
|
2015-09-28 14:32:05 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2016-09-12 13:47:01 +00:00
|
|
|
MultiTouchInput::MultiTouchInput()
|
|
|
|
: InputData(MULTITOUCH_INPUT)
|
|
|
|
, mHandledByAPZ(false)
|
2015-09-28 18:44:37 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2016-09-12 13:47:01 +00:00
|
|
|
MultiTouchInput::MultiTouchInput(const MultiTouchInput& aOther)
|
|
|
|
: InputData(MULTITOUCH_INPUT, aOther.mTime, aOther.mTimeStamp, aOther.modifiers)
|
|
|
|
, mType(aOther.mType)
|
|
|
|
, mHandledByAPZ(aOther.mHandledByAPZ)
|
2016-02-17 21:56:28 +00:00
|
|
|
{
|
2016-09-12 13:47:01 +00:00
|
|
|
mTouches.AppendElements(aOther.mTouches);
|
2016-02-17 21:56:28 +00:00
|
|
|
}
|
|
|
|
|
2013-09-27 06:20:57 +00:00
|
|
|
MultiTouchInput::MultiTouchInput(const WidgetTouchEvent& aTouchEvent)
|
2016-03-28 04:49:02 +00:00
|
|
|
: InputData(MULTITOUCH_INPUT, aTouchEvent.mTime, aTouchEvent.mTimeStamp,
|
2016-03-31 08:03:00 +00:00
|
|
|
aTouchEvent.mModifiers)
|
2015-10-28 16:53:34 +00:00
|
|
|
, mHandledByAPZ(aTouchEvent.mFlags.mHandledByAPZ)
|
2013-01-23 23:30:48 +00:00
|
|
|
{
|
2015-02-09 22:34:50 +00:00
|
|
|
MOZ_ASSERT(NS_IsMainThread(),
|
|
|
|
"Can only copy from WidgetTouchEvent on main thread");
|
2013-01-23 23:30:48 +00:00
|
|
|
|
2015-08-22 01:34:51 +00:00
|
|
|
switch (aTouchEvent.mMessage) {
|
2015-09-14 15:14:34 +00:00
|
|
|
case eTouchStart:
|
2013-01-23 23:30:48 +00:00
|
|
|
mType = MULTITOUCH_START;
|
|
|
|
break;
|
2015-09-14 15:14:35 +00:00
|
|
|
case eTouchMove:
|
2013-01-23 23:30:48 +00:00
|
|
|
mType = MULTITOUCH_MOVE;
|
|
|
|
break;
|
2015-09-14 15:14:35 +00:00
|
|
|
case eTouchEnd:
|
2013-01-23 23:30:48 +00:00
|
|
|
mType = MULTITOUCH_END;
|
|
|
|
break;
|
2015-09-14 15:14:35 +00:00
|
|
|
case eTouchCancel:
|
2013-01-23 23:30:48 +00:00
|
|
|
mType = MULTITOUCH_CANCEL;
|
|
|
|
break;
|
|
|
|
default:
|
2014-08-08 22:15:37 +00:00
|
|
|
MOZ_ASSERT_UNREACHABLE("Did not assign a type to a MultiTouchInput");
|
2013-01-23 23:30:48 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2016-03-30 09:44:28 +00:00
|
|
|
for (size_t i = 0; i < aTouchEvent.mTouches.Length(); i++) {
|
|
|
|
const Touch* domTouch = aTouchEvent.mTouches[i];
|
2013-01-23 23:30:48 +00:00
|
|
|
|
|
|
|
// Extract data from weird interfaces.
|
2013-08-02 07:06:35 +00:00
|
|
|
int32_t identifier = domTouch->Identifier();
|
|
|
|
int32_t radiusX = domTouch->RadiusX();
|
|
|
|
int32_t radiusY = domTouch->RadiusY();
|
|
|
|
float rotationAngle = domTouch->RotationAngle();
|
|
|
|
float force = domTouch->Force();
|
2013-01-23 23:30:48 +00:00
|
|
|
|
|
|
|
SingleTouchData data(identifier,
|
2015-11-19 00:32:37 +00:00
|
|
|
ViewAs<ScreenPixel>(domTouch->mRefPoint,
|
|
|
|
PixelCastJustification::LayoutDeviceIsScreenForUntransformedEvent),
|
2013-06-11 22:13:11 +00:00
|
|
|
ScreenSize(radiusX, radiusY),
|
2013-01-23 23:30:48 +00:00
|
|
|
rotationAngle,
|
|
|
|
force);
|
|
|
|
|
|
|
|
mTouches.AppendElement(data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-09-12 13:47:01 +00:00
|
|
|
MultiTouchInput::MultiTouchInput(const WidgetMouseEvent& aMouseEvent)
|
|
|
|
: InputData(MULTITOUCH_INPUT, aMouseEvent.mTime, aMouseEvent.mTimeStamp,
|
|
|
|
aMouseEvent.mModifiers)
|
|
|
|
, mHandledByAPZ(aMouseEvent.mFlags.mHandledByAPZ)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(NS_IsMainThread(),
|
|
|
|
"Can only copy from WidgetMouseEvent on main thread");
|
|
|
|
switch (aMouseEvent.mMessage) {
|
|
|
|
case eMouseDown:
|
|
|
|
mType = MULTITOUCH_START;
|
|
|
|
break;
|
|
|
|
case eMouseMove:
|
|
|
|
mType = MULTITOUCH_MOVE;
|
|
|
|
break;
|
|
|
|
case eMouseUp:
|
|
|
|
mType = MULTITOUCH_END;
|
|
|
|
break;
|
|
|
|
// The mouse pointer has been interrupted in an implementation-specific
|
|
|
|
// manner, such as a synchronous event or action cancelling the touch, or a
|
|
|
|
// touch point leaving the document window and going into a non-document
|
|
|
|
// area capable of handling user interactions.
|
|
|
|
case eMouseExitFromWidget:
|
|
|
|
mType = MULTITOUCH_CANCEL;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
NS_WARNING("Did not assign a type to a MultiTouchInput");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
mTouches.AppendElement(SingleTouchData(0,
|
|
|
|
ViewAs<ScreenPixel>(aMouseEvent.mRefPoint,
|
|
|
|
PixelCastJustification::LayoutDeviceIsScreenForUntransformedEvent),
|
|
|
|
ScreenSize(1, 1),
|
|
|
|
180.0f,
|
|
|
|
1.0f));
|
|
|
|
}
|
|
|
|
|
2014-08-08 22:15:37 +00:00
|
|
|
WidgetTouchEvent
|
|
|
|
MultiTouchInput::ToWidgetTouchEvent(nsIWidget* aWidget) const
|
|
|
|
{
|
2015-02-09 22:34:50 +00:00
|
|
|
MOZ_ASSERT(NS_IsMainThread(),
|
|
|
|
"Can only convert To WidgetTouchEvent on main thread");
|
2014-08-08 22:15:37 +00:00
|
|
|
|
2015-08-28 23:58:26 +00:00
|
|
|
EventMessage touchEventMessage = eVoidEvent;
|
2014-08-08 22:15:37 +00:00
|
|
|
switch (mType) {
|
|
|
|
case MULTITOUCH_START:
|
2015-09-14 15:14:34 +00:00
|
|
|
touchEventMessage = eTouchStart;
|
2014-08-08 22:15:37 +00:00
|
|
|
break;
|
|
|
|
case MULTITOUCH_MOVE:
|
2015-09-14 15:14:35 +00:00
|
|
|
touchEventMessage = eTouchMove;
|
2014-08-08 22:15:37 +00:00
|
|
|
break;
|
|
|
|
case MULTITOUCH_END:
|
2015-09-14 15:14:35 +00:00
|
|
|
touchEventMessage = eTouchEnd;
|
2014-08-08 22:15:37 +00:00
|
|
|
break;
|
|
|
|
case MULTITOUCH_CANCEL:
|
2015-09-14 15:14:35 +00:00
|
|
|
touchEventMessage = eTouchCancel;
|
2014-08-08 22:15:37 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
MOZ_ASSERT_UNREACHABLE("Did not assign a type to WidgetTouchEvent in MultiTouchInput");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2015-08-26 12:56:59 +00:00
|
|
|
WidgetTouchEvent event(true, touchEventMessage, aWidget);
|
2015-08-28 23:58:26 +00:00
|
|
|
if (touchEventMessage == eVoidEvent) {
|
2014-08-08 22:15:37 +00:00
|
|
|
return event;
|
|
|
|
}
|
|
|
|
|
2016-03-31 08:03:00 +00:00
|
|
|
event.mModifiers = this->modifiers;
|
2016-03-28 04:29:42 +00:00
|
|
|
event.mTime = this->mTime;
|
2016-03-28 04:49:02 +00:00
|
|
|
event.mTimeStamp = this->mTimeStamp;
|
2015-10-28 16:53:34 +00:00
|
|
|
event.mFlags.mHandledByAPZ = mHandledByAPZ;
|
2014-08-08 22:15:37 +00:00
|
|
|
|
|
|
|
for (size_t i = 0; i < mTouches.Length(); i++) {
|
2016-03-30 09:44:28 +00:00
|
|
|
*event.mTouches.AppendElement() = mTouches[i].ToNewDOMTouch();
|
2014-08-08 22:15:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return event;
|
|
|
|
}
|
|
|
|
|
2015-01-10 18:54:24 +00:00
|
|
|
WidgetMouseEvent
|
|
|
|
MultiTouchInput::ToWidgetMouseEvent(nsIWidget* aWidget) const
|
|
|
|
{
|
2015-02-09 22:34:50 +00:00
|
|
|
MOZ_ASSERT(NS_IsMainThread(),
|
|
|
|
"Can only convert To WidgetMouseEvent on main thread");
|
2015-01-10 18:54:24 +00:00
|
|
|
|
2015-08-28 23:58:26 +00:00
|
|
|
EventMessage mouseEventMessage = eVoidEvent;
|
2015-01-10 18:54:24 +00:00
|
|
|
switch (mType) {
|
|
|
|
case MultiTouchInput::MULTITOUCH_START:
|
2015-08-28 23:58:30 +00:00
|
|
|
mouseEventMessage = eMouseDown;
|
2015-01-10 18:54:24 +00:00
|
|
|
break;
|
|
|
|
case MultiTouchInput::MULTITOUCH_MOVE:
|
2015-08-28 23:58:29 +00:00
|
|
|
mouseEventMessage = eMouseMove;
|
2015-01-10 18:54:24 +00:00
|
|
|
break;
|
|
|
|
case MultiTouchInput::MULTITOUCH_CANCEL:
|
|
|
|
case MultiTouchInput::MULTITOUCH_END:
|
2015-08-28 23:58:30 +00:00
|
|
|
mouseEventMessage = eMouseUp;
|
2015-01-10 18:54:24 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
MOZ_ASSERT_UNREACHABLE("Did not assign a type to WidgetMouseEvent");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2015-08-26 12:56:59 +00:00
|
|
|
WidgetMouseEvent event(true, mouseEventMessage, aWidget,
|
2015-01-10 18:54:24 +00:00
|
|
|
WidgetMouseEvent::eReal, WidgetMouseEvent::eNormal);
|
|
|
|
|
|
|
|
const SingleTouchData& firstTouch = mTouches[0];
|
2016-04-18 14:09:02 +00:00
|
|
|
event.mRefPoint.x = firstTouch.mScreenPoint.x;
|
|
|
|
event.mRefPoint.y = firstTouch.mScreenPoint.y;
|
2015-01-10 18:54:24 +00:00
|
|
|
|
2016-03-28 04:29:42 +00:00
|
|
|
event.mTime = mTime;
|
2015-01-10 18:54:24 +00:00
|
|
|
event.button = WidgetMouseEvent::eLeftButton;
|
|
|
|
event.inputSource = nsIDOMMouseEvent::MOZ_SOURCE_TOUCH;
|
2016-03-31 08:03:00 +00:00
|
|
|
event.mModifiers = modifiers;
|
2015-10-28 16:53:34 +00:00
|
|
|
event.mFlags.mHandledByAPZ = mHandledByAPZ;
|
2015-01-10 18:54:24 +00:00
|
|
|
|
2015-08-28 23:58:29 +00:00
|
|
|
if (mouseEventMessage != eMouseMove) {
|
2016-05-10 14:29:14 +00:00
|
|
|
event.mClickCount = 1;
|
2015-01-10 18:54:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return event;
|
|
|
|
}
|
|
|
|
|
2015-01-19 23:38:00 +00:00
|
|
|
int32_t
|
|
|
|
MultiTouchInput::IndexOfTouch(int32_t aTouchIdentifier)
|
|
|
|
{
|
|
|
|
for (size_t i = 0; i < mTouches.Length(); i++) {
|
|
|
|
if (mTouches[i].mIdentifier == aTouchIdentifier) {
|
|
|
|
return (int32_t)i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2016-09-12 13:47:01 +00:00
|
|
|
bool
|
|
|
|
MultiTouchInput::TransformToLocal(const ScreenToParentLayerMatrix4x4& aTransform)
|
|
|
|
{
|
|
|
|
for (size_t i = 0; i < mTouches.Length(); i++) {
|
|
|
|
Maybe<ParentLayerIntPoint> point = UntransformBy(aTransform, mTouches[i].mScreenPoint);
|
|
|
|
if (!point) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
mTouches[i].mLocalScreenPoint = *point;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
MouseInput::MouseInput()
|
|
|
|
: InputData(MOUSE_INPUT)
|
|
|
|
, mType(MOUSE_NONE)
|
|
|
|
, mButtonType(NONE)
|
|
|
|
, mInputSource(0)
|
|
|
|
, mButtons(0)
|
|
|
|
, mHandledByAPZ(false)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
MouseInput::MouseInput(MouseType aType, ButtonType aButtonType,
|
|
|
|
uint16_t aInputSource, int16_t aButtons,
|
|
|
|
const ScreenPoint& aPoint, uint32_t aTime,
|
|
|
|
TimeStamp aTimeStamp, Modifiers aModifiers)
|
|
|
|
: InputData(MOUSE_INPUT, aTime, aTimeStamp, aModifiers)
|
|
|
|
, mType(aType)
|
|
|
|
, mButtonType(aButtonType)
|
|
|
|
, mInputSource(aInputSource)
|
|
|
|
, mButtons(aButtons)
|
|
|
|
, mOrigin(aPoint)
|
|
|
|
, mHandledByAPZ(false)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
MouseInput::MouseInput(const WidgetMouseEventBase& aMouseEvent)
|
|
|
|
: InputData(MOUSE_INPUT, aMouseEvent.mTime, aMouseEvent.mTimeStamp,
|
2016-03-31 08:03:00 +00:00
|
|
|
aMouseEvent.mModifiers)
|
2016-09-12 13:47:01 +00:00
|
|
|
, mType(MOUSE_NONE)
|
|
|
|
, mButtonType(NONE)
|
|
|
|
, mInputSource(aMouseEvent.inputSource)
|
|
|
|
, mButtons(aMouseEvent.buttons)
|
2015-10-28 16:53:34 +00:00
|
|
|
, mHandledByAPZ(aMouseEvent.mFlags.mHandledByAPZ)
|
2013-01-23 23:30:48 +00:00
|
|
|
{
|
2015-02-09 22:34:50 +00:00
|
|
|
MOZ_ASSERT(NS_IsMainThread(),
|
2016-09-12 13:47:01 +00:00
|
|
|
"Can only copy from WidgetTouchEvent on main thread");
|
|
|
|
|
|
|
|
mButtonType = NONE;
|
|
|
|
|
|
|
|
switch (aMouseEvent.button) {
|
|
|
|
case WidgetMouseEventBase::eLeftButton:
|
|
|
|
mButtonType = MouseInput::LEFT_BUTTON;
|
|
|
|
break;
|
|
|
|
case WidgetMouseEventBase::eMiddleButton:
|
|
|
|
mButtonType = MouseInput::MIDDLE_BUTTON;
|
|
|
|
break;
|
|
|
|
case WidgetMouseEventBase::eRightButton:
|
|
|
|
mButtonType = MouseInput::RIGHT_BUTTON;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2015-08-22 01:34:51 +00:00
|
|
|
switch (aMouseEvent.mMessage) {
|
2016-09-12 13:47:01 +00:00
|
|
|
case eMouseMove:
|
|
|
|
mType = MOUSE_MOVE;
|
|
|
|
break;
|
|
|
|
case eMouseUp:
|
|
|
|
mType = MOUSE_UP;
|
|
|
|
break;
|
|
|
|
case eMouseDown:
|
|
|
|
mType = MOUSE_DOWN;
|
|
|
|
break;
|
|
|
|
case eDragStart:
|
|
|
|
mType = MOUSE_DRAG_START;
|
|
|
|
break;
|
|
|
|
case eDragEnd:
|
|
|
|
mType = MOUSE_DRAG_END;
|
|
|
|
break;
|
|
|
|
case eMouseEnterIntoWidget:
|
|
|
|
mType = MOUSE_WIDGET_ENTER;
|
|
|
|
break;
|
|
|
|
case eMouseExitFromWidget:
|
|
|
|
mType = MOUSE_WIDGET_EXIT;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
MOZ_ASSERT_UNREACHABLE("Mouse event type not supported");
|
|
|
|
break;
|
2013-01-23 23:30:48 +00:00
|
|
|
}
|
|
|
|
|
2016-09-12 13:47:01 +00:00
|
|
|
mOrigin =
|
|
|
|
ScreenPoint(ViewAs<ScreenPixel>(aMouseEvent.mRefPoint,
|
|
|
|
PixelCastJustification::LayoutDeviceIsScreenForUntransformedEvent));
|
2013-01-23 23:30:48 +00:00
|
|
|
}
|
2015-01-09 18:39:08 +00:00
|
|
|
|
2015-07-03 19:06:26 +00:00
|
|
|
bool
|
2016-09-12 13:47:01 +00:00
|
|
|
MouseInput::IsLeftButton() const
|
2015-01-09 18:39:08 +00:00
|
|
|
{
|
2016-09-12 13:47:01 +00:00
|
|
|
return mButtonType == LEFT_BUTTON;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
MouseInput::TransformToLocal(const ScreenToParentLayerMatrix4x4& aTransform)
|
|
|
|
{
|
|
|
|
Maybe<ParentLayerPoint> point = UntransformBy(aTransform, mOrigin);
|
|
|
|
if (!point) {
|
|
|
|
return false;
|
2015-01-09 18:39:08 +00:00
|
|
|
}
|
2016-09-12 13:47:01 +00:00
|
|
|
mLocalOrigin = *point;
|
|
|
|
|
2015-07-03 19:06:26 +00:00
|
|
|
return true;
|
2013-01-23 23:30:48 +00:00
|
|
|
}
|
2015-01-09 18:39:08 +00:00
|
|
|
|
2016-09-12 13:47:01 +00:00
|
|
|
WidgetMouseEvent
|
|
|
|
MouseInput::ToWidgetMouseEvent(nsIWidget* aWidget) const
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(NS_IsMainThread(),
|
|
|
|
"Can only convert To WidgetTouchEvent on main thread");
|
|
|
|
|
|
|
|
EventMessage msg = eVoidEvent;
|
|
|
|
uint32_t clickCount = 0;
|
|
|
|
switch (mType) {
|
|
|
|
case MOUSE_MOVE:
|
|
|
|
msg = eMouseMove;
|
|
|
|
break;
|
|
|
|
case MOUSE_UP:
|
|
|
|
msg = eMouseUp;
|
|
|
|
clickCount = 1;
|
|
|
|
break;
|
|
|
|
case MOUSE_DOWN:
|
|
|
|
msg = eMouseDown;
|
|
|
|
clickCount = 1;
|
|
|
|
break;
|
|
|
|
case MOUSE_DRAG_START:
|
|
|
|
msg = eDragStart;
|
|
|
|
break;
|
|
|
|
case MOUSE_DRAG_END:
|
|
|
|
msg = eDragEnd;
|
|
|
|
break;
|
|
|
|
case MOUSE_WIDGET_ENTER:
|
|
|
|
msg = eMouseEnterIntoWidget;
|
|
|
|
break;
|
|
|
|
case MOUSE_WIDGET_EXIT:
|
|
|
|
msg = eMouseExitFromWidget;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
MOZ_ASSERT_UNREACHABLE("Did not assign a type to WidgetMouseEvent in MouseInput");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
WidgetMouseEvent event(true, msg, aWidget, WidgetMouseEvent::eReal, WidgetMouseEvent::eNormal);
|
|
|
|
|
|
|
|
if (msg == eVoidEvent) {
|
|
|
|
return event;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (mButtonType) {
|
|
|
|
case MouseInput::LEFT_BUTTON:
|
|
|
|
event.button = WidgetMouseEventBase::eLeftButton;
|
|
|
|
break;
|
|
|
|
case MouseInput::MIDDLE_BUTTON:
|
|
|
|
event.button = WidgetMouseEventBase::eMiddleButton;
|
|
|
|
break;
|
|
|
|
case MouseInput::RIGHT_BUTTON:
|
|
|
|
event.button = WidgetMouseEventBase::eRightButton;
|
|
|
|
break;
|
|
|
|
case MouseInput::NONE:
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
event.buttons = mButtons;
|
|
|
|
event.mModifiers = modifiers;
|
|
|
|
event.mTime = mTime;
|
|
|
|
event.mTimeStamp = mTimeStamp;
|
|
|
|
event.mFlags.mHandledByAPZ = mHandledByAPZ;
|
|
|
|
event.mRefPoint =
|
|
|
|
RoundedToInt(ViewAs<LayoutDevicePixel>(mOrigin,
|
|
|
|
PixelCastJustification::LayoutDeviceIsScreenForUntransformedEvent));
|
|
|
|
event.mClickCount = clickCount;
|
|
|
|
event.inputSource = mInputSource;
|
|
|
|
event.mIgnoreRootScrollFrame = true;
|
|
|
|
|
|
|
|
return event;
|
|
|
|
}
|
|
|
|
|
|
|
|
PanGestureInput::PanGestureInput()
|
|
|
|
: InputData(PANGESTURE_INPUT)
|
|
|
|
, mLineOrPageDeltaX(0)
|
|
|
|
, mLineOrPageDeltaY(0)
|
|
|
|
, mUserDeltaMultiplierX(1.0)
|
|
|
|
, mUserDeltaMultiplierY(1.0)
|
|
|
|
, mHandledByAPZ(false)
|
|
|
|
, mFollowedByMomentum(false)
|
|
|
|
, mRequiresContentResponseIfCannotScrollHorizontallyInStartDirection(false)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
PanGestureInput::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)
|
|
|
|
, mUserDeltaMultiplierX(1.0)
|
|
|
|
, mUserDeltaMultiplierY(1.0)
|
|
|
|
, mHandledByAPZ(false)
|
|
|
|
, mFollowedByMomentum(false)
|
|
|
|
, mRequiresContentResponseIfCannotScrollHorizontallyInStartDirection(false)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2015-08-26 03:21:41 +00:00
|
|
|
bool
|
|
|
|
PanGestureInput::IsMomentum() const
|
|
|
|
{
|
|
|
|
switch (mType) {
|
|
|
|
case PanGestureInput::PANGESTURE_MOMENTUMSTART:
|
|
|
|
case PanGestureInput::PANGESTURE_MOMENTUMPAN:
|
|
|
|
case PanGestureInput::PANGESTURE_MOMENTUMEND:
|
|
|
|
return true;
|
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
WidgetWheelEvent
|
|
|
|
PanGestureInput::ToWidgetWheelEvent(nsIWidget* aWidget) const
|
|
|
|
{
|
2015-09-10 16:59:54 +00:00
|
|
|
WidgetWheelEvent wheelEvent(true, eWheel, aWidget);
|
2016-03-31 08:03:00 +00:00
|
|
|
wheelEvent.mModifiers = this->modifiers;
|
2016-03-28 04:29:42 +00:00
|
|
|
wheelEvent.mTime = mTime;
|
2016-03-28 04:49:02 +00:00
|
|
|
wheelEvent.mTimeStamp = mTimeStamp;
|
2016-04-18 14:09:02 +00:00
|
|
|
wheelEvent.mRefPoint =
|
2015-08-26 03:21:41 +00:00
|
|
|
RoundedToInt(ViewAs<LayoutDevicePixel>(mPanStartPoint,
|
2015-11-19 00:32:37 +00:00
|
|
|
PixelCastJustification::LayoutDeviceIsScreenForUntransformedEvent));
|
2015-08-26 03:21:41 +00:00
|
|
|
wheelEvent.buttons = 0;
|
2016-03-31 09:35:24 +00:00
|
|
|
wheelEvent.mDeltaMode = nsIDOMWheelEvent::DOM_DELTA_PIXEL;
|
2016-03-31 14:36:49 +00:00
|
|
|
wheelEvent.mMayHaveMomentum = true; // pan inputs may have momentum
|
2016-03-31 14:45:55 +00:00
|
|
|
wheelEvent.mIsMomentum = IsMomentum();
|
2016-03-31 15:10:46 +00:00
|
|
|
wheelEvent.mLineOrPageDeltaX = mLineOrPageDeltaX;
|
2016-03-31 15:10:09 +00:00
|
|
|
wheelEvent.mLineOrPageDeltaY = mLineOrPageDeltaY;
|
2016-03-31 09:55:59 +00:00
|
|
|
wheelEvent.mDeltaX = mPanDisplacement.x;
|
2016-03-31 09:09:47 +00:00
|
|
|
wheelEvent.mDeltaY = mPanDisplacement.y;
|
2015-08-11 22:04:55 +00:00
|
|
|
wheelEvent.mFlags.mHandledByAPZ = mHandledByAPZ;
|
2015-08-26 03:21:41 +00:00
|
|
|
return wheelEvent;
|
|
|
|
}
|
|
|
|
|
2015-07-03 19:06:26 +00:00
|
|
|
bool
|
2015-12-01 01:14:31 +00:00
|
|
|
PanGestureInput::TransformToLocal(const ScreenToParentLayerMatrix4x4& aTransform)
|
2015-07-03 19:06:26 +00:00
|
|
|
{
|
2015-12-01 01:06:45 +00:00
|
|
|
Maybe<ParentLayerPoint> panStartPoint = UntransformBy(aTransform, mPanStartPoint);
|
2015-07-03 19:06:26 +00:00
|
|
|
if (!panStartPoint) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
mLocalPanStartPoint = *panStartPoint;
|
|
|
|
|
2015-12-01 01:06:45 +00:00
|
|
|
Maybe<ParentLayerPoint> panDisplacement = UntransformVector(aTransform, mPanDisplacement, mPanStartPoint);
|
2015-07-03 19:06:26 +00:00
|
|
|
if (!panDisplacement) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
mLocalPanDisplacement = *panDisplacement;
|
|
|
|
return true;
|
2015-01-09 18:39:08 +00:00
|
|
|
}
|
|
|
|
|
2016-05-03 13:09:10 +00:00
|
|
|
ScreenPoint
|
|
|
|
PanGestureInput::UserMultipliedPanDisplacement() const
|
|
|
|
{
|
|
|
|
return ScreenPoint(mPanDisplacement.x * mUserDeltaMultiplierX,
|
|
|
|
mPanDisplacement.y * mUserDeltaMultiplierY);
|
|
|
|
}
|
|
|
|
|
|
|
|
ParentLayerPoint
|
|
|
|
PanGestureInput::UserMultipliedLocalPanDisplacement() const
|
|
|
|
{
|
|
|
|
return ParentLayerPoint(mLocalPanDisplacement.x * mUserDeltaMultiplierX,
|
|
|
|
mLocalPanDisplacement.y * mUserDeltaMultiplierY);
|
|
|
|
}
|
|
|
|
|
2016-09-12 13:47:01 +00:00
|
|
|
PinchGestureInput::PinchGestureInput()
|
|
|
|
: InputData(PINCHGESTURE_INPUT)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
PinchGestureInput::PinchGestureInput(PinchGestureType aType, uint32_t aTime,
|
|
|
|
TimeStamp aTimeStamp,
|
|
|
|
const ParentLayerPoint& aLocalFocusPoint,
|
2016-09-24 13:46:01 +00:00
|
|
|
ParentLayerCoord aCurrentSpan,
|
|
|
|
ParentLayerCoord aPreviousSpan,
|
2016-09-12 13:47:01 +00:00
|
|
|
Modifiers aModifiers)
|
|
|
|
: InputData(PINCHGESTURE_INPUT, aTime, aTimeStamp, aModifiers)
|
|
|
|
, mType(aType)
|
|
|
|
, mLocalFocusPoint(aLocalFocusPoint)
|
|
|
|
, mCurrentSpan(aCurrentSpan)
|
|
|
|
, mPreviousSpan(aPreviousSpan)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2015-07-03 19:06:26 +00:00
|
|
|
bool
|
2015-12-01 01:14:31 +00:00
|
|
|
PinchGestureInput::TransformToLocal(const ScreenToParentLayerMatrix4x4& aTransform)
|
2015-07-03 19:06:26 +00:00
|
|
|
{
|
2015-12-01 01:06:45 +00:00
|
|
|
Maybe<ParentLayerPoint> point = UntransformBy(aTransform, mFocusPoint);
|
2015-07-03 19:06:26 +00:00
|
|
|
if (!point) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
mLocalFocusPoint = *point;
|
|
|
|
return true;
|
2015-01-09 18:39:08 +00:00
|
|
|
}
|
|
|
|
|
2016-09-12 13:47:01 +00:00
|
|
|
TapGestureInput::TapGestureInput()
|
|
|
|
: InputData(TAPGESTURE_INPUT)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
TapGestureInput::TapGestureInput(TapGestureType aType, uint32_t aTime,
|
|
|
|
TimeStamp aTimeStamp,
|
|
|
|
const ScreenIntPoint& aPoint,
|
|
|
|
Modifiers aModifiers)
|
|
|
|
: InputData(TAPGESTURE_INPUT, aTime, aTimeStamp, aModifiers)
|
|
|
|
, mType(aType)
|
|
|
|
, mPoint(aPoint)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
TapGestureInput::TapGestureInput(TapGestureType aType, uint32_t aTime,
|
|
|
|
TimeStamp aTimeStamp,
|
|
|
|
const ParentLayerPoint& aLocalPoint,
|
|
|
|
Modifiers aModifiers)
|
|
|
|
: InputData(TAPGESTURE_INPUT, aTime, aTimeStamp, aModifiers)
|
|
|
|
, mType(aType)
|
|
|
|
, mLocalPoint(aLocalPoint)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2015-07-03 19:06:26 +00:00
|
|
|
bool
|
2015-12-01 01:14:31 +00:00
|
|
|
TapGestureInput::TransformToLocal(const ScreenToParentLayerMatrix4x4& aTransform)
|
2015-01-09 18:39:08 +00:00
|
|
|
{
|
2015-12-01 01:06:45 +00:00
|
|
|
Maybe<ParentLayerIntPoint> point = UntransformBy(aTransform, mPoint);
|
2015-07-03 19:06:26 +00:00
|
|
|
if (!point) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
mLocalPoint = *point;
|
|
|
|
return true;
|
2015-01-09 18:39:08 +00:00
|
|
|
}
|
|
|
|
|
2016-09-12 13:47:01 +00:00
|
|
|
ScrollWheelInput::ScrollWheelInput()
|
|
|
|
: InputData(SCROLLWHEEL_INPUT)
|
|
|
|
, mHandledByAPZ(false)
|
|
|
|
, mLineOrPageDeltaX(0)
|
|
|
|
, mLineOrPageDeltaY(0)
|
|
|
|
, mScrollSeriesNumber(0)
|
|
|
|
, mUserDeltaMultiplierX(1.0)
|
|
|
|
, mUserDeltaMultiplierY(1.0)
|
|
|
|
, mMayHaveMomentum(false)
|
|
|
|
, mIsMomentum(false)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
ScrollWheelInput::ScrollWheelInput(uint32_t aTime, TimeStamp aTimeStamp,
|
|
|
|
Modifiers aModifiers, ScrollMode aScrollMode,
|
|
|
|
ScrollDeltaType aDeltaType,
|
|
|
|
const ScreenPoint& aOrigin, double aDeltaX,
|
|
|
|
double aDeltaY,
|
|
|
|
bool aAllowToOverrideSystemScrollSpeed)
|
|
|
|
: InputData(SCROLLWHEEL_INPUT, aTime, aTimeStamp, aModifiers)
|
|
|
|
, mDeltaType(aDeltaType)
|
|
|
|
, mScrollMode(aScrollMode)
|
|
|
|
, mOrigin(aOrigin)
|
|
|
|
, mHandledByAPZ(false)
|
|
|
|
, mDeltaX(aDeltaX)
|
|
|
|
, mDeltaY(aDeltaY)
|
|
|
|
, mLineOrPageDeltaX(0)
|
|
|
|
, mLineOrPageDeltaY(0)
|
|
|
|
, mScrollSeriesNumber(0)
|
|
|
|
, mUserDeltaMultiplierX(1.0)
|
|
|
|
, mUserDeltaMultiplierY(1.0)
|
|
|
|
, mMayHaveMomentum(false)
|
|
|
|
, mIsMomentum(false)
|
|
|
|
, mAllowToOverrideSystemScrollSpeed(aAllowToOverrideSystemScrollSpeed)
|
2015-08-26 03:21:41 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2016-01-27 06:09:13 +00:00
|
|
|
ScrollWheelInput::ScrollWheelInput(const WidgetWheelEvent& aWheelEvent)
|
2016-09-12 13:47:01 +00:00
|
|
|
: InputData(SCROLLWHEEL_INPUT, aWheelEvent.mTime, aWheelEvent.mTimeStamp,
|
2016-03-31 08:03:00 +00:00
|
|
|
aWheelEvent.mModifiers)
|
2016-03-31 09:35:24 +00:00
|
|
|
, mDeltaType(DeltaTypeForDeltaMode(aWheelEvent.mDeltaMode))
|
2016-01-27 06:09:13 +00:00
|
|
|
, mScrollMode(SCROLLMODE_INSTANT)
|
|
|
|
, mHandledByAPZ(aWheelEvent.mFlags.mHandledByAPZ)
|
2016-03-31 09:55:59 +00:00
|
|
|
, mDeltaX(aWheelEvent.mDeltaX)
|
2016-03-31 09:09:47 +00:00
|
|
|
, mDeltaY(aWheelEvent.mDeltaY)
|
2016-03-31 15:10:46 +00:00
|
|
|
, mLineOrPageDeltaX(aWheelEvent.mLineOrPageDeltaX)
|
2016-03-31 15:10:09 +00:00
|
|
|
, mLineOrPageDeltaY(aWheelEvent.mLineOrPageDeltaY)
|
2016-01-28 13:47:28 +00:00
|
|
|
, mScrollSeriesNumber(0)
|
2016-01-27 06:09:13 +00:00
|
|
|
, mUserDeltaMultiplierX(1.0)
|
|
|
|
, mUserDeltaMultiplierY(1.0)
|
2016-03-31 14:36:49 +00:00
|
|
|
, mMayHaveMomentum(aWheelEvent.mMayHaveMomentum)
|
2016-03-31 14:45:55 +00:00
|
|
|
, mIsMomentum(aWheelEvent.mIsMomentum)
|
2016-01-27 06:09:13 +00:00
|
|
|
, mAllowToOverrideSystemScrollSpeed(
|
|
|
|
aWheelEvent.mAllowToOverrideSystemScrollSpeed)
|
2015-11-19 00:32:37 +00:00
|
|
|
{
|
|
|
|
mOrigin =
|
2016-04-18 14:09:02 +00:00
|
|
|
ScreenPoint(ViewAs<ScreenPixel>(aWheelEvent.mRefPoint,
|
2015-11-19 00:32:37 +00:00
|
|
|
PixelCastJustification::LayoutDeviceIsScreenForUntransformedEvent));
|
|
|
|
}
|
|
|
|
|
2016-09-12 13:47:01 +00:00
|
|
|
ScrollWheelInput::ScrollDeltaType
|
|
|
|
ScrollWheelInput::DeltaTypeForDeltaMode(uint32_t aDeltaMode)
|
|
|
|
{
|
|
|
|
switch (aDeltaMode) {
|
|
|
|
case nsIDOMWheelEvent::DOM_DELTA_LINE:
|
|
|
|
return SCROLLDELTA_LINE;
|
|
|
|
case nsIDOMWheelEvent::DOM_DELTA_PAGE:
|
|
|
|
return SCROLLDELTA_PAGE;
|
|
|
|
case nsIDOMWheelEvent::DOM_DELTA_PIXEL:
|
|
|
|
return SCROLLDELTA_PIXEL;
|
|
|
|
default:
|
|
|
|
MOZ_CRASH();
|
|
|
|
}
|
|
|
|
return SCROLLDELTA_LINE;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t
|
|
|
|
ScrollWheelInput::DeltaModeForDeltaType(ScrollDeltaType aDeltaType)
|
|
|
|
{
|
|
|
|
switch (aDeltaType) {
|
|
|
|
case ScrollWheelInput::SCROLLDELTA_LINE:
|
|
|
|
return nsIDOMWheelEvent::DOM_DELTA_LINE;
|
|
|
|
case ScrollWheelInput::SCROLLDELTA_PAGE:
|
|
|
|
return nsIDOMWheelEvent::DOM_DELTA_PAGE;
|
|
|
|
case ScrollWheelInput::SCROLLDELTA_PIXEL:
|
|
|
|
default:
|
|
|
|
return nsIDOMWheelEvent::DOM_DELTA_PIXEL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
nsIScrollableFrame::ScrollUnit
|
|
|
|
ScrollWheelInput::ScrollUnitForDeltaType(ScrollDeltaType aDeltaType)
|
|
|
|
{
|
|
|
|
switch (aDeltaType) {
|
|
|
|
case SCROLLDELTA_LINE:
|
|
|
|
return nsIScrollableFrame::LINES;
|
|
|
|
case SCROLLDELTA_PAGE:
|
|
|
|
return nsIScrollableFrame::PAGES;
|
|
|
|
case SCROLLDELTA_PIXEL:
|
|
|
|
return nsIScrollableFrame::DEVICE_PIXELS;
|
|
|
|
default:
|
|
|
|
MOZ_CRASH();
|
|
|
|
}
|
|
|
|
return nsIScrollableFrame::LINES;
|
|
|
|
}
|
|
|
|
|
2015-08-26 03:21:41 +00:00
|
|
|
WidgetWheelEvent
|
|
|
|
ScrollWheelInput::ToWidgetWheelEvent(nsIWidget* aWidget) const
|
|
|
|
{
|
2015-09-10 16:59:54 +00:00
|
|
|
WidgetWheelEvent wheelEvent(true, eWheel, aWidget);
|
2016-03-31 08:03:00 +00:00
|
|
|
wheelEvent.mModifiers = this->modifiers;
|
2016-03-28 04:29:42 +00:00
|
|
|
wheelEvent.mTime = mTime;
|
2016-03-28 04:49:02 +00:00
|
|
|
wheelEvent.mTimeStamp = mTimeStamp;
|
2016-04-18 14:09:02 +00:00
|
|
|
wheelEvent.mRefPoint =
|
2015-08-26 03:21:41 +00:00
|
|
|
RoundedToInt(ViewAs<LayoutDevicePixel>(mOrigin,
|
2015-11-19 00:32:37 +00:00
|
|
|
PixelCastJustification::LayoutDeviceIsScreenForUntransformedEvent));
|
2015-08-26 03:21:41 +00:00
|
|
|
wheelEvent.buttons = 0;
|
2016-03-31 09:35:24 +00:00
|
|
|
wheelEvent.mDeltaMode = DeltaModeForDeltaType(mDeltaType);
|
2016-03-31 14:36:49 +00:00
|
|
|
wheelEvent.mMayHaveMomentum = mMayHaveMomentum;
|
2016-03-31 14:45:55 +00:00
|
|
|
wheelEvent.mIsMomentum = mIsMomentum;
|
2016-03-31 09:55:59 +00:00
|
|
|
wheelEvent.mDeltaX = mDeltaX;
|
2016-03-31 09:09:47 +00:00
|
|
|
wheelEvent.mDeltaY = mDeltaY;
|
2016-03-31 15:10:46 +00:00
|
|
|
wheelEvent.mLineOrPageDeltaX = mLineOrPageDeltaX;
|
2016-03-31 15:10:09 +00:00
|
|
|
wheelEvent.mLineOrPageDeltaY = mLineOrPageDeltaY;
|
2016-01-27 06:09:13 +00:00
|
|
|
wheelEvent.mAllowToOverrideSystemScrollSpeed =
|
|
|
|
mAllowToOverrideSystemScrollSpeed;
|
2015-08-11 22:04:55 +00:00
|
|
|
wheelEvent.mFlags.mHandledByAPZ = mHandledByAPZ;
|
2015-08-26 03:21:41 +00:00
|
|
|
return wheelEvent;
|
|
|
|
}
|
|
|
|
|
2015-07-03 19:06:26 +00:00
|
|
|
bool
|
2015-12-01 01:14:31 +00:00
|
|
|
ScrollWheelInput::TransformToLocal(const ScreenToParentLayerMatrix4x4& aTransform)
|
2015-01-09 18:39:08 +00:00
|
|
|
{
|
2015-12-01 01:06:45 +00:00
|
|
|
Maybe<ParentLayerPoint> point = UntransformBy(aTransform, mOrigin);
|
2015-07-03 19:06:26 +00:00
|
|
|
if (!point) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
mLocalOrigin = *point;
|
|
|
|
return true;
|
2015-01-09 18:39:08 +00:00
|
|
|
}
|
|
|
|
|
2015-12-01 21:46:07 +00:00
|
|
|
bool
|
|
|
|
ScrollWheelInput::IsCustomizedByUserPrefs() const
|
|
|
|
{
|
|
|
|
return mUserDeltaMultiplierX != 1.0 ||
|
|
|
|
mUserDeltaMultiplierY != 1.0;
|
|
|
|
}
|
|
|
|
|
2015-01-09 18:39:08 +00:00
|
|
|
} // namespace mozilla
|