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

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

Issue 2471843005: Delegate dragend to the correct frame's EventHandler. (Closed)
Patch Set: The LSAN-reported leak was actually a failure to reset the drag state in MouseEventHandler. Created 4 years, 1 month 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 1949 matching lines...) Expand 10 before | Expand all | Expand 10 after
1960 return m_keyboardEventManager->keyEvent(initialKeyEvent); 1960 return m_keyboardEventManager->keyEvent(initialKeyEvent);
1961 } 1961 }
1962 1962
1963 void EventHandler::defaultKeyboardEventHandler(KeyboardEvent* event) { 1963 void EventHandler::defaultKeyboardEventHandler(KeyboardEvent* event) {
1964 m_keyboardEventManager->defaultKeyboardEventHandler( 1964 m_keyboardEventManager->defaultKeyboardEventHandler(
1965 event, m_mouseEventManager->mousePressNode()); 1965 event, m_mouseEventManager->mousePressNode());
1966 } 1966 }
1967 1967
1968 void EventHandler::dragSourceEndedAt(const PlatformMouseEvent& event, 1968 void EventHandler::dragSourceEndedAt(const PlatformMouseEvent& event,
1969 DragOperation operation) { 1969 DragOperation operation) {
1970 // Asides from routing the event to the correct frame, the hit test is also an
Navid Zolghadr 2016/11/04 15:29:06 Can we have this whole block of code in MouseEvent
pwnall 2016/11/04 18:24:29 This kind of code also exists in EventHandler::upd
Navid Zolghadr 2016/11/04 18:33:22 MouseEventManager was intended to contain this and
pwnall 2016/11/04 22:40:39 Thank you very much for understanding! This is a
1971 // opportunity for Layer to update the :hover and :active pseudoclasses.
1972 HitTestRequest request(HitTestRequest::Release);
1973 MouseEventWithHitTestResults mev =
1974 EventHandlingUtil::performMouseEventHitTest(m_frame, request, event);
1975
1976 LocalFrame* targetFrame;
1977 if (targetIsFrame(mev.innerNode(), targetFrame)) {
1978 if (targetFrame)
1979 targetFrame->eventHandler().dragSourceEndedAt(event, operation);
1980 }
1981
1982 // This has to be called even if the dragend event is fired in another frame,
1983 // in order to clean up the event manager's drag state.
1970 m_mouseEventManager->dragSourceEndedAt(event, operation); 1984 m_mouseEventManager->dragSourceEndedAt(event, operation);
dcheng 2016/11/04 15:12:15 Hmm... that means this actually gets called twice
pwnall 2016/11/04 18:24:29 I think that each LocalFrame (including subframes)
Navid Zolghadr 2016/11/04 18:33:22 that is correct. Each frame has its own EventHandl
pwnall 2016/11/04 22:40:39 Thank you very much for explaining! I put togethe
1971 } 1985 }
1972 1986
1973 void EventHandler::updateDragStateAfterEditDragIfNeeded( 1987 void EventHandler::updateDragStateAfterEditDragIfNeeded(
1974 Element* rootEditableElement) { 1988 Element* rootEditableElement) {
1975 // If inserting the dragged contents removed the drag source, we still want to 1989 // If inserting the dragged contents removed the drag source, we still want to
1976 // fire dragend at the root editble element. 1990 // fire dragend at the root editble element.
1977 if (m_mouseEventManager->dragState().m_dragSrc && 1991 if (m_mouseEventManager->dragState().m_dragSrc &&
1978 !m_mouseEventManager->dragState().m_dragSrc->isConnected()) 1992 !m_mouseEventManager->dragState().m_dragSrc->isConnected())
1979 m_mouseEventManager->dragState().m_dragSrc = rootEditableElement; 1993 m_mouseEventManager->dragState().m_dragSrc = rootEditableElement;
1980 } 1994 }
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
2086 } 2100 }
2087 2101
2088 FrameHost* EventHandler::frameHost() const { 2102 FrameHost* EventHandler::frameHost() const {
2089 if (!m_frame->page()) 2103 if (!m_frame->page())
2090 return nullptr; 2104 return nullptr;
2091 2105
2092 return &m_frame->page()->frameHost(); 2106 return &m_frame->page()->frameHost();
2093 } 2107 }
2094 2108
2095 } // namespace blink 2109 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698