| 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/events/WindowEventContext.h" | 34 #include "core/events/WindowEventContext.h" |
| 35 #include "core/frame/FrameView.h" | 35 #include "core/frame/FrameView.h" |
| 36 #include "core/frame/LocalDOMWindow.h" | 36 #include "core/frame/LocalDOMWindow.h" |
| 37 #include "core/inspector/InspectorTraceEvents.h" | 37 #include "core/inspector/InspectorTraceEvents.h" |
| 38 #include "platform/EventDispatchForbiddenScope.h" | 38 #include "platform/EventDispatchForbiddenScope.h" |
| 39 #include "platform/TraceEvent.h" | 39 #include "platform/TraceEvent.h" |
| 40 #include "wtf/RefPtr.h" | 40 #include "wtf/RefPtr.h" |
| 41 | 41 |
| 42 namespace blink { | 42 namespace blink { |
| 43 | 43 |
| 44 DispatchEventResult EventDispatcher::dispatchEvent(Node& node, PassRefPtrWillBeR
awPtr<EventDispatchMediator> mediator) | 44 DispatchEventResult EventDispatcher::dispatchEvent(Node& node, RawPtr<EventDispa
tchMediator> mediator) |
| 45 { | 45 { |
| 46 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("blink.debug"), "EventDispatcher::dis
patchEvent"); | 46 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("blink.debug"), "EventDispatcher::dis
patchEvent"); |
| 47 ASSERT(!EventDispatchForbiddenScope::isEventDispatchForbidden()); | 47 ASSERT(!EventDispatchForbiddenScope::isEventDispatchForbidden()); |
| 48 EventDispatcher dispatcher(node, &mediator->event()); | 48 EventDispatcher dispatcher(node, &mediator->event()); |
| 49 return mediator->dispatchEvent(dispatcher); | 49 return mediator->dispatchEvent(dispatcher); |
| 50 } | 50 } |
| 51 | 51 |
| 52 EventDispatcher::EventDispatcher(Node& node, PassRefPtrWillBeRawPtr<Event> event
) | 52 EventDispatcher::EventDispatcher(Node& node, RawPtr<Event> event) |
| 53 : m_node(node) | 53 : m_node(node) |
| 54 , m_event(event) | 54 , m_event(event) |
| 55 #if ENABLE(ASSERT) | 55 #if ENABLE(ASSERT) |
| 56 , m_eventDispatched(false) | 56 , m_eventDispatched(false) |
| 57 #endif | 57 #endif |
| 58 { | 58 { |
| 59 ASSERT(m_event.get()); | 59 ASSERT(m_event.get()); |
| 60 m_view = node.document().view(); | 60 m_view = node.document().view(); |
| 61 m_event->initEventPath(*m_node); | 61 m_event->initEventPath(*m_node); |
| 62 } | 62 } |
| 63 | 63 |
| 64 void EventDispatcher::dispatchScopedEvent(Node& node, PassRefPtrWillBeRawPtr<Eve
ntDispatchMediator> mediator) | 64 void EventDispatcher::dispatchScopedEvent(Node& node, RawPtr<EventDispatchMediat
or> mediator) |
| 65 { | 65 { |
| 66 // We need to set the target here because it can go away by the time we actu
ally fire the event. | 66 // We need to set the target here because it can go away by the time we actu
ally fire the event. |
| 67 mediator->event().setTarget(EventPath::eventTargetRespectingTargetRules(node
)); | 67 mediator->event().setTarget(EventPath::eventTargetRespectingTargetRules(node
)); |
| 68 ScopedEventQueue::instance()->enqueueEventDispatchMediator(mediator); | 68 ScopedEventQueue::instance()->enqueueEventDispatchMediator(mediator); |
| 69 } | 69 } |
| 70 | 70 |
| 71 void EventDispatcher::dispatchSimulatedClick(Node& node, Event* underlyingEvent,
SimulatedClickMouseEventOptions mouseEventOptions, SimulatedClickCreationScope
creationScope) | 71 void EventDispatcher::dispatchSimulatedClick(Node& node, Event* underlyingEvent,
SimulatedClickMouseEventOptions mouseEventOptions, SimulatedClickCreationScope
creationScope) |
| 72 { | 72 { |
| 73 // This persistent vector doesn't cause leaks, because added Nodes are remov
ed | 73 // This persistent vector doesn't cause leaks, because added Nodes are remov
ed |
| 74 // before dispatchSimulatedClick() returns. This vector is here just to prev
ent | 74 // before dispatchSimulatedClick() returns. This vector is here just to prev
ent |
| 75 // the code from running into an infinite recursion of dispatchSimulatedClic
k(). | 75 // the code from running into an infinite recursion of dispatchSimulatedClic
k(). |
| 76 DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<WillBeHeapHashSet<RawPtrWillBeMem
ber<Node>>>, nodesDispatchingSimulatedClicks, (adoptPtrWillBeNoop(new WillBeHeap
HashSet<RawPtrWillBeMember<Node>>()))); | 76 DEFINE_STATIC_LOCAL(Persistent<HeapHashSet<Member<Node>>>, nodesDispatchingS
imulatedClicks, (new HeapHashSet<Member<Node>>())); |
| 77 | 77 |
| 78 if (isDisabledFormControl(&node)) | 78 if (isDisabledFormControl(&node)) |
| 79 return; | 79 return; |
| 80 | 80 |
| 81 if (nodesDispatchingSimulatedClicks->contains(&node)) | 81 if (nodesDispatchingSimulatedClicks->contains(&node)) |
| 82 return; | 82 return; |
| 83 | 83 |
| 84 nodesDispatchingSimulatedClicks->add(&node); | 84 nodesDispatchingSimulatedClicks->add(&node); |
| 85 | 85 |
| 86 if (mouseEventOptions == SendMouseOverUpDownEvents) | 86 if (mouseEventOptions == SendMouseOverUpDownEvents) |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 m_event->eventPath()[i].node()->defaultEventHandler(m_event.get(
)); | 232 m_event->eventPath()[i].node()->defaultEventHandler(m_event.get(
)); |
| 233 ASSERT(!m_event->defaultPrevented()); | 233 ASSERT(!m_event->defaultPrevented()); |
| 234 if (m_event->defaultHandled()) | 234 if (m_event->defaultHandled()) |
| 235 return; | 235 return; |
| 236 } | 236 } |
| 237 } | 237 } |
| 238 } | 238 } |
| 239 } | 239 } |
| 240 | 240 |
| 241 } // namespace blink | 241 } // namespace blink |
| OLD | NEW |