Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(200)

Unified Diff: third_party/WebKit/Source/core/events/EventDispatcher.cpp

Issue 1972053002: Add UseCounters for Event.cancelBubble behavior. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/events/Event.idl ('k') | third_party/WebKit/Source/core/frame/UseCounter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/events/EventDispatcher.cpp
diff --git a/third_party/WebKit/Source/core/events/EventDispatcher.cpp b/third_party/WebKit/Source/core/events/EventDispatcher.cpp
index c97cc0e40d012f1906676a19a9db2df0f1ace10a..665cf82318b789725a9bfbd2449d95a3130e6e23 100644
--- a/third_party/WebKit/Source/core/events/EventDispatcher.cpp
+++ b/third_party/WebKit/Source/core/events/EventDispatcher.cpp
@@ -34,6 +34,7 @@
#include "core/events/WindowEventContext.h"
#include "core/frame/FrameView.h"
#include "core/frame/LocalDOMWindow.h"
+#include "core/frame/UseCounter.h"
#include "core/inspector/InspectorTraceEvents.h"
#include "platform/EventDispatchForbiddenScope.h"
#include "platform/TraceEvent.h"
@@ -177,12 +178,15 @@ inline void EventDispatcher::dispatchEventAtBubbling()
size_t size = m_event->eventPath().size();
for (size_t i = 1; i < size; ++i) {
const NodeEventContext& eventContext = m_event->eventPath()[i];
- if (eventContext.currentTargetSameAsTarget())
+ if (eventContext.currentTargetSameAsTarget()) {
m_event->setEventPhase(Event::AT_TARGET);
- else if (m_event->bubbles() && !m_event->cancelBubble())
+ } else if (m_event->bubbles() && !m_event->cancelBubble()) {
m_event->setEventPhase(Event::BUBBLING_PHASE);
- else
+ } else {
+ if (m_event->bubbles() && m_event->cancelBubble() && eventContext.node()->hasEventListeners(m_event->type()))
+ UseCounter::count(eventContext.node()->document(), UseCounter::EventCancelBubbleAffected);
continue;
+ }
eventContext.handleLocalEvents(*m_event);
if (m_event->propagationStopped())
return;
@@ -190,6 +194,8 @@ inline void EventDispatcher::dispatchEventAtBubbling()
if (m_event->bubbles() && !m_event->cancelBubble()) {
m_event->setEventPhase(Event::BUBBLING_PHASE);
m_event->eventPath().windowEventContext().handleLocalEvents(*m_event);
+ } else if (m_event->bubbles() && m_event->eventPath().windowEventContext().window()->hasEventListeners(m_event->type())) {
+ UseCounter::count(m_event->eventPath().windowEventContext().window()->getExecutionContext(), UseCounter::EventCancelBubbleAffected);
}
}
« no previous file with comments | « third_party/WebKit/Source/core/events/Event.idl ('k') | third_party/WebKit/Source/core/frame/UseCounter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698