| 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 17 matching lines...) Expand all Loading... |
| 28 | 28 |
| 29 #include "sky/engine/core/dom/ContainerNode.h" | 29 #include "sky/engine/core/dom/ContainerNode.h" |
| 30 #include "sky/engine/core/dom/Document.h" | 30 #include "sky/engine/core/dom/Document.h" |
| 31 #include "sky/engine/core/dom/Element.h" | 31 #include "sky/engine/core/dom/Element.h" |
| 32 #include "sky/engine/core/events/Event.h" | 32 #include "sky/engine/core/events/Event.h" |
| 33 #include "sky/engine/core/events/EventDispatchMediator.h" | 33 #include "sky/engine/core/events/EventDispatchMediator.h" |
| 34 #include "sky/engine/core/events/ScopedEventQueue.h" | 34 #include "sky/engine/core/events/ScopedEventQueue.h" |
| 35 #include "sky/engine/core/events/WindowEventContext.h" | 35 #include "sky/engine/core/events/WindowEventContext.h" |
| 36 #include "sky/engine/core/frame/FrameView.h" | 36 #include "sky/engine/core/frame/FrameView.h" |
| 37 #include "sky/engine/core/frame/LocalDOMWindow.h" | 37 #include "sky/engine/core/frame/LocalDOMWindow.h" |
| 38 #include "sky/engine/core/inspector/InspectorTraceEvents.h" | |
| 39 #include "sky/engine/platform/EventDispatchForbiddenScope.h" | 38 #include "sky/engine/platform/EventDispatchForbiddenScope.h" |
| 40 #include "sky/engine/platform/TraceEvent.h" | 39 #include "sky/engine/platform/TraceEvent.h" |
| 41 #include "sky/engine/wtf/RefPtr.h" | 40 #include "sky/engine/wtf/RefPtr.h" |
| 42 | 41 |
| 43 namespace blink { | 42 namespace blink { |
| 44 | 43 |
| 45 bool EventDispatcher::dispatchEvent(Node* node, PassRefPtr<EventDispatchMediator
> mediator) | 44 bool EventDispatcher::dispatchEvent(Node* node, PassRefPtr<EventDispatchMediator
> mediator) |
| 46 { | 45 { |
| 47 TRACE_EVENT0("blink", "EventDispatcher::dispatchEvent"); | 46 TRACE_EVENT0("blink", "EventDispatcher::dispatchEvent"); |
| 48 ASSERT(!EventDispatchForbiddenScope::isEventDispatchForbidden()); | 47 ASSERT(!EventDispatchForbiddenScope::isEventDispatchForbidden()); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 79 | 78 |
| 80 #if ENABLE(ASSERT) | 79 #if ENABLE(ASSERT) |
| 81 ASSERT(!m_eventDispatched); | 80 ASSERT(!m_eventDispatched); |
| 82 m_eventDispatched = true; | 81 m_eventDispatched = true; |
| 83 #endif | 82 #endif |
| 84 | 83 |
| 85 m_event->setTarget(EventPath::eventTargetRespectingTargetRules(m_node.get())
); | 84 m_event->setTarget(EventPath::eventTargetRespectingTargetRules(m_node.get())
); |
| 86 ASSERT(!EventDispatchForbiddenScope::isEventDispatchForbidden()); | 85 ASSERT(!EventDispatchForbiddenScope::isEventDispatchForbidden()); |
| 87 ASSERT(m_event->target()); | 86 ASSERT(m_event->target()); |
| 88 WindowEventContext windowEventContext(m_event.get(), m_node.get(), topNodeEv
entContext()); | 87 WindowEventContext windowEventContext(m_event.get(), m_node.get(), topNodeEv
entContext()); |
| 89 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "EventDispatch"
, "data", InspectorEventDispatchEvent::data(*m_event)); | |
| 90 | 88 |
| 91 if (dispatchEventPreProcess() == ContinueDispatching) | 89 if (dispatchEventPreProcess() == ContinueDispatching) |
| 92 if (dispatchEventAtCapturing(windowEventContext) == ContinueDispatching) | 90 if (dispatchEventAtCapturing(windowEventContext) == ContinueDispatching) |
| 93 if (dispatchEventAtTarget() == ContinueDispatching) | 91 if (dispatchEventAtTarget() == ContinueDispatching) |
| 94 dispatchEventAtBubbling(windowEventContext); | 92 dispatchEventAtBubbling(windowEventContext); |
| 95 dispatchEventPostProcess(); | 93 dispatchEventPostProcess(); |
| 96 | 94 |
| 97 // Ensure that after event dispatch, the event's target object is the | 95 // Ensure that after event dispatch, the event's target object is the |
| 98 // outermost shadow DOM boundary. | 96 // outermost shadow DOM boundary. |
| 99 m_event->setTarget(windowEventContext.target()); | 97 m_event->setTarget(windowEventContext.target()); |
| 100 m_event->setCurrentTarget(0); | 98 m_event->setCurrentTarget(0); |
| 101 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Update
Counters", TRACE_EVENT_SCOPE_PROCESS, "data", InspectorUpdateCountersEvent::data
()); | |
| 102 | 99 |
| 103 return !m_event->defaultPrevented(); | 100 return !m_event->defaultPrevented(); |
| 104 } | 101 } |
| 105 | 102 |
| 106 inline EventDispatchContinuation EventDispatcher::dispatchEventPreProcess() | 103 inline EventDispatchContinuation EventDispatcher::dispatchEventPreProcess() |
| 107 { | 104 { |
| 108 return (m_event->eventPath().isEmpty() || m_event->propagationStopped()) ? D
oneDispatching : ContinueDispatching; | 105 return (m_event->eventPath().isEmpty() || m_event->propagationStopped()) ? D
oneDispatching : ContinueDispatching; |
| 109 } | 106 } |
| 110 | 107 |
| 111 inline EventDispatchContinuation EventDispatcher::dispatchEventAtCapturing(Windo
wEventContext& windowEventContext) | 108 inline EventDispatchContinuation EventDispatcher::dispatchEventAtCapturing(Windo
wEventContext& windowEventContext) |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 } | 182 } |
| 186 } | 183 } |
| 187 } | 184 } |
| 188 | 185 |
| 189 const NodeEventContext* EventDispatcher::topNodeEventContext() | 186 const NodeEventContext* EventDispatcher::topNodeEventContext() |
| 190 { | 187 { |
| 191 return m_event->eventPath().isEmpty() ? 0 : &m_event->eventPath().last(); | 188 return m_event->eventPath().isEmpty() ? 0 : &m_event->eventPath().last(); |
| 192 } | 189 } |
| 193 | 190 |
| 194 } | 191 } |
| OLD | NEW |