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

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

Issue 894913002: Prevent default actions for JS-generated mouse events other than click (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: address bokan's feedback Created 5 years, 10 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
Index: Source/core/events/EventDispatcher.cpp
diff --git a/Source/core/events/EventDispatcher.cpp b/Source/core/events/EventDispatcher.cpp
index 4608101c264a159845dfa964eb9e09c77dbb7310..6e904cdf397f7fc9c14a51a547e8efd7bdbe1fc0 100644
--- a/Source/core/events/EventDispatcher.cpp
+++ b/Source/core/events/EventDispatcher.cpp
@@ -206,7 +206,11 @@ inline void EventDispatcher::dispatchEventPostProcess(void* preDispatchEventHand
// Call default event handlers. While the DOM does have a concept of preventing
// default handling, the detail of which handlers are called is an internal
// implementation detail and not part of the DOM.
- if (!m_event->defaultPrevented() && !m_event->defaultHandled()) {
+
+ // Prevent calling default handlers for synthetic mouse events (issue #423975)
Rick Byers 2015/03/05 16:34:18 Rather than say what the code is doing, this comme
+ bool isSyntheticMouseEventOtherThanClick = m_event->isMouseEvent() && toMouseEvent(*m_event).isSynthetic() && toMouseEvent(*m_event).type() != EventTypeNames::click;
+
+ if (!m_event->defaultPrevented() && !m_event->defaultHandled() && !isSyntheticMouseEventOtherThanClick) {
// Non-bubbling events call only one default event handler, the one for the target.
m_node->willCallDefaultEventHandler(*m_event);
m_node->defaultEventHandler(m_event.get());

Powered by Google App Engine
This is Rietveld 408576698