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

Side by Side Diff: Source/core/dom/EventHandlerRegistry.h

Issue 237963014: Track scroll event handlers in nested documents (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Address comments. Created 6 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 | Annotate | Revision Log
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/dom/ActiveDOMObject.h"
8 #include "core/dom/DocumentSupplementable.h" 9 #include "core/dom/DocumentSupplementable.h"
9 #include "core/events/Event.h" 10 #include "core/events/Event.h"
10 #include "wtf/HashCountedSet.h" 11 #include "wtf/HashCountedSet.h"
11 12
12 namespace WebCore { 13 namespace WebCore {
13 14
14 typedef HashCountedSet<EventTarget*> EventTargetSet; 15 typedef HashCountedSet<EventTarget*> EventTargetSet;
15 16
16 // Registry for keeping track of event handlers. Handlers can either be 17 // Registry for keeping track of event handlers. Handlers can either be
17 // associated with an EventTarget or be "external" handlers which live outside 18 // associated with an EventTarget or be "external" handlers which live outside
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 // a given event class. |hasActiveHandlers| can be used to distinguish 72 // a given event class. |hasActiveHandlers| can be used to distinguish
72 // between the two cases. 73 // between the two cases.
73 void notifyHasHandlersChanged(EventHandlerClass, bool hasActiveHandlers); 74 void notifyHasHandlersChanged(EventHandlerClass, bool hasActiveHandlers);
74 75
75 // Record a change operation to a given event handler class and notify any 76 // Record a change operation to a given event handler class and notify any
76 // parent registry and other clients accordingly. 77 // parent registry and other clients accordingly.
77 void updateEventHandlerOfType(ChangeOperation, const AtomicString& eventType , EventTarget*); 78 void updateEventHandlerOfType(ChangeOperation, const AtomicString& eventType , EventTarget*);
78 79
79 void updateEventHandlerInternal(ChangeOperation, EventHandlerClass, EventTar get*); 80 void updateEventHandlerInternal(ChangeOperation, EventHandlerClass, EventTar get*);
80 81
82 class DocumentObserver: public ActiveDOMObject {
abarth-chromium 2014/04/22 23:40:26 I still don't understand why we're using ActiveDOM
Sami 2014/04/23 10:02:35 Sorry if that wasn't clear. The reason is that whe
83 public:
84 explicit DocumentObserver(Document&);
85 virtual ~DocumentObserver();
86
87 // Inherited from ActiveDOMObject
88 virtual void stop() OVERRIDE;
89 };
90
81 struct HandlerState { 91 struct HandlerState {
82 HandlerState(); 92 HandlerState();
83 ~HandlerState(); 93 ~HandlerState();
84 94
85 OwnPtr<EventTargetSet> targets; 95 OwnPtr<EventTargetSet> targets;
86 }; 96 };
87 97
88 Document& m_document; 98 Document& m_document;
89 HandlerState m_eventHandlers[EventHandlerClassCount]; 99 HandlerState m_eventHandlers[EventHandlerClassCount];
100
101 DocumentObserver m_documentObserver;
90 }; 102 };
91 103
92 } // namespace WebCore 104 } // namespace WebCore
93 105
94 #endif // EventHandlerRegistry_h 106 #endif // EventHandlerRegistry_h
OLDNEW
« no previous file with comments | « LayoutTests/fast/events/scroll-event-handler-count-expected.txt ('k') | Source/core/dom/EventHandlerRegistry.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698