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 24 matching lines...) Expand all Loading... |
35 #include "core/frame/FrameView.h" | 35 #include "core/frame/FrameView.h" |
36 #include "core/inspector/InspectorInstrumentation.h" | 36 #include "core/inspector/InspectorInstrumentation.h" |
37 #include "core/inspector/InspectorTraceEvents.h" | 37 #include "core/inspector/InspectorTraceEvents.h" |
38 #include "platform/TraceEvent.h" | 38 #include "platform/TraceEvent.h" |
39 #include "wtf/RefPtr.h" | 39 #include "wtf/RefPtr.h" |
40 | 40 |
41 namespace WebCore { | 41 namespace WebCore { |
42 | 42 |
43 static HashSet<Node*>* gNodesDispatchingSimulatedClicks = 0; | 43 static HashSet<Node*>* gNodesDispatchingSimulatedClicks = 0; |
44 | 44 |
45 bool EventDispatcher::dispatchEvent(Node* node, PassRefPtr<EventDispatchMediator
> mediator) | 45 bool EventDispatcher::dispatchEvent(Node* node, PassRefPtrWillBeRawPtr<EventDisp
atchMediator> mediator) |
46 { | 46 { |
47 TRACE_EVENT0("webkit", "EventDispatcher::dispatchEvent"); | 47 TRACE_EVENT0("webkit", "EventDispatcher::dispatchEvent"); |
48 ASSERT(!NoEventDispatchAssertion::isEventDispatchForbidden()); | 48 ASSERT(!NoEventDispatchAssertion::isEventDispatchForbidden()); |
49 if (!mediator->event()) | 49 if (!mediator->event()) |
50 return true; | 50 return true; |
51 EventDispatcher dispatcher(node, mediator->event()); | 51 EventDispatcher dispatcher(node, mediator->event()); |
52 return mediator->dispatchEvent(&dispatcher); | 52 return mediator->dispatchEvent(&dispatcher); |
53 } | 53 } |
54 | 54 |
55 EventDispatcher::EventDispatcher(Node* node, PassRefPtrWillBeRawPtr<Event> event
) | 55 EventDispatcher::EventDispatcher(Node* node, PassRefPtrWillBeRawPtr<Event> event
) |
56 : m_node(node) | 56 : m_node(node) |
57 , m_event(event) | 57 , m_event(event) |
58 #ifndef NDEBUG | 58 #ifndef NDEBUG |
59 , m_eventDispatched(false) | 59 , m_eventDispatched(false) |
60 #endif | 60 #endif |
61 { | 61 { |
62 ASSERT(node); | 62 ASSERT(node); |
63 ASSERT(m_event.get()); | 63 ASSERT(m_event.get()); |
64 ASSERT(!m_event->type().isNull()); // JavaScript code can create an event wi
th an empty name, but not null. | 64 ASSERT(!m_event->type().isNull()); // JavaScript code can create an event wi
th an empty name, but not null. |
65 m_view = node->document().view(); | 65 m_view = node->document().view(); |
66 m_event->ensureEventPath().resetWith(m_node.get()); | 66 m_event->ensureEventPath().resetWith(m_node.get()); |
67 } | 67 } |
68 | 68 |
69 void EventDispatcher::dispatchScopedEvent(Node* node, PassRefPtr<EventDispatchMe
diator> mediator) | 69 void EventDispatcher::dispatchScopedEvent(Node* node, PassRefPtrWillBeRawPtr<Eve
ntDispatchMediator> mediator) |
70 { | 70 { |
71 // We need to set the target here because it can go away by the time we actu
ally fire the event. | 71 // We need to set the target here because it can go away by the time we actu
ally fire the event. |
72 mediator->event()->setTarget(EventPath::eventTargetRespectingTargetRules(nod
e)); | 72 mediator->event()->setTarget(EventPath::eventTargetRespectingTargetRules(nod
e)); |
73 ScopedEventQueue::instance()->enqueueEventDispatchMediator(mediator); | 73 ScopedEventQueue::instance()->enqueueEventDispatchMediator(mediator); |
74 } | 74 } |
75 | 75 |
76 void EventDispatcher::dispatchSimulatedClick(Node* node, Event* underlyingEvent,
SimulatedClickMouseEventOptions mouseEventOptions) | 76 void EventDispatcher::dispatchSimulatedClick(Node* node, Event* underlyingEvent,
SimulatedClickMouseEventOptions mouseEventOptions) |
77 { | 77 { |
78 if (isDisabledFormControl(node)) | 78 if (isDisabledFormControl(node)) |
79 return; | 79 return; |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 } | 226 } |
227 } | 227 } |
228 } | 228 } |
229 | 229 |
230 const NodeEventContext* EventDispatcher::topNodeEventContext() | 230 const NodeEventContext* EventDispatcher::topNodeEventContext() |
231 { | 231 { |
232 return m_event->eventPath().isEmpty() ? 0 : &m_event->eventPath().last(); | 232 return m_event->eventPath().isEmpty() ? 0 : &m_event->eventPath().last(); |
233 } | 233 } |
234 | 234 |
235 } | 235 } |
OLD | NEW |