Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/dom/events/PointerEvent.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
 * Portions Copyright 2013 Microsoft Open Technologies, Inc. */
8
9
#ifndef mozilla_dom_PointerEvent_h_
10
#define mozilla_dom_PointerEvent_h_
11
12
#include "mozilla/dom/MouseEvent.h"
13
#include "mozilla/dom/PointerEventBinding.h"
14
15
class nsPresContext;
16
17
namespace mozilla {
18
namespace dom {
19
20
struct PointerEventInit;
21
22
class PointerEvent : public MouseEvent
23
{
24
public:
25
  PointerEvent(EventTarget* aOwner,
26
               nsPresContext* aPresContext,
27
               WidgetPointerEvent* aEvent);
28
29
  NS_DECL_ISUPPORTS_INHERITED
30
  NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(PointerEvent, MouseEvent)
31
32
  virtual JSObject* WrapObjectInternal(
33
                      JSContext* aCx,
34
                      JS::Handle<JSObject*> aGivenProto) override;
35
36
  static already_AddRefed<PointerEvent>
37
  Constructor(const GlobalObject& aGlobal,
38
              const nsAString& aType,
39
              const PointerEventInit& aParam,
40
              ErrorResult& aRv);
41
42
  static already_AddRefed<PointerEvent>
43
  Constructor(EventTarget* aOwner,
44
              const nsAString& aType,
45
              const PointerEventInit& aParam);
46
47
  int32_t PointerId();
48
  int32_t Width();
49
  int32_t Height();
50
  float Pressure();
51
  float TangentialPressure();
52
  int32_t TiltX();
53
  int32_t TiltY();
54
  int32_t Twist();
55
  bool IsPrimary();
56
  void GetPointerType(nsAString& aPointerType);
57
  void GetCoalescedEvents(nsTArray<RefPtr<PointerEvent>>& aPointerEvents);
58
59
protected:
60
0
  ~PointerEvent() {}
61
62
private:
63
  nsTArray<RefPtr<PointerEvent>> mCoalescedEvents;
64
};
65
66
void ConvertPointerTypeToString(uint16_t aPointerTypeSrc, nsAString& aPointerTypeDest);
67
68
} // namespace dom
69
} // namespace mozilla
70
71
already_AddRefed<mozilla::dom::PointerEvent>
72
NS_NewDOMPointerEvent(mozilla::dom::EventTarget* aOwner,
73
                      nsPresContext* aPresContext,
74
                      mozilla::WidgetPointerEvent* aEvent);
75
76
#endif // mozilla_dom_PointerEvent_h_