| 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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 | 195 |
| 196 inline void EventDispatcher::dispatchEventPostProcess(void* preDispatchEventHand
lerResult) | 196 inline void EventDispatcher::dispatchEventPostProcess(void* preDispatchEventHand
lerResult) |
| 197 { | 197 { |
| 198 m_event->setTarget(EventPath::eventTargetRespectingTargetRules(*m_node)); | 198 m_event->setTarget(EventPath::eventTargetRespectingTargetRules(*m_node)); |
| 199 m_event->setCurrentTarget(nullptr); | 199 m_event->setCurrentTarget(nullptr); |
| 200 m_event->setEventPhase(0); | 200 m_event->setEventPhase(0); |
| 201 | 201 |
| 202 // Pass the data from the preDispatchEventHandler to the postDispatchEventHa
ndler. | 202 // Pass the data from the preDispatchEventHandler to the postDispatchEventHa
ndler. |
| 203 m_node->postDispatchEventHandler(m_event.get(), preDispatchEventHandlerResul
t); | 203 m_node->postDispatchEventHandler(m_event.get(), preDispatchEventHandlerResul
t); |
| 204 | 204 |
| 205 bool isClick = m_event->isMouseEvent() && toMouseEvent(*m_event).type() == E
ventTypeNames::click; |
| 206 if (isClick) { |
| 207 // Fire an accessibility event indicating a node was clicked on. This i
s safe if m_event->target()->toNode() returns null. |
| 208 if (AXObjectCache* cache = m_node->document().existingAXObjectCache()) |
| 209 cache->handleClicked(m_event->target()->toNode()); |
| 210 } |
| 211 |
| 205 // The DOM Events spec says that events dispatched by JS (other than "click"
) | 212 // The DOM Events spec says that events dispatched by JS (other than "click"
) |
| 206 // should not have their default handlers invoked. | 213 // should not have their default handlers invoked. |
| 207 bool isTrustedOrClick = !RuntimeEnabledFeatures::trustedEventsDefaultActionE
nabled() || m_event->isTrusted() || (m_event->isMouseEvent() && toMouseEvent(*m_
event).type() == EventTypeNames::click); | 214 bool isTrustedOrClick = !RuntimeEnabledFeatures::trustedEventsDefaultActionE
nabled() || m_event->isTrusted() || isClick; |
| 208 | 215 |
| 209 // Call default event handlers. While the DOM does have a concept of prevent
ing | 216 // Call default event handlers. While the DOM does have a concept of prevent
ing |
| 210 // default handling, the detail of which handlers are called is an internal | 217 // default handling, the detail of which handlers are called is an internal |
| 211 // implementation detail and not part of the DOM. | 218 // implementation detail and not part of the DOM. |
| 212 if (!m_event->defaultPrevented() && !m_event->defaultHandled() && isTrustedO
rClick) { | 219 if (!m_event->defaultPrevented() && !m_event->defaultHandled() && isTrustedO
rClick) { |
| 213 // Non-bubbling events call only one default event handler, the one for
the target. | 220 // Non-bubbling events call only one default event handler, the one for
the target. |
| 214 m_node->willCallDefaultEventHandler(*m_event); | 221 m_node->willCallDefaultEventHandler(*m_event); |
| 215 m_node->defaultEventHandler(m_event.get()); | 222 m_node->defaultEventHandler(m_event.get()); |
| 216 ASSERT(!m_event->defaultPrevented()); | 223 ASSERT(!m_event->defaultPrevented()); |
| 217 if (m_event->defaultHandled()) | 224 if (m_event->defaultHandled()) |
| 218 return; | 225 return; |
| 219 // For bubbling events, call default event handlers on the same targets
in the | 226 // For bubbling events, call default event handlers on the same targets
in the |
| 220 // same order as the bubbling phase. | 227 // same order as the bubbling phase. |
| 221 if (m_event->bubbles()) { | 228 if (m_event->bubbles()) { |
| 222 size_t size = m_event->eventPath().size(); | 229 size_t size = m_event->eventPath().size(); |
| 223 for (size_t i = 1; i < size; ++i) { | 230 for (size_t i = 1; i < size; ++i) { |
| 224 m_event->eventPath()[i].node()->willCallDefaultEventHandler(*m_e
vent); | 231 m_event->eventPath()[i].node()->willCallDefaultEventHandler(*m_e
vent); |
| 225 m_event->eventPath()[i].node()->defaultEventHandler(m_event.get(
)); | 232 m_event->eventPath()[i].node()->defaultEventHandler(m_event.get(
)); |
| 226 ASSERT(!m_event->defaultPrevented()); | 233 ASSERT(!m_event->defaultPrevented()); |
| 227 if (m_event->defaultHandled()) | 234 if (m_event->defaultHandled()) |
| 228 return; | 235 return; |
| 229 } | 236 } |
| 230 } | 237 } |
| 231 } | 238 } |
| 232 } | 239 } |
| 233 | 240 |
| 234 } // namespace blink | 241 } // namespace blink |
| OLD | NEW |