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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/input/EventHandler.cpp
diff --git a/third_party/WebKit/Source/core/input/EventHandler.cpp b/third_party/WebKit/Source/core/input/EventHandler.cpp
index 2d6734fe3e55de31552918063107734b5633b74f..6958d69b5cee1b400d5c9f5a2a41999859fe98bf 100644
--- a/third_party/WebKit/Source/core/input/EventHandler.cpp
+++ b/third_party/WebKit/Source/core/input/EventHandler.cpp
@@ -1463,15 +1463,20 @@ WebInputEventResult EventHandler::handleMouseReleaseEvent(const PlatformMouseEve
&& mev.innerNode()->canParticipateInFlatTree() && m_clickNode->canParticipateInFlatTree()
&& !(selectionController().hasExtendedSelection() && isLinkSelection(mev));
if (shouldDispatchClickEvent) {
+ Node* clickTargetNode = nullptr;
// Updates distribution because a 'mouseup' event listener can make the
// tree dirty at dispatchMouseEvent() invocation above.
// Unless distribution is updated, commonAncestor would hit ASSERT.
- // Both m_clickNode and mev.innerNode() don't need to be updated
- // because commonAncestor() will exit early if their documents are different.
- m_clickNode->updateDistribution();
- if (Node* clickTargetNode = mev.innerNode()->commonAncestor(
- *m_clickNode, parentForClickEvent)) {
-
+ if (m_clickNode == mev.innerNode()) {
+ clickTargetNode = m_clickNode;
+ clickTargetNode->updateDistribution();
+ } else if (m_clickNode->document() == mev.innerNode()->document()) {
+ m_clickNode->updateDistribution();
+ mev.innerNode()->updateDistribution();
+ clickTargetNode = mev.innerNode()->commonAncestor(
+ *m_clickNode, parentForClickEvent);
+ }
+ if (clickTargetNode) {
// Dispatch mouseup directly w/o calling updateMouseEventTargetNodeAndSendEvents
// because the mouseup dispatch above has already updated it
// correctly. Moreover, clickTargetNode is different from
« 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