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

Side by Side Diff: Source/core/page/EventHandler.cpp

Issue 302133002: Fix a document memory leak in drag-and-drop. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/clipboard/Clipboard.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed.
3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) 3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org)
4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) 4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies)
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 3019 matching lines...) Expand 10 before | Expand all | Expand 10 after
3030 break; 3030 break;
3031 case DragSourceActionNone: 3031 case DragSourceActionNone:
3032 ASSERT_NOT_REACHED(); 3032 ASSERT_NOT_REACHED();
3033 } 3033 }
3034 3034
3035 return abs(delta.width()) >= threshold || abs(delta.height()) >= threshold; 3035 return abs(delta.width()) >= threshold || abs(delta.height()) >= threshold;
3036 } 3036 }
3037 3037
3038 void EventHandler::freeClipboard() 3038 void EventHandler::freeClipboard()
3039 { 3039 {
3040 if (dragState().m_dragClipboard) 3040 if (dragState().m_dragClipboard) {
3041 dragState().m_dragSrc = nullptr;
haraken 2014/05/30 12:35:29 You'll need to move this to outside of the if bran
3042 dragState().m_dragClipboard->clearDragImage();
3041 dragState().m_dragClipboard->setAccessPolicy(ClipboardNumb); 3043 dragState().m_dragClipboard->setAccessPolicy(ClipboardNumb);
3044 }
3042 } 3045 }
3043 3046
3044 void EventHandler::dragSourceEndedAt(const PlatformMouseEvent& event, DragOperat ion operation) 3047 void EventHandler::dragSourceEndedAt(const PlatformMouseEvent& event, DragOperat ion operation)
3045 { 3048 {
3046 // Send a hit test request so that RenderLayer gets a chance to update the : hover and :active pseudoclasses. 3049 // Send a hit test request so that RenderLayer gets a chance to update the : hover and :active pseudoclasses.
3047 HitTestRequest request(HitTestRequest::Release | HitTestRequest::ConfusingAn dOftenMisusedDisallowShadowContent); 3050 HitTestRequest request(HitTestRequest::Release | HitTestRequest::ConfusingAn dOftenMisusedDisallowShadowContent);
3048 prepareMouseEvent(request, event); 3051 prepareMouseEvent(request, event);
3049 3052
3050 if (dragState().m_dragSrc) { 3053 if (dragState().m_dragSrc) {
3051 dragState().m_dragClipboard->setDestinationOperation(operation); 3054 dragState().m_dragClipboard->setDestinationOperation(operation);
3052 // for now we don't care if event handler cancels default behavior, sinc e there is none 3055 // for now we don't care if event handler cancels default behavior, sinc e there is none
3053 dispatchDragSrcEvent(EventTypeNames::dragend, event); 3056 dispatchDragSrcEvent(EventTypeNames::dragend, event);
3054 } 3057 }
3055 freeClipboard(); 3058 freeClipboard();
3056 dragState().m_dragSrc = nullptr; 3059 dragState().m_dragSrc = nullptr;
kouhei (in TOK) 2014/05/30 12:29:55 remove this and other m_dragSrc clear after freeCl
3057 // In case the drag was ended due to an escape key press we need to ensure 3060 // In case the drag was ended due to an escape key press we need to ensure
3058 // that consecutive mousemove events don't reinitiate the drag and drop. 3061 // that consecutive mousemove events don't reinitiate the drag and drop.
3059 m_mouseDownMayStartDrag = false; 3062 m_mouseDownMayStartDrag = false;
3060 } 3063 }
3061 3064
3062 void EventHandler::updateDragStateAfterEditDragIfNeeded(Element* rootEditableEle ment) 3065 void EventHandler::updateDragStateAfterEditDragIfNeeded(Element* rootEditableEle ment)
3063 { 3066 {
3064 // If inserting the dragged contents removed the drag source, we still want to fire dragend at the root editble element. 3067 // If inserting the dragged contents removed the drag source, we still want to fire dragend at the root editble element.
3065 if (dragState().m_dragSrc && !dragState().m_dragSrc->inDocument()) 3068 if (dragState().m_dragSrc && !dragState().m_dragSrc->inDocument())
3066 dragState().m_dragSrc = rootEditableElement; 3069 dragState().m_dragSrc = rootEditableElement;
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after
3731 unsigned EventHandler::accessKeyModifiers() 3734 unsigned EventHandler::accessKeyModifiers()
3732 { 3735 {
3733 #if OS(MACOSX) 3736 #if OS(MACOSX)
3734 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; 3737 return PlatformEvent::CtrlKey | PlatformEvent::AltKey;
3735 #else 3738 #else
3736 return PlatformEvent::AltKey; 3739 return PlatformEvent::AltKey;
3737 #endif 3740 #endif
3738 } 3741 }
3739 3742
3740 } // namespace WebCore 3743 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/clipboard/Clipboard.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698