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

Unified Diff: Source/core/page/EventHandler.cpp

Issue 23060022: Don't turn middleclicks into click events. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Removed tests that no longer added any value. Created 7 years, 2 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 | « LayoutTests/fast/events/script-tests/mouse-click-events.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/page/EventHandler.cpp
diff --git a/Source/core/page/EventHandler.cpp b/Source/core/page/EventHandler.cpp
index 0fbfe2a174f6aa2e60eb249e23f2d635526e7207..43f967b8a90faaa963d9291e2c1094b23a92ec9a 100644
--- a/Source/core/page/EventHandler.cpp
+++ b/Source/core/page/EventHandler.cpp
@@ -1682,8 +1682,11 @@ bool EventHandler::handleMouseReleaseEvent(const PlatformMouseEvent& mouseEvent)
if (mouseEvent.button() == LeftButton && mouseEvent.modifiers() & PlatformEvent::CtrlKey)
contextMenuEvent = true;
#endif
-
- bool swallowClickEvent = m_clickCount > 0 && !contextMenuEvent && mouseIsReleasedOnPressedElement(mev.targetNode(), m_clickNode.get()) && !dispatchMouseEvent(EventTypeNames::click, mev.targetNode(), true, m_clickCount, mouseEvent, true);
+ bool swallowClickEvent = false;
+ if (m_clickCount > 0 && !contextMenuEvent && mouseEvent.button() != MiddleButton && mouseIsReleasedOnPressedElement(mev.targetNode(), m_clickNode.get())) {
+ // Turn the Mouse Button Released event into a click event since all requirements are fulfilled.
+ swallowClickEvent = !dispatchMouseEvent(EventTypeNames::click, mev.targetNode(), true, m_clickCount, mouseEvent, true);
+ }
if (m_resizeLayer) {
m_resizeLayer->setInResizeMode(false);
« no previous file with comments | « LayoutTests/fast/events/script-tests/mouse-click-events.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698