OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2001 Peter Kelly (pmk@post.com) | 2 * Copyright (C) 2001 Peter Kelly (pmk@post.com) |
3 * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de) | 3 * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de) |
4 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) | 4 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) |
5 * Copyright (C) 2003, 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. | 5 * Copyright (C) 2003, 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 27 matching lines...) Expand all Loading... |
38 | 38 |
39 int screenX; | 39 int screenX; |
40 int screenY; | 40 int screenY; |
41 int clientX; | 41 int clientX; |
42 int clientY; | 42 int clientY; |
43 bool ctrlKey; | 43 bool ctrlKey; |
44 bool altKey; | 44 bool altKey; |
45 bool shiftKey; | 45 bool shiftKey; |
46 bool metaKey; | 46 bool metaKey; |
47 unsigned short button; | 47 unsigned short button; |
| 48 unsigned short buttons; |
48 RefPtrWillBeMember<EventTarget> relatedTarget; | 49 RefPtrWillBeMember<EventTarget> relatedTarget; |
49 }; | 50 }; |
50 | 51 |
51 class MouseEvent : public MouseRelatedEvent { | 52 class MouseEvent : public MouseRelatedEvent { |
52 DEFINE_WRAPPERTYPEINFO(); | 53 DEFINE_WRAPPERTYPEINFO(); |
53 public: | 54 public: |
54 static PassRefPtrWillBeRawPtr<MouseEvent> create() | 55 static PassRefPtrWillBeRawPtr<MouseEvent> create() |
55 { | 56 { |
56 return adoptRefWillBeNoop(new MouseEvent); | 57 return adoptRefWillBeNoop(new MouseEvent); |
57 } | 58 } |
58 | 59 |
59 static PassRefPtrWillBeRawPtr<MouseEvent> create(const AtomicString& type, b
ool canBubble, bool cancelable, PassRefPtrWillBeRawPtr<AbstractView>, | 60 static PassRefPtrWillBeRawPtr<MouseEvent> create(const AtomicString& type, b
ool canBubble, bool cancelable, PassRefPtrWillBeRawPtr<AbstractView>, |
60 int detail, int screenX, int screenY, int pageX, int pageY, | 61 int detail, int screenX, int screenY, int pageX, int pageY, |
61 int movementX, int movementY, | 62 int movementX, int movementY, |
62 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short b
utton, | 63 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short b
utton, unsigned short buttons, |
63 PassRefPtrWillBeRawPtr<EventTarget> relatedTarget, PassRefPtrWillBeRawPt
r<DataTransfer>, | 64 PassRefPtrWillBeRawPtr<EventTarget> relatedTarget, PassRefPtrWillBeRawPt
r<DataTransfer>, |
64 bool isSimulated = false, PlatformMouseEvent::SyntheticEventType = Platf
ormMouseEvent::RealOrIndistinguishable); | 65 bool isSimulated = false, PlatformMouseEvent::SyntheticEventType = Platf
ormMouseEvent::RealOrIndistinguishable); |
65 | 66 |
66 static PassRefPtrWillBeRawPtr<MouseEvent> create(const AtomicString& eventTy
pe, PassRefPtrWillBeRawPtr<AbstractView>, const PlatformMouseEvent&, int detail,
PassRefPtrWillBeRawPtr<Node> relatedTarget); | 67 static PassRefPtrWillBeRawPtr<MouseEvent> create(const AtomicString& eventTy
pe, PassRefPtrWillBeRawPtr<AbstractView>, const PlatformMouseEvent&, int detail,
PassRefPtrWillBeRawPtr<Node> relatedTarget); |
67 | 68 |
68 static PassRefPtrWillBeRawPtr<MouseEvent> create(const AtomicString& eventTy
pe, const MouseEventInit&); | 69 static PassRefPtrWillBeRawPtr<MouseEvent> create(const AtomicString& eventTy
pe, const MouseEventInit&); |
69 | 70 |
70 virtual ~MouseEvent(); | 71 virtual ~MouseEvent(); |
71 | 72 |
| 73 static unsigned short platformModifiersToButtons(unsigned modifiers); |
| 74 |
72 void initMouseEvent(const AtomicString& type, bool canBubble, bool cancelabl
e, PassRefPtrWillBeRawPtr<AbstractView>, | 75 void initMouseEvent(const AtomicString& type, bool canBubble, bool cancelabl
e, PassRefPtrWillBeRawPtr<AbstractView>, |
73 int detail, int screenX, int screenY, int clientX, int clientY, | 76 int detail, int screenX, int screenY, int clientX, int clientY, |
74 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, | 77 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, |
75 unsigned short button, PassRefPtrWillBeRawPtr<EventTarget> relatedTarget
); | 78 unsigned short button, PassRefPtrWillBeRawPtr<EventTarget> relatedTarget
, unsigned short buttons = 0); |
76 | 79 |
77 // WinIE uses 1,4,2 for left/middle/right but not for click (just for moused
own/up, maybe others), | 80 // WinIE uses 1,4,2 for left/middle/right but not for click (just for moused
own/up, maybe others), |
78 // but we will match the standard DOM. | 81 // but we will match the standard DOM. |
79 unsigned short button() const { return m_button; } | 82 unsigned short button() const { return m_button; } |
| 83 unsigned short buttons() const { return m_buttons; } |
80 bool buttonDown() const { return m_buttonDown; } | 84 bool buttonDown() const { return m_buttonDown; } |
81 EventTarget* relatedTarget() const { return m_relatedTarget.get(); } | 85 EventTarget* relatedTarget() const { return m_relatedTarget.get(); } |
82 void setRelatedTarget(PassRefPtrWillBeRawPtr<EventTarget> relatedTarget) { m
_relatedTarget = relatedTarget; } | 86 void setRelatedTarget(PassRefPtrWillBeRawPtr<EventTarget> relatedTarget) { m
_relatedTarget = relatedTarget; } |
83 | 87 |
84 Node* toElement() const; | 88 Node* toElement() const; |
85 Node* fromElement() const; | 89 Node* fromElement() const; |
86 | 90 |
87 DataTransfer* dataTransfer() const { return isDragEvent() ? m_dataTransfer.g
et() : 0; } | 91 DataTransfer* dataTransfer() const { return isDragEvent() ? m_dataTransfer.g
et() : 0; } |
88 | 92 |
89 bool fromTouch() const { return m_syntheticEventType == PlatformMouseEvent::
FromTouch; } | 93 bool fromTouch() const { return m_syntheticEventType == PlatformMouseEvent::
FromTouch; } |
90 | 94 |
91 virtual const AtomicString& interfaceName() const override; | 95 virtual const AtomicString& interfaceName() const override; |
92 | 96 |
93 virtual bool isMouseEvent() const override; | 97 virtual bool isMouseEvent() const override; |
94 virtual bool isDragEvent() const override final; | 98 virtual bool isDragEvent() const override final; |
95 virtual int which() const override final; | 99 virtual int which() const override final; |
96 | 100 |
97 virtual void trace(Visitor*) override; | 101 virtual void trace(Visitor*) override; |
98 | 102 |
99 protected: | 103 protected: |
100 MouseEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRe
fPtrWillBeRawPtr<AbstractView>, | 104 MouseEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRe
fPtrWillBeRawPtr<AbstractView>, |
101 int detail, int screenX, int screenY, int pageX, int pageY, | 105 int detail, int screenX, int screenY, int pageX, int pageY, |
102 int movementX, int movementY, | 106 int movementX, int movementY, |
103 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short b
utton, | 107 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short b
utton, unsigned short buttons, |
104 PassRefPtrWillBeRawPtr<EventTarget> relatedTarget, PassRefPtrWillBeRawPt
r<DataTransfer>, | 108 PassRefPtrWillBeRawPtr<EventTarget> relatedTarget, PassRefPtrWillBeRawPt
r<DataTransfer>, |
105 bool isSimulated, PlatformMouseEvent::SyntheticEventType); | 109 bool isSimulated, PlatformMouseEvent::SyntheticEventType); |
106 | 110 |
107 MouseEvent(const AtomicString& type, const MouseEventInit&); | 111 MouseEvent(const AtomicString& type, const MouseEventInit&); |
108 | 112 |
109 MouseEvent(); | 113 MouseEvent(); |
110 | 114 |
111 private: | 115 private: |
112 unsigned short m_button; | 116 unsigned short m_button; |
| 117 unsigned short m_buttons; |
113 bool m_buttonDown; | 118 bool m_buttonDown; |
114 RefPtrWillBeMember<EventTarget> m_relatedTarget; | 119 RefPtrWillBeMember<EventTarget> m_relatedTarget; |
115 RefPtrWillBeMember<DataTransfer> m_dataTransfer; | 120 RefPtrWillBeMember<DataTransfer> m_dataTransfer; |
116 PlatformMouseEvent::SyntheticEventType m_syntheticEventType; | 121 PlatformMouseEvent::SyntheticEventType m_syntheticEventType; |
117 }; | 122 }; |
118 | 123 |
119 class SimulatedMouseEvent final : public MouseEvent { | 124 class SimulatedMouseEvent final : public MouseEvent { |
120 public: | 125 public: |
121 static PassRefPtrWillBeRawPtr<SimulatedMouseEvent> create(const AtomicString
& eventType, PassRefPtrWillBeRawPtr<AbstractView>, PassRefPtrWillBeRawPtr<Event>
underlyingEvent); | 126 static PassRefPtrWillBeRawPtr<SimulatedMouseEvent> create(const AtomicString
& eventType, PassRefPtrWillBeRawPtr<AbstractView>, PassRefPtrWillBeRawPtr<Event>
underlyingEvent); |
122 virtual ~SimulatedMouseEvent(); | 127 virtual ~SimulatedMouseEvent(); |
(...skipping 16 matching lines...) Expand all Loading... |
139 virtual bool dispatchEvent(EventDispatcher&) const override; | 144 virtual bool dispatchEvent(EventDispatcher&) const override; |
140 bool isSyntheticMouseEvent() const { return m_mouseEventType == SyntheticMou
seEvent; } | 145 bool isSyntheticMouseEvent() const { return m_mouseEventType == SyntheticMou
seEvent; } |
141 MouseEventType m_mouseEventType; | 146 MouseEventType m_mouseEventType; |
142 }; | 147 }; |
143 | 148 |
144 DEFINE_EVENT_TYPE_CASTS(MouseEvent); | 149 DEFINE_EVENT_TYPE_CASTS(MouseEvent); |
145 | 150 |
146 } // namespace blink | 151 } // namespace blink |
147 | 152 |
148 #endif // MouseEvent_h | 153 #endif // MouseEvent_h |
OLD | NEW |