| 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 14 matching lines...) Expand all Loading... |
| 25 | 25 |
| 26 #include "core/events/EventDispatcher.h" | 26 #include "core/events/EventDispatcher.h" |
| 27 | 27 |
| 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/FrameView.h" | 36 #include "core/frame/FrameView.h" |
| 36 #include "core/frame/LocalDOMWindow.h" | 37 #include "core/frame/LocalDOMWindow.h" |
| 37 #include "core/frame/UseCounter.h" | 38 #include "core/frame/UseCounter.h" |
| 38 #include "core/inspector/InspectorTraceEvents.h" | 39 #include "core/inspector/InspectorTraceEvents.h" |
| 39 #include "platform/EventDispatchForbiddenScope.h" | 40 #include "platform/EventDispatchForbiddenScope.h" |
| 40 #include "platform/TraceEvent.h" | 41 #include "platform/TraceEvent.h" |
| 41 #include "wtf/RefPtr.h" | 42 #include "wtf/RefPtr.h" |
| 42 | 43 |
| 43 namespace blink { | 44 namespace blink { |
| 44 | 45 |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 bool isTrustedOrClick = !RuntimeEnabledFeatures::trustedEventsDefaultActionE
nabled() || m_event->isTrusted() || isClick; | 221 bool isTrustedOrClick = !RuntimeEnabledFeatures::trustedEventsDefaultActionE
nabled() || m_event->isTrusted() || isClick; |
| 221 | 222 |
| 222 // Call default event handlers. While the DOM does have a concept of prevent
ing | 223 // Call default event handlers. While the DOM does have a concept of prevent
ing |
| 223 // default handling, the detail of which handlers are called is an internal | 224 // default handling, the detail of which handlers are called is an internal |
| 224 // implementation detail and not part of the DOM. | 225 // implementation detail and not part of the DOM. |
| 225 if (!m_event->defaultPrevented() && !m_event->defaultHandled() && isTrustedO
rClick) { | 226 if (!m_event->defaultPrevented() && !m_event->defaultHandled() && isTrustedO
rClick) { |
| 226 // Non-bubbling events call only one default event handler, the one for
the target. | 227 // Non-bubbling events call only one default event handler, the one for
the target. |
| 227 m_node->willCallDefaultEventHandler(*m_event); | 228 m_node->willCallDefaultEventHandler(*m_event); |
| 228 m_node->defaultEventHandler(m_event.get()); | 229 m_node->defaultEventHandler(m_event.get()); |
| 229 ASSERT(!m_event->defaultPrevented()); | 230 ASSERT(!m_event->defaultPrevented()); |
| 230 if (m_event->defaultHandled()) | |
| 231 return; | |
| 232 // For bubbling events, call default event handlers on the same targets
in the | 231 // For bubbling events, call default event handlers on the same targets
in the |
| 233 // same order as the bubbling phase. | 232 // same order as the bubbling phase. |
| 234 if (m_event->bubbles()) { | 233 if (!m_event->defaultHandled() && m_event->bubbles()) { |
| 235 size_t size = m_event->eventPath().size(); | 234 size_t size = m_event->eventPath().size(); |
| 236 for (size_t i = 1; i < size; ++i) { | 235 for (size_t i = 1; i < size; ++i) { |
| 237 m_event->eventPath()[i].node()->willCallDefaultEventHandler(*m_e
vent); | 236 m_event->eventPath()[i].node()->willCallDefaultEventHandler(*m_e
vent); |
| 238 m_event->eventPath()[i].node()->defaultEventHandler(m_event.get(
)); | 237 m_event->eventPath()[i].node()->defaultEventHandler(m_event.get(
)); |
| 239 ASSERT(!m_event->defaultPrevented()); | 238 ASSERT(!m_event->defaultPrevented()); |
| 240 if (m_event->defaultHandled()) | 239 if (m_event->defaultHandled()) |
| 241 return; | 240 break; |
| 242 } | 241 } |
| 243 } | 242 } |
| 243 if (m_event->defaultHandled() && !m_event->isTrusted() && !isClick) |
| 244 Deprecation::countDeprecation(m_node->document(), UseCounter::Untrus
tedEventDefaultHandled); |
| 244 } | 245 } |
| 245 } | 246 } |
| 246 | 247 |
| 247 } // namespace blink | 248 } // namespace blink |
| OLD | NEW |