1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
/* -*- Mode: C++; tab-width: 8; 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_dom_Touch_h_
#define mozilla_dom_Touch_h_
#include "mozilla/Attributes.h"
#include "mozilla/EventForwards.h"
#include "mozilla/MouseEvents.h"
#include "mozilla/dom/TouchBinding.h"
#include "nsWrapperCache.h"
#include "Units.h"
class nsPresContext;
namespace mozilla {
namespace dom {
class EventTarget;
class Touch final : public nsISupports
, public nsWrapperCache
, public WidgetPointerHelper
{
public:
static bool PrefEnabled(JSContext* aCx, JSObject* aGlobal);
static already_AddRefed<Touch> Constructor(const GlobalObject& aGlobal,
const TouchInit& aParam,
ErrorResult& aRv);
Touch(EventTarget* aTarget,
int32_t aIdentifier,
int32_t aPageX,
int32_t aPageY,
int32_t aScreenX,
int32_t aScreenY,
int32_t aClientX,
int32_t aClientY,
int32_t aRadiusX,
int32_t aRadiusY,
float aRotationAngle,
float aForce);
Touch(int32_t aIdentifier,
LayoutDeviceIntPoint aPoint,
LayoutDeviceIntPoint aRadius,
float aRotationAngle,
float aForce);
Touch(const Touch& aOther);
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(Touch)
void InitializePoints(nsPresContext* aPresContext, WidgetEvent* aEvent);
void SetTarget(EventTarget* aTarget);
bool Equals(Touch* aTouch);
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
nsIGlobalObject* GetParentObject();
// WebIDL
int32_t Identifier() const { return mIdentifier; }
EventTarget* GetTarget() const;
int32_t ScreenX() const { return mScreenPoint.x; }
int32_t ScreenY() const { return mScreenPoint.y; }
int32_t ClientX() const { return mClientPoint.x; }
int32_t ClientY() const { return mClientPoint.y; }
int32_t PageX() const { return mPagePoint.x; }
int32_t PageY() const { return mPagePoint.y; }
int32_t RadiusX() const { return mRadius.x; }
int32_t RadiusY() const { return mRadius.y; }
float RotationAngle() const { return mRotationAngle; }
float Force() const { return mForce; }
nsCOMPtr<EventTarget> mTarget;
LayoutDeviceIntPoint mRefPoint;
bool mChanged;
uint32_t mMessage;
int32_t mIdentifier;
CSSIntPoint mPagePoint;
CSSIntPoint mClientPoint;
CSSIntPoint mScreenPoint;
LayoutDeviceIntPoint mRadius;
float mRotationAngle;
float mForce;
protected:
~Touch();
bool mPointsInitialized;
};
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_Touch_h_
|