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

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

Issue 2807123002: Fix the wrong non-element node handling in EventHanlder and MouseEventManager (Closed)
Patch Set: try Created 3 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 | « third_party/WebKit/LayoutTests/fast/events/remove-text-node-in-mouseup-expected.txt ('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 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/input/MouseEventManager.h" 5 #include "core/input/MouseEventManager.h"
6 6
7 #include "core/clipboard/DataObject.h" 7 #include "core/clipboard/DataObject.h"
8 #include "core/clipboard/DataTransfer.h" 8 #include "core/clipboard/DataTransfer.h"
9 #include "core/dom/Element.h" 9 #include "core/dom/Element.h"
10 #include "core/dom/ElementTraversal.h" 10 #include "core/dom/ElementTraversal.h"
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 const bool should_dispatch_click_event = 251 const bool should_dispatch_click_event =
252 click_count_ > 0 && !context_menu_event && mev.InnerNode() && 252 click_count_ > 0 && !context_menu_event && mev.InnerNode() &&
253 click_node_ && mev.InnerNode()->CanParticipateInFlatTree() && 253 click_node_ && mev.InnerNode()->CanParticipateInFlatTree() &&
254 click_node_->CanParticipateInFlatTree() && 254 click_node_->CanParticipateInFlatTree() &&
255 !(frame_->GetEventHandler() 255 !(frame_->GetEventHandler()
256 .GetSelectionController() 256 .GetSelectionController()
257 .HasExtendedSelection() && 257 .HasExtendedSelection() &&
258 IsLinkSelection(mev)); 258 IsLinkSelection(mev));
259 if (should_dispatch_click_event) { 259 if (should_dispatch_click_event) {
260 Node* click_target_node = nullptr; 260 Node* click_target_node = nullptr;
261 // Updates distribution because a 'mouseup' event listener can make the 261 // A click event should be fired even when a text node has been removed in
262 // tree dirty at dispatchMouseEvent() invocation above. 262 // mouseup event.
263 // Unless distribution is updated, commonAncestor would hit ASSERT. 263 if ((mev.InnerNode()->IsTextNode() && click_node_->isConnected() &&
tkent 2017/04/11 04:16:14 I think this code has the following unexpected beh
tkent 2017/04/11 04:24:15 Maybe a logic would be: Node* mouseup_node = mev.
264 if (click_node_ == mev.InnerNode()) { 264 !mev.InnerNode()->isConnected()) ||
kochi 2017/04/11 04:25:00 (I am not sure and just checking) - Isn't click_no
265 click_node_ == mev.InnerNode()) {
kochi 2017/04/11 04:25:00 I'd guess "click_node_ == mev.InnerNode()" is the
265 click_target_node = click_node_; 266 click_target_node = click_node_;
266 click_target_node->UpdateDistribution();
267 } else if (click_node_->GetDocument() == mev.InnerNode()->GetDocument()) { 267 } else if (click_node_->GetDocument() == mev.InnerNode()->GetDocument()) {
268 // Updates distribution because a 'mouseup' event listener can make the
269 // tree dirty at dispatchMouseEvent() invocation above.
270 // Unless distribution is updated, commonAncestor would hit ASSERT.
268 click_node_->UpdateDistribution(); 271 click_node_->UpdateDistribution();
269 mev.InnerNode()->UpdateDistribution(); 272 mev.InnerNode()->UpdateDistribution();
270 click_target_node = mev.InnerNode()->CommonAncestor( 273 click_target_node = mev.InnerNode()->CommonAncestor(
271 *click_node_, EventHandlingUtil::ParentForClickEvent); 274 *click_node_, EventHandlingUtil::ParentForClickEvent);
272 } 275 }
273 if (click_target_node) { 276 if (click_target_node) {
274 click_event_result = DispatchMouseEvent( 277 click_event_result = DispatchMouseEvent(
275 click_target_node, 278 click_target_node,
276 !RuntimeEnabledFeatures::auxclickEnabled() || 279 !RuntimeEnabledFeatures::auxclickEnabled() ||
277 (mev.Event().button == WebPointerProperties::Button::kLeft) 280 (mev.Event().button == WebPointerProperties::Button::kLeft)
(...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after
1039 1042
1040 void MouseEventManager::SetClickCount(int click_count) { 1043 void MouseEventManager::SetClickCount(int click_count) {
1041 click_count_ = click_count; 1044 click_count_ = click_count;
1042 } 1045 }
1043 1046
1044 bool MouseEventManager::MouseDownMayStartDrag() { 1047 bool MouseEventManager::MouseDownMayStartDrag() {
1045 return mouse_down_may_start_drag_; 1048 return mouse_down_may_start_drag_;
1046 } 1049 }
1047 1050
1048 } // namespace blink 1051 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/events/remove-text-node-in-mouseup-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698