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

Unified Diff: third_party/WebKit/Source/core/events/EventTarget.h

Issue 1479923002: Enumerate the return value of dispatchEvent so it is clear. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master_passive_uma_add
Patch Set: Add back the EventDispatchResult enum Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/events/EventTarget.h
diff --git a/third_party/WebKit/Source/core/events/EventTarget.h b/third_party/WebKit/Source/core/events/EventTarget.h
index 5f56ecb04adcf376f578f59ca61a2f76aede39e3..15cf5fa9415a6bf30b56e0c4cfdb1037497a943c 100644
--- a/third_party/WebKit/Source/core/events/EventTarget.h
+++ b/third_party/WebKit/Source/core/events/EventTarget.h
@@ -114,6 +114,17 @@ public:
class CORE_EXPORT EventTarget : public NoBaseWillBeGarbageCollectedFinalized<EventTarget>, public ScriptWrappable {
DEFINE_WRAPPERTYPEINFO();
public:
+ enum class DispatchEventResult {
tkent 2016/02/22 01:40:22 nit: You may move this out from EventTarget for co
dtapuska 2016/02/23 19:14:40 Done.
+ // Event was not consumed by application or system.
+ NotHandled,
philipj_slow 2016/02/22 07:30:18 In order to bring this closer to the https://dom.s
Rick Byers 2016/02/22 15:16:14 +1. This is the place to describe how we want the
dtapuska 2016/02/23 19:14:40 Done.
dtapuska 2016/02/23 19:14:40 Done.
+ // Event was consumed but suppressed before dispatched to application.
+ HandledSuppressed,
+ // Event was consumed by application itself; ie. a script handler calling preventDefault.
+ HandledApplication,
+ // Event was consumed by the system; ie. executing the default action.
+ HandledSystem,
+ };
+
virtual ~EventTarget();
#if !ENABLE(OILPAN)
@@ -138,7 +149,7 @@ public:
bool removeEventListener(const AtomicString& eventType, PassRefPtrWillBeRawPtr<EventListener>, EventListenerOptions&);
virtual void removeAllEventListeners();
- bool dispatchEvent(PassRefPtrWillBeRawPtr<Event>);
+ EventTarget::DispatchEventResult dispatchEvent(PassRefPtrWillBeRawPtr<Event>);
// dispatchEventForBindings is intended to only be called from
// javascript originated calls. This method will validate and may adjust
@@ -156,7 +167,7 @@ public:
EventListenerVector* getEventListeners(const AtomicString& eventType);
Vector<AtomicString> eventTypes();
- bool fireEventListeners(Event*);
+ EventTarget::DispatchEventResult fireEventListeners(Event*);
DEFINE_INLINE_VIRTUAL_TRACE() { }
@@ -167,7 +178,7 @@ protected:
virtual bool addEventListenerInternal(const AtomicString& eventType, PassRefPtrWillBeRawPtr<EventListener>, const EventListenerOptions&);
virtual bool removeEventListenerInternal(const AtomicString& eventType, PassRefPtrWillBeRawPtr<EventListener>, const EventListenerOptions&);
- virtual bool dispatchEventInternal(PassRefPtrWillBeRawPtr<Event>);
+ virtual EventTarget::DispatchEventResult dispatchEventInternal(PassRefPtrWillBeRawPtr<Event>);
// Subclasses should likely not override these themselves; instead, they should subclass EventTargetWithInlineData.
virtual EventTargetData* eventTargetData() = 0;

Powered by Google App Engine
This is Rietveld 408576698