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

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

Issue 2681443003: Send click event after pointer capturing retarget (Closed)
Patch Set: Created 3 years, 10 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/MouseEventManager.cpp
diff --git a/third_party/WebKit/Source/core/input/MouseEventManager.cpp b/third_party/WebKit/Source/core/input/MouseEventManager.cpp
index aaca3de4a6922a173bbbca8e925282d38145c232..64f26c083880e42a755906ddfb4a3a9aaeeea3c2 100644
--- a/third_party/WebKit/Source/core/input/MouseEventManager.cpp
+++ b/third_party/WebKit/Source/core/input/MouseEventManager.cpp
@@ -230,50 +230,50 @@ WebInputEventResult MouseEventManager::setMousePositionAndDispatchMouseEvent(
}
WebInputEventResult MouseEventManager::dispatchMouseClickIfNeeded(
- const MouseEventWithHitTestResults& mev) {
+ Node* target,
+ const WebMouseEvent& mouseEvent,
+ const String& canvasRegionId) {
// We only prevent click event when the click may cause contextmenu to popup.
// However, we always send auxclick.
bool contextMenuEvent =
!RuntimeEnabledFeatures::auxclickEnabled() &&
- mev.event().button == WebPointerProperties::Button::Right;
+ mouseEvent.button == WebPointerProperties::Button::Right;
#if OS(MACOSX)
// FIXME: The Mac port achieves the same behavior by checking whether the
// context menu is currently open in WebPage::mouseEvent(). Consider merging
// the implementations.
- if (mev.event().button == WebPointerProperties::Button::Left &&
- mev.event().modifiers() & WebInputEvent::Modifiers::ControlKey)
+ if (mouseEvent.button == WebPointerProperties::Button::Left &&
+ mouseEvent.modifiers() & WebInputEvent::Modifiers::ControlKey)
contextMenuEvent = true;
#endif
WebInputEventResult clickEventResult = WebInputEventResult::NotHandled;
- const bool shouldDispatchClickEvent =
- m_clickCount > 0 && !contextMenuEvent && mev.innerNode() && m_clickNode &&
- mev.innerNode()->canParticipateInFlatTree() &&
- m_clickNode->canParticipateInFlatTree() &&
- !(m_frame->eventHandler().selectionController().hasExtendedSelection() &&
- isLinkSelection(mev));
+ const bool shouldDispatchClickEvent = m_clickCount > 0 && !contextMenuEvent &&
+ target && m_clickNode &&
+ target->canParticipateInFlatTree() &&
+ m_clickNode->canParticipateInFlatTree();
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.
- if (m_clickNode == mev.innerNode()) {
+ if (m_clickNode == target) {
clickTargetNode = m_clickNode;
clickTargetNode->updateDistribution();
- } else if (m_clickNode->document() == mev.innerNode()->document()) {
+ } else if (m_clickNode->document() == target->document()) {
m_clickNode->updateDistribution();
- mev.innerNode()->updateDistribution();
- clickTargetNode = mev.innerNode()->commonAncestor(
+ target->updateDistribution();
+ clickTargetNode = target->commonAncestor(
*m_clickNode, EventHandlingUtil::parentForClickEvent);
}
if (clickTargetNode) {
clickEventResult = dispatchMouseEvent(
clickTargetNode,
!RuntimeEnabledFeatures::auxclickEnabled() ||
- (mev.event().button == WebPointerProperties::Button::Left)
+ (mouseEvent.button == WebPointerProperties::Button::Left)
? EventTypeNames::click
: EventTypeNames::auxclick,
- mev.event(), mev.canvasRegionId(), nullptr);
+ mouseEvent, canvasRegionId, nullptr);
}
}
return clickEventResult;

Powered by Google App Engine
This is Rietveld 408576698