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 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 | 245 |
246 PassOwnPtr<DragImage> DataTransfer::createDragImage(IntPoint& loc, LocalFrame* f
rame) const | 246 PassOwnPtr<DragImage> DataTransfer::createDragImage(IntPoint& loc, LocalFrame* f
rame) const |
247 { | 247 { |
248 if (m_dragImageElement) { | 248 if (m_dragImageElement) { |
249 loc = m_dragLoc; | 249 loc = m_dragLoc; |
250 | 250 |
251 return frame->nodeImage(*m_dragImageElement); | 251 return frame->nodeImage(*m_dragImageElement); |
252 } | 252 } |
253 if (m_dragImage) { | 253 if (m_dragImage) { |
254 loc = m_dragLoc; | 254 loc = m_dragLoc; |
255 return DragImage::create(m_dragImage->image()); | 255 return DragImage::create(m_dragImage->getImage()); |
256 } | 256 } |
257 return nullptr; | 257 return nullptr; |
258 } | 258 } |
259 | 259 |
260 static ImageResource* getImageResource(Element* element) | 260 static ImageResource* getImageResource(Element* element) |
261 { | 261 { |
262 // Attempt to pull ImageResource from element | 262 // Attempt to pull ImageResource from element |
263 ASSERT(element); | 263 ASSERT(element); |
264 LayoutObject* layoutObject = element->layoutObject(); | 264 LayoutObject* layoutObject = element->layoutObject(); |
265 if (!layoutObject || !layoutObject->isImage()) | 265 if (!layoutObject || !layoutObject->isImage()) |
266 return 0; | 266 return 0; |
267 | 267 |
268 LayoutImage* image = toLayoutImage(layoutObject); | 268 LayoutImage* image = toLayoutImage(layoutObject); |
269 if (image->cachedImage() && !image->cachedImage()->errorOccurred()) | 269 if (image->cachedImage() && !image->cachedImage()->errorOccurred()) |
270 return image->cachedImage(); | 270 return image->cachedImage(); |
271 | 271 |
272 return 0; | 272 return 0; |
273 } | 273 } |
274 | 274 |
275 static void writeImageToDataObject(DataObject* dataObject, Element* element, con
st KURL& url) | 275 static void writeImageToDataObject(DataObject* dataObject, Element* element, con
st KURL& url) |
276 { | 276 { |
277 // Shove image data into a DataObject for use as a file | 277 // Shove image data into a DataObject for use as a file |
278 ImageResource* cachedImage = getImageResource(element); | 278 ImageResource* cachedImage = getImageResource(element); |
279 if (!cachedImage || !cachedImage->image() || !cachedImage->isLoaded()) | 279 if (!cachedImage || !cachedImage->getImage() || !cachedImage->isLoaded()) |
280 return; | 280 return; |
281 | 281 |
282 SharedBuffer* imageBuffer = cachedImage->image()->data(); | 282 SharedBuffer* imageBuffer = cachedImage->getImage()->data(); |
283 if (!imageBuffer || !imageBuffer->size()) | 283 if (!imageBuffer || !imageBuffer->size()) |
284 return; | 284 return; |
285 | 285 |
286 String imageExtension = cachedImage->image()->filenameExtension(); | 286 String imageExtension = cachedImage->getImage()->filenameExtension(); |
287 ASSERT(!imageExtension.isEmpty()); | 287 ASSERT(!imageExtension.isEmpty()); |
288 | 288 |
289 // Determine the filename for the file contents of the image. | 289 // Determine the filename for the file contents of the image. |
290 String filename = cachedImage->response().suggestedFilename(); | 290 String filename = cachedImage->response().suggestedFilename(); |
291 if (filename.isEmpty()) | 291 if (filename.isEmpty()) |
292 filename = url.lastPathComponent(); | 292 filename = url.lastPathComponent(); |
293 | 293 |
294 String fileExtension; | 294 String fileExtension; |
295 if (filename.isEmpty()) { | 295 if (filename.isEmpty()) { |
296 filename = element->getAttribute(HTMLNames::altAttr); | 296 filename = element->getAttribute(HTMLNames::altAttr); |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 DEFINE_TRACE(DataTransfer) | 511 DEFINE_TRACE(DataTransfer) |
512 { | 512 { |
513 visitor->trace(m_dataObject); | 513 visitor->trace(m_dataObject); |
514 visitor->trace(m_dragImage); | 514 visitor->trace(m_dragImage); |
515 #if ENABLE(OILPAN) | 515 #if ENABLE(OILPAN) |
516 visitor->trace(m_dragImageElement); | 516 visitor->trace(m_dragImageElement); |
517 #endif | 517 #endif |
518 } | 518 } |
519 | 519 |
520 } // namespace blink | 520 } // namespace blink |
OLD | NEW |