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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 RefPtr<EventTarget> relatedTarget; | 48 RefPtr<EventTarget> relatedTarget; |
49 }; | 49 }; |
50 | 50 |
51 class MouseEvent : public MouseRelatedEvent { | 51 class MouseEvent : public MouseRelatedEvent { |
52 public: | 52 public: |
53 static PassRefPtr<MouseEvent> create() | 53 static PassRefPtrWillBeRawPtr<MouseEvent> create() |
54 { | 54 { |
55 return adoptRef(new MouseEvent); | 55 return adoptRefCountedWillBeRefCountedGarbageCollected(new MouseEvent); |
56 } | 56 } |
57 | 57 |
58 static PassRefPtr<MouseEvent> create(const AtomicString& type, bool canBubbl
e, bool cancelable, PassRefPtr<AbstractView>, | 58 static PassRefPtrWillBeRawPtr<MouseEvent> create(const AtomicString& type, b
ool canBubble, bool cancelable, PassRefPtr<AbstractView>, |
59 int detail, int screenX, int screenY, int pageX, int pageY, | 59 int detail, int screenX, int screenY, int pageX, int pageY, |
60 int movementX, int movementY, | 60 int movementX, int movementY, |
61 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short b
utton, | 61 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short b
utton, |
62 PassRefPtr<EventTarget> relatedTarget, PassRefPtrWillBeRawPtr<Clipboard>
, bool isSimulated = false); | 62 PassRefPtr<EventTarget> relatedTarget, PassRefPtrWillBeRawPtr<Clipboard>
, bool isSimulated = false); |
63 | 63 |
64 static PassRefPtr<MouseEvent> create(const AtomicString& eventType, PassRefP
tr<AbstractView>, const PlatformMouseEvent&, int detail, PassRefPtr<Node> relate
dTarget); | 64 static PassRefPtrWillBeRawPtr<MouseEvent> create(const AtomicString& eventTy
pe, PassRefPtr<AbstractView>, const PlatformMouseEvent&, int detail, PassRefPtr<
Node> relatedTarget); |
65 | 65 |
66 static PassRefPtr<MouseEvent> create(const AtomicString& eventType, const Mo
useEventInit&); | 66 static PassRefPtrWillBeRawPtr<MouseEvent> create(const AtomicString& eventTy
pe, const MouseEventInit&); |
67 | 67 |
68 virtual ~MouseEvent(); | 68 virtual ~MouseEvent(); |
69 | 69 |
70 void initMouseEvent(const AtomicString& type, bool canBubble, bool cancelabl
e, PassRefPtr<AbstractView>, | 70 void initMouseEvent(const AtomicString& type, bool canBubble, bool cancelabl
e, PassRefPtr<AbstractView>, |
71 int detail, int screenX, int screenY, int clientX, int clientY, | 71 int detail, int screenX, int screenY, int clientX, int clientY, |
72 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, | 72 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, |
73 unsigned short button, PassRefPtr<EventTarget> relatedTarget); | 73 unsigned short button, PassRefPtr<EventTarget> relatedTarget); |
74 | 74 |
75 // WinIE uses 1,4,2 for left/middle/right but not for click (just for moused
own/up, maybe others), | 75 // WinIE uses 1,4,2 for left/middle/right but not for click (just for moused
own/up, maybe others), |
76 // but we will match the standard DOM. | 76 // but we will match the standard DOM. |
77 unsigned short button() const { return m_button; } | 77 unsigned short button() const { return m_button; } |
78 bool buttonDown() const { return m_buttonDown; } | 78 bool buttonDown() const { return m_buttonDown; } |
79 EventTarget* relatedTarget() const { return m_relatedTarget.get(); } | 79 EventTarget* relatedTarget() const { return m_relatedTarget.get(); } |
80 EventTarget* relatedTarget(bool& isNull) const { isNull = !m_relatedTarget;
return m_relatedTarget.get(); } | 80 EventTarget* relatedTarget(bool& isNull) const { isNull = !m_relatedTarget;
return m_relatedTarget.get(); } |
81 void setRelatedTarget(PassRefPtr<EventTarget> relatedTarget) { m_relatedTarg
et = relatedTarget; } | 81 void setRelatedTarget(PassRefPtr<EventTarget> relatedTarget) { m_relatedTarg
et = relatedTarget; } |
82 | 82 |
83 Node* toElement() const; | 83 Node* toElement() const; |
84 Node* fromElement() const; | 84 Node* fromElement() const; |
85 | 85 |
86 Clipboard* dataTransfer() const { return isDragEvent() ? m_clipboard.get() :
0; } | 86 Clipboard* dataTransfer() const { return isDragEvent() ? m_clipboard.get() :
0; } |
87 | 87 |
88 virtual const AtomicString& interfaceName() const OVERRIDE; | 88 virtual const AtomicString& interfaceName() const OVERRIDE; |
89 | 89 |
90 virtual bool isMouseEvent() const OVERRIDE; | 90 virtual bool isMouseEvent() const OVERRIDE; |
91 virtual bool isDragEvent() const OVERRIDE FINAL; | 91 virtual bool isDragEvent() const OVERRIDE FINAL; |
92 virtual int which() const OVERRIDE FINAL; | 92 virtual int which() const OVERRIDE FINAL; |
93 | 93 |
| 94 virtual void trace(Visitor*) OVERRIDE; |
| 95 |
94 protected: | 96 protected: |
95 MouseEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRe
fPtr<AbstractView>, | 97 MouseEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRe
fPtr<AbstractView>, |
96 int detail, int screenX, int screenY, int pageX, int pageY, | 98 int detail, int screenX, int screenY, int pageX, int pageY, |
97 int movementX, int movementY, | 99 int movementX, int movementY, |
98 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short b
utton, | 100 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short b
utton, |
99 PassRefPtr<EventTarget> relatedTarget, PassRefPtrWillBeRawPtr<Clipboard>
, bool isSimulated); | 101 PassRefPtr<EventTarget> relatedTarget, PassRefPtrWillBeRawPtr<Clipboard>
, bool isSimulated); |
100 | 102 |
101 MouseEvent(const AtomicString& type, const MouseEventInit&); | 103 MouseEvent(const AtomicString& type, const MouseEventInit&); |
102 | 104 |
103 MouseEvent(); | 105 MouseEvent(); |
104 | 106 |
105 virtual void trace(Visitor*) OVERRIDE; | |
106 | |
107 private: | 107 private: |
108 unsigned short m_button; | 108 unsigned short m_button; |
109 bool m_buttonDown; | 109 bool m_buttonDown; |
110 RefPtr<EventTarget> m_relatedTarget; | 110 RefPtr<EventTarget> m_relatedTarget; |
111 RefPtrWillBeMember<Clipboard> m_clipboard; | 111 RefPtrWillBeMember<Clipboard> m_clipboard; |
112 }; | 112 }; |
113 | 113 |
114 class SimulatedMouseEvent FINAL : public MouseEvent { | 114 class SimulatedMouseEvent FINAL : public MouseEvent { |
115 public: | 115 public: |
116 static PassRefPtr<SimulatedMouseEvent> create(const AtomicString& eventType,
PassRefPtr<AbstractView>, PassRefPtr<Event> underlyingEvent); | 116 static PassRefPtrWillBeRawPtr<SimulatedMouseEvent> create(const AtomicString
& eventType, PassRefPtr<AbstractView>, PassRefPtr<Event> underlyingEvent); |
117 virtual ~SimulatedMouseEvent(); | 117 virtual ~SimulatedMouseEvent(); |
118 | 118 |
119 virtual void trace(Visitor*) OVERRIDE; | 119 virtual void trace(Visitor*) OVERRIDE; |
120 | 120 |
121 private: | 121 private: |
122 SimulatedMouseEvent(const AtomicString& eventType, PassRefPtr<AbstractView>,
PassRefPtr<Event> underlyingEvent); | 122 SimulatedMouseEvent(const AtomicString& eventType, PassRefPtr<AbstractView>,
PassRefPtr<Event> underlyingEvent); |
123 }; | 123 }; |
124 | 124 |
125 class MouseEventDispatchMediator FINAL : public EventDispatchMediator { | 125 class MouseEventDispatchMediator FINAL : public EventDispatchMediator { |
126 public: | 126 public: |
127 enum MouseEventType { SyntheticMouseEvent, NonSyntheticMouseEvent}; | 127 enum MouseEventType { SyntheticMouseEvent, NonSyntheticMouseEvent}; |
128 static PassRefPtr<MouseEventDispatchMediator> create(PassRefPtr<MouseEvent>,
MouseEventType = NonSyntheticMouseEvent); | 128 static PassRefPtr<MouseEventDispatchMediator> create(PassRefPtr<MouseEvent>,
MouseEventType = NonSyntheticMouseEvent); |
129 | 129 |
130 private: | 130 private: |
131 explicit MouseEventDispatchMediator(PassRefPtr<MouseEvent>, MouseEventType); | 131 explicit MouseEventDispatchMediator(PassRefPtr<MouseEvent>, MouseEventType); |
132 MouseEvent* event() const; | 132 MouseEvent* event() const; |
133 | 133 |
134 virtual bool dispatchEvent(EventDispatcher*) const OVERRIDE; | 134 virtual bool dispatchEvent(EventDispatcher*) const OVERRIDE; |
135 bool isSyntheticMouseEvent() const { return m_mouseEventType == SyntheticMou
seEvent; } | 135 bool isSyntheticMouseEvent() const { return m_mouseEventType == SyntheticMou
seEvent; } |
136 MouseEventType m_mouseEventType; | 136 MouseEventType m_mouseEventType; |
137 }; | 137 }; |
138 | 138 |
139 DEFINE_EVENT_TYPE_CASTS(MouseEvent); | 139 DEFINE_EVENT_TYPE_CASTS(MouseEvent); |
140 | 140 |
141 } // namespace WebCore | 141 } // namespace WebCore |
142 | 142 |
143 #endif // MouseEvent_h | 143 #endif // MouseEvent_h |
OLD | NEW |