Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dist/include/mozilla/dom/Touch.h
Line
Count
Source (jump to first uncovered line)
1
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
3
/* This Source Code Form is subject to the terms of the Mozilla Public
4
 * License, v. 2.0. If a copy of the MPL was not distributed with this
5
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7
#ifndef mozilla_dom_Touch_h_
8
#define mozilla_dom_Touch_h_
9
10
#include "mozilla/Attributes.h"
11
#include "mozilla/EventForwards.h"
12
#include "mozilla/MouseEvents.h"
13
#include "mozilla/dom/BindingDeclarations.h"
14
#include "mozilla/dom/TouchBinding.h"
15
#include "nsWrapperCache.h"
16
#include "Units.h"
17
18
class nsPresContext;
19
20
namespace mozilla {
21
namespace dom {
22
23
class EventTarget;
24
25
class Touch final : public nsISupports
26
                  , public nsWrapperCache
27
                  , public WidgetPointerHelper
28
{
29
public:
30
  static bool PrefEnabled(JSContext* aCx, JSObject* aGlobal);
31
32
  static already_AddRefed<Touch> Constructor(const GlobalObject& aGlobal,
33
                                             const TouchInit& aParam,
34
                                             ErrorResult& aRv);
35
36
  Touch(EventTarget* aTarget,
37
        int32_t aIdentifier,
38
        int32_t aPageX,
39
        int32_t aPageY,
40
        int32_t aScreenX,
41
        int32_t aScreenY,
42
        int32_t aClientX,
43
        int32_t aClientY,
44
        int32_t aRadiusX,
45
        int32_t aRadiusY,
46
        float aRotationAngle,
47
        float aForce);
48
  Touch(int32_t aIdentifier,
49
        LayoutDeviceIntPoint aPoint,
50
        LayoutDeviceIntPoint aRadius,
51
        float aRotationAngle,
52
        float aForce);
53
  Touch(const Touch& aOther);
54
55
  NS_DECL_CYCLE_COLLECTING_ISUPPORTS
56
  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(Touch)
57
58
  void InitializePoints(nsPresContext* aPresContext, WidgetEvent* aEvent);
59
60
  // Note, this sets both mOriginalTarget and mTarget.
61
  void SetTouchTarget(EventTarget* aTarget);
62
63
  bool Equals(Touch* aTouch);
64
65
  virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
66
67
  nsIGlobalObject* GetParentObject();
68
69
  // WebIDL
70
0
  int32_t Identifier() const { return mIdentifier; }
71
  EventTarget* GetTarget() const;
72
  int32_t ScreenX(CallerType aCallerType) const;
73
  int32_t ScreenY(CallerType aCallerType) const;
74
0
  int32_t ClientX() const { return mClientPoint.x; }
75
0
  int32_t ClientY() const { return mClientPoint.y; }
76
0
  int32_t PageX() const { return mPagePoint.x; }
77
0
  int32_t PageY() const { return mPagePoint.y; }
78
  int32_t RadiusX(CallerType aCallerType) const;
79
  int32_t RadiusY(CallerType aCallerType) const;
80
  float RotationAngle(CallerType aCallerType) const;
81
  float Force(CallerType aCallerType) const;
82
83
  nsCOMPtr<EventTarget> mOriginalTarget;
84
  nsCOMPtr<EventTarget> mTarget;
85
  LayoutDeviceIntPoint mRefPoint;
86
  bool mChanged;
87
88
  // Is this touch instance being suppressed to dispatch touch event to content.
89
  // We can't remove touch instance from WidgetTouchEvent::mTouches because we
90
  // still need it when dispatching pointer events.
91
  bool mIsTouchEventSuppressed;
92
93
  uint32_t mMessage;
94
  int32_t mIdentifier;
95
  CSSIntPoint mPagePoint;
96
  CSSIntPoint mClientPoint;
97
  CSSIntPoint mScreenPoint;
98
  LayoutDeviceIntPoint mRadius;
99
  float mRotationAngle;
100
  float mForce;
101
protected:
102
  ~Touch();
103
104
  bool mPointsInitialized;
105
};
106
107
} // namespace dom
108
} // namespace mozilla
109
110
#endif // mozilla_dom_Touch_h_