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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 if (isClick) { | 215 if (isClick) { |
215 // Fire an accessibility event indicating a node was clicked on. This i
s safe if m_event->target()->toNode() returns null. | 216 // Fire an accessibility event indicating a node was clicked on. This i
s safe if m_event->target()->toNode() returns null. |
216 if (AXObjectCache* cache = m_node->document().existingAXObjectCache()) | 217 if (AXObjectCache* cache = m_node->document().existingAXObjectCache()) |
217 cache->handleClicked(m_event->target()->toNode()); | 218 cache->handleClicked(m_event->target()->toNode()); |
218 } | 219 } |
219 | 220 |
220 // The DOM Events spec says that events dispatched by JS (other than "click"
) | 221 // The DOM Events spec says that events dispatched by JS (other than "click"
) |
221 // should not have their default handlers invoked. | 222 // should not have their default handlers invoked. |
222 bool isTrustedOrClick = !RuntimeEnabledFeatures::trustedEventsDefaultActionE
nabled() || m_event->isTrusted() || isClick; | 223 bool isTrustedOrClick = !RuntimeEnabledFeatures::trustedEventsDefaultActionE
nabled() || m_event->isTrusted() || isClick; |
223 | 224 |
| 225 // For Android WebView (distinguished by wideViewportQuirkEnabled) |
| 226 // enable untrusted events for mouse down on select elements because |
| 227 // fastclick.js seems to generate these. crbug.com/642698 |
| 228 // TODO(dtapuska): Change this to a target SDK quirk crbug.com/643705 |
| 229 if (!isTrustedOrClick && m_event->isMouseEvent() && m_event->type() == Event
TypeNames::mousedown && isHTMLSelectElement(*m_node)) { |
| 230 if (Settings* settings = m_node->document().settings()) { |
| 231 isTrustedOrClick = settings->wideViewportQuirkEnabled(); |
| 232 } |
| 233 } |
| 234 |
224 // Call default event handlers. While the DOM does have a concept of prevent
ing | 235 // Call default event handlers. While the DOM does have a concept of prevent
ing |
225 // default handling, the detail of which handlers are called is an internal | 236 // default handling, the detail of which handlers are called is an internal |
226 // implementation detail and not part of the DOM. | 237 // implementation detail and not part of the DOM. |
227 if (!m_event->defaultPrevented() && !m_event->defaultHandled() && isTrustedO
rClick) { | 238 if (!m_event->defaultPrevented() && !m_event->defaultHandled() && isTrustedO
rClick) { |
228 // Non-bubbling events call only one default event handler, the one for
the target. | 239 // Non-bubbling events call only one default event handler, the one for
the target. |
229 m_node->willCallDefaultEventHandler(*m_event); | 240 m_node->willCallDefaultEventHandler(*m_event); |
230 m_node->defaultEventHandler(m_event.get()); | 241 m_node->defaultEventHandler(m_event.get()); |
231 DCHECK(!m_event->defaultPrevented()); | 242 DCHECK(!m_event->defaultPrevented()); |
232 // For bubbling events, call default event handlers on the same targets
in the | 243 // For bubbling events, call default event handlers on the same targets
in the |
233 // same order as the bubbling phase. | 244 // same order as the bubbling phase. |
234 if (!m_event->defaultHandled() && m_event->bubbles()) { | 245 if (!m_event->defaultHandled() && m_event->bubbles()) { |
235 size_t size = m_event->eventPath().size(); | 246 size_t size = m_event->eventPath().size(); |
236 for (size_t i = 1; i < size; ++i) { | 247 for (size_t i = 1; i < size; ++i) { |
237 m_event->eventPath()[i].node()->willCallDefaultEventHandler(*m_e
vent); | 248 m_event->eventPath()[i].node()->willCallDefaultEventHandler(*m_e
vent); |
238 m_event->eventPath()[i].node()->defaultEventHandler(m_event.get(
)); | 249 m_event->eventPath()[i].node()->defaultEventHandler(m_event.get(
)); |
239 DCHECK(!m_event->defaultPrevented()); | 250 DCHECK(!m_event->defaultPrevented()); |
240 if (m_event->defaultHandled()) | 251 if (m_event->defaultHandled()) |
241 break; | 252 break; |
242 } | 253 } |
243 } | 254 } |
244 if (m_event->defaultHandled() && !m_event->isTrusted() && !isClick) | 255 if (m_event->defaultHandled() && !m_event->isTrusted() && !isClick) |
245 Deprecation::countDeprecation(m_node->document(), UseCounter::Untrus
tedEventDefaultHandled); | 256 Deprecation::countDeprecation(m_node->document(), UseCounter::Untrus
tedEventDefaultHandled); |
246 } | 257 } |
247 } | 258 } |
248 | 259 |
249 } // namespace blink | 260 } // namespace blink |
OLD | NEW |