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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 ASSERT(!NoEventDispatchAssertion::isEventDispatchForbidden()); | 46 ASSERT(!NoEventDispatchAssertion::isEventDispatchForbidden()); |
47 if (!mediator->event()) | 47 if (!mediator->event()) |
48 return true; | 48 return true; |
49 EventDispatcher dispatcher(node, mediator->event()); | 49 EventDispatcher dispatcher(node, mediator->event()); |
50 return mediator->dispatchEvent(&dispatcher); | 50 return mediator->dispatchEvent(&dispatcher); |
51 } | 51 } |
52 | 52 |
53 EventDispatcher::EventDispatcher(Node* node, PassRefPtrWillBeRawPtr<Event> event
) | 53 EventDispatcher::EventDispatcher(Node* node, PassRefPtrWillBeRawPtr<Event> event
) |
54 : m_node(node) | 54 : m_node(node) |
55 , m_event(event) | 55 , m_event(event) |
56 #ifndef NDEBUG | 56 #if ENABLE(ASSERT) |
57 , m_eventDispatched(false) | 57 , m_eventDispatched(false) |
58 #endif | 58 #endif |
59 { | 59 { |
60 ASSERT(node); | 60 ASSERT(node); |
61 ASSERT(m_event.get()); | 61 ASSERT(m_event.get()); |
62 ASSERT(!m_event->type().isNull()); // JavaScript code can create an event wi
th an empty name, but not null. | 62 ASSERT(!m_event->type().isNull()); // JavaScript code can create an event wi
th an empty name, but not null. |
63 m_view = node->document().view(); | 63 m_view = node->document().view(); |
64 m_event->ensureEventPath().resetWith(m_node.get()); | 64 m_event->ensureEventPath().resetWith(m_node.get()); |
65 } | 65 } |
66 | 66 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 // always send click | 101 // always send click |
102 EventDispatcher(node, SimulatedMouseEvent::create(EventTypeNames::click, nod
e->document().domWindow(), underlyingEvent)).dispatch(); | 102 EventDispatcher(node, SimulatedMouseEvent::create(EventTypeNames::click, nod
e->document().domWindow(), underlyingEvent)).dispatch(); |
103 | 103 |
104 nodesDispatchingSimulatedClicks->remove(node); | 104 nodesDispatchingSimulatedClicks->remove(node); |
105 } | 105 } |
106 | 106 |
107 bool EventDispatcher::dispatch() | 107 bool EventDispatcher::dispatch() |
108 { | 108 { |
109 TRACE_EVENT0("blink", "EventDispatcher::dispatch"); | 109 TRACE_EVENT0("blink", "EventDispatcher::dispatch"); |
110 | 110 |
111 #ifndef NDEBUG | 111 #if ENABLE(ASSERT) |
112 ASSERT(!m_eventDispatched); | 112 ASSERT(!m_eventDispatched); |
113 m_eventDispatched = true; | 113 m_eventDispatched = true; |
114 #endif | 114 #endif |
115 | 115 |
116 m_event->setTarget(EventPath::eventTargetRespectingTargetRules(m_node.get())
); | 116 m_event->setTarget(EventPath::eventTargetRespectingTargetRules(m_node.get())
); |
117 ASSERT(!NoEventDispatchAssertion::isEventDispatchForbidden()); | 117 ASSERT(!NoEventDispatchAssertion::isEventDispatchForbidden()); |
118 ASSERT(m_event->target()); | 118 ASSERT(m_event->target()); |
119 WindowEventContext windowEventContext(m_event.get(), m_node.get(), topNodeEv
entContext()); | 119 WindowEventContext windowEventContext(m_event.get(), m_node.get(), topNodeEv
entContext()); |
120 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "EventDispatch"
, "data", InspectorEventDispatchEvent::data(*m_event)); | 120 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "EventDispatch"
, "data", InspectorEventDispatchEvent::data(*m_event)); |
121 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Timeli
ne migrates to tracing. | 121 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Timeli
ne migrates to tracing. |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 } | 227 } |
228 } | 228 } |
229 } | 229 } |
230 | 230 |
231 const NodeEventContext* EventDispatcher::topNodeEventContext() | 231 const NodeEventContext* EventDispatcher::topNodeEventContext() |
232 { | 232 { |
233 return m_event->eventPath().isEmpty() ? 0 : &m_event->eventPath().last(); | 233 return m_event->eventPath().isEmpty() ? 0 : &m_event->eventPath().last(); |
234 } | 234 } |
235 | 235 |
236 } | 236 } |
OLD | NEW |