OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
6 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 6 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
7 * (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> | 7 * (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> |
8 * | 8 * |
9 * Redistribution and use in source and binary forms, with or without | 9 * Redistribution and use in source and binary forms, with or without |
10 * modification, are permitted provided that the following conditions | 10 * modification, are permitted provided that the following conditions |
(...skipping 21 matching lines...) Expand all Loading... |
32 #ifndef EventTarget_h | 32 #ifndef EventTarget_h |
33 #define EventTarget_h | 33 #define EventTarget_h |
34 | 34 |
35 #include "bindings/core/v8/AddEventListenerOptionsOrBoolean.h" | 35 #include "bindings/core/v8/AddEventListenerOptionsOrBoolean.h" |
36 #include "bindings/core/v8/EventListenerOptionsOrBoolean.h" | 36 #include "bindings/core/v8/EventListenerOptionsOrBoolean.h" |
37 #include "bindings/core/v8/ScriptWrappable.h" | 37 #include "bindings/core/v8/ScriptWrappable.h" |
38 #include "core/CoreExport.h" | 38 #include "core/CoreExport.h" |
39 #include "core/EventNames.h" | 39 #include "core/EventNames.h" |
40 #include "core/EventTargetNames.h" | 40 #include "core/EventTargetNames.h" |
41 #include "core/EventTypeNames.h" | 41 #include "core/EventTypeNames.h" |
| 42 #include "core/events/AddEventListenerOptionsResolved.h" |
42 #include "core/events/EventDispatchResult.h" | 43 #include "core/events/EventDispatchResult.h" |
43 #include "core/events/EventListenerMap.h" | 44 #include "core/events/EventListenerMap.h" |
44 #include "platform/heap/Handle.h" | 45 #include "platform/heap/Handle.h" |
45 #include "wtf/Allocator.h" | 46 #include "wtf/Allocator.h" |
46 #include "wtf/text/AtomicString.h" | 47 #include "wtf/text/AtomicString.h" |
47 #include <memory> | 48 #include <memory> |
48 | 49 |
49 namespace blink { | 50 namespace blink { |
50 | 51 |
51 class DOMWindow; | 52 class DOMWindow; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 virtual ExecutionContext* getExecutionContext() const = 0; | 111 virtual ExecutionContext* getExecutionContext() const = 0; |
111 | 112 |
112 virtual Node* toNode(); | 113 virtual Node* toNode(); |
113 virtual const DOMWindow* toDOMWindow() const; | 114 virtual const DOMWindow* toDOMWindow() const; |
114 virtual const LocalDOMWindow* toLocalDOMWindow() const; | 115 virtual const LocalDOMWindow* toLocalDOMWindow() const; |
115 virtual LocalDOMWindow* toLocalDOMWindow(); | 116 virtual LocalDOMWindow* toLocalDOMWindow(); |
116 virtual MessagePort* toMessagePort(); | 117 virtual MessagePort* toMessagePort(); |
117 | 118 |
118 bool addEventListener(const AtomicString& eventType, EventListener*, bool us
eCapture = false); | 119 bool addEventListener(const AtomicString& eventType, EventListener*, bool us
eCapture = false); |
119 bool addEventListener(const AtomicString& eventType, EventListener*, const A
ddEventListenerOptionsOrBoolean&); | 120 bool addEventListener(const AtomicString& eventType, EventListener*, const A
ddEventListenerOptionsOrBoolean&); |
120 bool addEventListener(const AtomicString& eventType, EventListener*, AddEven
tListenerOptions&); | 121 bool addEventListener(const AtomicString& eventType, EventListener*, AddEven
tListenerOptionsResolved&); |
121 | 122 |
122 bool removeEventListener(const AtomicString& eventType, const EventListener*
, bool useCapture = false); | 123 bool removeEventListener(const AtomicString& eventType, const EventListener*
, bool useCapture = false); |
123 bool removeEventListener(const AtomicString& eventType, const EventListener*
, const EventListenerOptionsOrBoolean&); | 124 bool removeEventListener(const AtomicString& eventType, const EventListener*
, const EventListenerOptionsOrBoolean&); |
124 bool removeEventListener(const AtomicString& eventType, const EventListener*
, EventListenerOptions&); | 125 bool removeEventListener(const AtomicString& eventType, const EventListener*
, EventListenerOptions&); |
125 virtual void removeAllEventListeners(); | 126 virtual void removeAllEventListeners(); |
126 | 127 |
127 DispatchEventResult dispatchEvent(Event*); | 128 DispatchEventResult dispatchEvent(Event*); |
128 | 129 |
129 // dispatchEventForBindings is intended to only be called from | 130 // dispatchEventForBindings is intended to only be called from |
130 // javascript originated calls. This method will validate and may adjust | 131 // javascript originated calls. This method will validate and may adjust |
(...skipping 17 matching lines...) Expand all Loading... |
148 | 149 |
149 DEFINE_INLINE_VIRTUAL_TRACE() { } | 150 DEFINE_INLINE_VIRTUAL_TRACE() { } |
150 | 151 |
151 DECLARE_VIRTUAL_TRACE_WRAPPERS(); | 152 DECLARE_VIRTUAL_TRACE_WRAPPERS(); |
152 | 153 |
153 virtual bool keepEventInNode(Event*) { return false; } | 154 virtual bool keepEventInNode(Event*) { return false; } |
154 | 155 |
155 protected: | 156 protected: |
156 EventTarget(); | 157 EventTarget(); |
157 | 158 |
158 virtual bool addEventListenerInternal(const AtomicString& eventType, EventLi
stener*, const AddEventListenerOptions&); | 159 virtual bool addEventListenerInternal(const AtomicString& eventType, EventLi
stener*, const AddEventListenerOptionsResolved&); |
159 virtual bool removeEventListenerInternal(const AtomicString& eventType, cons
t EventListener*, const EventListenerOptions&); | 160 virtual bool removeEventListenerInternal(const AtomicString& eventType, cons
t EventListener*, const EventListenerOptions&); |
160 | 161 |
161 // Called when an event listener has been successfully added. | 162 // Called when an event listener has been successfully added. |
162 virtual void addedEventListener(const AtomicString& eventType, RegisteredEve
ntListener&); | 163 virtual void addedEventListener(const AtomicString& eventType, RegisteredEve
ntListener&); |
163 | 164 |
164 // Called when an event listener is removed. The original registration param
eters of this | 165 // Called when an event listener is removed. The original registration param
eters of this |
165 // event listener are available to be queried. | 166 // event listener are available to be queried. |
166 virtual void removedEventListener(const AtomicString& eventType, const Regis
teredEventListener&); | 167 virtual void removedEventListener(const AtomicString& eventType, const Regis
teredEventListener&); |
167 | 168 |
168 virtual DispatchEventResult dispatchEventInternal(Event*); | 169 virtual DispatchEventResult dispatchEventInternal(Event*); |
169 | 170 |
170 // Subclasses should likely not override these themselves; instead, they sho
uld subclass EventTargetWithInlineData. | 171 // Subclasses should likely not override these themselves; instead, they sho
uld subclass EventTargetWithInlineData. |
171 virtual EventTargetData* eventTargetData() = 0; | 172 virtual EventTargetData* eventTargetData() = 0; |
172 virtual EventTargetData& ensureEventTargetData() = 0; | 173 virtual EventTargetData& ensureEventTargetData() = 0; |
173 | 174 |
174 private: | 175 private: |
175 LocalDOMWindow* executingWindow(); | 176 LocalDOMWindow* executingWindow(); |
176 void setDefaultAddEventListenerOptions(const AtomicString& eventType, AddEve
ntListenerOptions&); | 177 void setDefaultAddEventListenerOptions(const AtomicString& eventType, AddEve
ntListenerOptionsResolved&); |
177 bool fireEventListeners(Event*, EventTargetData*, EventListenerVector&); | 178 bool fireEventListeners(Event*, EventTargetData*, EventListenerVector&); |
178 void countLegacyEvents(const AtomicString& legacyTypeName, EventListenerVect
or*, EventListenerVector*); | 179 void countLegacyEvents(const AtomicString& legacyTypeName, EventListenerVect
or*, EventListenerVector*); |
179 | 180 |
180 bool clearAttributeEventListener(const AtomicString& eventType); | 181 bool clearAttributeEventListener(const AtomicString& eventType); |
181 | 182 |
182 friend class EventListenerIterator; | 183 friend class EventListenerIterator; |
183 }; | 184 }; |
184 | 185 |
185 // EventTargetData is a GCed object, so it should not be used as a part of | 186 // EventTargetData is a GCed object, so it should not be used as a part of |
186 // object. However, we intentionally use it as a part of object for performance, | 187 // object. However, we intentionally use it as a part of object for performance, |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 { | 259 { |
259 EventTargetData* d = eventTargetData(); | 260 EventTargetData* d = eventTargetData(); |
260 if (!d) | 261 if (!d) |
261 return false; | 262 return false; |
262 return d->eventListenerMap.containsCapturing(eventType); | 263 return d->eventListenerMap.containsCapturing(eventType); |
263 } | 264 } |
264 | 265 |
265 } // namespace blink | 266 } // namespace blink |
266 | 267 |
267 #endif // EventTarget_h | 268 #endif // EventTarget_h |
OLD | NEW |