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

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: Rebased 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
« no previous file with comments | « third_party/WebKit/Source/core/events/MouseEvent.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1512 matching lines...) Expand 10 before | Expand all | Expand 10 after
1523 m_clickNode->updateDistribution(); 1523 m_clickNode->updateDistribution();
1524 mev.innerNode()->updateDistribution(); 1524 mev.innerNode()->updateDistribution();
1525 clickTargetNode = mev.innerNode()->commonAncestor( 1525 clickTargetNode = mev.innerNode()->commonAncestor(
1526 *m_clickNode, parentForClickEvent); 1526 *m_clickNode, parentForClickEvent);
1527 } 1527 }
1528 if (clickTargetNode) { 1528 if (clickTargetNode) {
1529 // Dispatch mouseup directly w/o calling updateMouseEventTargetNodeA ndSendEvents 1529 // Dispatch mouseup directly w/o calling updateMouseEventTargetNodeA ndSendEvents
1530 // because the mouseup dispatch above has already updated it 1530 // because the mouseup dispatch above has already updated it
1531 // correctly. Moreover, clickTargetNode is different from 1531 // correctly. Moreover, clickTargetNode is different from
1532 // mev.innerNode at drag-release. 1532 // mev.innerNode at drag-release.
1533 clickEventResult = toWebInputEventResult(clickTargetNode->dispatchMo useEvent(mev.event(), 1533
1534 EventTypeNames::click, m_clickCount)); 1534 MouseEvent* event = MouseEvent::create(
1535 EventTypeNames::click,
1536 clickTargetNode->document().domWindow(),
1537 mev.event(), m_clickCount, nullptr);
1538
1539 // This is to suppress sending click events for non-primary buttons.
1540 // But still doing default action like opening a new tab for middle
1541 // click (crbug.com/255).
1542 if (mev.event().button() != MouseButton::LeftButton)
1543 event->stopPropagation();
1544
1545 clickEventResult = toWebInputEventResult(clickTargetNode->dispatchEv ent(event));
1535 } 1546 }
1536 } 1547 }
1537 1548
1538 if (m_resizeScrollableArea) { 1549 if (m_resizeScrollableArea) {
1539 m_resizeScrollableArea->setInResizeMode(false); 1550 m_resizeScrollableArea->setInResizeMode(false);
1540 m_resizeScrollableArea = nullptr; 1551 m_resizeScrollableArea = nullptr;
1541 } 1552 }
1542 1553
1543 if (eventResult == WebInputEventResult::NotHandled) 1554 if (eventResult == WebInputEventResult::NotHandled)
1544 eventResult = handleMouseReleaseEvent(mev); 1555 eventResult = handleMouseReleaseEvent(mev);
(...skipping 2630 matching lines...) Expand 10 before | Expand all | Expand 10 after
4175 PlatformEvent::Modifiers EventHandler::accessKeyModifiers() 4186 PlatformEvent::Modifiers EventHandler::accessKeyModifiers()
4176 { 4187 {
4177 #if OS(MACOSX) 4188 #if OS(MACOSX)
4178 return static_cast<PlatformEvent::Modifiers>(PlatformEvent::CtrlKey | Platfo rmEvent::AltKey); 4189 return static_cast<PlatformEvent::Modifiers>(PlatformEvent::CtrlKey | Platfo rmEvent::AltKey);
4179 #else 4190 #else
4180 return PlatformEvent::AltKey; 4191 return PlatformEvent::AltKey;
4181 #endif 4192 #endif
4182 } 4193 }
4183 4194
4184 } // namespace blink 4195 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/events/MouseEvent.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698