| 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..bfa0611d320c217cea7ecf3408cbca850fb95ca1 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; i.e. a script handler calling preventDefault.
|
| + CanceledByEventHandler,
|
| + // Event was canceled by the default event handler; i.e. 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 its usage likely indicates
|
| + // 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;
|
|
|