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

Unified Diff: Source/core/dom/Clipboard.cpp

Issue 26532002: Get rid of of custom code for Clipboard.setDragImage() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/dom/Clipboard.h ('k') | Source/core/dom/Clipboard.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Clipboard.cpp
diff --git a/Source/core/dom/Clipboard.cpp b/Source/core/dom/Clipboard.cpp
index 9e15c900636b922e489f3d15df62e87f171fa651..12312802d4a7e19e93b637e5d862e6c1688a6748 100644
--- a/Source/core/dom/Clipboard.cpp
+++ b/Source/core/dom/Clipboard.cpp
@@ -32,6 +32,7 @@
#include "core/editing/markup.h"
#include "core/fetch/ImageResource.h"
#include "core/fileapi/FileList.h"
+#include "core/html/HTMLImageElement.h"
#include "core/page/Frame.h"
#include "core/platform/DragImage.h"
#include "core/platform/MIMETypeRegistry.h"
@@ -210,7 +211,23 @@ PassRefPtr<FileList> Clipboard::files() const
return files.release();
}
-void Clipboard::setDragImage(ImageResource* img, const IntPoint& loc)
+void Clipboard::setDragImage(Element* image, int x, int y, ExceptionState& es)
+{
+ if (!isForDragAndDrop())
+ return;
+
+ if (!image) {
+ es.throwTypeError("setDragImage: Invalid first argument");
+ return;
+ }
+ IntPoint location(x, y);
+ if (image->hasTagName(HTMLNames::imgTag) && !image->inDocument())
+ setDragImageResource(toHTMLImageElement(image)->cachedImage(), location);
+ else
+ setDragImageElement(image, location);
+}
+
+void Clipboard::setDragImageResource(ImageResource* img, const IntPoint& loc)
{
setDragImage(img, 0, loc);
}
« no previous file with comments | « Source/core/dom/Clipboard.h ('k') | Source/core/dom/Clipboard.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698