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

Unified Diff: third_party/WebKit/Source/core/input/GestureManager.cpp

Issue 2807123002: Fix the wrong non-element node handling in EventHanlder and MouseEventManager (Closed)
Patch Set: Addressed 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/input/GestureManager.cpp
diff --git a/third_party/WebKit/Source/core/input/GestureManager.cpp b/third_party/WebKit/Source/core/input/GestureManager.cpp
index cf16ec673be0a424729e5399b0516fef9380a62f..a291e0e17c3b8bbe7f924d7901089f724cd547f6 100644
--- a/third_party/WebKit/Source/core/input/GestureManager.cpp
+++ b/third_party/WebKit/Source/core/input/GestureManager.cpp
@@ -185,17 +185,15 @@ WebInputEventResult GestureManager::HandleGestureTap(
}
// Capture data for showUnhandledTapUIIfNeeded.
- Node* tapped_node = current_hit_test.InnerNode();
IntPoint tapped_position =
FlooredIntPoint(gesture_event.PositionInRootFrame());
- Node* tapped_non_text_node = tapped_node;
+ Node* tapped_node = current_hit_test.InnerNode();
+ Element* tapped_element =
+ EventHandlingUtil::ParentElementIfNeeded(tapped_node);
UserGestureIndicator gesture_indicator(DocumentUserGestureToken::Create(
tapped_node ? &tapped_node->GetDocument() : nullptr));
- if (tapped_non_text_node && tapped_non_text_node->IsTextNode())
- tapped_non_text_node = FlatTreeTraversal::Parent(*tapped_non_text_node);
-
- mouse_event_manager_->SetClickNode(tapped_non_text_node);
+ mouse_event_manager_->SetClickElement(tapped_element);
WebMouseEvent fake_mouse_down(
WebInputEvent::kMouseDown, gesture_event,
@@ -262,7 +260,7 @@ WebInputEventResult GestureManager::HandleGestureTap(
EventTypeNames::mouseup, fake_mouse_up);
WebInputEventResult click_event_result = WebInputEventResult::kNotHandled;
- if (tapped_non_text_node) {
+ if (tapped_element) {
if (current_hit_test.InnerNode()) {
// Updates distribution because a mouseup (or mousedown) event listener
// can make the tree dirty at dispatchMouseEvent() invocation above.
@@ -270,15 +268,15 @@ WebInputEventResult GestureManager::HandleGestureTap(
// tappedNonTextNode and currentHitTest.innerNode()) don't need to be
// updated because commonAncestor() will exit early if their documents are
// different.
- tapped_non_text_node->UpdateDistribution();
+ tapped_element->UpdateDistribution();
Node* click_target_node = current_hit_test.InnerNode()->CommonAncestor(
- *tapped_non_text_node, EventHandlingUtil::ParentForClickEvent);
+ *tapped_element, EventHandlingUtil::ParentForClickEvent);
click_event_result =
mouse_event_manager_->SetMousePositionAndDispatchMouseEvent(
click_target_node, String(), EventTypeNames::click,
fake_mouse_up);
}
- mouse_event_manager_->SetClickNode(nullptr);
+ mouse_event_manager_->SetClickElement(nullptr);
}
if (mouse_up_event_result == WebInputEventResult::kNotHandled)

Powered by Google App Engine
This is Rietveld 408576698