| Index: Source/core/page/EventHandlerRegistry.h
|
| diff --git a/Source/core/dom/EventHandlerRegistry.h b/Source/core/page/EventHandlerRegistry.h
|
| similarity index 72%
|
| rename from Source/core/dom/EventHandlerRegistry.h
|
| rename to Source/core/page/EventHandlerRegistry.h
|
| index dde20641c428ccdc74705796c5dd65ab488f28c9..daf6e9f1d2356d55d562831b59a8696cbddead6c 100644
|
| --- a/Source/core/dom/EventHandlerRegistry.h
|
| +++ b/Source/core/page/EventHandlerRegistry.h
|
| @@ -5,18 +5,16 @@
|
| #ifndef EventHandlerRegistry_h
|
| #define EventHandlerRegistry_h
|
|
|
| -#include "core/dom/DocumentSupplementable.h"
|
| #include "core/events/Event.h"
|
| +#include "core/page/Page.h"
|
| #include "wtf/HashCountedSet.h"
|
|
|
| namespace WebCore {
|
|
|
| typedef HashCountedSet<EventTarget*> EventTargetSet;
|
|
|
| -// Registry for keeping track of event handlers. Handlers can either be
|
| -// associated with an EventTarget or be "external" handlers which live outside
|
| -// the DOM (e.g., WebViewImpl).
|
| -class EventHandlerRegistry FINAL : public DocumentSupplement {
|
| +// Registry for keeping track of event handlers.
|
| +class EventHandlerRegistry FINAL : public Supplement<Page> {
|
| public:
|
| virtual ~EventHandlerRegistry();
|
|
|
| @@ -28,16 +26,12 @@ public:
|
| };
|
|
|
| static const char* supplementName();
|
| - static EventHandlerRegistry* from(Document&);
|
| + static EventHandlerRegistry* from(Page&);
|
|
|
| - // Returns true if the host Document or any child documents have any
|
| - // registered event handlers of the class.
|
| + // Returns true if the page has event handlers of the specified class.
|
| bool hasEventHandlers(EventHandlerClass) const;
|
|
|
| - // Returns a set of EventTargets which have registered handlers of the
|
| - // given class. Only contains targets directly in this document; all
|
| - // handlers in a child Document are collapsed to a single respective
|
| - // Document instance in the set.
|
| + // Returns a set of EventTargets which have registered handlers of the given class.
|
| const EventTargetSet* eventHandlerTargets(EventHandlerClass) const;
|
|
|
| // Registration and management of event handlers attached to EventTargets.
|
| @@ -45,13 +39,14 @@ public:
|
| void didAddEventHandler(EventTarget&, EventHandlerClass);
|
| void didRemoveEventHandler(EventTarget&, const AtomicString& eventType);
|
| void didRemoveEventHandler(EventTarget&, EventHandlerClass);
|
| - void didMoveFromOtherDocument(EventTarget&, Document& oldDocument);
|
| void didRemoveAllEventHandlers(EventTarget&);
|
| + void didMoveIntoPage(EventTarget&);
|
| + void didMoveOutOfPage(EventTarget&);
|
|
|
| virtual void trace(Visitor*) OVERRIDE { }
|
|
|
| private:
|
| - explicit EventHandlerRegistry(Document&);
|
| + explicit EventHandlerRegistry(Page&);
|
|
|
| enum ChangeOperation {
|
| Add, // Add a new event handler.
|
| @@ -78,15 +73,10 @@ private:
|
|
|
| void updateEventHandlerInternal(ChangeOperation, EventHandlerClass, EventTarget*);
|
|
|
| - struct HandlerState {
|
| - HandlerState();
|
| - ~HandlerState();
|
| + void updateAllEventHandlers(ChangeOperation, EventTarget&);
|
|
|
| - OwnPtr<EventTargetSet> targets;
|
| - };
|
| -
|
| - Document& m_document;
|
| - HandlerState m_eventHandlers[EventHandlerClassCount];
|
| + Page& m_page;
|
| + EventTargetSet m_targets[EventHandlerClassCount];
|
| };
|
|
|
| } // namespace WebCore
|
|
|