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..2d22c16a80e4706f20cf6987a17ec1bc385f16ca 100644 |
--- a/third_party/WebKit/Source/core/events/EventTarget.h |
+++ b/third_party/WebKit/Source/core/events/EventTarget.h |
@@ -79,6 +79,23 @@ public: |
OwnPtr<FiringEventIteratorVector> firingEventIterators; |
}; |
+enum class DispatchEventResult { |
+ // Event was not canceled by event handler or default event handler. |
+ NotCanceled, |
+ // Event was canceled by event handler; ie. a script handler calling preventDefault. |
philipj_slow
2016/02/25 04:21:27
i.e. is a much more common spelling, in Source/cor
dtapuska
2016/02/25 14:20:24
Done.
|
+ CanceledByEventHandler, |
+ // Event was canceled by the default event handler; ie. executing the default action. |
+ // This result should be used sparingly as it deviates from the DOM Event Dispatch |
+ // model. Default event handlers really shouldn't be invoked inside of dispatch. |
+ CanceledByDefaultEventHandler, |
+ // Event was canceled but suppressed before dispatched to event handler. |
+ // This result should be used sparingly; and likely its usage likely indicates |
philipj_slow
2016/02/25 04:21:27
two likely
dtapuska
2016/02/25 14:20:24
Done.
|
+ // there is potential for a bug. Trusted events may return this code; but untrusted |
+ // events likely should always execute the event handler the developer intends to |
+ // execute. |
+ 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 +155,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 +173,7 @@ public: |
EventListenerVector* getEventListeners(const AtomicString& eventType); |
Vector<AtomicString> eventTypes(); |
- bool fireEventListeners(Event*); |
+ DispatchEventResult fireEventListeners(Event*); |
DEFINE_INLINE_VIRTUAL_TRACE() { } |
@@ -167,7 +184,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; |