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

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

Issue 1824733006: Suppress mouseup/down when button is NoButton (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 | « no previous file | 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 1357 matching lines...) Expand 10 before | Expand all | Expand 10 after
1368 if (m_clickCount > 0 && !contextMenuEvent && mev.innerNode() && m_clickNode && mev.innerNode()->canParticipateInFlatTree() && m_clickNode->canParticipateInF latTree()) { 1368 if (m_clickCount > 0 && !contextMenuEvent && mev.innerNode() && m_clickNode && mev.innerNode()->canParticipateInFlatTree() && m_clickNode->canParticipateInF latTree()) {
1369 // Updates distribution because a 'mouseup' event listener can make the 1369 // Updates distribution because a 'mouseup' event listener can make the
1370 // tree dirty at dispatchMouseEvent() invocation above. 1370 // tree dirty at dispatchMouseEvent() invocation above.
1371 // Unless distribution is updated, commonAncestor would hit ASSERT. 1371 // Unless distribution is updated, commonAncestor would hit ASSERT.
1372 // Both m_clickNode and mev.innerNode() don't need to be updated 1372 // Both m_clickNode and mev.innerNode() don't need to be updated
1373 // because commonAncestor() will exit early if their documents are diffe rent. 1373 // because commonAncestor() will exit early if their documents are diffe rent.
1374 m_clickNode->updateDistribution(); 1374 m_clickNode->updateDistribution();
1375 if (Node* clickTargetNode = mev.innerNode()->commonAncestor( 1375 if (Node* clickTargetNode = mev.innerNode()->commonAncestor(
1376 *m_clickNode, parentForClickEvent)) { 1376 *m_clickNode, parentForClickEvent)) {
1377 1377
1378 // Dispatch mouseup directly w/o calling updateMouseEventTargetNode 1378 // For 4th/5th button in the mouse since Chrome does not yet send
1379 // because the mouseup dispatch above has already updated it 1379 // button value to Blink but in some cases it does send the event.
1380 // correctly. Moreover, clickTargetNode is different from 1380 // This check is needed to suppress such an event (crbug.com/574959)
1381 // mev.innerNode at drag-release. 1381 if (mouseEvent.button() == NoButton) {
1382 clickEventResult = toWebInputEventResult(clickTargetNode->dispatchMo useEvent(mev.event(), 1382 clickEventResult = WebInputEventResult::HandledSystem;
1383 EventTypeNames::click, m_clickCount)); 1383 } else {
1384 // Dispatch mouseup directly w/o calling updateMouseEventTargetN ode
1385 // because the mouseup dispatch above has already updated it
1386 // correctly. Moreover, clickTargetNode is different from
1387 // mev.innerNode at drag-release.
1388 clickEventResult = toWebInputEventResult(clickTargetNode->dispat chMouseEvent(mev.event(),
1389 EventTypeNames::click, m_clickCount));
1390 }
1384 } 1391 }
1385 } 1392 }
1386 1393
1387 if (m_resizeScrollableArea) { 1394 if (m_resizeScrollableArea) {
1388 m_resizeScrollableArea->setInResizeMode(false); 1395 m_resizeScrollableArea->setInResizeMode(false);
1389 m_resizeScrollableArea = nullptr; 1396 m_resizeScrollableArea = nullptr;
1390 } 1397 }
1391 1398
1392 if (eventResult == WebInputEventResult::NotHandled) 1399 if (eventResult == WebInputEventResult::NotHandled)
1393 eventResult = handleMouseReleaseEvent(mev); 1400 eventResult = handleMouseReleaseEvent(mev);
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
1673 m_pointerEventManager.elementRemoved(target); 1680 m_pointerEventManager.elementRemoved(target);
1674 } 1681 }
1675 1682
1676 // TODO(mustaq): Make PE drive ME dispatch & bookkeeping in EventHandler. 1683 // TODO(mustaq): Make PE drive ME dispatch & bookkeeping in EventHandler.
1677 WebInputEventResult EventHandler::updatePointerTargetAndDispatchEvents(const Ato micString& mouseEventType, Node* targetNode, int clickCount, const PlatformMouse Event& mouseEvent) 1684 WebInputEventResult EventHandler::updatePointerTargetAndDispatchEvents(const Ato micString& mouseEventType, Node* targetNode, int clickCount, const PlatformMouse Event& mouseEvent)
1678 { 1685 {
1679 ASSERT(mouseEventType == EventTypeNames::mousedown 1686 ASSERT(mouseEventType == EventTypeNames::mousedown
1680 || mouseEventType == EventTypeNames::mousemove 1687 || mouseEventType == EventTypeNames::mousemove
1681 || mouseEventType == EventTypeNames::mouseup); 1688 || mouseEventType == EventTypeNames::mouseup);
1682 1689
1690 // For 4th/5th button in the mouse since Chrome does not yet send
1691 // button value to Blink but in some cases it does send the event.
1692 // This check is needed to suppress such an event (crbug.com/574959)
1693 if (mouseEventType != EventTypeNames::mousemove && mouseEvent.button() == No Button) {
dtapuska 2016/03/23 18:37:31 braces aren't needed here
1694 return WebInputEventResult::HandledSystem;
1695 }
1696
1683 updateMouseEventTargetNode(targetNode, mouseEvent); 1697 updateMouseEventTargetNode(targetNode, mouseEvent);
1684 if (!m_nodeUnderMouse) 1698 if (!m_nodeUnderMouse)
1685 return WebInputEventResult::NotHandled; 1699 return WebInputEventResult::NotHandled;
1686 1700
1687 return m_pointerEventManager.sendMousePointerEvent( 1701 return m_pointerEventManager.sendMousePointerEvent(
1688 m_nodeUnderMouse, mouseEventType, clickCount, mouseEvent, nullptr, 1702 m_nodeUnderMouse, mouseEventType, clickCount, mouseEvent, nullptr,
1689 m_frame->document()->domWindow()); 1703 m_frame->document()->domWindow());
1690 } 1704 }
1691 1705
1692 WebInputEventResult EventHandler::handleMouseFocus(const MouseEventWithHitTestRe sults& targetedEvent, InputDeviceCapabilities* sourceCapabilities) 1706 WebInputEventResult EventHandler::handleMouseFocus(const MouseEventWithHitTestRe sults& targetedEvent, InputDeviceCapabilities* sourceCapabilities)
(...skipping 2280 matching lines...) Expand 10 before | Expand all | Expand 10 after
3973 PlatformEvent::Modifiers EventHandler::accessKeyModifiers() 3987 PlatformEvent::Modifiers EventHandler::accessKeyModifiers()
3974 { 3988 {
3975 #if OS(MACOSX) 3989 #if OS(MACOSX)
3976 return static_cast<PlatformEvent::Modifiers>(PlatformEvent::CtrlKey | Platfo rmEvent::AltKey); 3990 return static_cast<PlatformEvent::Modifiers>(PlatformEvent::CtrlKey | Platfo rmEvent::AltKey);
3977 #else 3991 #else
3978 return PlatformEvent::AltKey; 3992 return PlatformEvent::AltKey;
3979 #endif 3993 #endif
3980 } 3994 }
3981 3995
3982 } // namespace blink 3996 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698