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

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

Issue 1241613004: Rework dispatchEvent so it is consistent for isTrusted support. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Work around MSVC optimization bug Created 5 years, 5 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 virtual const AtomicString& interfaceName() const = 0; 118 virtual const AtomicString& interfaceName() const = 0;
119 virtual ExecutionContext* executionContext() const = 0; 119 virtual ExecutionContext* executionContext() const = 0;
120 120
121 virtual Node* toNode(); 121 virtual Node* toNode();
122 virtual LocalDOMWindow* toDOMWindow(); 122 virtual LocalDOMWindow* toDOMWindow();
123 virtual MessagePort* toMessagePort(); 123 virtual MessagePort* toMessagePort();
124 124
125 virtual bool addEventListener(const AtomicString& eventType, PassRefPtr<Even tListener>, bool useCapture); 125 virtual bool addEventListener(const AtomicString& eventType, PassRefPtr<Even tListener>, bool useCapture);
126 virtual bool removeEventListener(const AtomicString& eventType, PassRefPtr<E ventListener>, bool useCapture); 126 virtual bool removeEventListener(const AtomicString& eventType, PassRefPtr<E ventListener>, bool useCapture);
127 virtual void removeAllEventListeners(); 127 virtual void removeAllEventListeners();
128 virtual bool dispatchEvent(PassRefPtrWillBeRawPtr<Event>); 128
129 bool dispatchEvent(PassRefPtrWillBeRawPtr<Event>);
129 130
130 // dispatchEventForBindings is intended to only be called from 131 // dispatchEventForBindings is intended to only be called from
131 // javascript originated calls. This method will validate and may adjust 132 // javascript originated calls. This method will validate and may adjust
132 // the Event object before dispatching. 133 // the Event object before dispatching.
133 bool dispatchEventForBindings(PassRefPtrWillBeRawPtr<Event>, ExceptionState& ); 134 bool dispatchEventForBindings(PassRefPtrWillBeRawPtr<Event>, ExceptionState& );
134 virtual void uncaughtExceptionInEventHandler(); 135 virtual void uncaughtExceptionInEventHandler();
135 136
136 // Used for legacy "onEvent" attribute APIs. 137 // Used for legacy "onEvent" attribute APIs.
137 bool setAttributeEventListener(const AtomicString& eventType, PassRefPtr<Eve ntListener>); 138 bool setAttributeEventListener(const AtomicString& eventType, PassRefPtr<Eve ntListener>);
138 EventListener* getAttributeEventListener(const AtomicString& eventType); 139 EventListener* getAttributeEventListener(const AtomicString& eventType);
139 140
140 bool hasEventListeners() const; 141 bool hasEventListeners() const;
141 bool hasEventListeners(const AtomicString& eventType) const; 142 bool hasEventListeners(const AtomicString& eventType) const;
142 bool hasCapturingEventListeners(const AtomicString& eventType); 143 bool hasCapturingEventListeners(const AtomicString& eventType);
143 const EventListenerVector& getEventListeners(const AtomicString& eventType); 144 const EventListenerVector& getEventListeners(const AtomicString& eventType);
144 Vector<AtomicString> eventTypes(); 145 Vector<AtomicString> eventTypes();
145 146
146 bool fireEventListeners(Event*); 147 bool fireEventListeners(Event*);
147 148
148 DEFINE_INLINE_VIRTUAL_TRACE() { } 149 DEFINE_INLINE_VIRTUAL_TRACE() { }
149 150
150 virtual bool keepEventInNode(Event*) { return false; } 151 virtual bool keepEventInNode(Event*) { return false; }
151 152
152 protected: 153 protected:
153 EventTarget(); 154 EventTarget();
154 155
156 virtual bool dispatchEventInternal(PassRefPtrWillBeRawPtr<Event>);
157
155 // Subclasses should likely not override these themselves; instead, they sho uld subclass EventTargetWithInlineData. 158 // Subclasses should likely not override these themselves; instead, they sho uld subclass EventTargetWithInlineData.
156 virtual EventTargetData* eventTargetData() = 0; 159 virtual EventTargetData* eventTargetData() = 0;
157 virtual EventTargetData& ensureEventTargetData() = 0; 160 virtual EventTargetData& ensureEventTargetData() = 0;
158 161
159 private: 162 private:
160 #if !ENABLE(OILPAN) 163 #if !ENABLE(OILPAN)
161 // Subclasses should likely not override these themselves; instead, they sho uld use the REFCOUNTED_EVENT_TARGET() macro. 164 // Subclasses should likely not override these themselves; instead, they sho uld use the REFCOUNTED_EVENT_TARGET() macro.
162 virtual void refEventTarget() = 0; 165 virtual void refEventTarget() = 0;
163 virtual void derefEventTarget() = 0; 166 virtual void derefEventTarget() = 0;
164 #endif 167 #endif
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 using baseClass::deref; \ 300 using baseClass::deref; \
298 private: \ 301 private: \
299 void refEventTarget() final { ref(); } \ 302 void refEventTarget() final { ref(); } \
300 void derefEventTarget() final { deref(); } \ 303 void derefEventTarget() final { deref(); } \
301 typedef int thisIsHereToForceASemiColonAfterThisEventTargetMacro 304 typedef int thisIsHereToForceASemiColonAfterThisEventTargetMacro
302 #define REFCOUNTED_EVENT_TARGET(baseClass) DEFINE_EVENT_TARGET_REFCOUNTING(RefCo unted<baseClass>) 305 #define REFCOUNTED_EVENT_TARGET(baseClass) DEFINE_EVENT_TARGET_REFCOUNTING(RefCo unted<baseClass>)
303 #define REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(baseClass) DEFINE_EVENT_TARGET _REFCOUNTING(RefCountedGarbageCollected<baseClass>) 306 #define REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(baseClass) DEFINE_EVENT_TARGET _REFCOUNTING(RefCountedGarbageCollected<baseClass>)
304 #endif // ENABLE(OILPAN) 307 #endif // ENABLE(OILPAN)
305 308
306 #endif // EventTarget_h 309 #endif // EventTarget_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698