Chromium Code Reviews| 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..e59912d21f570b2663f7a28826efd8e201ffe422 100644 |
| --- a/third_party/WebKit/Source/core/events/EventTarget.h |
| +++ b/third_party/WebKit/Source/core/events/EventTarget.h |
| @@ -79,6 +79,17 @@ public: |
| OwnPtr<FiringEventIteratorVector> firingEventIterators; |
| }; |
| +enum class DispatchEventResult { |
| + // Event was not consumed by application or system. |
|
philipj_slow
2016/02/24 10:19:51
s/consumed/canceled/, s/application/event handler/
dtapuska
2016/02/24 22:14:16
Done.
|
| + NotCanceled, |
| + // Event was consumed by application itself; ie. a script handler calling preventDefault. |
| + CanceledByEventHandler, |
| + // Event was consumed by the system; ie. executing the default action. |
| + CanceledByDefaultEventHandler, |
|
philipj_slow
2016/02/24 10:19:51
Add stern warnings that these two should not be us
dtapuska
2016/02/24 22:14:16
Done.
|
| + // Event was consumed but suppressed before dispatched to application. |
| + CanceledBeforeDispatch, |
| +}; |
| + |
| // This is the base class for all DOM event targets. To make your class an |
| // EventTarget, follow these steps: |
| // - Make your IDL interface inherit from EventTarget. |
| @@ -138,7 +149,7 @@ public: |
| bool removeEventListener(const AtomicString& eventType, PassRefPtrWillBeRawPtr<EventListener>, EventListenerOptions&); |
| virtual void removeAllEventListeners(); |
| - bool dispatchEvent(PassRefPtrWillBeRawPtr<Event>); |
| + 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*); |
| + 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 DispatchEventResult dispatchEventInternal(PassRefPtrWillBeRawPtr<Event>); |
| // Subclasses should likely not override these themselves; instead, they should subclass EventTargetWithInlineData. |
| virtual EventTargetData* eventTargetData() = 0; |