OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef EventHandlerRegistry_h | 5 #ifndef EventHandlerRegistry_h |
6 #define EventHandlerRegistry_h | 6 #define EventHandlerRegistry_h |
7 | 7 |
8 #include "core/events/Event.h" | 8 #include "core/events/Event.h" |
9 #include "core/frame/FrameHost.h" | 9 #include "core/frame/FrameHost.h" |
10 #include "wtf/HashCountedSet.h" | 10 #include "wtf/HashCountedSet.h" |
11 | 11 |
12 namespace WebCore { | 12 namespace WebCore { |
13 | 13 |
14 typedef HashCountedSet<EventTarget*> EventTargetSet; | 14 typedef HashCountedSet<EventTarget*> EventTargetSet; |
15 | 15 |
16 // Registry for keeping track of event handlers. Note that only handlers on | 16 // Registry for keeping track of event handlers. Note that only handlers on |
17 // documents that can be rendered or can receive input (i.e., are attached to a | 17 // documents that can be rendered or can receive input (i.e., are attached to a |
18 // FrameHost) are registered here. | 18 // FrameHost) are registered here. |
19 class EventHandlerRegistry FINAL : public NoBaseWillBeGarbageCollectedFinalized<
EventHandlerRegistry> { | 19 class EventHandlerRegistry FINAL : public NoBaseWillBeGarbageCollectedFinalized<
EventHandlerRegistry> { |
20 public: | 20 public: |
21 explicit EventHandlerRegistry(FrameHost&); | 21 explicit EventHandlerRegistry(FrameHost&); |
22 virtual ~EventHandlerRegistry(); | 22 virtual ~EventHandlerRegistry(); |
23 | 23 |
24 // Supported event handler classes. Note that each one may correspond to | 24 // Supported event handler classes. Note that each one may correspond to |
25 // multiple event types. | 25 // multiple event types. |
26 enum EventHandlerClass { | 26 enum EventHandlerClass { |
27 ScrollEvent, | 27 ScrollEvent, |
| 28 WheelEvent, |
28 #if ASSERT_ENABLED | 29 #if ASSERT_ENABLED |
29 // Additional event categories for verifying handler tracking logic. | 30 // Additional event categories for verifying handler tracking logic. |
30 EventsForTesting, | 31 EventsForTesting, |
31 #endif | 32 #endif |
32 EventHandlerClassCount, // Must be the last entry. | 33 EventHandlerClassCount, // Must be the last entry. |
33 }; | 34 }; |
34 | 35 |
35 // Returns true if the FrameHost has event handlers of the specified class. | 36 // Returns true if the FrameHost has event handlers of the specified class. |
36 bool hasEventHandlers(EventHandlerClass) const; | 37 bool hasEventHandlers(EventHandlerClass) const; |
37 | 38 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 | 87 |
87 void checkConsistency() const; | 88 void checkConsistency() const; |
88 | 89 |
89 FrameHost& m_frameHost; | 90 FrameHost& m_frameHost; |
90 EventTargetSet m_targets[EventHandlerClassCount]; | 91 EventTargetSet m_targets[EventHandlerClassCount]; |
91 }; | 92 }; |
92 | 93 |
93 } // namespace WebCore | 94 } // namespace WebCore |
94 | 95 |
95 #endif // EventHandlerRegistry_h | 96 #endif // EventHandlerRegistry_h |
OLD | NEW |