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 #include "config.h" | 5 #include "config.h" |
6 #include "core/frame/EventHandlerRegistry.h" | 6 #include "core/frame/EventHandlerRegistry.h" |
7 | 7 |
8 #include "core/events/ThreadLocalEventNames.h" | 8 #include "core/events/ThreadLocalEventNames.h" |
9 #include "core/frame/DOMWindow.h" | 9 #include "core/frame/DOMWindow.h" |
10 #include "core/frame/LocalFrame.h" | 10 #include "core/frame/LocalFrame.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 EventHandlerRegistry::~EventHandlerRegistry() | 22 EventHandlerRegistry::~EventHandlerRegistry() |
23 { | 23 { |
24 checkConsistency(); | 24 checkConsistency(); |
25 } | 25 } |
26 | 26 |
27 bool EventHandlerRegistry::eventTypeToClass(const AtomicString& eventType, Event
HandlerClass* result) | 27 bool EventHandlerRegistry::eventTypeToClass(const AtomicString& eventType, Event
HandlerClass* result) |
28 { | 28 { |
29 if (eventType == EventTypeNames::scroll) { | 29 if (eventType == EventTypeNames::scroll) { |
30 *result = ScrollEvent; | 30 *result = ScrollEvent; |
| 31 } else if (eventType == EventTypeNames::wheel || eventType == EventTypeNames
::mousewheel) { |
| 32 *result = WheelEvent; |
31 #if ASSERT_ENABLED | 33 #if ASSERT_ENABLED |
32 } else if (eventType == EventTypeNames::load || eventType == EventTypeNames:
:mousemove || eventType == EventTypeNames::touchstart) { | 34 } else if (eventType == EventTypeNames::load || eventType == EventTypeNames:
:mousemove || eventType == EventTypeNames::touchstart) { |
33 *result = EventsForTesting; | 35 *result = EventsForTesting; |
34 #endif | 36 #endif |
35 } else { | 37 } else { |
36 return false; | 38 return false; |
37 } | 39 } |
38 return true; | 40 return true; |
39 } | 41 } |
40 | 42 |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 continue; | 150 continue; |
149 } | 151 } |
150 for (unsigned count = target.getEventListeners(eventTypes[i]).size(); co
unt > 0; --count) | 152 for (unsigned count = target.getEventListeners(eventTypes[i]).size(); co
unt > 0; --count) |
151 updateEventHandlerInternal(op, handlerClass, &target); | 153 updateEventHandlerInternal(op, handlerClass, &target); |
152 } | 154 } |
153 } | 155 } |
154 | 156 |
155 void EventHandlerRegistry::notifyHasHandlersChanged(EventHandlerClass handlerCla
ss, bool hasActiveHandlers) | 157 void EventHandlerRegistry::notifyHasHandlersChanged(EventHandlerClass handlerCla
ss, bool hasActiveHandlers) |
156 { | 158 { |
157 ScrollingCoordinator* scrollingCoordinator = m_frameHost.page().scrollingCoo
rdinator(); | 159 ScrollingCoordinator* scrollingCoordinator = m_frameHost.page().scrollingCoo
rdinator(); |
| 160 LocalFrame* mainFrame = m_frameHost.page().mainFrame(); |
158 | 161 |
159 switch (handlerClass) { | 162 switch (handlerClass) { |
160 case ScrollEvent: | 163 case ScrollEvent: |
161 if (scrollingCoordinator) | 164 if (scrollingCoordinator) |
162 scrollingCoordinator->updateHaveScrollEventHandlers(); | 165 scrollingCoordinator->updateHaveScrollEventHandlers(); |
163 break; | 166 break; |
| 167 case WheelEvent: |
| 168 if (mainFrame) { |
| 169 // FIXME: This notification is wired up to a black hole, so remove i
t. |
| 170 mainFrame->notifyChromeClientWheelEventHandlerCountChanged(); |
| 171 } |
| 172 if (scrollingCoordinator) |
| 173 scrollingCoordinator->updateHaveWheelEventHandlers(); |
| 174 break; |
164 #if ASSERT_ENABLED | 175 #if ASSERT_ENABLED |
165 case EventsForTesting: | 176 case EventsForTesting: |
166 break; | 177 break; |
167 #endif | 178 #endif |
168 default: | 179 default: |
169 ASSERT_NOT_REACHED(); | 180 ASSERT_NOT_REACHED(); |
170 break; | 181 break; |
171 } | 182 } |
172 } | 183 } |
173 | 184 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 ASSERT(window->frame()); | 251 ASSERT(window->frame()); |
241 ASSERT(window->frame()->host()); | 252 ASSERT(window->frame()->host()); |
242 ASSERT(window->frame()->host() == &m_frameHost); | 253 ASSERT(window->frame()->host() == &m_frameHost); |
243 } | 254 } |
244 } | 255 } |
245 } | 256 } |
246 #endif // ASSERT_ENABLED | 257 #endif // ASSERT_ENABLED |
247 } | 258 } |
248 | 259 |
249 } // namespace WebCore | 260 } // namespace WebCore |
OLD | NEW |