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

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

Issue 1907633002: Update distribution on the nodes involved in click (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Applying comments Created 4 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
« 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 1445 matching lines...) Expand 10 before | Expand all | Expand 10 after
1456 contextMenuEvent = true; 1456 contextMenuEvent = true;
1457 #endif 1457 #endif
1458 1458
1459 WebInputEventResult clickEventResult = WebInputEventResult::NotHandled; 1459 WebInputEventResult clickEventResult = WebInputEventResult::NotHandled;
1460 const bool shouldDispatchClickEvent = m_clickCount > 0 1460 const bool shouldDispatchClickEvent = m_clickCount > 0
1461 && !contextMenuEvent 1461 && !contextMenuEvent
1462 && mev.innerNode() && m_clickNode 1462 && mev.innerNode() && m_clickNode
1463 && mev.innerNode()->canParticipateInFlatTree() && m_clickNode->canPartic ipateInFlatTree() 1463 && mev.innerNode()->canParticipateInFlatTree() && m_clickNode->canPartic ipateInFlatTree()
1464 && !(selectionController().hasExtendedSelection() && isLinkSelection(mev )); 1464 && !(selectionController().hasExtendedSelection() && isLinkSelection(mev ));
1465 if (shouldDispatchClickEvent) { 1465 if (shouldDispatchClickEvent) {
1466 Node* clickTargetNode = nullptr;
1466 // Updates distribution because a 'mouseup' event listener can make the 1467 // Updates distribution because a 'mouseup' event listener can make the
1467 // tree dirty at dispatchMouseEvent() invocation above. 1468 // tree dirty at dispatchMouseEvent() invocation above.
1468 // Unless distribution is updated, commonAncestor would hit ASSERT. 1469 // Unless distribution is updated, commonAncestor would hit ASSERT.
1469 // Both m_clickNode and mev.innerNode() don't need to be updated 1470 if (m_clickNode == mev.innerNode()) {
1470 // because commonAncestor() will exit early if their documents are diffe rent. 1471 clickTargetNode = m_clickNode;
1471 m_clickNode->updateDistribution(); 1472 clickTargetNode->updateDistribution();
1472 if (Node* clickTargetNode = mev.innerNode()->commonAncestor( 1473 } else if (m_clickNode->document() == mev.innerNode()->document()) {
1473 *m_clickNode, parentForClickEvent)) { 1474 m_clickNode->updateDistribution();
1474 1475 mev.innerNode()->updateDistribution();
1476 clickTargetNode = mev.innerNode()->commonAncestor(
1477 *m_clickNode, parentForClickEvent);
1478 }
1479 if (clickTargetNode) {
1475 // Dispatch mouseup directly w/o calling updateMouseEventTargetNodeA ndSendEvents 1480 // Dispatch mouseup directly w/o calling updateMouseEventTargetNodeA ndSendEvents
1476 // because the mouseup dispatch above has already updated it 1481 // because the mouseup dispatch above has already updated it
1477 // correctly. Moreover, clickTargetNode is different from 1482 // correctly. Moreover, clickTargetNode is different from
1478 // mev.innerNode at drag-release. 1483 // mev.innerNode at drag-release.
1479 clickEventResult = toWebInputEventResult(clickTargetNode->dispatchMo useEvent(mev.event(), 1484 clickEventResult = toWebInputEventResult(clickTargetNode->dispatchMo useEvent(mev.event(),
1480 EventTypeNames::click, m_clickCount)); 1485 EventTypeNames::click, m_clickCount));
1481 } 1486 }
1482 } 1487 }
1483 1488
1484 if (m_resizeScrollableArea) { 1489 if (m_resizeScrollableArea) {
(...skipping 2619 matching lines...) Expand 10 before | Expand all | Expand 10 after
4104 PlatformEvent::Modifiers EventHandler::accessKeyModifiers() 4109 PlatformEvent::Modifiers EventHandler::accessKeyModifiers()
4105 { 4110 {
4106 #if OS(MACOSX) 4111 #if OS(MACOSX)
4107 return static_cast<PlatformEvent::Modifiers>(PlatformEvent::CtrlKey | Platfo rmEvent::AltKey); 4112 return static_cast<PlatformEvent::Modifiers>(PlatformEvent::CtrlKey | Platfo rmEvent::AltKey);
4108 #else 4113 #else
4109 return PlatformEvent::AltKey; 4114 return PlatformEvent::AltKey;
4110 #endif 4115 #endif
4111 } 4116 }
4112 4117
4113 } // namespace blink 4118 } // 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