OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 #ifndef EventHandlerRegistry_h | |
5 #define EventHandlerRegistry_h | |
6 | |
7 #include "core/dom/DocumentSupplementable.h" | |
8 #include "core/events/Event.h" | |
9 #include "core/frame/DOMWindowLifecycleObserver.h" | |
10 #include "wtf/HashCountedSet.h" | |
11 | |
12 namespace WebCore { | |
13 | |
14 class DOMWindow; | |
15 | |
16 typedef HashCountedSet<Node*> TouchEventTargetSet; | |
17 | |
18 class EventHandlerRegistry FINAL : public DocumentSupplement, public DOMWindowLi fecycleObserver { | |
Rick Byers
2014/03/24 14:27:59
I really like the fact that you're unifying this e
| |
19 public: | |
20 virtual ~EventHandlerRegistry(); | |
21 | |
22 static const char* supplementName(); | |
23 static EventHandlerRegistry* from(Document&); | |
24 | |
25 unsigned scrollEventHandlerCount() const { return m_scrollEventHandlerCount; } | |
26 unsigned wheelEventHandlerCount() const { return m_wheelEventHandlerCount; } | |
27 | |
28 // Node: Handlers added/removed from the DOMWindow are reported as the Docum ent. | |
29 const TouchEventTargetSet* touchEventTargets() const { return m_touchEventTa rgets.get(); } | |
30 | |
31 static void didRemoveAllEventHandlers(Node&); | |
32 static void didMoveNodeToNewDocument(Node&, Document& oldDocument); | |
33 | |
34 void didAddEventHandler(Document&, const AtomicString&, Node*); | |
35 void didRemoveEventHandler(Document&, const AtomicString&, Node*); | |
36 | |
37 // Inherited from DOMWindowLifecycleObserver | |
38 virtual void didAddEventListener(DOMWindow*, const AtomicString&) OVERRIDE; | |
39 virtual void didRemoveEventListener(DOMWindow*, const AtomicString&) OVERRID E; | |
40 | |
41 private: | |
42 explicit EventHandlerRegistry(Document&); | |
43 | |
44 void didChangeWheelEventHandlerCount(Document&, int delta); | |
45 void didChangeScrollEventHandlerCount(Document&, int delta); | |
46 | |
47 void didAddTouchEventHandler(Document&, Node&); | |
48 void didRemoveTouchEventHandler(Document&, Node&, bool clearAll); | |
49 | |
50 enum ChangeOperation { Added, Removed, RemovedAll }; | |
51 static void didChangeAllEventHandlers(Node&, Document&, ChangeOperation); | |
52 | |
53 unsigned m_scrollEventHandlerCount; | |
54 unsigned m_wheelEventHandlerCount; | |
55 OwnPtr<TouchEventTargetSet> m_touchEventTargets; | |
56 }; | |
57 | |
58 } // namespace WebCore | |
59 | |
60 #endif // EventHandlerRegistry_h | |
OLD | NEW |