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

Side by Side 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: Remove empty line Created 4 years, 7 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 1474 matching lines...) Expand 10 before | Expand all | Expand 10 after
1485 // Both m_clickNode and mev.innerNode() don't need to be updated 1485 // Both m_clickNode and mev.innerNode() don't need to be updated
1486 // because commonAncestor() will exit early if their documents are diffe rent. 1486 // because commonAncestor() will exit early if their documents are diffe rent.
1487 m_clickNode->updateDistribution(); 1487 m_clickNode->updateDistribution();
1488 if (Node* clickTargetNode = mev.innerNode()->commonAncestor( 1488 if (Node* clickTargetNode = mev.innerNode()->commonAncestor(
1489 *m_clickNode, parentForClickEvent)) { 1489 *m_clickNode, parentForClickEvent)) {
1490 1490
1491 // Dispatch mouseup directly w/o calling updateMouseEventTargetNodeA ndSendEvents 1491 // Dispatch mouseup directly w/o calling updateMouseEventTargetNodeA ndSendEvents
1492 // because the mouseup dispatch above has already updated it 1492 // because the mouseup dispatch above has already updated it
1493 // correctly. Moreover, clickTargetNode is different from 1493 // correctly. Moreover, clickTargetNode is different from
1494 // mev.innerNode at drag-release. 1494 // mev.innerNode at drag-release.
1495 clickEventResult = toWebInputEventResult(clickTargetNode->dispatchMo useEvent(mev.event(), 1495 MouseEvent* event = MouseEvent::create(
1496 EventTypeNames::click, m_clickCount)); 1496 EventTypeNames::click,
1497 clickTargetNode->document().domWindow(),
1498 mev.event(), m_clickCount, nullptr);
1499 if (mev.event().button() != MouseButton::LeftButton)
dtapuska 2016/04/25 19:59:37 Perhaps add a comment about the bug number here?
Navid Zolghadr 2016/04/26 17:04:07 Done.
1500 event->stopPropagation();
1501 return toWebInputEventResult(clickTargetNode->dispatchEvent(event));
dtapuska 2016/04/25 19:59:36 This is different logic than in the past... clickE
Navid Zolghadr 2016/04/26 17:04:07 My bad! Thanks for catching it.
1497 } 1502 }
1498 } 1503 }
1499 1504
1500 if (m_resizeScrollableArea) { 1505 if (m_resizeScrollableArea) {
1501 m_resizeScrollableArea->setInResizeMode(false); 1506 m_resizeScrollableArea->setInResizeMode(false);
1502 m_resizeScrollableArea = nullptr; 1507 m_resizeScrollableArea = nullptr;
1503 } 1508 }
1504 1509
1505 if (eventResult == WebInputEventResult::NotHandled) 1510 if (eventResult == WebInputEventResult::NotHandled)
1506 eventResult = handleMouseReleaseEvent(mev); 1511 eventResult = handleMouseReleaseEvent(mev);
(...skipping 2642 matching lines...) Expand 10 before | Expand all | Expand 10 after
4149 PlatformEvent::Modifiers EventHandler::accessKeyModifiers() 4154 PlatformEvent::Modifiers EventHandler::accessKeyModifiers()
4150 { 4155 {
4151 #if OS(MACOSX) 4156 #if OS(MACOSX)
4152 return static_cast<PlatformEvent::Modifiers>(PlatformEvent::CtrlKey | Platfo rmEvent::AltKey); 4157 return static_cast<PlatformEvent::Modifiers>(PlatformEvent::CtrlKey | Platfo rmEvent::AltKey);
4153 #else 4158 #else
4154 return PlatformEvent::AltKey; 4159 return PlatformEvent::AltKey;
4155 #endif 4160 #endif
4156 } 4161 }
4157 4162
4158 } // namespace blink 4163 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698