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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 if (m_dataObject->item(i)->kind() == DataObjectItem::FileKind) { | 205 if (m_dataObject->item(i)->kind() == DataObjectItem::FileKind) { |
206 Blob* blob = m_dataObject->item(i)->getAsFile(); | 206 Blob* blob = m_dataObject->item(i)->getAsFile(); |
207 if (blob && blob->isFile()) | 207 if (blob && blob->isFile()) |
208 files->append(toFile(blob)); | 208 files->append(toFile(blob)); |
209 } | 209 } |
210 } | 210 } |
211 | 211 |
212 return files; | 212 return files; |
213 } | 213 } |
214 | 214 |
215 void DataTransfer::setDragImage(Element* image, int x, int y, ExceptionState& ex
ceptionState) | 215 void DataTransfer::setDragImage(Element* image, int x, int y) |
216 { | 216 { |
| 217 ASSERT(image); |
| 218 |
217 if (!isForDragAndDrop()) | 219 if (!isForDragAndDrop()) |
218 return; | 220 return; |
219 | 221 |
220 if (!image) { | |
221 exceptionState.throwTypeError("setDragImage: Invalid first argument"); | |
222 return; | |
223 } | |
224 IntPoint location(x, y); | 222 IntPoint location(x, y); |
225 if (isHTMLImageElement(*image) && !image->inDocument()) | 223 if (isHTMLImageElement(*image) && !image->inDocument()) |
226 setDragImageResource(toHTMLImageElement(*image).cachedImage(), location)
; | 224 setDragImageResource(toHTMLImageElement(*image).cachedImage(), location)
; |
227 else | 225 else |
228 setDragImageElement(image, location); | 226 setDragImageElement(image, location); |
229 } | 227 } |
230 | 228 |
231 void DataTransfer::clearDragImage() | 229 void DataTransfer::clearDragImage() |
232 { | 230 { |
233 if (!canSetDragImage()) | 231 if (!canSetDragImage()) |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 | 513 |
516 DEFINE_TRACE(DataTransfer) | 514 DEFINE_TRACE(DataTransfer) |
517 { | 515 { |
518 visitor->trace(m_dataObject); | 516 visitor->trace(m_dataObject); |
519 #if ENABLE(OILPAN) | 517 #if ENABLE(OILPAN) |
520 visitor->trace(m_dragImageElement); | 518 visitor->trace(m_dragImageElement); |
521 #endif | 519 #endif |
522 } | 520 } |
523 | 521 |
524 } // namespace blink | 522 } // namespace blink |
OLD | NEW |