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

Side by Side Diff: Source/core/clipboard/Clipboard.cpp

Issue 302133002: Fix a document memory leak in drag-and-drop. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: addressed the comment 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.h ('k') | Source/core/page/EventHandler.cpp » ('j') | 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 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 exceptionState.throwTypeError("setDragImage: Invalid first argument"); 221 exceptionState.throwTypeError("setDragImage: Invalid first argument");
222 return; 222 return;
223 } 223 }
224 IntPoint location(x, y); 224 IntPoint location(x, y);
225 if (isHTMLImageElement(*image) && !image->inDocument()) 225 if (isHTMLImageElement(*image) && !image->inDocument())
226 setDragImageResource(toHTMLImageElement(*image).cachedImage(), location) ; 226 setDragImageResource(toHTMLImageElement(*image).cachedImage(), location) ;
227 else 227 else
228 setDragImageElement(image, location); 228 setDragImageElement(image, location);
229 } 229 }
230 230
231 void Clipboard::clearDragImage()
232 {
233 if (!canSetDragImage())
234 return;
235
236 m_dragImage = 0;
237 m_dragLoc = IntPoint();
238 m_dragImageElement = nullptr;
239 }
240
231 void Clipboard::setDragImageResource(ImageResource* img, const IntPoint& loc) 241 void Clipboard::setDragImageResource(ImageResource* img, const IntPoint& loc)
232 { 242 {
233 setDragImage(img, 0, loc); 243 setDragImage(img, 0, loc);
234 } 244 }
235 245
236 void Clipboard::setDragImageElement(Node* node, const IntPoint& loc) 246 void Clipboard::setDragImageElement(Node* node, const IntPoint& loc)
237 { 247 {
238 setDragImage(0, node, loc); 248 setDragImage(0, node, loc);
239 } 249 }
240 250
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 return String("copy"); 533 return String("copy");
524 } 534 }
525 } 535 }
526 536
527 void Clipboard::trace(Visitor* visitor) 537 void Clipboard::trace(Visitor* visitor)
528 { 538 {
529 visitor->trace(m_dataObject); 539 visitor->trace(m_dataObject);
530 } 540 }
531 541
532 } // namespace WebCore 542 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/clipboard/Clipboard.h ('k') | Source/core/page/EventHandler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698