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

Unified Diff: third_party/WebKit/Source/core/input/EventHandler.cpp

Issue 1894253002: Prevent sending click event for non primary button (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 8 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/MouseEvent.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/input/EventHandler.cpp
diff --git a/third_party/WebKit/Source/core/input/EventHandler.cpp b/third_party/WebKit/Source/core/input/EventHandler.cpp
index 37781e1a21258da736dafa23dfceb4ff2399934a..e7e0fdfb78c102830b8c383155d16be1356b80b0 100644
--- a/third_party/WebKit/Source/core/input/EventHandler.cpp
+++ b/third_party/WebKit/Source/core/input/EventHandler.cpp
@@ -1530,8 +1530,19 @@ WebInputEventResult EventHandler::handleMouseReleaseEvent(const PlatformMouseEve
// because the mouseup dispatch above has already updated it
// correctly. Moreover, clickTargetNode is different from
// mev.innerNode at drag-release.
- clickEventResult = toWebInputEventResult(clickTargetNode->dispatchMouseEvent(mev.event(),
- EventTypeNames::click, m_clickCount));
+
+ MouseEvent* event = MouseEvent::create(
+ EventTypeNames::click,
+ clickTargetNode->document().domWindow(),
+ mev.event(), m_clickCount, nullptr);
+
+ // This is to suppress sending click events for non-primary buttons.
+ // But still doing default action like opening a new tab for middle
+ // click (crbug.com/255).
+ if (mev.event().button() != MouseButton::LeftButton)
+ event->stopPropagation();
+
+ clickEventResult = toWebInputEventResult(clickTargetNode->dispatchEvent(event));
}
}
« no previous file with comments | « third_party/WebKit/Source/core/events/MouseEvent.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698