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

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

Issue 2814343002: Fire a click event even when a clicked text node is removed in mouseup (Closed)
Patch Set: 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
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 931 matching lines...) Expand 10 before | Expand all | Expand 10 after
942 String(), mouseEvent, Vector<WebMouseEvent>()); 942 String(), mouseEvent, Vector<WebMouseEvent>());
943 } 943 }
944 944
945 // Mouse events simulated from touch should not hit-test again. 945 // Mouse events simulated from touch should not hit-test again.
946 ASSERT(!mouseEvent.fromTouch()); 946 ASSERT(!mouseEvent.fromTouch());
947 947
948 HitTestRequest::HitTestRequestType hitType = HitTestRequest::Release; 948 HitTestRequest::HitTestRequestType hitType = HitTestRequest::Release;
949 HitTestRequest request(hitType); 949 HitTestRequest request(hitType);
950 MouseEventWithHitTestResults mev = 950 MouseEventWithHitTestResults mev =
951 EventHandlingUtil::performMouseEventHitTest(m_frame, request, mouseEvent); 951 EventHandlingUtil::performMouseEventHitTest(m_frame, request, mouseEvent);
952 Node* releaseNode = (mev.innerNode() && mev.innerNode()->isTextNode())
953 ? FlatTreeTraversal::Parent(*mev.innerNode())
954 : mev.innerNode();
952 LocalFrame* subframe = 955 LocalFrame* subframe =
953 m_capturingMouseEventsNode.get() 956 m_capturingMouseEventsNode.get()
954 ? subframeForTargetNode(m_capturingMouseEventsNode.get()) 957 ? subframeForTargetNode(m_capturingMouseEventsNode.get())
955 : subframeForHitTestResult(mev); 958 : subframeForHitTestResult(mev);
956 if (m_eventHandlerWillResetCapturingMouseEventsNode) 959 if (m_eventHandlerWillResetCapturingMouseEventsNode)
957 m_capturingMouseEventsNode = nullptr; 960 m_capturingMouseEventsNode = nullptr;
958 if (subframe) 961 if (subframe)
959 return passMouseReleaseEventToSubframe(mev, subframe); 962 return passMouseReleaseEventToSubframe(mev, subframe);
960 963
961 // Mouse events will be associated with the Document where mousedown 964 // Mouse events will be associated with the Document where mousedown
(...skipping 12 matching lines...) Expand all
974 } else { 977 } else {
975 gestureIndicator = WTF::wrapUnique(new UserGestureIndicator( 978 gestureIndicator = WTF::wrapUnique(new UserGestureIndicator(
976 DocumentUserGestureToken::create(m_frame->document()))); 979 DocumentUserGestureToken::create(m_frame->document())));
977 } 980 }
978 981
979 WebInputEventResult eventResult = updatePointerTargetAndDispatchEvents( 982 WebInputEventResult eventResult = updatePointerTargetAndDispatchEvents(
980 EventTypeNames::mouseup, mev.innerNode(), mev.canvasRegionId(), 983 EventTypeNames::mouseup, mev.innerNode(), mev.canvasRegionId(),
981 mev.event(), Vector<WebMouseEvent>()); 984 mev.event(), Vector<WebMouseEvent>());
982 985
983 WebInputEventResult clickEventResult = 986 WebInputEventResult clickEventResult =
984 m_mouseEventManager->dispatchMouseClickIfNeeded(mev); 987 m_mouseEventManager_->dispatchMouseClickIfNeeded(mev, releaseNode);
985 988
986 m_scrollManager->clearResizeScrollableArea(false); 989 m_scrollManager->clearResizeScrollableArea(false);
987 990
988 if (eventResult == WebInputEventResult::NotHandled) 991 if (eventResult == WebInputEventResult::NotHandled)
989 eventResult = m_mouseEventManager->handleMouseReleaseEvent(mev); 992 eventResult = m_mouseEventManager->handleMouseReleaseEvent(mev);
990 m_mouseEventManager->clearDragHeuristicState(); 993 m_mouseEventManager->clearDragHeuristicState();
991 994
992 m_mouseEventManager->invalidateClick(); 995 m_mouseEventManager->invalidateClick();
993 996
994 return EventHandlingUtil::mergeEventResult(clickEventResult, eventResult); 997 return EventHandlingUtil::mergeEventResult(clickEventResult, eventResult);
(...skipping 1099 matching lines...) Expand 10 before | Expand all | Expand 10 after
2094 } 2097 }
2095 2098
2096 FrameHost* EventHandler::frameHost() const { 2099 FrameHost* EventHandler::frameHost() const {
2097 if (!m_frame->page()) 2100 if (!m_frame->page())
2098 return nullptr; 2101 return nullptr;
2099 2102
2100 return &m_frame->page()->frameHost(); 2103 return &m_frame->page()->frameHost();
2101 } 2104 }
2102 2105
2103 } // namespace blink 2106 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698