Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: third_party/WebKit/Source/core/events/EventTarget.h

Issue 1942723004: Change EventTarget callback APIs for add/RemoveEventListenerInternal. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix gypi Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 virtual Node* toNode(); 110 virtual Node* toNode();
111 virtual const DOMWindow* toDOMWindow() const; 111 virtual const DOMWindow* toDOMWindow() const;
112 virtual const LocalDOMWindow* toLocalDOMWindow() const; 112 virtual const LocalDOMWindow* toLocalDOMWindow() const;
113 virtual LocalDOMWindow* toLocalDOMWindow(); 113 virtual LocalDOMWindow* toLocalDOMWindow();
114 virtual MessagePort* toMessagePort(); 114 virtual MessagePort* toMessagePort();
115 115
116 bool addEventListener(const AtomicString& eventType, EventListener*, bool us eCapture = false); 116 bool addEventListener(const AtomicString& eventType, EventListener*, bool us eCapture = false);
117 bool addEventListener(const AtomicString& eventType, EventListener*, const E ventListenerOptionsOrBoolean&); 117 bool addEventListener(const AtomicString& eventType, EventListener*, const E ventListenerOptionsOrBoolean&);
118 bool addEventListener(const AtomicString& eventType, EventListener*, EventLi stenerOptions&); 118 bool addEventListener(const AtomicString& eventType, EventListener*, EventLi stenerOptions&);
119 119
120 bool removeEventListener(const AtomicString& eventType, EventListener*, bool useCapture = false); 120 bool removeEventListener(const AtomicString& eventType, const EventListener* , bool useCapture = false);
121 bool removeEventListener(const AtomicString& eventType, EventListener*, cons t EventListenerOptionsOrBoolean&); 121 bool removeEventListener(const AtomicString& eventType, const EventListener* , const EventListenerOptionsOrBoolean&);
122 bool removeEventListener(const AtomicString& eventType, EventListener*, Even tListenerOptions&); 122 bool removeEventListener(const AtomicString& eventType, const EventListener* , EventListenerOptions&);
123 virtual void removeAllEventListeners(); 123 virtual void removeAllEventListeners();
124 124
125 DispatchEventResult dispatchEvent(Event*); 125 DispatchEventResult dispatchEvent(Event*);
126 126
127 // dispatchEventForBindings is intended to only be called from 127 // dispatchEventForBindings is intended to only be called from
128 // javascript originated calls. This method will validate and may adjust 128 // javascript originated calls. This method will validate and may adjust
129 // the Event object before dispatching. 129 // the Event object before dispatching.
130 bool dispatchEventForBindings(Event*, ExceptionState&); 130 bool dispatchEventForBindings(Event*, ExceptionState&);
131 virtual void uncaughtExceptionInEventHandler(); 131 virtual void uncaughtExceptionInEventHandler();
132 132
(...skipping 12 matching lines...) Expand all
145 static DispatchEventResult dispatchEventResult(const Event&); 145 static DispatchEventResult dispatchEventResult(const Event&);
146 146
147 DEFINE_INLINE_VIRTUAL_TRACE() { } 147 DEFINE_INLINE_VIRTUAL_TRACE() { }
148 148
149 virtual bool keepEventInNode(Event*) { return false; } 149 virtual bool keepEventInNode(Event*) { return false; }
150 150
151 protected: 151 protected:
152 EventTarget(); 152 EventTarget();
153 153
154 virtual bool addEventListenerInternal(const AtomicString& eventType, EventLi stener*, const EventListenerOptions&); 154 virtual bool addEventListenerInternal(const AtomicString& eventType, EventLi stener*, const EventListenerOptions&);
155 virtual bool removeEventListenerInternal(const AtomicString& eventType, Even tListener*, const EventListenerOptions&); 155 virtual bool removeEventListenerInternal(const AtomicString& eventType, cons t EventListener*, const EventListenerOptions&);
156 virtual void addedEventListener(const AtomicString& eventType, const Registe redEventListener&);
bokan 2016/05/03 15:52:46 Please add comments describing what these are for.
dtapuska 2016/05/03 20:53:04 Done.
157 virtual void removedEventListener(const AtomicString& eventType, const Regis teredEventListener&);
156 virtual DispatchEventResult dispatchEventInternal(Event*); 158 virtual DispatchEventResult dispatchEventInternal(Event*);
157 159
158 // Subclasses should likely not override these themselves; instead, they sho uld subclass EventTargetWithInlineData. 160 // Subclasses should likely not override these themselves; instead, they sho uld subclass EventTargetWithInlineData.
159 virtual EventTargetData* eventTargetData() = 0; 161 virtual EventTargetData* eventTargetData() = 0;
160 virtual EventTargetData& ensureEventTargetData() = 0; 162 virtual EventTargetData& ensureEventTargetData() = 0;
161 163
162 private: 164 private:
163 LocalDOMWindow* executingWindow(); 165 LocalDOMWindow* executingWindow();
164 void fireEventListeners(Event*, EventTargetData*, EventListenerVector&); 166 void fireEventListeners(Event*, EventTargetData*, EventListenerVector&);
165 void countLegacyEvents(const AtomicString& legacyTypeName, EventListenerVect or*, EventListenerVector*); 167 void countLegacyEvents(const AtomicString& legacyTypeName, EventListenerVect or*, EventListenerVector*);
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 { 245 {
244 EventTargetData* d = eventTargetData(); 246 EventTargetData* d = eventTargetData();
245 if (!d) 247 if (!d)
246 return false; 248 return false;
247 return d->eventListenerMap.containsCapturing(eventType); 249 return d->eventListenerMap.containsCapturing(eventType);
248 } 250 }
249 251
250 } // namespace blink 252 } // namespace blink
251 253
252 #endif // EventTarget_h 254 #endif // EventTarget_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698