2013-09-24 14:04:15 +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 mozilla_MouseEvents_h__
|
|
|
|
#define mozilla_MouseEvents_h__
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
#include "mozilla/BasicEvents.h"
|
|
|
|
#include "mozilla/MathAlgorithms.h"
|
2014-02-27 07:23:31 +04:00
|
|
|
#include "mozilla/dom/DataTransfer.h"
|
2013-09-24 14:04:15 +04:00
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsIDOMMouseEvent.h"
|
|
|
|
#include "nsIDOMWheelEvent.h"
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* nsDragDropEventStatus
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
enum nsDragDropEventStatus
|
|
|
|
{
|
|
|
|
// The event is a enter
|
|
|
|
nsDragDropEventStatus_eDragEntered,
|
|
|
|
// The event is exit
|
|
|
|
nsDragDropEventStatus_eDragExited,
|
|
|
|
// The event is drop
|
|
|
|
nsDragDropEventStatus_eDrop
|
|
|
|
};
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
|
|
|
|
namespace dom {
|
|
|
|
class PBrowserParent;
|
|
|
|
class PBrowserChild;
|
|
|
|
} // namespace dom
|
|
|
|
|
2014-02-27 01:37:01 +04:00
|
|
|
/******************************************************************************
|
|
|
|
* mozilla::WidgetPointerHelper
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
class WidgetPointerHelper
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
bool convertToPointer;
|
2014-04-04 21:09:10 +04:00
|
|
|
uint32_t pointerId;
|
2014-02-27 01:37:01 +04:00
|
|
|
uint32_t tiltX;
|
|
|
|
uint32_t tiltY;
|
2014-06-20 17:20:00 +04:00
|
|
|
bool retargetedByPointerCapture;
|
2014-02-27 01:37:01 +04:00
|
|
|
|
2014-06-20 17:20:00 +04:00
|
|
|
WidgetPointerHelper() : convertToPointer(true), pointerId(0), tiltX(0), tiltY(0),
|
|
|
|
retargetedByPointerCapture(false) {}
|
2014-02-27 01:37:01 +04:00
|
|
|
|
|
|
|
void AssignPointerHelperData(const WidgetPointerHelper& aEvent)
|
|
|
|
{
|
|
|
|
convertToPointer = aEvent.convertToPointer;
|
2014-04-04 21:09:10 +04:00
|
|
|
pointerId = aEvent.pointerId;
|
2014-02-27 01:37:01 +04:00
|
|
|
tiltX = aEvent.tiltX;
|
|
|
|
tiltY = aEvent.tiltY;
|
2014-06-20 17:20:00 +04:00
|
|
|
retargetedByPointerCapture = aEvent.retargetedByPointerCapture;
|
2014-02-27 01:37:01 +04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2013-09-24 14:04:15 +04:00
|
|
|
/******************************************************************************
|
|
|
|
* mozilla::WidgetMouseEventBase
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
class WidgetMouseEventBase : public WidgetInputEvent
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
friend class dom::PBrowserParent;
|
|
|
|
friend class dom::PBrowserChild;
|
|
|
|
|
2013-10-18 10:10:20 +04:00
|
|
|
protected:
|
2013-09-24 14:04:15 +04:00
|
|
|
WidgetMouseEventBase()
|
2016-01-12 21:16:59 +03:00
|
|
|
: button(0)
|
|
|
|
, buttons(0)
|
|
|
|
, pressure(0)
|
|
|
|
, hitCluster(false)
|
|
|
|
, inputSource(nsIDOMMouseEvent::MOZ_SOURCE_MOUSE)
|
2013-09-24 14:04:15 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2015-08-26 15:56:59 +03:00
|
|
|
WidgetMouseEventBase(bool aIsTrusted, EventMessage aMessage,
|
|
|
|
nsIWidget* aWidget, EventClassID aEventClassID)
|
2014-08-04 09:28:46 +04:00
|
|
|
: WidgetInputEvent(aIsTrusted, aMessage, aWidget, aEventClassID)
|
|
|
|
, button(0)
|
|
|
|
, buttons(0)
|
|
|
|
, pressure(0)
|
2014-11-24 17:33:06 +03:00
|
|
|
, hitCluster(false)
|
2014-08-04 09:28:46 +04:00
|
|
|
, inputSource(nsIDOMMouseEvent::MOZ_SOURCE_MOUSE)
|
2013-09-24 14:04:15 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-10-18 10:10:20 +04:00
|
|
|
public:
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual WidgetMouseEventBase* AsMouseEventBase() override { return this; }
|
2013-10-18 10:10:20 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual WidgetEvent* Duplicate() const override
|
2014-01-27 10:10:44 +04:00
|
|
|
{
|
|
|
|
MOZ_CRASH("WidgetMouseEventBase must not be most-subclass");
|
|
|
|
}
|
|
|
|
|
2013-09-24 14:04:15 +04:00
|
|
|
/// The possible related target
|
|
|
|
nsCOMPtr<nsISupports> relatedTarget;
|
|
|
|
|
|
|
|
enum buttonType
|
|
|
|
{
|
|
|
|
eLeftButton = 0,
|
|
|
|
eMiddleButton = 1,
|
|
|
|
eRightButton = 2
|
|
|
|
};
|
|
|
|
// Pressed button ID of mousedown or mouseup event.
|
|
|
|
// This is set only when pressing a button causes the event.
|
|
|
|
int16_t button;
|
|
|
|
|
|
|
|
enum buttonsFlag {
|
2015-05-19 08:03:00 +03:00
|
|
|
eNoButtonFlag = 0x00,
|
2013-09-24 14:04:15 +04:00
|
|
|
eLeftButtonFlag = 0x01,
|
|
|
|
eRightButtonFlag = 0x02,
|
|
|
|
eMiddleButtonFlag = 0x04,
|
|
|
|
// typicall, "back" button being left side of 5-button
|
|
|
|
// mice, see "buttons" attribute document of DOM3 Events.
|
|
|
|
e4thButtonFlag = 0x08,
|
|
|
|
// typicall, "forward" button being right side of 5-button
|
|
|
|
// mice, see "buttons" attribute document of DOM3 Events.
|
|
|
|
e5thButtonFlag = 0x10
|
|
|
|
};
|
|
|
|
|
|
|
|
// Flags of all pressed buttons at the event fired.
|
|
|
|
// This is set at any mouse event, don't be confused with |button|.
|
|
|
|
int16_t buttons;
|
|
|
|
|
|
|
|
// Finger or touch pressure of event. It ranges between 0.0 and 1.0.
|
|
|
|
float pressure;
|
2014-11-24 17:33:06 +03:00
|
|
|
// Touch near a cluster of links (true)
|
|
|
|
bool hitCluster;
|
2013-09-24 14:04:15 +04:00
|
|
|
|
|
|
|
// Possible values at nsIDOMMouseEvent
|
|
|
|
uint16_t inputSource;
|
2014-05-20 08:54:00 +04:00
|
|
|
|
|
|
|
// ID of the canvas HitRegion
|
|
|
|
nsString region;
|
2013-09-24 14:04:15 +04:00
|
|
|
|
2015-10-16 07:19:27 +03:00
|
|
|
bool IsLeftButtonPressed() const { return !!(buttons & eLeftButtonFlag); }
|
|
|
|
bool IsRightButtonPressed() const { return !!(buttons & eRightButtonFlag); }
|
|
|
|
bool IsMiddleButtonPressed() const { return !!(buttons & eMiddleButtonFlag); }
|
|
|
|
bool Is4thButtonPressed() const { return !!(buttons & e4thButtonFlag); }
|
|
|
|
bool Is5thButtonPressed() const { return !!(buttons & e5thButtonFlag); }
|
|
|
|
|
2013-09-24 14:04:15 +04:00
|
|
|
void AssignMouseEventBaseData(const WidgetMouseEventBase& aEvent,
|
|
|
|
bool aCopyTargets)
|
|
|
|
{
|
|
|
|
AssignInputEventData(aEvent, aCopyTargets);
|
|
|
|
|
|
|
|
relatedTarget = aCopyTargets ? aEvent.relatedTarget : nullptr;
|
|
|
|
button = aEvent.button;
|
|
|
|
buttons = aEvent.buttons;
|
|
|
|
pressure = aEvent.pressure;
|
2014-11-24 17:33:06 +03:00
|
|
|
hitCluster = aEvent.hitCluster;
|
2013-09-24 14:04:15 +04:00
|
|
|
inputSource = aEvent.inputSource;
|
|
|
|
}
|
2013-10-28 13:03:19 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true if left click event.
|
|
|
|
*/
|
|
|
|
bool IsLeftClickEvent() const
|
|
|
|
{
|
2015-08-29 02:58:32 +03:00
|
|
|
return mMessage == eMouseClick && button == eLeftButton;
|
2013-10-28 13:03:19 +04:00
|
|
|
}
|
2013-09-24 14:04:15 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* mozilla::WidgetMouseEvent
|
|
|
|
******************************************************************************/
|
|
|
|
|
2016-05-10 15:57:16 +03:00
|
|
|
class WidgetMouseEvent : public WidgetMouseEventBase
|
|
|
|
, public WidgetPointerHelper
|
2013-09-24 14:04:15 +04:00
|
|
|
{
|
|
|
|
private:
|
2016-05-10 15:57:16 +03:00
|
|
|
friend class dom::PBrowserParent;
|
|
|
|
friend class dom::PBrowserChild;
|
2013-09-24 14:04:15 +04:00
|
|
|
|
|
|
|
public:
|
2016-05-12 05:17:46 +03:00
|
|
|
typedef bool ReasonType;
|
|
|
|
enum Reason : ReasonType
|
2013-09-24 14:04:15 +04:00
|
|
|
{
|
|
|
|
eReal,
|
|
|
|
eSynthesized
|
|
|
|
};
|
|
|
|
|
2016-05-12 05:28:14 +03:00
|
|
|
typedef bool ContextMenuTriggerType;
|
|
|
|
enum ContextMenuTrigger : ContextMenuTriggerType
|
2013-09-24 14:04:15 +04:00
|
|
|
{
|
|
|
|
eNormal,
|
|
|
|
eContextMenuKey
|
|
|
|
};
|
|
|
|
|
2016-05-12 05:32:53 +03:00
|
|
|
typedef bool ExitFromType;
|
|
|
|
enum ExitFrom : ExitFromType
|
2013-09-24 14:04:15 +04:00
|
|
|
{
|
|
|
|
eChild,
|
|
|
|
eTopLevel
|
|
|
|
};
|
|
|
|
|
2013-10-18 10:10:20 +04:00
|
|
|
protected:
|
2013-09-24 14:04:15 +04:00
|
|
|
WidgetMouseEvent()
|
2016-05-12 05:36:41 +03:00
|
|
|
: mReason(eReal)
|
2016-05-12 05:39:05 +03:00
|
|
|
, mContextMenuTrigger(eNormal)
|
2016-05-12 05:42:08 +03:00
|
|
|
, mExitFrom(eChild)
|
2016-05-10 15:15:05 +03:00
|
|
|
, mIgnoreRootScrollFrame(false)
|
2016-05-10 17:29:14 +03:00
|
|
|
, mClickCount(0)
|
2013-09-24 14:04:15 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2016-05-10 15:57:16 +03:00
|
|
|
WidgetMouseEvent(bool aIsTrusted,
|
|
|
|
EventMessage aMessage,
|
|
|
|
nsIWidget* aWidget,
|
|
|
|
EventClassID aEventClassID,
|
|
|
|
Reason aReason)
|
2014-08-04 09:28:46 +04:00
|
|
|
: WidgetMouseEventBase(aIsTrusted, aMessage, aWidget, aEventClassID)
|
2016-05-12 05:36:41 +03:00
|
|
|
, mReason(aReason)
|
2016-05-12 05:39:05 +03:00
|
|
|
, mContextMenuTrigger(eNormal)
|
2016-05-12 05:42:08 +03:00
|
|
|
, mExitFrom(eChild)
|
2016-05-10 15:15:05 +03:00
|
|
|
, mIgnoreRootScrollFrame(false)
|
2016-05-10 17:29:14 +03:00
|
|
|
, mClickCount(0)
|
2013-09-24 14:04:15 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual WidgetMouseEvent* AsMouseEvent() override { return this; }
|
2013-09-24 14:04:15 +04:00
|
|
|
|
2016-05-12 05:39:05 +03:00
|
|
|
WidgetMouseEvent(bool aIsTrusted,
|
|
|
|
EventMessage aMessage,
|
|
|
|
nsIWidget* aWidget,
|
|
|
|
Reason aReason,
|
|
|
|
ContextMenuTrigger aContextMenuTrigger = eNormal)
|
2016-05-12 05:17:46 +03:00
|
|
|
: WidgetMouseEventBase(aIsTrusted, aMessage, aWidget, eMouseEventClass)
|
2016-05-12 05:36:41 +03:00
|
|
|
, mReason(aReason)
|
2016-05-12 05:39:05 +03:00
|
|
|
, mContextMenuTrigger(aContextMenuTrigger)
|
2016-05-12 05:42:08 +03:00
|
|
|
, mExitFrom(eChild)
|
2016-05-10 15:15:05 +03:00
|
|
|
, mIgnoreRootScrollFrame(false)
|
2016-05-10 17:29:14 +03:00
|
|
|
, mClickCount(0)
|
2013-09-24 14:04:15 +04:00
|
|
|
{
|
2016-04-13 09:16:42 +03:00
|
|
|
if (aMessage == eContextMenu) {
|
2016-05-12 05:39:05 +03:00
|
|
|
button = (mContextMenuTrigger == eNormal) ? eRightButton : eLeftButton;
|
2013-09-24 14:04:15 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
2013-10-18 10:10:20 +04:00
|
|
|
virtual ~WidgetMouseEvent()
|
|
|
|
{
|
2016-09-01 08:01:16 +03:00
|
|
|
NS_WARNING_ASSERTION(
|
|
|
|
mMessage != eContextMenu ||
|
|
|
|
button == ((mContextMenuTrigger == eNormal) ? eRightButton : eLeftButton),
|
|
|
|
"Wrong button set to eContextMenu event?");
|
2013-09-24 14:04:15 +04:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual WidgetEvent* Duplicate() const override
|
2014-01-27 10:10:44 +04:00
|
|
|
{
|
2014-08-04 09:28:50 +04:00
|
|
|
MOZ_ASSERT(mClass == eMouseEventClass,
|
2014-01-27 10:10:44 +04:00
|
|
|
"Duplicate() must be overridden by sub class");
|
|
|
|
// Not copying widget, it is a weak reference.
|
|
|
|
WidgetMouseEvent* result =
|
2016-05-12 05:39:05 +03:00
|
|
|
new WidgetMouseEvent(false, mMessage, nullptr,
|
|
|
|
mReason, mContextMenuTrigger);
|
2014-01-27 10:10:44 +04:00
|
|
|
result->AssignMouseEventData(*this, true);
|
|
|
|
result->mFlags = mFlags;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2016-05-10 15:57:16 +03:00
|
|
|
// mReason indicates the reason why the event is fired:
|
|
|
|
// - Representing mouse operation.
|
|
|
|
// - Synthesized for emulating mousemove event when the content under the
|
|
|
|
// mouse cursor is scrolled.
|
2016-05-12 05:36:41 +03:00
|
|
|
Reason mReason;
|
2016-05-12 05:17:46 +03:00
|
|
|
|
2016-05-10 15:57:16 +03:00
|
|
|
// mContextMenuTrigger is valid only when mMessage is eContextMenu.
|
|
|
|
// This indicates if the context menu event is caused by context menu key or
|
|
|
|
// other reasons (typically, a click of right mouse button).
|
2016-05-12 05:39:05 +03:00
|
|
|
ContextMenuTrigger mContextMenuTrigger;
|
2016-05-12 05:28:14 +03:00
|
|
|
|
2016-05-10 15:57:16 +03:00
|
|
|
// mExitFrom is valid only when mMessage is eMouseExitFromWidget.
|
|
|
|
// This indicates if the mouse cursor exits from a top level widget or
|
|
|
|
// a child widget.
|
2016-05-12 05:42:08 +03:00
|
|
|
ExitFrom mExitFrom;
|
2016-05-12 05:32:53 +03:00
|
|
|
|
2013-09-24 14:04:15 +04:00
|
|
|
// Whether the event should ignore scroll frame bounds during dispatch.
|
2016-05-10 15:15:05 +03:00
|
|
|
bool mIgnoreRootScrollFrame;
|
2013-09-24 14:04:15 +04:00
|
|
|
|
2016-05-10 15:57:16 +03:00
|
|
|
// mClickCount may be non-zero value when mMessage is eMouseDown, eMouseUp,
|
|
|
|
// eMouseClick or eMouseDoubleClick. The number is count of mouse clicks.
|
|
|
|
// Otherwise, this must be 0.
|
2016-05-10 17:29:14 +03:00
|
|
|
uint32_t mClickCount;
|
2013-09-24 14:04:15 +04:00
|
|
|
|
|
|
|
void AssignMouseEventData(const WidgetMouseEvent& aEvent, bool aCopyTargets)
|
|
|
|
{
|
|
|
|
AssignMouseEventBaseData(aEvent, aCopyTargets);
|
2014-02-27 01:37:01 +04:00
|
|
|
AssignPointerHelperData(aEvent);
|
2013-09-24 14:04:15 +04:00
|
|
|
|
2016-05-10 15:15:05 +03:00
|
|
|
mIgnoreRootScrollFrame = aEvent.mIgnoreRootScrollFrame;
|
2016-05-10 17:29:14 +03:00
|
|
|
mClickCount = aEvent.mClickCount;
|
2013-09-24 14:04:15 +04:00
|
|
|
}
|
2013-10-28 13:03:19 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true if the event is a context menu event caused by key.
|
|
|
|
*/
|
|
|
|
bool IsContextMenuKeyEvent() const
|
|
|
|
{
|
2016-05-12 05:39:05 +03:00
|
|
|
return mMessage == eContextMenu && mContextMenuTrigger == eContextMenuKey;
|
2013-10-28 13:03:19 +04:00
|
|
|
}
|
2014-04-01 08:09:22 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true if the event is a real mouse event. Otherwise, i.e., it's
|
|
|
|
* a synthesized event by scroll or something, returns false.
|
|
|
|
*/
|
|
|
|
bool IsReal() const
|
|
|
|
{
|
2016-05-12 05:36:41 +03:00
|
|
|
return mReason == eReal;
|
2014-04-01 08:09:22 +04:00
|
|
|
}
|
2013-09-24 14:04:15 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* mozilla::WidgetDragEvent
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
class WidgetDragEvent : public WidgetMouseEvent
|
|
|
|
{
|
2015-04-08 21:48:11 +03:00
|
|
|
private:
|
|
|
|
friend class mozilla::dom::PBrowserParent;
|
|
|
|
friend class mozilla::dom::PBrowserChild;
|
|
|
|
protected:
|
|
|
|
WidgetDragEvent()
|
2016-03-31 13:06:05 +03:00
|
|
|
: mUserCancelled(false)
|
2016-01-12 21:16:59 +03:00
|
|
|
, mDefaultPreventedOnContent(false)
|
2015-04-08 21:48:11 +03:00
|
|
|
{
|
|
|
|
}
|
2013-09-24 14:04:15 +04:00
|
|
|
public:
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual WidgetDragEvent* AsDragEvent() override { return this; }
|
2013-10-18 10:10:20 +04:00
|
|
|
|
2015-08-26 15:56:59 +03:00
|
|
|
WidgetDragEvent(bool aIsTrusted, EventMessage aMessage, nsIWidget* aWidget)
|
2014-08-04 09:28:50 +04:00
|
|
|
: WidgetMouseEvent(aIsTrusted, aMessage, aWidget, eDragEventClass, eReal)
|
2016-03-31 13:06:05 +03:00
|
|
|
, mUserCancelled(false)
|
2014-08-04 09:28:50 +04:00
|
|
|
, mDefaultPreventedOnContent(false)
|
2013-09-24 14:04:15 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual WidgetEvent* Duplicate() const override
|
2014-01-27 10:10:44 +04:00
|
|
|
{
|
2014-08-04 09:28:50 +04:00
|
|
|
MOZ_ASSERT(mClass == eDragEventClass,
|
2014-01-27 10:10:44 +04:00
|
|
|
"Duplicate() must be overridden by sub class");
|
|
|
|
// Not copying widget, it is a weak reference.
|
2015-08-22 04:34:51 +03:00
|
|
|
WidgetDragEvent* result = new WidgetDragEvent(false, mMessage, nullptr);
|
2014-01-27 10:10:44 +04:00
|
|
|
result->AssignDragEventData(*this, true);
|
|
|
|
result->mFlags = mFlags;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2013-09-24 14:04:15 +04:00
|
|
|
// The dragging data.
|
2016-03-31 11:26:32 +03:00
|
|
|
nsCOMPtr<dom::DataTransfer> mDataTransfer;
|
2013-09-24 14:04:15 +04:00
|
|
|
|
|
|
|
// If this is true, user has cancelled the drag operation.
|
2016-03-31 13:06:05 +03:00
|
|
|
bool mUserCancelled;
|
2013-12-12 13:39:04 +04:00
|
|
|
// If this is true, the drag event's preventDefault() is called on content.
|
|
|
|
bool mDefaultPreventedOnContent;
|
2013-09-24 14:04:15 +04:00
|
|
|
|
|
|
|
// XXX Not tested by test_assign_event_data.html
|
|
|
|
void AssignDragEventData(const WidgetDragEvent& aEvent, bool aCopyTargets)
|
|
|
|
{
|
|
|
|
AssignMouseEventData(aEvent, aCopyTargets);
|
|
|
|
|
2016-03-31 11:26:32 +03:00
|
|
|
mDataTransfer = aEvent.mDataTransfer;
|
2016-03-31 13:06:05 +03:00
|
|
|
// XXX mUserCancelled isn't copied, is this intentionally?
|
|
|
|
mUserCancelled = false;
|
2013-12-12 13:39:04 +04:00
|
|
|
mDefaultPreventedOnContent = aEvent.mDefaultPreventedOnContent;
|
2013-09-24 14:04:15 +04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* mozilla::WidgetMouseScrollEvent
|
|
|
|
*
|
|
|
|
* This is used for legacy DOM mouse scroll events, i.e.,
|
|
|
|
* DOMMouseScroll and MozMousePixelScroll event. These events are NOT hanbled
|
|
|
|
* by ESM even if widget dispatches them. Use new WidgetWheelEvent instead.
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
class WidgetMouseScrollEvent : public WidgetMouseEventBase
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
WidgetMouseScrollEvent()
|
2016-04-06 10:44:11 +03:00
|
|
|
: mDelta(0)
|
|
|
|
, mIsHorizontal(false)
|
2013-09-24 14:04:15 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual WidgetMouseScrollEvent* AsMouseScrollEvent() override
|
2013-10-18 10:10:20 +04:00
|
|
|
{
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2015-08-26 15:56:59 +03:00
|
|
|
WidgetMouseScrollEvent(bool aIsTrusted, EventMessage aMessage,
|
2014-08-04 09:28:51 +04:00
|
|
|
nsIWidget* aWidget)
|
|
|
|
: WidgetMouseEventBase(aIsTrusted, aMessage, aWidget,
|
|
|
|
eMouseScrollEventClass)
|
2016-04-06 10:44:11 +03:00
|
|
|
, mDelta(0)
|
|
|
|
, mIsHorizontal(false)
|
2013-09-24 14:04:15 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual WidgetEvent* Duplicate() const override
|
2014-01-27 10:10:44 +04:00
|
|
|
{
|
2014-08-04 09:28:51 +04:00
|
|
|
MOZ_ASSERT(mClass == eMouseScrollEventClass,
|
2014-01-27 10:10:44 +04:00
|
|
|
"Duplicate() must be overridden by sub class");
|
|
|
|
// Not copying widget, it is a weak reference.
|
|
|
|
WidgetMouseScrollEvent* result =
|
2015-08-22 04:34:51 +03:00
|
|
|
new WidgetMouseScrollEvent(false, mMessage, nullptr);
|
2014-01-27 10:10:44 +04:00
|
|
|
result->AssignMouseScrollEventData(*this, true);
|
|
|
|
result->mFlags = mFlags;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2013-09-24 14:04:15 +04:00
|
|
|
// The delta value of mouse scroll event.
|
2015-09-10 04:40:04 +03:00
|
|
|
// If the event message is eLegacyMouseLineOrPageScroll, the value indicates
|
|
|
|
// scroll amount in lines. However, if the value is
|
|
|
|
// nsIDOMUIEvent::SCROLL_PAGE_UP or nsIDOMUIEvent::SCROLL_PAGE_DOWN, the
|
|
|
|
// value inducates one page scroll. If the event message is
|
2015-09-10 04:40:04 +03:00
|
|
|
// eLegacyMousePixelScroll, the value indicates scroll amount in pixels.
|
2016-04-06 10:44:11 +03:00
|
|
|
int32_t mDelta;
|
2013-09-24 14:04:15 +04:00
|
|
|
|
|
|
|
// If this is true, it may cause to scroll horizontally.
|
|
|
|
// Otherwise, vertically.
|
2016-04-06 10:44:11 +03:00
|
|
|
bool mIsHorizontal;
|
2013-09-24 14:04:15 +04:00
|
|
|
|
|
|
|
void AssignMouseScrollEventData(const WidgetMouseScrollEvent& aEvent,
|
|
|
|
bool aCopyTargets)
|
|
|
|
{
|
|
|
|
AssignMouseEventBaseData(aEvent, aCopyTargets);
|
|
|
|
|
2016-04-06 10:44:11 +03:00
|
|
|
mDelta = aEvent.mDelta;
|
|
|
|
mIsHorizontal = aEvent.mIsHorizontal;
|
2013-09-24 14:04:15 +04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* mozilla::WidgetWheelEvent
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
class WidgetWheelEvent : public WidgetMouseEventBase
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
friend class mozilla::dom::PBrowserParent;
|
|
|
|
friend class mozilla::dom::PBrowserChild;
|
|
|
|
|
|
|
|
WidgetWheelEvent()
|
2016-03-31 12:55:59 +03:00
|
|
|
: mDeltaX(0.0)
|
2016-03-31 12:09:47 +03:00
|
|
|
, mDeltaY(0.0)
|
2016-03-31 12:18:34 +03:00
|
|
|
, mDeltaZ(0.0)
|
2016-03-31 18:46:18 +03:00
|
|
|
, mOverflowDeltaX(0.0)
|
|
|
|
, mOverflowDeltaY(0.0)
|
2016-03-31 12:35:24 +03:00
|
|
|
, mDeltaMode(nsIDOMWheelEvent::DOM_DELTA_PIXEL)
|
2016-03-31 18:10:46 +03:00
|
|
|
, mLineOrPageDeltaX(0)
|
2016-03-31 18:10:09 +03:00
|
|
|
, mLineOrPageDeltaY(0)
|
2016-03-31 17:54:42 +03:00
|
|
|
, mScrollType(SCROLL_DEFAULT)
|
2016-03-31 18:46:18 +03:00
|
|
|
, mCustomizedByUserPrefs(false)
|
|
|
|
, mIsMomentum(false)
|
|
|
|
, mIsNoLineOrPageDelta(false)
|
2016-01-12 21:16:59 +03:00
|
|
|
, mViewPortIsOverscrolled(false)
|
|
|
|
, mCanTriggerSwipe(false)
|
2016-01-27 09:09:13 +03:00
|
|
|
, mAllowToOverrideSystemScrollSpeed(false)
|
2013-09-24 14:04:15 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual WidgetWheelEvent* AsWheelEvent() override { return this; }
|
2013-10-18 10:10:20 +04:00
|
|
|
|
2015-08-26 15:56:59 +03:00
|
|
|
WidgetWheelEvent(bool aIsTrusted, EventMessage aMessage, nsIWidget* aWidget)
|
2014-08-04 09:28:51 +04:00
|
|
|
: WidgetMouseEventBase(aIsTrusted, aMessage, aWidget, eWheelEventClass)
|
2016-03-31 12:55:59 +03:00
|
|
|
, mDeltaX(0.0)
|
2016-03-31 12:09:47 +03:00
|
|
|
, mDeltaY(0.0)
|
2016-03-31 12:18:34 +03:00
|
|
|
, mDeltaZ(0.0)
|
2016-03-31 18:46:18 +03:00
|
|
|
, mOverflowDeltaX(0.0)
|
|
|
|
, mOverflowDeltaY(0.0)
|
2016-03-31 12:35:24 +03:00
|
|
|
, mDeltaMode(nsIDOMWheelEvent::DOM_DELTA_PIXEL)
|
2016-03-31 18:46:18 +03:00
|
|
|
, mLineOrPageDeltaX(0)
|
|
|
|
, mLineOrPageDeltaY(0)
|
|
|
|
, mScrollType(SCROLL_DEFAULT)
|
2016-03-31 12:44:01 +03:00
|
|
|
, mCustomizedByUserPrefs(false)
|
2016-03-31 17:36:49 +03:00
|
|
|
, mMayHaveMomentum(false)
|
2016-03-31 17:45:55 +03:00
|
|
|
, mIsMomentum(false)
|
2014-08-04 09:28:51 +04:00
|
|
|
, mIsNoLineOrPageDelta(false)
|
|
|
|
, mViewPortIsOverscrolled(false)
|
2015-08-28 06:50:31 +03:00
|
|
|
, mCanTriggerSwipe(false)
|
2016-01-27 09:09:13 +03:00
|
|
|
, mAllowToOverrideSystemScrollSpeed(true)
|
2013-09-24 14:04:15 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual WidgetEvent* Duplicate() const override
|
2014-01-27 10:10:44 +04:00
|
|
|
{
|
2014-08-04 09:28:51 +04:00
|
|
|
MOZ_ASSERT(mClass == eWheelEventClass,
|
2014-01-27 10:10:44 +04:00
|
|
|
"Duplicate() must be overridden by sub class");
|
|
|
|
// Not copying widget, it is a weak reference.
|
2015-08-22 04:34:51 +03:00
|
|
|
WidgetWheelEvent* result = new WidgetWheelEvent(false, mMessage, nullptr);
|
2014-01-27 10:10:44 +04:00
|
|
|
result->AssignWheelEventData(*this, true);
|
|
|
|
result->mFlags = mFlags;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2015-08-28 06:50:31 +03:00
|
|
|
// On OS X, scroll gestures that start at the edge of the scrollable range
|
|
|
|
// can result in a swipe gesture. For the first wheel event of such a
|
|
|
|
// gesture, call TriggersSwipe() after the event has been processed
|
|
|
|
// in order to find out whether a swipe should be started.
|
|
|
|
bool TriggersSwipe() const
|
|
|
|
{
|
|
|
|
return mCanTriggerSwipe && mViewPortIsOverscrolled &&
|
2016-03-31 18:27:45 +03:00
|
|
|
this->mOverflowDeltaX != 0.0;
|
2015-08-28 06:50:31 +03:00
|
|
|
}
|
|
|
|
|
2016-03-31 12:18:34 +03:00
|
|
|
// NOTE: mDeltaX, mDeltaY and mDeltaZ may be customized by
|
2013-09-24 14:04:15 +04:00
|
|
|
// mousewheel.*.delta_multiplier_* prefs which are applied by
|
2014-04-01 08:09:23 +04:00
|
|
|
// EventStateManager. So, after widget dispatches this event,
|
2013-09-24 14:04:15 +04:00
|
|
|
// these delta values may have different values than before.
|
2016-03-31 12:55:59 +03:00
|
|
|
double mDeltaX;
|
2016-03-31 12:09:47 +03:00
|
|
|
double mDeltaY;
|
2016-03-31 12:18:34 +03:00
|
|
|
double mDeltaZ;
|
2013-09-24 14:04:15 +04:00
|
|
|
|
2016-03-31 18:46:18 +03:00
|
|
|
// overflowed delta values for scroll, these values are set by
|
|
|
|
// nsEventStateManger. If the default action of the wheel event isn't scroll,
|
|
|
|
// these values always zero. Otherwise, remaning delta values which are
|
|
|
|
// not used by scroll are set.
|
|
|
|
// NOTE: mDeltaX, mDeltaY and mDeltaZ may be modified by EventStateManager.
|
|
|
|
// However, mOverflowDeltaX and mOverflowDeltaY indicate unused original
|
|
|
|
// delta values which are not applied the delta_multiplier prefs.
|
|
|
|
// So, if widget wanted to know the actual direction to be scrolled,
|
|
|
|
// it would need to check the mDeltaX and mDeltaY.
|
|
|
|
double mOverflowDeltaX;
|
|
|
|
double mOverflowDeltaY;
|
|
|
|
|
2013-09-24 14:04:15 +04:00
|
|
|
// Should be one of nsIDOMWheelEvent::DOM_DELTA_*
|
2016-03-31 12:35:24 +03:00
|
|
|
uint32_t mDeltaMode;
|
2013-09-24 14:04:15 +04:00
|
|
|
|
2016-03-31 18:10:46 +03:00
|
|
|
// If widget sets mLineOrPageDelta, EventStateManager will dispatch
|
2015-09-10 04:40:04 +03:00
|
|
|
// eLegacyMouseLineOrPageScroll event for compatibility. Note that the delta
|
2016-03-31 12:35:24 +03:00
|
|
|
// value means pages if the mDeltaMode is DOM_DELTA_PAGE, otherwise, lines.
|
2016-03-31 18:10:46 +03:00
|
|
|
int32_t mLineOrPageDeltaX;
|
2016-03-31 18:10:09 +03:00
|
|
|
int32_t mLineOrPageDeltaY;
|
2013-09-24 14:04:15 +04:00
|
|
|
|
|
|
|
// When the default action for an wheel event is moving history or zooming,
|
|
|
|
// need to chose a delta value for doing it.
|
|
|
|
int32_t GetPreferredIntDelta()
|
|
|
|
{
|
2016-03-31 18:10:09 +03:00
|
|
|
if (!mLineOrPageDeltaX && !mLineOrPageDeltaY) {
|
2013-09-24 14:04:15 +04:00
|
|
|
return 0;
|
|
|
|
}
|
2016-03-31 18:10:09 +03:00
|
|
|
if (mLineOrPageDeltaY && !mLineOrPageDeltaX) {
|
|
|
|
return mLineOrPageDeltaY;
|
2013-09-24 14:04:15 +04:00
|
|
|
}
|
2016-03-31 18:10:09 +03:00
|
|
|
if (mLineOrPageDeltaX && !mLineOrPageDeltaY) {
|
2016-03-31 18:10:46 +03:00
|
|
|
return mLineOrPageDeltaX;
|
2013-09-24 14:04:15 +04:00
|
|
|
}
|
2016-03-31 18:10:09 +03:00
|
|
|
if ((mLineOrPageDeltaX < 0 && mLineOrPageDeltaY > 0) ||
|
|
|
|
(mLineOrPageDeltaX > 0 && mLineOrPageDeltaY < 0)) {
|
2013-09-24 14:04:15 +04:00
|
|
|
return 0; // We cannot guess the answer in this case.
|
|
|
|
}
|
2016-03-31 18:10:09 +03:00
|
|
|
return (Abs(mLineOrPageDeltaX) > Abs(mLineOrPageDeltaY)) ?
|
|
|
|
mLineOrPageDeltaX : mLineOrPageDeltaY;
|
2013-09-24 14:04:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// Scroll type
|
2014-04-01 08:09:23 +04:00
|
|
|
// The default value is SCROLL_DEFAULT, which means EventStateManager will
|
2013-09-24 14:04:15 +04:00
|
|
|
// select preferred scroll type automatically.
|
2016-03-31 18:46:18 +03:00
|
|
|
enum ScrollType : uint8_t
|
2013-09-24 14:04:15 +04:00
|
|
|
{
|
|
|
|
SCROLL_DEFAULT,
|
|
|
|
SCROLL_SYNCHRONOUSLY,
|
|
|
|
SCROLL_ASYNCHRONOUSELY,
|
|
|
|
SCROLL_SMOOTHLY
|
|
|
|
};
|
2016-03-31 17:54:42 +03:00
|
|
|
ScrollType mScrollType;
|
2013-09-24 14:04:15 +04:00
|
|
|
|
2016-03-31 18:46:18 +03:00
|
|
|
// If the delta values are computed from prefs, this value is true.
|
|
|
|
// Otherwise, i.e., they are computed from native events, false.
|
|
|
|
bool mCustomizedByUserPrefs;
|
|
|
|
|
|
|
|
// true if the momentum events directly tied to this event may follow it.
|
|
|
|
bool mMayHaveMomentum;
|
|
|
|
// true if the event is caused by momentum.
|
|
|
|
bool mIsMomentum;
|
|
|
|
|
|
|
|
// If device event handlers don't know when they should set mLineOrPageDeltaX
|
|
|
|
// and mLineOrPageDeltaY, this is true. Otherwise, false.
|
|
|
|
// If mIsNoLineOrPageDelta is true, ESM will generate
|
|
|
|
// eLegacyMouseLineOrPageScroll events when accumulated delta values reach
|
|
|
|
// a line height.
|
|
|
|
bool mIsNoLineOrPageDelta;
|
2013-09-24 14:04:15 +04:00
|
|
|
|
2013-10-11 23:48:53 +04:00
|
|
|
// Whether or not the parent of the currently overscrolled frame is the
|
|
|
|
// ViewPort. This is false in situations when an element on the page is being
|
|
|
|
// overscrolled (such as a text field), but true when the 'page' is being
|
|
|
|
// overscrolled.
|
|
|
|
bool mViewPortIsOverscrolled;
|
|
|
|
|
2015-08-28 06:50:31 +03:00
|
|
|
// The wheel event can trigger a swipe to start if it's overscrolling the
|
|
|
|
// viewport.
|
|
|
|
bool mCanTriggerSwipe;
|
|
|
|
|
2016-01-27 09:09:13 +03:00
|
|
|
// If mAllowToOverrideSystemScrollSpeed is true, the scroll speed may be
|
|
|
|
// overridden. Otherwise, the scroll speed won't be overridden even if
|
|
|
|
// it's enabled by the pref.
|
|
|
|
bool mAllowToOverrideSystemScrollSpeed;
|
|
|
|
|
2013-09-24 14:04:15 +04:00
|
|
|
void AssignWheelEventData(const WidgetWheelEvent& aEvent, bool aCopyTargets)
|
|
|
|
{
|
|
|
|
AssignMouseEventBaseData(aEvent, aCopyTargets);
|
|
|
|
|
2016-03-31 12:55:59 +03:00
|
|
|
mDeltaX = aEvent.mDeltaX;
|
2016-03-31 12:09:47 +03:00
|
|
|
mDeltaY = aEvent.mDeltaY;
|
2016-03-31 12:18:34 +03:00
|
|
|
mDeltaZ = aEvent.mDeltaZ;
|
2016-03-31 12:35:24 +03:00
|
|
|
mDeltaMode = aEvent.mDeltaMode;
|
2016-03-31 12:44:01 +03:00
|
|
|
mCustomizedByUserPrefs = aEvent.mCustomizedByUserPrefs;
|
2016-03-31 17:36:49 +03:00
|
|
|
mMayHaveMomentum = aEvent.mMayHaveMomentum;
|
2016-03-31 17:45:55 +03:00
|
|
|
mIsMomentum = aEvent.mIsMomentum;
|
2014-07-07 13:54:14 +04:00
|
|
|
mIsNoLineOrPageDelta = aEvent.mIsNoLineOrPageDelta;
|
2016-03-31 18:10:46 +03:00
|
|
|
mLineOrPageDeltaX = aEvent.mLineOrPageDeltaX;
|
2016-03-31 18:10:09 +03:00
|
|
|
mLineOrPageDeltaY = aEvent.mLineOrPageDeltaY;
|
2016-03-31 17:54:42 +03:00
|
|
|
mScrollType = aEvent.mScrollType;
|
2016-03-31 18:27:45 +03:00
|
|
|
mOverflowDeltaX = aEvent.mOverflowDeltaX;
|
2016-03-31 18:36:55 +03:00
|
|
|
mOverflowDeltaY = aEvent.mOverflowDeltaY;
|
2013-10-11 23:48:53 +04:00
|
|
|
mViewPortIsOverscrolled = aEvent.mViewPortIsOverscrolled;
|
2015-08-28 06:50:31 +03:00
|
|
|
mCanTriggerSwipe = aEvent.mCanTriggerSwipe;
|
2016-01-27 09:09:13 +03:00
|
|
|
mAllowToOverrideSystemScrollSpeed =
|
|
|
|
aEvent.mAllowToOverrideSystemScrollSpeed;
|
2013-09-24 14:04:15 +04:00
|
|
|
}
|
2016-01-27 09:09:13 +03:00
|
|
|
|
|
|
|
// System scroll speed settings may be too slow at using Gecko. In such
|
|
|
|
// case, we should override the scroll speed computed with system settings.
|
|
|
|
// Following methods return preferred delta values which are multiplied by
|
|
|
|
// factors specified by prefs. If system scroll speed shouldn't be
|
|
|
|
// overridden (e.g., this feature is disabled by pref), they return raw
|
|
|
|
// delta values.
|
|
|
|
double OverriddenDeltaX() const;
|
|
|
|
double OverriddenDeltaY() const;
|
|
|
|
|
2016-01-27 09:09:13 +03:00
|
|
|
// Compute the overridden delta value. This may be useful for suppressing
|
|
|
|
// too fast scroll by system scroll speed overriding when widget sets
|
|
|
|
// mAllowToOverrideSystemScrollSpeed.
|
|
|
|
static double ComputeOverriddenDelta(double aDelta, bool aIsForVertical);
|
|
|
|
|
2016-01-27 09:09:13 +03:00
|
|
|
private:
|
|
|
|
static bool sInitialized;
|
|
|
|
static bool sIsSystemScrollSpeedOverrideEnabled;
|
|
|
|
static int32_t sOverrideFactorX;
|
|
|
|
static int32_t sOverrideFactorY;
|
|
|
|
static void Initialize();
|
2013-09-24 14:04:15 +04:00
|
|
|
};
|
|
|
|
|
2013-11-21 09:44:22 +04:00
|
|
|
/******************************************************************************
|
|
|
|
* mozilla::WidgetPointerEvent
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
class WidgetPointerEvent : public WidgetMouseEvent
|
|
|
|
{
|
|
|
|
friend class mozilla::dom::PBrowserParent;
|
|
|
|
friend class mozilla::dom::PBrowserChild;
|
|
|
|
|
|
|
|
WidgetPointerEvent()
|
2016-09-21 11:26:21 +03:00
|
|
|
: mWidth(1)
|
|
|
|
, mHeight(1)
|
2016-08-03 11:34:53 +03:00
|
|
|
, mIsPrimary(true)
|
2013-11-21 09:44:22 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual WidgetPointerEvent* AsPointerEvent() override { return this; }
|
2013-11-21 09:44:22 +04:00
|
|
|
|
2015-08-26 15:56:59 +03:00
|
|
|
WidgetPointerEvent(bool aIsTrusted, EventMessage aMsg, nsIWidget* w)
|
2014-08-04 09:28:52 +04:00
|
|
|
: WidgetMouseEvent(aIsTrusted, aMsg, w, ePointerEventClass, eReal)
|
2016-09-21 11:26:21 +03:00
|
|
|
, mWidth(1)
|
|
|
|
, mHeight(1)
|
2016-08-03 11:34:53 +03:00
|
|
|
, mIsPrimary(true)
|
2013-11-21 09:44:22 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-08-08 03:46:08 +04:00
|
|
|
explicit WidgetPointerEvent(const WidgetMouseEvent& aEvent)
|
2013-11-21 09:44:22 +04:00
|
|
|
: WidgetMouseEvent(aEvent)
|
2016-08-10 08:04:33 +03:00
|
|
|
, mWidth(1)
|
|
|
|
, mHeight(1)
|
2016-08-03 11:34:53 +03:00
|
|
|
, mIsPrimary(true)
|
2013-11-21 09:44:22 +04:00
|
|
|
{
|
2014-08-04 09:28:52 +04:00
|
|
|
mClass = ePointerEventClass;
|
2013-11-21 09:44:22 +04:00
|
|
|
}
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual WidgetEvent* Duplicate() const override
|
2014-01-27 10:10:44 +04:00
|
|
|
{
|
2014-08-04 09:28:52 +04:00
|
|
|
MOZ_ASSERT(mClass == ePointerEventClass,
|
2014-01-27 10:10:44 +04:00
|
|
|
"Duplicate() must be overridden by sub class");
|
|
|
|
// Not copying widget, it is a weak reference.
|
|
|
|
WidgetPointerEvent* result =
|
2015-08-22 04:34:51 +03:00
|
|
|
new WidgetPointerEvent(false, mMessage, nullptr);
|
2014-01-27 10:10:44 +04:00
|
|
|
result->AssignPointerEventData(*this, true);
|
|
|
|
result->mFlags = mFlags;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2016-08-03 11:18:04 +03:00
|
|
|
uint32_t mWidth;
|
2016-08-03 11:23:56 +03:00
|
|
|
uint32_t mHeight;
|
2016-08-03 11:34:53 +03:00
|
|
|
bool mIsPrimary;
|
2014-01-27 10:10:44 +04:00
|
|
|
|
|
|
|
// XXX Not tested by test_assign_event_data.html
|
|
|
|
void AssignPointerEventData(const WidgetPointerEvent& aEvent,
|
|
|
|
bool aCopyTargets)
|
|
|
|
{
|
|
|
|
AssignMouseEventData(aEvent, aCopyTargets);
|
|
|
|
|
2016-08-03 11:18:04 +03:00
|
|
|
mWidth = aEvent.mWidth;
|
2016-08-03 11:23:56 +03:00
|
|
|
mHeight = aEvent.mHeight;
|
2016-08-03 11:34:53 +03:00
|
|
|
mIsPrimary = aEvent.mIsPrimary;
|
2014-01-27 10:10:44 +04:00
|
|
|
}
|
2013-11-21 09:44:22 +04:00
|
|
|
};
|
|
|
|
|
2013-09-24 14:04:15 +04:00
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // mozilla_MouseEvents_h__
|