| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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(Persistent<HeapHashSet<Member<Node>>>, nodesDispatchingS
imulatedClicks, (new HeapHashSet<Member<Node>>())); | 76 DEFINE_STATIC_LOCAL(HeapHashSet<Member<Node>>, nodesDispatchingSimulatedClic
ks, (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) |
| 87 EventDispatcher(node, MouseEvent::create(EventTypeNames::mouseover, node
.document().domWindow(), underlyingEvent, creationScope)).dispatch(); | 87 EventDispatcher(node, MouseEvent::create(EventTypeNames::mouseover, node
.document().domWindow(), underlyingEvent, creationScope)).dispatch(); |
| 88 | 88 |
| 89 if (mouseEventOptions != SendNoEvents) { | 89 if (mouseEventOptions != SendNoEvents) { |
| 90 EventDispatcher(node, MouseEvent::create(EventTypeNames::mousedown, node
.document().domWindow(), underlyingEvent, creationScope)).dispatch(); | 90 EventDispatcher(node, MouseEvent::create(EventTypeNames::mousedown, node
.document().domWindow(), underlyingEvent, creationScope)).dispatch(); |
| 91 node.setActive(true); | 91 node.setActive(true); |
| 92 EventDispatcher(node, MouseEvent::create(EventTypeNames::mouseup, node.d
ocument().domWindow(), underlyingEvent, creationScope)).dispatch(); | 92 EventDispatcher(node, MouseEvent::create(EventTypeNames::mouseup, node.d
ocument().domWindow(), underlyingEvent, creationScope)).dispatch(); |
| 93 } | 93 } |
| 94 // Some elements (e.g. the color picker) may set active state to true before | 94 // Some elements (e.g. the color picker) may set active state to true before |
| 95 // calling this method and expect the state to be reset during the call. | 95 // calling this method and expect the state to be reset during the call. |
| 96 node.setActive(false); | 96 node.setActive(false); |
| 97 | 97 |
| 98 // always send click | 98 // always send click |
| 99 EventDispatcher(node, MouseEvent::create(EventTypeNames::click, node.documen
t().domWindow(), underlyingEvent, creationScope)).dispatch(); | 99 EventDispatcher(node, MouseEvent::create(EventTypeNames::click, node.documen
t().domWindow(), underlyingEvent, creationScope)).dispatch(); |
| 100 | 100 |
| 101 nodesDispatchingSimulatedClicks->remove(&node); | 101 nodesDispatchingSimulatedClicks.remove(&node); |
| 102 } | 102 } |
| 103 | 103 |
| 104 DispatchEventResult EventDispatcher::dispatch() | 104 DispatchEventResult EventDispatcher::dispatch() |
| 105 { | 105 { |
| 106 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("blink.debug"), "EventDispatcher::dis
patch"); | 106 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("blink.debug"), "EventDispatcher::dis
patch"); |
| 107 | 107 |
| 108 #if ENABLE(ASSERT) | 108 #if ENABLE(ASSERT) |
| 109 ASSERT(!m_eventDispatched); | 109 ASSERT(!m_eventDispatched); |
| 110 m_eventDispatched = true; | 110 m_eventDispatched = true; |
| 111 #endif | 111 #endif |
| (...skipping 120 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 |