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/CoreExport.h" | 8 #include "core/CoreExport.h" |
9 #include "core/frame/FrameHost.h" | 9 #include "core/frame/FrameHost.h" |
10 #include "wtf/HashCountedSet.h" | 10 #include "wtf/HashCountedSet.h" |
(...skipping 12 matching lines...) Expand all Loading... | |
23 public: | 23 public: |
24 explicit EventHandlerRegistry(FrameHost&); | 24 explicit EventHandlerRegistry(FrameHost&); |
25 virtual ~EventHandlerRegistry(); | 25 virtual ~EventHandlerRegistry(); |
26 | 26 |
27 // Supported event handler classes. Note that each one may correspond to | 27 // Supported event handler classes. Note that each one may correspond to |
28 // multiple event types. | 28 // multiple event types. |
29 enum EventHandlerClass { | 29 enum EventHandlerClass { |
30 ScrollEvent, | 30 ScrollEvent, |
31 WheelEvent, | 31 WheelEvent, |
32 TouchEvent, | 32 TouchEvent, |
33 PointerEvent, | |
33 #if ENABLE(ASSERT) | 34 #if ENABLE(ASSERT) |
34 // Additional event categories for verifying handler tracking logic. | 35 // Additional event categories for verifying handler tracking logic. |
35 EventsForTesting, | 36 EventsForTesting, |
36 #endif | 37 #endif |
37 EventHandlerClassCount, // Must be the last entry. | 38 EventHandlerClassCount, // Must be the last entry. |
38 }; | 39 }; |
39 | 40 |
40 // Returns true if the FrameHost has event handlers of the specified class. | 41 // Returns true if the FrameHost has event handlers of the specified class. |
41 bool hasEventHandlers(EventHandlerClass) const; | 42 bool hasEventHandlers(EventHandlerClass) const; |
42 | 43 |
(...skipping 21 matching lines...) Expand all Loading... | |
64 void clearWeakMembers(Visitor*); | 65 void clearWeakMembers(Visitor*); |
65 | 66 |
66 private: | 67 private: |
67 enum ChangeOperation { | 68 enum ChangeOperation { |
68 Add, // Add a new event handler. | 69 Add, // Add a new event handler. |
69 Remove, // Remove an existing event handler. | 70 Remove, // Remove an existing event handler. |
70 RemoveAll // Remove any and all existing event handlers for a given targ et. | 71 RemoveAll // Remove any and all existing event handlers for a given targ et. |
71 }; | 72 }; |
72 | 73 |
73 // Returns true if |eventType| belongs to a class this registry tracks. | 74 // Returns true if |eventType| belongs to a class this registry tracks. |
74 static bool eventTypeToClass(const AtomicString& eventType, EventHandlerClas s* result); | 75 static bool eventTypeToClass(const AtomicString& eventType, EventHandlerClas s* result); |
USE eero AT chromium.org
2015/06/09 18:51:02
You have not extended the eventTypeToClass functio
| |
75 | 76 |
76 // Returns true if the operation actually added a new target or completely | 77 // Returns true if the operation actually added a new target or completely |
77 // removed an existing one. | 78 // removed an existing one. |
78 bool updateEventHandlerTargets(ChangeOperation, EventHandlerClass, EventTarg et*); | 79 bool updateEventHandlerTargets(ChangeOperation, EventHandlerClass, EventTarg et*); |
79 | 80 |
80 // Called on the EventHandlerRegistry of the root Document to notify | 81 // Called on the EventHandlerRegistry of the root Document to notify |
81 // clients when we have added the first handler or removed the last one for | 82 // clients when we have added the first handler or removed the last one for |
82 // a given event class. |hasActiveHandlers| can be used to distinguish | 83 // a given event class. |hasActiveHandlers| can be used to distinguish |
83 // between the two cases. | 84 // between the two cases. |
84 void notifyHasHandlersChanged(EventHandlerClass, bool hasActiveHandlers); | 85 void notifyHasHandlersChanged(EventHandlerClass, bool hasActiveHandlers); |
(...skipping 13 matching lines...) Expand all Loading... | |
98 | 99 |
99 void checkConsistency() const; | 100 void checkConsistency() const; |
100 | 101 |
101 FrameHost& m_frameHost; | 102 FrameHost& m_frameHost; |
102 EventTargetSet m_targets[EventHandlerClassCount]; | 103 EventTargetSet m_targets[EventHandlerClassCount]; |
103 }; | 104 }; |
104 | 105 |
105 } // namespace blink | 106 } // namespace blink |
106 | 107 |
107 #endif // EventHandlerRegistry_h | 108 #endif // EventHandlerRegistry_h |
OLD | NEW |