| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
| 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ights reserved. | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ights reserved. |
| 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
| 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) | 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) |
| 8 * Copyright (C) 2011 Google Inc. All rights reserved. | 8 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 9 * | 9 * |
| 10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 #include "core/inspector/InspectorInstrumentation.h" | 34 #include "core/inspector/InspectorInstrumentation.h" |
| 35 #include "core/frame/FrameView.h" | 35 #include "core/frame/FrameView.h" |
| 36 #include "wtf/RefPtr.h" | 36 #include "wtf/RefPtr.h" |
| 37 | 37 |
| 38 namespace WebCore { | 38 namespace WebCore { |
| 39 | 39 |
| 40 static HashSet<Node*>* gNodesDispatchingSimulatedClicks = 0; | 40 static HashSet<Node*>* gNodesDispatchingSimulatedClicks = 0; |
| 41 | 41 |
| 42 bool EventDispatcher::dispatchEvent(Node* node, PassRefPtr<EventDispatchMediator
> mediator) | 42 bool EventDispatcher::dispatchEvent(Node* node, PassRefPtr<EventDispatchMediator
> mediator) |
| 43 { | 43 { |
| 44 TRACE_EVENT0("webkit", "EventDispatcher::dispatchEvent"); |
| 44 ASSERT(!NoEventDispatchAssertion::isEventDispatchForbidden()); | 45 ASSERT(!NoEventDispatchAssertion::isEventDispatchForbidden()); |
| 45 if (!mediator->event()) | 46 if (!mediator->event()) |
| 46 return true; | 47 return true; |
| 47 EventDispatcher dispatcher(node, mediator->event()); | 48 EventDispatcher dispatcher(node, mediator->event()); |
| 48 return mediator->dispatchEvent(&dispatcher); | 49 return mediator->dispatchEvent(&dispatcher); |
| 49 } | 50 } |
| 50 | 51 |
| 51 EventDispatcher::EventDispatcher(Node* node, PassRefPtr<Event> event) | 52 EventDispatcher::EventDispatcher(Node* node, PassRefPtr<Event> event) |
| 52 : m_node(node) | 53 : m_node(node) |
| 53 , m_event(event) | 54 , m_event(event) |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 node->setActive(false); | 93 node->setActive(false); |
| 93 | 94 |
| 94 // always send click | 95 // always send click |
| 95 EventDispatcher(node, SimulatedMouseEvent::create(EventTypeNames::click, nod
e->document().domWindow(), underlyingEvent)).dispatch(); | 96 EventDispatcher(node, SimulatedMouseEvent::create(EventTypeNames::click, nod
e->document().domWindow(), underlyingEvent)).dispatch(); |
| 96 | 97 |
| 97 gNodesDispatchingSimulatedClicks->remove(node); | 98 gNodesDispatchingSimulatedClicks->remove(node); |
| 98 } | 99 } |
| 99 | 100 |
| 100 bool EventDispatcher::dispatch() | 101 bool EventDispatcher::dispatch() |
| 101 { | 102 { |
| 103 TRACE_EVENT0("webkit", "EventDispatcher::dispatch"); |
| 104 |
| 102 #ifndef NDEBUG | 105 #ifndef NDEBUG |
| 103 ASSERT(!m_eventDispatched); | 106 ASSERT(!m_eventDispatched); |
| 104 m_eventDispatched = true; | 107 m_eventDispatched = true; |
| 105 #endif | 108 #endif |
| 106 ChildNodesLazySnapshot::takeChildNodesLazySnapshot(); | 109 ChildNodesLazySnapshot::takeChildNodesLazySnapshot(); |
| 107 | 110 |
| 108 m_event->setTarget(EventPath::eventTargetRespectingTargetRules(m_node.get())
); | 111 m_event->setTarget(EventPath::eventTargetRespectingTargetRules(m_node.get())
); |
| 109 ASSERT(!NoEventDispatchAssertion::isEventDispatchForbidden()); | 112 ASSERT(!NoEventDispatchAssertion::isEventDispatchForbidden()); |
| 110 ASSERT(m_event->target()); | 113 ASSERT(m_event->target()); |
| 111 WindowEventContext windowEventContext(m_event.get(), m_node.get(), topNodeEv
entContext()); | 114 WindowEventContext windowEventContext(m_event.get(), m_node.get(), topNodeEv
entContext()); |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 } | 219 } |
| 217 } | 220 } |
| 218 } | 221 } |
| 219 | 222 |
| 220 const NodeEventContext* EventDispatcher::topNodeEventContext() | 223 const NodeEventContext* EventDispatcher::topNodeEventContext() |
| 221 { | 224 { |
| 222 return m_event->eventPath().isEmpty() ? 0 : &m_event->eventPath().last(); | 225 return m_event->eventPath().isEmpty() ? 0 : &m_event->eventPath().last(); |
| 223 } | 226 } |
| 224 | 227 |
| 225 } | 228 } |
| OLD | NEW |