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, 2007, 2008 Apple Inc. All rights reserv
ed. | 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserv
ed. |
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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 bool bubbles() const { return m_canBubble; } | 117 bool bubbles() const { return m_canBubble; } |
118 bool cancelable() const { return m_cancelable; } | 118 bool cancelable() const { return m_cancelable; } |
119 DOMTimeStamp timeStamp() const { return m_createTime; } | 119 DOMTimeStamp timeStamp() const { return m_createTime; } |
120 | 120 |
121 void stopPropagation() { m_propagationStopped = true; } | 121 void stopPropagation() { m_propagationStopped = true; } |
122 void stopImmediatePropagation() { m_immediatePropagationStopped = true; } | 122 void stopImmediatePropagation() { m_immediatePropagationStopped = true; } |
123 | 123 |
124 // IE Extensions | 124 // IE Extensions |
125 EventTarget* srcElement() const { return target(); } // MSIE extension - "th
e object that fired the event" | 125 EventTarget* srcElement() const { return target(); } // MSIE extension - "th
e object that fired the event" |
126 | 126 |
127 bool returnValue() const { return !defaultPrevented(); } | 127 bool legacyReturnValue() const { return !defaultPrevented(); } |
128 void setReturnValue(bool returnValue) { setDefaultPrevented(!returnValue); } | 128 void setLegacyReturnValue(bool returnValue) { setDefaultPrevented(!returnVal
ue); } |
129 | 129 |
130 Clipboard* clipboardData() const { return isClipboardEvent() ? clipboard() :
0; } | 130 Clipboard* clipboardData() const { return isClipboardEvent() ? clipboard() :
0; } |
131 | 131 |
132 virtual const AtomicString& interfaceName() const; | 132 virtual const AtomicString& interfaceName() const; |
133 bool hasInterface(const AtomicString&) const; | 133 bool hasInterface(const AtomicString&) const; |
134 | 134 |
135 // These events are general classes of events. | 135 // These events are general classes of events. |
136 virtual bool isUIEvent() const; | 136 virtual bool isUIEvent() const; |
137 virtual bool isMouseEvent() const; | 137 virtual bool isMouseEvent() const; |
138 virtual bool isFocusEvent() const; | 138 virtual bool isFocusEvent() const; |
139 virtual bool isKeyboardEvent() const; | 139 virtual bool isKeyboardEvent() const; |
140 virtual bool isTouchEvent() const; | 140 virtual bool isTouchEvent() const; |
141 | 141 |
142 // Drag events are a subset of mouse events. | 142 // Drag events are a subset of mouse events. |
143 virtual bool isDragEvent() const; | 143 virtual bool isDragEvent() const; |
144 | 144 |
145 // These events lack a DOM interface. | 145 // These events lack a DOM interface. |
146 virtual bool isClipboardEvent() const; | 146 virtual bool isClipboardEvent() const; |
147 virtual bool isBeforeTextInsertedEvent() const; | 147 virtual bool isBeforeTextInsertedEvent() const; |
148 | 148 |
| 149 virtual bool isBeforeUnloadEvent() const; |
| 150 |
149 bool propagationStopped() const { return m_propagationStopped || m_immediate
PropagationStopped; } | 151 bool propagationStopped() const { return m_propagationStopped || m_immediate
PropagationStopped; } |
150 bool immediatePropagationStopped() const { return m_immediatePropagationStop
ped; } | 152 bool immediatePropagationStopped() const { return m_immediatePropagationStop
ped; } |
151 | 153 |
152 bool defaultPrevented() const { return m_defaultPrevented; } | 154 bool defaultPrevented() const { return m_defaultPrevented; } |
153 void preventDefault() | 155 void preventDefault() |
154 { | 156 { |
155 if (m_cancelable) | 157 if (m_cancelable) |
156 m_defaultPrevented = true; | 158 m_defaultPrevented = true; |
157 } | 159 } |
158 void setDefaultPrevented(bool defaultPrevented) { m_defaultPrevented = defau
ltPrevented; } | 160 void setDefaultPrevented(bool defaultPrevented) { m_defaultPrevented = defau
ltPrevented; } |
159 | 161 |
160 bool defaultHandled() const { return m_defaultHandled; } | 162 bool defaultHandled() const { return m_defaultHandled; } |
161 void setDefaultHandled() { m_defaultHandled = true; } | 163 void setDefaultHandled() { m_defaultHandled = true; } |
162 | 164 |
163 bool cancelBubble() const { return m_cancelBubble; } | 165 bool cancelBubble() const { return m_cancelBubble; } |
164 void setCancelBubble(bool cancel) { m_cancelBubble = cancel; } | 166 void setCancelBubble(bool cancel) { m_cancelBubble = cancel; } |
165 | 167 |
166 Event* underlyingEvent() const { return m_underlyingEvent.get(); } | 168 Event* underlyingEvent() const { return m_underlyingEvent.get(); } |
167 void setUnderlyingEvent(PassRefPtr<Event>); | 169 void setUnderlyingEvent(PassRefPtr<Event>); |
168 | 170 |
169 EventPath& eventPath() { return m_eventPath; } | 171 EventPath& eventPath() { return m_eventPath; } |
170 PassRefPtr<NodeList> path() const; | 172 PassRefPtr<NodeList> path() const; |
171 | 173 |
172 virtual bool storesResultAsString() const; | |
173 virtual void storeResult(const String&); | |
174 | |
175 virtual Clipboard* clipboard() const { return 0; } | 174 virtual Clipboard* clipboard() const { return 0; } |
176 | 175 |
177 bool isBeingDispatched() const { return eventPhase(); } | 176 bool isBeingDispatched() const { return eventPhase(); } |
178 | 177 |
179 protected: | 178 protected: |
180 Event(); | 179 Event(); |
181 Event(const AtomicString& type, bool canBubble, bool cancelable); | 180 Event(const AtomicString& type, bool canBubble, bool cancelable); |
182 Event(const AtomicString& type, const EventInit&); | 181 Event(const AtomicString& type, const EventInit&); |
183 | 182 |
184 virtual void receivedTarget(); | 183 virtual void receivedTarget(); |
(...skipping 14 matching lines...) Expand all Loading... |
199 EventTarget* m_currentTarget; | 198 EventTarget* m_currentTarget; |
200 RefPtr<EventTarget> m_target; | 199 RefPtr<EventTarget> m_target; |
201 DOMTimeStamp m_createTime; | 200 DOMTimeStamp m_createTime; |
202 RefPtr<Event> m_underlyingEvent; | 201 RefPtr<Event> m_underlyingEvent; |
203 EventPath m_eventPath; | 202 EventPath m_eventPath; |
204 }; | 203 }; |
205 | 204 |
206 } // namespace WebCore | 205 } // namespace WebCore |
207 | 206 |
208 #endif // Event_h | 207 #endif // Event_h |
OLD | NEW |