Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(161)

Side by Side Diff: third_party/WebKit/Source/core/frame/EventHandlerRegistry.h

Issue 1884863003: Non passive touch end or touch cancel listeners should not block scroll. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adjust comments Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 14 matching lines...) Expand all
25 explicit EventHandlerRegistry(FrameHost&); 25 explicit EventHandlerRegistry(FrameHost&);
26 virtual ~EventHandlerRegistry(); 26 virtual ~EventHandlerRegistry();
27 27
28 // Supported event handler classes. Note that each one may correspond to 28 // Supported event handler classes. Note that each one may correspond to
29 // multiple event types. 29 // multiple event types.
30 enum EventHandlerClass { 30 enum EventHandlerClass {
31 ScrollEvent, 31 ScrollEvent,
32 WheelEventBlocking, 32 WheelEventBlocking,
33 WheelEventPassive, 33 WheelEventPassive,
34 TouchEventBlocking, 34 TouchEventBlocking,
35 TouchEventPassive, 35 TouchEventPassive,
Rick Byers 2016/04/14 01:41:41 Please rename these to TouchStartOrMove* for symme
dtapuska 2016/04/14 01:49:10 Do you want the WebEventListenerClass enum renamed
dtapuska 2016/04/14 14:41:11 Done.
36 TouchEndOrCancelEventBlocking,
37 TouchEndOrCancelEventPassive,
36 #if ENABLE(ASSERT) 38 #if ENABLE(ASSERT)
37 // Additional event categories for verifying handler tracking logic. 39 // Additional event categories for verifying handler tracking logic.
38 EventsForTesting, 40 EventsForTesting,
39 #endif 41 #endif
40 EventHandlerClassCount, // Must be the last entry. 42 EventHandlerClassCount, // Must be the last entry.
41 }; 43 };
42 44
43 // Returns true if the FrameHost has event handlers of the specified class. 45 // Returns true if the FrameHost has event handlers of the specified class.
44 bool hasEventHandlers(EventHandlerClass) const; 46 bool hasEventHandlers(EventHandlerClass) const;
45 47
(...skipping 27 matching lines...) Expand all
73 RemoveAll // Remove any and all existing event handlers for a given targ et. 75 RemoveAll // Remove any and all existing event handlers for a given targ et.
74 }; 76 };
75 77
76 // Returns true if |eventType| belongs to a class this registry tracks. 78 // Returns true if |eventType| belongs to a class this registry tracks.
77 static bool eventTypeToClass(const AtomicString& eventType, const EventListe nerOptions&, EventHandlerClass* result); 79 static bool eventTypeToClass(const AtomicString& eventType, const EventListe nerOptions&, EventHandlerClass* result);
78 80
79 // Returns true if the operation actually added a new target or completely 81 // Returns true if the operation actually added a new target or completely
80 // removed an existing one. 82 // removed an existing one.
81 bool updateEventHandlerTargets(ChangeOperation, EventHandlerClass, EventTarg et*); 83 bool updateEventHandlerTargets(ChangeOperation, EventHandlerClass, EventTarg et*);
82 84
85 // Update whether we have any touch handler or not.
86 void updateHasTouchEventListeners();
87
83 // Called on the EventHandlerRegistry of the root Document to notify 88 // Called on the EventHandlerRegistry of the root Document to notify
84 // clients when we have added the first handler or removed the last one for 89 // clients when we have added the first handler or removed the last one for
85 // a given event class. |hasActiveHandlers| can be used to distinguish 90 // a given event class. |hasActiveHandlers| can be used to distinguish
86 // between the two cases. 91 // between the two cases.
87 void notifyHasHandlersChanged(EventHandlerClass, bool hasActiveHandlers); 92 void notifyHasHandlersChanged(EventHandlerClass, bool hasActiveHandlers);
88 93
89 // Called to notify clients whenever a single event handler target is 94 // Called to notify clients whenever a single event handler target is
90 // registered or unregistered. If several handlers are registered for the 95 // registered or unregistered. If several handlers are registered for the
91 // same target, only the first registration will trigger this notification. 96 // same target, only the first registration will trigger this notification.
92 void notifyDidAddOrRemoveEventHandlerTarget(EventHandlerClass); 97 void notifyDidAddOrRemoveEventHandlerTarget(EventHandlerClass);
93 98
94 // Record a change operation to a given event handler class and notify any 99 // Record a change operation to a given event handler class and notify any
95 // parent registry and other clients accordingly. 100 // parent registry and other clients accordingly.
96 void updateEventHandlerOfType(ChangeOperation, const AtomicString& eventType , const EventListenerOptions&, EventTarget*); 101 void updateEventHandlerOfType(ChangeOperation, const AtomicString& eventType , const EventListenerOptions&, EventTarget*);
97 102
98 void updateEventHandlerInternal(ChangeOperation, EventHandlerClass, EventTar get*); 103 void updateEventHandlerInternal(ChangeOperation, EventHandlerClass, EventTar get*);
99 104
100 void updateAllEventHandlers(ChangeOperation, EventTarget&); 105 void updateAllEventHandlers(ChangeOperation, EventTarget&);
101 106
102 void checkConsistency() const; 107 void checkConsistency() const;
103 108
104 Member<FrameHost> m_frameHost; 109 Member<FrameHost> m_frameHost;
105 EventTargetSet m_targets[EventHandlerClassCount]; 110 EventTargetSet m_targets[EventHandlerClassCount];
106 }; 111 };
107 112
108 } // namespace blink 113 } // namespace blink
109 114
110 #endif // EventHandlerRegistry_h 115 #endif // EventHandlerRegistry_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698