| OLD | NEW | 
|---|
| 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 14 matching lines...) Expand all  Loading... | 
| 25 | 25 | 
| 26 #include "config.h" | 26 #include "config.h" | 
| 27 #include "core/dom/Clipboard.h" | 27 #include "core/dom/Clipboard.h" | 
| 28 | 28 | 
| 29 #include "HTMLNames.h" | 29 #include "HTMLNames.h" | 
| 30 #include "core/dom/DataTransferItem.h" | 30 #include "core/dom/DataTransferItem.h" | 
| 31 #include "core/dom/DataTransferItemList.h" | 31 #include "core/dom/DataTransferItemList.h" | 
| 32 #include "core/editing/markup.h" | 32 #include "core/editing/markup.h" | 
| 33 #include "core/fetch/ImageResource.h" | 33 #include "core/fetch/ImageResource.h" | 
| 34 #include "core/fileapi/FileList.h" | 34 #include "core/fileapi/FileList.h" | 
|  | 35 #include "core/html/HTMLImageElement.h" | 
| 35 #include "core/page/Frame.h" | 36 #include "core/page/Frame.h" | 
| 36 #include "core/platform/DragImage.h" | 37 #include "core/platform/DragImage.h" | 
| 37 #include "core/platform/MIMETypeRegistry.h" | 38 #include "core/platform/MIMETypeRegistry.h" | 
| 38 #include "core/platform/chromium/ChromiumDataObject.h" | 39 #include "core/platform/chromium/ChromiumDataObject.h" | 
| 39 #include "core/rendering/RenderImage.h" | 40 #include "core/rendering/RenderImage.h" | 
| 40 #include "core/rendering/RenderObject.h" | 41 #include "core/rendering/RenderObject.h" | 
| 41 #include "platform/clipboard/ClipboardMimeTypes.h" | 42 #include "platform/clipboard/ClipboardMimeTypes.h" | 
| 42 #include "platform/clipboard/ClipboardUtilities.h" | 43 #include "platform/clipboard/ClipboardUtilities.h" | 
| 43 | 44 | 
| 44 namespace WebCore { | 45 namespace WebCore { | 
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 203         if (m_dataObject->item(i)->kind() == DataTransferItem::kindFile) { | 204         if (m_dataObject->item(i)->kind() == DataTransferItem::kindFile) { | 
| 204             RefPtr<Blob> blob = m_dataObject->item(i)->getAsFile(); | 205             RefPtr<Blob> blob = m_dataObject->item(i)->getAsFile(); | 
| 205             if (blob && blob->isFile()) | 206             if (blob && blob->isFile()) | 
| 206                 files->append(toFile(blob.get())); | 207                 files->append(toFile(blob.get())); | 
| 207         } | 208         } | 
| 208     } | 209     } | 
| 209 | 210 | 
| 210     return files.release(); | 211     return files.release(); | 
| 211 } | 212 } | 
| 212 | 213 | 
| 213 void Clipboard::setDragImage(ImageResource* img, const IntPoint& loc) | 214 void Clipboard::setDragImage(Element* image, int x, int y, ExceptionState& es) | 
|  | 215 { | 
|  | 216     if (!isForDragAndDrop()) | 
|  | 217         return; | 
|  | 218 | 
|  | 219     if (!image) { | 
|  | 220         es.throwTypeError("setDragImage: Invalid first argument"); | 
|  | 221         return; | 
|  | 222     } | 
|  | 223     IntPoint location(x, y); | 
|  | 224     if (image->hasTagName(HTMLNames::imgTag) && !image->inDocument()) | 
|  | 225         setDragImageResource(toHTMLImageElement(image)->cachedImage(), location)
     ; | 
|  | 226     else | 
|  | 227         setDragImageElement(image, location); | 
|  | 228 } | 
|  | 229 | 
|  | 230 void Clipboard::setDragImageResource(ImageResource* img, const IntPoint& loc) | 
| 214 { | 231 { | 
| 215     setDragImage(img, 0, loc); | 232     setDragImage(img, 0, loc); | 
| 216 } | 233 } | 
| 217 | 234 | 
| 218 void Clipboard::setDragImageElement(Node* node, const IntPoint& loc) | 235 void Clipboard::setDragImageElement(Node* node, const IntPoint& loc) | 
| 219 { | 236 { | 
| 220     setDragImage(0, node, loc); | 237     setDragImage(0, node, loc); | 
| 221 } | 238 } | 
| 222 | 239 | 
| 223 PassOwnPtr<DragImage> Clipboard::createDragImage(IntPoint& loc, Frame* frame) co
     nst | 240 PassOwnPtr<DragImage> Clipboard::createDragImage(IntPoint& loc, Frame* frame) co
     nst | 
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 499     case DragOperationMove: | 516     case DragOperationMove: | 
| 500         return String("move"); | 517         return String("move"); | 
| 501     case DragOperationLink: | 518     case DragOperationLink: | 
| 502         return String("link"); | 519         return String("link"); | 
| 503     default: | 520     default: | 
| 504         return String("copy"); | 521         return String("copy"); | 
| 505     } | 522     } | 
| 506 } | 523 } | 
| 507 | 524 | 
| 508 } // namespace WebCore | 525 } // namespace WebCore | 
| OLD | NEW | 
|---|