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

Side by Side 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: Another rebase Created 4 years, 4 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed.
3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) 3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org)
4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) 4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies)
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 1132 matching lines...) Expand 10 before | Expand all | Expand 10 after
1143 HitTestRequest request(hitType); 1143 HitTestRequest request(hitType);
1144 MouseEventWithHitTestResults mev = prepareMouseEvent(request, mouseEvent); 1144 MouseEventWithHitTestResults mev = prepareMouseEvent(request, mouseEvent);
1145 LocalFrame* subframe = m_capturingMouseEventsNode.get() ? subframeForTargetN ode(m_capturingMouseEventsNode.get()) : subframeForHitTestResult(mev); 1145 LocalFrame* subframe = m_capturingMouseEventsNode.get() ? subframeForTargetN ode(m_capturingMouseEventsNode.get()) : subframeForHitTestResult(mev);
1146 if (m_eventHandlerWillResetCapturingMouseEventsNode) 1146 if (m_eventHandlerWillResetCapturingMouseEventsNode)
1147 m_capturingMouseEventsNode = nullptr; 1147 m_capturingMouseEventsNode = nullptr;
1148 if (subframe) 1148 if (subframe)
1149 return passMouseReleaseEventToSubframe(mev, subframe); 1149 return passMouseReleaseEventToSubframe(mev, subframe);
1150 1150
1151 WebInputEventResult eventResult = updatePointerTargetAndDispatchEvents(Event TypeNames::mouseup, mev.innerNode(), m_clickCount, mev.event()); 1151 WebInputEventResult eventResult = updatePointerTargetAndDispatchEvents(Event TypeNames::mouseup, mev.innerNode(), m_clickCount, mev.event());
1152 1152
1153 bool contextMenuEvent = mouseEvent.button() == RightButton; 1153 // We only prevent click event when the click may cause contextmenu to popup .
1154 // However, we always send auxclick.
1155 bool contextMenuEvent = !RuntimeEnabledFeatures::auxclickEnabled() && mouseE vent.button() == RightButton;
1154 #if OS(MACOSX) 1156 #if OS(MACOSX)
1155 // FIXME: The Mac port achieves the same behavior by checking whether the co ntext menu is currently open in WebPage::mouseEvent(). Consider merging the impl ementations. 1157 // FIXME: The Mac port achieves the same behavior by checking whether the co ntext menu is currently open in WebPage::mouseEvent(). Consider merging the impl ementations.
1156 if (mouseEvent.button() == LeftButton && mouseEvent.getModifiers() & Platfor mEvent::CtrlKey) 1158 if (mouseEvent.button() == LeftButton && mouseEvent.getModifiers() & Platfor mEvent::CtrlKey)
1157 contextMenuEvent = true; 1159 contextMenuEvent = true;
1158 #endif 1160 #endif
1159 1161
1160 WebInputEventResult clickEventResult = WebInputEventResult::NotHandled; 1162 WebInputEventResult clickEventResult = WebInputEventResult::NotHandled;
1161 const bool shouldDispatchClickEvent = m_clickCount > 0 1163 const bool shouldDispatchClickEvent = m_clickCount > 0
1162 && !contextMenuEvent 1164 && !contextMenuEvent
1163 && mev.innerNode() && m_clickNode 1165 && mev.innerNode() && m_clickNode
(...skipping 12 matching lines...) Expand all
1176 mev.innerNode()->updateDistribution(); 1178 mev.innerNode()->updateDistribution();
1177 clickTargetNode = mev.innerNode()->commonAncestor( 1179 clickTargetNode = mev.innerNode()->commonAncestor(
1178 *m_clickNode, parentForClickEvent); 1180 *m_clickNode, parentForClickEvent);
1179 } 1181 }
1180 if (clickTargetNode) { 1182 if (clickTargetNode) {
1181 // Dispatch mouseup directly w/o calling updateMouseEventTargetNodeA ndSendEvents 1183 // Dispatch mouseup directly w/o calling updateMouseEventTargetNodeA ndSendEvents
1182 // because the mouseup dispatch above has already updated it 1184 // because the mouseup dispatch above has already updated it
1183 // correctly. Moreover, clickTargetNode is different from 1185 // correctly. Moreover, clickTargetNode is different from
1184 // mev.innerNode at drag-release. 1186 // mev.innerNode at drag-release.
1185 clickEventResult = toWebInputEventResult(clickTargetNode->dispatchMo useEvent(mev.event(), 1187 clickEventResult = toWebInputEventResult(clickTargetNode->dispatchMo useEvent(mev.event(),
1186 EventTypeNames::click, m_clickCount)); 1188 !RuntimeEnabledFeatures::auxclickEnabled() || (mev.event().butto n() == MouseButton::LeftButton)
1189 ? EventTypeNames::click
1190 : EventTypeNames::auxclick,
1191 m_clickCount));
1187 } 1192 }
1188 } 1193 }
1189 1194
1190 m_scrollManager.clearResizeScrollableArea(false); 1195 m_scrollManager.clearResizeScrollableArea(false);
1191 1196
1192 if (eventResult == WebInputEventResult::NotHandled) 1197 if (eventResult == WebInputEventResult::NotHandled)
1193 eventResult = handleMouseReleaseEvent(mev); 1198 eventResult = handleMouseReleaseEvent(mev);
1194 clearDragHeuristicState(); 1199 clearDragHeuristicState();
1195 1200
1196 invalidateClick(); 1201 invalidateClick();
(...skipping 1395 matching lines...) Expand 10 before | Expand all | Expand 10 after
2592 2597
2593 FrameHost* EventHandler::frameHost() const 2598 FrameHost* EventHandler::frameHost() const
2594 { 2599 {
2595 if (!m_frame->page()) 2600 if (!m_frame->page())
2596 return nullptr; 2601 return nullptr;
2597 2602
2598 return &m_frame->page()->frameHost(); 2603 return &m_frame->page()->frameHost();
2599 } 2604 }
2600 2605
2601 } // namespace blink 2606 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698