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

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

Issue 2163893003: Start sending auxclick instead of click for non-primary buttons (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Start sending auxclick instead of click for non-primary buttons Created 4 years, 5 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: 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 cc58b44a8e10ad145b64a0c1093cc3dbf17af8be..adecd14afcf1ef8c51a06491bb4f611721f370ee 100644
--- a/third_party/WebKit/Source/core/input/EventHandler.cpp
+++ b/third_party/WebKit/Source/core/input/EventHandler.cpp
@@ -1155,16 +1155,18 @@ WebInputEventResult EventHandler::handleMouseReleaseEvent(const PlatformMouseEve
WebInputEventResult eventResult = updatePointerTargetAndDispatchEvents(EventTypeNames::mouseup, mev.innerNode(), m_clickCount, mev.event());
- bool contextMenuEvent = mouseEvent.button() == RightButton;
+ // We only prevent click event when the click may cause contextmenu to popup.
+ // However, we always send auxclick.
+ bool macContextMenuEvent = false;
#if OS(MACOSX)
// FIXME: The Mac port achieves the same behavior by checking whether the context menu is currently open in WebPage::mouseEvent(). Consider merging the implementations.
if (mouseEvent.button() == LeftButton && mouseEvent.getModifiers() & PlatformEvent::CtrlKey)
- contextMenuEvent = true;
+ macContextMenuEvent = true;
#endif
WebInputEventResult clickEventResult = WebInputEventResult::NotHandled;
const bool shouldDispatchClickEvent = m_clickCount > 0
- && !contextMenuEvent
+ && !macContextMenuEvent
&& mev.innerNode() && m_clickNode
&& mev.innerNode()->canParticipateInFlatTree() && m_clickNode->canParticipateInFlatTree()
&& !(selectionController().hasExtendedSelection() && isLinkSelection(mev));
@@ -1188,7 +1190,10 @@ WebInputEventResult EventHandler::handleMouseReleaseEvent(const PlatformMouseEve
// correctly. Moreover, clickTargetNode is different from
// mev.innerNode at drag-release.
clickEventResult = toWebInputEventResult(clickTargetNode->dispatchMouseEvent(mev.event(),
- EventTypeNames::click, m_clickCount));
+ !RuntimeEnabledFeatures::auxclickEnabled() || (mev.event().button() == MouseButton::LeftButton)
+ ? EventTypeNames::click
+ : EventTypeNames::auxclick,
+ m_clickCount));
}
}

Powered by Google App Engine
This is Rietveld 408576698