| 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 #include "core/dom/ContainerNode.h" | 28 #include "core/dom/ContainerNode.h" |
| 29 #include "core/dom/Document.h" | 29 #include "core/dom/Document.h" |
| 30 #include "core/dom/Element.h" | 30 #include "core/dom/Element.h" |
| 31 #include "core/events/EventDispatchMediator.h" | 31 #include "core/events/EventDispatchMediator.h" |
| 32 #include "core/events/MouseEvent.h" | 32 #include "core/events/MouseEvent.h" |
| 33 #include "core/events/ScopedEventQueue.h" | 33 #include "core/events/ScopedEventQueue.h" |
| 34 #include "core/events/WindowEventContext.h" | 34 #include "core/events/WindowEventContext.h" |
| 35 #include "core/frame/Deprecation.h" | 35 #include "core/frame/Deprecation.h" |
| 36 #include "core/frame/FrameView.h" | 36 #include "core/frame/FrameView.h" |
| 37 #include "core/frame/LocalDOMWindow.h" | 37 #include "core/frame/LocalDOMWindow.h" |
| 38 #include "core/frame/Settings.h" |
| 38 #include "core/frame/UseCounter.h" | 39 #include "core/frame/UseCounter.h" |
| 39 #include "core/inspector/InspectorTraceEvents.h" | 40 #include "core/inspector/InspectorTraceEvents.h" |
| 40 #include "platform/EventDispatchForbiddenScope.h" | 41 #include "platform/EventDispatchForbiddenScope.h" |
| 41 #include "platform/TraceEvent.h" | 42 #include "platform/TraceEvent.h" |
| 42 #include "wtf/RefPtr.h" | 43 #include "wtf/RefPtr.h" |
| 43 | 44 |
| 44 namespace blink { | 45 namespace blink { |
| 45 | 46 |
| 46 DispatchEventResult EventDispatcher::dispatchEvent(Node& node, EventDispatchMedi
ator* mediator) | 47 DispatchEventResult EventDispatcher::dispatchEvent(Node& node, EventDispatchMedi
ator* mediator) |
| 47 { | 48 { |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 if (isClick) { | 214 if (isClick) { |
| 214 // Fire an accessibility event indicating a node was clicked on. This i
s safe if m_event->target()->toNode() returns null. | 215 // Fire an accessibility event indicating a node was clicked on. This i
s safe if m_event->target()->toNode() returns null. |
| 215 if (AXObjectCache* cache = m_node->document().existingAXObjectCache()) | 216 if (AXObjectCache* cache = m_node->document().existingAXObjectCache()) |
| 216 cache->handleClicked(m_event->target()->toNode()); | 217 cache->handleClicked(m_event->target()->toNode()); |
| 217 } | 218 } |
| 218 | 219 |
| 219 // The DOM Events spec says that events dispatched by JS (other than "click"
) | 220 // The DOM Events spec says that events dispatched by JS (other than "click"
) |
| 220 // should not have their default handlers invoked. | 221 // should not have their default handlers invoked. |
| 221 bool isTrustedOrClick = !RuntimeEnabledFeatures::trustedEventsDefaultActionE
nabled() || m_event->isTrusted() || isClick; | 222 bool isTrustedOrClick = !RuntimeEnabledFeatures::trustedEventsDefaultActionE
nabled() || m_event->isTrusted() || isClick; |
| 222 | 223 |
| 224 // For Android WebView (distinguished by wideViewportQuirkEnabled) |
| 225 // enable untrusted events for mouse down on select elements because |
| 226 // fastclick.js seems to generate these. crbug.com/642698 |
| 227 // TODO(dtapuska): Change this to a target SDK quirk crbug.com/643705 |
| 228 if (!isTrustedOrClick && m_event->isMouseEvent() && m_event->type() == Event
TypeNames::mousedown && isHTMLSelectElement(*m_node)) { |
| 229 if (Settings* settings = m_node->document().settings()) { |
| 230 isTrustedOrClick = settings->wideViewportQuirkEnabled(); |
| 231 } |
| 232 } |
| 233 |
| 223 // Call default event handlers. While the DOM does have a concept of prevent
ing | 234 // Call default event handlers. While the DOM does have a concept of prevent
ing |
| 224 // default handling, the detail of which handlers are called is an internal | 235 // default handling, the detail of which handlers are called is an internal |
| 225 // implementation detail and not part of the DOM. | 236 // implementation detail and not part of the DOM. |
| 226 if (!m_event->defaultPrevented() && !m_event->defaultHandled() && isTrustedO
rClick) { | 237 if (!m_event->defaultPrevented() && !m_event->defaultHandled() && isTrustedO
rClick) { |
| 227 // Non-bubbling events call only one default event handler, the one for
the target. | 238 // Non-bubbling events call only one default event handler, the one for
the target. |
| 228 m_node->willCallDefaultEventHandler(*m_event); | 239 m_node->willCallDefaultEventHandler(*m_event); |
| 229 m_node->defaultEventHandler(m_event.get()); | 240 m_node->defaultEventHandler(m_event.get()); |
| 230 ASSERT(!m_event->defaultPrevented()); | 241 ASSERT(!m_event->defaultPrevented()); |
| 231 // For bubbling events, call default event handlers on the same targets
in the | 242 // For bubbling events, call default event handlers on the same targets
in the |
| 232 // same order as the bubbling phase. | 243 // same order as the bubbling phase. |
| 233 if (!m_event->defaultHandled() && m_event->bubbles()) { | 244 if (!m_event->defaultHandled() && m_event->bubbles()) { |
| 234 size_t size = m_event->eventPath().size(); | 245 size_t size = m_event->eventPath().size(); |
| 235 for (size_t i = 1; i < size; ++i) { | 246 for (size_t i = 1; i < size; ++i) { |
| 236 m_event->eventPath()[i].node()->willCallDefaultEventHandler(*m_e
vent); | 247 m_event->eventPath()[i].node()->willCallDefaultEventHandler(*m_e
vent); |
| 237 m_event->eventPath()[i].node()->defaultEventHandler(m_event.get(
)); | 248 m_event->eventPath()[i].node()->defaultEventHandler(m_event.get(
)); |
| 238 ASSERT(!m_event->defaultPrevented()); | 249 ASSERT(!m_event->defaultPrevented()); |
| 239 if (m_event->defaultHandled()) | 250 if (m_event->defaultHandled()) |
| 240 break; | 251 break; |
| 241 } | 252 } |
| 242 } | 253 } |
| 243 if (m_event->defaultHandled() && !m_event->isTrusted() && !isClick) | 254 if (m_event->defaultHandled() && !m_event->isTrusted() && !isClick) |
| 244 Deprecation::countDeprecation(m_node->document(), UseCounter::Untrus
tedEventDefaultHandled); | 255 Deprecation::countDeprecation(m_node->document(), UseCounter::Untrus
tedEventDefaultHandled); |
| 245 } | 256 } |
| 246 } | 257 } |
| 247 | 258 |
| 248 } // namespace blink | 259 } // namespace blink |
| OLD | NEW |