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

Side by Side Diff: third_party/WebKit/Source/core/input/EventHandler.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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights
3 * reserved. 3 * reserved.
4 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) 4 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org)
5 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) 5 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies)
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 953 matching lines...) Expand 10 before | Expand all | Expand 10 after
964 m_frame->localFrameRoot() 964 m_frame->localFrameRoot()
965 ->eventHandler() 965 ->eventHandler()
966 .m_lastMouseDownUserGestureToken.release())); 966 .m_lastMouseDownUserGestureToken.release()));
967 } else { 967 } else {
968 gestureIndicator = WTF::wrapUnique(new UserGestureIndicator( 968 gestureIndicator = WTF::wrapUnique(new UserGestureIndicator(
969 DocumentUserGestureToken::create(m_frame->document()))); 969 DocumentUserGestureToken::create(m_frame->document())));
970 } 970 }
971 971
972 WebInputEventResult eventResult = updatePointerTargetAndDispatchEvents( 972 WebInputEventResult eventResult = updatePointerTargetAndDispatchEvents(
973 EventTypeNames::mouseup, mev.innerNode(), mev.canvasRegionId(), 973 EventTypeNames::mouseup, mev.innerNode(), mev.canvasRegionId(),
974 mev.event(), Vector<WebMouseEvent>()); 974 mev.event(), Vector<WebMouseEvent>(),
975 975 !(selectionController().hasExtendedSelection() && isLinkSelection(mev)));
976 WebInputEventResult clickEventResult =
977 m_mouseEventManager->dispatchMouseClickIfNeeded(mev);
978 976
979 m_scrollManager->clearResizeScrollableArea(false); 977 m_scrollManager->clearResizeScrollableArea(false);
980 978
981 if (eventResult == WebInputEventResult::NotHandled) 979 if (eventResult == WebInputEventResult::NotHandled)
982 eventResult = m_mouseEventManager->handleMouseReleaseEvent(mev); 980 eventResult = m_mouseEventManager->handleMouseReleaseEvent(mev);
983 m_mouseEventManager->clearDragHeuristicState(); 981 m_mouseEventManager->clearDragHeuristicState();
984 982
985 m_mouseEventManager->invalidateClick(); 983 m_mouseEventManager->invalidateClick();
986 984
987 return EventHandlingUtil::mergeEventResult(clickEventResult, eventResult); 985 return eventResult;
988 } 986 }
989 987
990 static bool targetIsFrame(Node* target, LocalFrame*& frame) { 988 static bool targetIsFrame(Node* target, LocalFrame*& frame) {
991 if (!isHTMLFrameElementBase(target)) 989 if (!isHTMLFrameElementBase(target))
992 return false; 990 return false;
993 991
994 // Cross-process drag and drop is not yet supported. 992 // Cross-process drag and drop is not yet supported.
995 if (toHTMLFrameElementBase(target)->contentFrame() && 993 if (toHTMLFrameElementBase(target)->contentFrame() &&
996 !toHTMLFrameElementBase(target)->contentFrame()->isLocalFrame()) 994 !toHTMLFrameElementBase(target)->contentFrame()->isLocalFrame())
997 return false; 995 return false;
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
1252 1250
1253 void EventHandler::elementRemoved(EventTarget* target) { 1251 void EventHandler::elementRemoved(EventTarget* target) {
1254 m_pointerEventManager->elementRemoved(target); 1252 m_pointerEventManager->elementRemoved(target);
1255 } 1253 }
1256 1254
1257 WebInputEventResult EventHandler::updatePointerTargetAndDispatchEvents( 1255 WebInputEventResult EventHandler::updatePointerTargetAndDispatchEvents(
1258 const AtomicString& mouseEventType, 1256 const AtomicString& mouseEventType,
1259 Node* targetNode, 1257 Node* targetNode,
1260 const String& canvasRegionId, 1258 const String& canvasRegionId,
1261 const WebMouseEvent& mouseEvent, 1259 const WebMouseEvent& mouseEvent,
1262 const Vector<WebMouseEvent>& coalescedEvents) { 1260 const Vector<WebMouseEvent>& coalescedEvents,
1261 bool sendClickIfNeeded) {
mustaq 2017/02/10 21:16:53 Can the name |sendClickIfNeeded| be more specific
1263 ASSERT(mouseEventType == EventTypeNames::mousedown || 1262 ASSERT(mouseEventType == EventTypeNames::mousedown ||
1264 mouseEventType == EventTypeNames::mousemove || 1263 mouseEventType == EventTypeNames::mousemove ||
1265 mouseEventType == EventTypeNames::mouseup); 1264 mouseEventType == EventTypeNames::mouseup);
1266 1265
1267 const auto& eventResult = m_pointerEventManager->sendMousePointerEvent( 1266 const auto& eventResult = m_pointerEventManager->sendMousePointerEvent(
1268 updateMouseEventTargetNode(targetNode), canvasRegionId, mouseEventType, 1267 updateMouseEventTargetNode(targetNode), canvasRegionId, mouseEventType,
1269 mouseEvent, coalescedEvents); 1268 mouseEvent, coalescedEvents, sendClickIfNeeded);
1270 return eventResult; 1269 return eventResult;
1271 } 1270 }
1272 1271
1273 WebInputEventResult EventHandler::handleWheelEvent( 1272 WebInputEventResult EventHandler::handleWheelEvent(
1274 const WebMouseWheelEvent& event) { 1273 const WebMouseWheelEvent& event) {
1275 #if OS(MACOSX) 1274 #if OS(MACOSX)
1276 // Filter Mac OS specific phases, usually with a zero-delta. 1275 // Filter Mac OS specific phases, usually with a zero-delta.
1277 // https://crbug.com/553732 1276 // https://crbug.com/553732
1278 // TODO(chongz): EventSender sends events with 1277 // TODO(chongz): EventSender sends events with
1279 // |WebMouseWheelEvent::PhaseNone|, 1278 // |WebMouseWheelEvent::PhaseNone|,
(...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after
2131 } 2130 }
2132 2131
2133 FrameHost* EventHandler::frameHost() const { 2132 FrameHost* EventHandler::frameHost() const {
2134 if (!m_frame->page()) 2133 if (!m_frame->page())
2135 return nullptr; 2134 return nullptr;
2136 2135
2137 return &m_frame->page()->frameHost(); 2136 return &m_frame->page()->frameHost();
2138 } 2137 }
2139 2138
2140 } // namespace blink 2139 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/input/EventHandler.h ('k') | third_party/WebKit/Source/core/input/MouseEventManager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698