Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dist/include/mozilla/dom/MouseEvent.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_MouseEvent_h_
8
#define mozilla_dom_MouseEvent_h_
9
10
#include "mozilla/dom/BindingDeclarations.h"
11
#include "mozilla/dom/UIEvent.h"
12
#include "mozilla/dom/MouseEventBinding.h"
13
#include "mozilla/EventForwards.h"
14
15
namespace mozilla {
16
namespace dom {
17
18
class MouseEvent : public UIEvent
19
{
20
public:
21
  MouseEvent(EventTarget* aOwner,
22
             nsPresContext* aPresContext,
23
             WidgetMouseEventBase* aEvent);
24
25
  NS_INLINE_DECL_REFCOUNTING_INHERITED(MouseEvent, UIEvent)
26
27
  virtual JSObject* WrapObjectInternal(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override
28
0
  {
29
0
    return MouseEvent_Binding::Wrap(aCx, this, aGivenProto);
30
0
  }
31
32
  virtual MouseEvent* AsMouseEvent() override
33
0
  {
34
0
    return this;
35
0
  }
36
37
  // Web IDL binding methods
38
  virtual uint32_t Which(CallerType aCallerType) override
39
0
  {
40
0
    return Button() + 1;
41
0
  }
42
43
  int32_t ScreenX(CallerType aCallerType);
44
  int32_t ScreenY(CallerType aCallerType);
45
  int32_t ClientX();
46
  int32_t ClientY();
47
  int32_t OffsetX();
48
  int32_t OffsetY();
49
  bool CtrlKey();
50
  bool ShiftKey();
51
  bool AltKey();
52
  bool MetaKey();
53
  int16_t Button();
54
  uint16_t Buttons();
55
  already_AddRefed<EventTarget> GetRelatedTarget();
56
  void GetRegion(nsAString& aRegion);
57
  void InitMouseEvent(const nsAString& aType, bool aCanBubble, bool aCancelable,
58
                      nsGlobalWindowInner* aView, int32_t aDetail, int32_t aScreenX,
59
                      int32_t aScreenY, int32_t aClientX, int32_t aClientY,
60
                      bool aCtrlKey, bool aAltKey, bool aShiftKey,
61
                      bool aMetaKey, uint16_t aButton,
62
                      EventTarget* aRelatedTarget);
63
64
  void InitializeExtraMouseEventDictionaryMembers(const MouseEventInit& aParam);
65
66
  bool GetModifierState(const nsAString& aKeyArg)
67
0
  {
68
0
    return GetModifierStateInternal(aKeyArg);
69
0
  }
70
  static already_AddRefed<MouseEvent> Constructor(const GlobalObject& aGlobal,
71
                                                  const nsAString& aType,
72
                                                  const MouseEventInit& aParam,
73
                                                  ErrorResult& aRv);
74
  int32_t MovementX()
75
0
  {
76
0
    return GetMovementPoint().x;
77
0
  }
78
  int32_t MovementY()
79
0
  {
80
0
    return GetMovementPoint().y;
81
0
  }
82
  float MozPressure() const;
83
  bool HitCluster() const;
84
  uint16_t MozInputSource() const;
85
  void InitNSMouseEvent(const nsAString& aType,
86
                        bool aCanBubble, bool aCancelable,
87
                        nsGlobalWindowInner* aView, int32_t aDetail,
88
                        int32_t aScreenX, int32_t aScreenY,
89
                        int32_t aClientX, int32_t aClientY,
90
                        bool aCtrlKey, bool aAltKey, bool aShiftKey,
91
                        bool aMetaKey, uint16_t aButton,
92
                        EventTarget* aRelatedTarget,
93
                        float aPressure, uint16_t aInputSource);
94
95
protected:
96
0
  ~MouseEvent() {}
97
98
  void InitMouseEvent(const nsAString& aType,
99
                      bool aCanBubble,
100
                      bool aCancelable,
101
                      nsGlobalWindowInner* aView,
102
                      int32_t aDetail,
103
                      int32_t aScreenX,
104
                      int32_t aScreenY,
105
                      int32_t aClientX,
106
                      int32_t aClientY,
107
                      int16_t aButton,
108
                      EventTarget* aRelatedTarget,
109
                      const nsAString& aModifiersList);
110
};
111
112
} // namespace dom
113
} // namespace mozilla
114
115
already_AddRefed<mozilla::dom::MouseEvent>
116
NS_NewDOMMouseEvent(mozilla::dom::EventTarget* aOwner,
117
                    nsPresContext* aPresContext,
118
                    mozilla::WidgetMouseEvent* aEvent);
119
120
#endif // mozilla_dom_MouseEvent_h_