| 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 "core/frame/EventHandlerRegistry.h" | 5 #include "core/frame/EventHandlerRegistry.h" |
| 6 | 6 |
| 7 #include "core/events/EventListenerOptions.h" | 7 #include "core/events/EventListenerOptions.h" |
| 8 #include "core/events/EventUtil.h" | 8 #include "core/events/EventUtil.h" |
| 9 #include "core/frame/LocalDOMWindow.h" | 9 #include "core/frame/LocalDOMWindow.h" |
| 10 #include "core/frame/LocalFrame.h" | 10 #include "core/frame/LocalFrame.h" |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 } | 184 } |
| 185 | 185 |
| 186 void EventHandlerRegistry::didMoveOutOfFrameHost(EventTarget& target) { | 186 void EventHandlerRegistry::didMoveOutOfFrameHost(EventTarget& target) { |
| 187 didRemoveAllEventHandlers(target); | 187 didRemoveAllEventHandlers(target); |
| 188 } | 188 } |
| 189 | 189 |
| 190 void EventHandlerRegistry::didMoveBetweenFrameHosts(EventTarget& target, | 190 void EventHandlerRegistry::didMoveBetweenFrameHosts(EventTarget& target, |
| 191 FrameHost* oldFrameHost, | 191 FrameHost* oldFrameHost, |
| 192 FrameHost* newFrameHost) { | 192 FrameHost* newFrameHost) { |
| 193 ASSERT(newFrameHost != oldFrameHost); | 193 ASSERT(newFrameHost != oldFrameHost); |
| 194 for (size_t i = 0; i < EventHandlerClassCount; ++i) { | 194 oldFrameHost->eventHandlerRegistry().didMoveOutOfFrameHost(target); |
| 195 EventHandlerClass handlerClass = static_cast<EventHandlerClass>(i); | 195 newFrameHost->eventHandlerRegistry().didMoveIntoFrameHost(target); |
| 196 const EventTargetSet* targets = | |
| 197 &oldFrameHost->eventHandlerRegistry().m_targets[handlerClass]; | |
| 198 for (unsigned count = targets->count(&target); count > 0; --count) | |
| 199 newFrameHost->eventHandlerRegistry().didAddEventHandler(target, | |
| 200 handlerClass); | |
| 201 } | |
| 202 oldFrameHost->eventHandlerRegistry().didRemoveAllEventHandlers(target); | |
| 203 } | 196 } |
| 204 | 197 |
| 205 void EventHandlerRegistry::didRemoveAllEventHandlers(EventTarget& target) { | 198 void EventHandlerRegistry::didRemoveAllEventHandlers(EventTarget& target) { |
| 206 for (size_t i = 0; i < EventHandlerClassCount; ++i) { | 199 for (size_t i = 0; i < EventHandlerClassCount; ++i) { |
| 207 EventHandlerClass handlerClass = static_cast<EventHandlerClass>(i); | 200 EventHandlerClass handlerClass = static_cast<EventHandlerClass>(i); |
| 208 updateEventHandlerInternal(RemoveAll, handlerClass, &target); | 201 updateEventHandlerInternal(RemoveAll, handlerClass, &target); |
| 209 } | 202 } |
| 210 } | 203 } |
| 211 | 204 |
| 212 void EventHandlerRegistry::notifyHasHandlersChanged( | 205 void EventHandlerRegistry::notifyHasHandlersChanged( |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 ASSERT(window->frame()); | 321 ASSERT(window->frame()); |
| 329 ASSERT(window->frame()->host()); | 322 ASSERT(window->frame()->host()); |
| 330 ASSERT(window->frame()->host() == m_frameHost); | 323 ASSERT(window->frame()->host() == m_frameHost); |
| 331 } | 324 } |
| 332 } | 325 } |
| 333 } | 326 } |
| 334 #endif // ENABLE(ASSERT) | 327 #endif // ENABLE(ASSERT) |
| 335 } | 328 } |
| 336 | 329 |
| 337 } // namespace blink | 330 } // namespace blink |
| OLD | NEW |