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

Side by Side Diff: third_party/WebKit/Source/core/input/MouseEventManager.cpp

Issue 2777213002: Revert of Add use count for click retargeting due to capture (Closed)
Patch Set: Created 3 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/input/MouseEventManager.h" 5 #include "core/input/MouseEventManager.h"
6 6
7 #include "core/clipboard/DataObject.h" 7 #include "core/clipboard/DataObject.h"
8 #include "core/clipboard/DataTransfer.h" 8 #include "core/clipboard/DataTransfer.h"
9 #include "core/dom/Element.h" 9 #include "core/dom/Element.h"
10 #include "core/dom/ElementTraversal.h" 10 #include "core/dom/ElementTraversal.h"
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 225
226 setNodeUnderMouse(targetNode, canvasRegionId, webMouseEvent); 226 setNodeUnderMouse(targetNode, canvasRegionId, webMouseEvent);
227 227
228 return dispatchMouseEvent(m_nodeUnderMouse, eventType, webMouseEvent, 228 return dispatchMouseEvent(m_nodeUnderMouse, eventType, webMouseEvent,
229 canvasRegionId, nullptr); 229 canvasRegionId, nullptr);
230 } 230 }
231 231
232 WebInputEventResult MouseEventManager::dispatchMouseClickIfNeeded( 232 WebInputEventResult MouseEventManager::dispatchMouseClickIfNeeded(
233 Node* target, 233 Node* target,
234 const WebMouseEvent& mouseEvent, 234 const WebMouseEvent& mouseEvent,
235 const String& canvasRegionId, 235 const String& canvasRegionId) {
236 Node* targetWithoutCapture) {
237 // We only prevent click event when the click may cause contextmenu to popup. 236 // We only prevent click event when the click may cause contextmenu to popup.
238 // However, we always send auxclick. 237 // However, we always send auxclick.
239 bool contextMenuEvent = 238 bool contextMenuEvent =
240 !RuntimeEnabledFeatures::auxclickEnabled() && 239 !RuntimeEnabledFeatures::auxclickEnabled() &&
241 mouseEvent.button == WebPointerProperties::Button::Right; 240 mouseEvent.button == WebPointerProperties::Button::Right;
242 #if OS(MACOSX) 241 #if OS(MACOSX)
243 // FIXME: The Mac port achieves the same behavior by checking whether the 242 // FIXME: The Mac port achieves the same behavior by checking whether the
244 // context menu is currently open in WebPage::mouseEvent(). Consider merging 243 // context menu is currently open in WebPage::mouseEvent(). Consider merging
245 // the implementations. 244 // the implementations.
246 if (mouseEvent.button == WebPointerProperties::Button::Left && 245 if (mouseEvent.button == WebPointerProperties::Button::Left &&
(...skipping 13 matching lines...) Expand all
260 // Unless distribution is updated, commonAncestor would hit ASSERT. 259 // Unless distribution is updated, commonAncestor would hit ASSERT.
261 if (m_clickNode == target) { 260 if (m_clickNode == target) {
262 clickTargetNode = m_clickNode; 261 clickTargetNode = m_clickNode;
263 clickTargetNode->updateDistribution(); 262 clickTargetNode->updateDistribution();
264 } else if (m_clickNode->document() == target->document()) { 263 } else if (m_clickNode->document() == target->document()) {
265 m_clickNode->updateDistribution(); 264 m_clickNode->updateDistribution();
266 target->updateDistribution(); 265 target->updateDistribution();
267 clickTargetNode = target->commonAncestor( 266 clickTargetNode = target->commonAncestor(
268 *m_clickNode, EventHandlingUtil::parentForClickEvent); 267 *m_clickNode, EventHandlingUtil::parentForClickEvent);
269 } 268 }
270
271 // This block is only for the purpose of gathering the metric and can be
272 // removed as soon as we don't need the metric.
273 if (targetWithoutCapture != target) {
274 Node* alternativeClickTargetNode = nullptr;
275 if (m_clickNode == targetWithoutCapture) {
276 alternativeClickTargetNode = m_clickNode;
277 } else if (m_clickNode->document() == targetWithoutCapture->document()) {
278 alternativeClickTargetNode = targetWithoutCapture->commonAncestor(
279 *m_clickNode, EventHandlingUtil::parentForClickEvent);
280 }
281 if (alternativeClickTargetNode != clickTargetNode) {
282 UseCounter::count(m_frame,
283 UseCounter::PointerEventClickRetargetCausedByCapture);
284 }
285 }
286
287 if (clickTargetNode) { 269 if (clickTargetNode) {
288 clickEventResult = dispatchMouseEvent( 270 clickEventResult = dispatchMouseEvent(
289 clickTargetNode, 271 clickTargetNode,
290 !RuntimeEnabledFeatures::auxclickEnabled() || 272 !RuntimeEnabledFeatures::auxclickEnabled() ||
291 (mouseEvent.button == WebPointerProperties::Button::Left) 273 (mouseEvent.button == WebPointerProperties::Button::Left)
292 ? EventTypeNames::click 274 ? EventTypeNames::click
293 : EventTypeNames::auxclick, 275 : EventTypeNames::auxclick,
294 mouseEvent, canvasRegionId, nullptr); 276 mouseEvent, canvasRegionId, nullptr);
295 } 277 }
296 } 278 }
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after
1031 1013
1032 void MouseEventManager::setClickCount(int clickCount) { 1014 void MouseEventManager::setClickCount(int clickCount) {
1033 m_clickCount = clickCount; 1015 m_clickCount = clickCount;
1034 } 1016 }
1035 1017
1036 bool MouseEventManager::mouseDownMayStartDrag() { 1018 bool MouseEventManager::mouseDownMayStartDrag() {
1037 return m_mouseDownMayStartDrag; 1019 return m_mouseDownMayStartDrag;
1038 } 1020 }
1039 1021
1040 } // namespace blink 1022 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/input/MouseEventManager.h ('k') | third_party/WebKit/Source/core/input/PointerEventManager.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698