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

Side by Side Diff: Source/core/platform/chromium/ClipboardChromium.cpp

Issue 16715002: Refactor WebCore::DragImage. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: merge upstream changes, some changes per jamesr Created 7 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
3 * Copyright (C) 2008, 2009 Google Inc. 3 * Copyright (C) 2008, 2009 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 void ClipboardChromium::setDragImage(CachedImage* img, const IntPoint& loc) 316 void ClipboardChromium::setDragImage(CachedImage* img, const IntPoint& loc)
317 { 317 {
318 setDragImage(img, 0, loc); 318 setDragImage(img, 0, loc);
319 } 319 }
320 320
321 void ClipboardChromium::setDragImageElement(Node* node, const IntPoint& loc) 321 void ClipboardChromium::setDragImageElement(Node* node, const IntPoint& loc)
322 { 322 {
323 setDragImage(0, node, loc); 323 setDragImage(0, node, loc);
324 } 324 }
325 325
326 DragImageRef ClipboardChromium::createDragImage(IntPoint& loc) const 326 PassOwnPtr<DragImage> ClipboardChromium::createDragImage(IntPoint& loc) const
327 { 327 {
328 DragImageRef result = 0;
329 if (m_dragImageElement) { 328 if (m_dragImageElement) {
330 if (m_frame) { 329 if (m_frame) {
331 result = m_frame->nodeImage(m_dragImageElement.get());
332 loc = m_dragLoc; 330 loc = m_dragLoc;
331 return m_frame->nodeImage(m_dragImageElement.get());
333 } 332 }
334 } else if (m_dragImage) { 333 } else if (m_dragImage) {
335 result = createDragImageFromImage(m_dragImage->image());
336 loc = m_dragLoc; 334 loc = m_dragLoc;
335 return DragImage::create(m_dragImage->image());
337 } 336 }
338 return result; 337 return nullptr;
339 } 338 }
340 339
341 static CachedImage* getCachedImage(Element* element) 340 static CachedImage* getCachedImage(Element* element)
342 { 341 {
343 // Attempt to pull CachedImage from element 342 // Attempt to pull CachedImage from element
344 ASSERT(element); 343 ASSERT(element);
345 RenderObject* renderer = element->renderer(); 344 RenderObject* renderer = element->renderer();
346 if (!renderer || !renderer->isImage()) 345 if (!renderer || !renderer->isImage())
347 return 0; 346 return 0;
348 347
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 460
462 PassRefPtr<DataTransferItemList> ClipboardChromium::items() 461 PassRefPtr<DataTransferItemList> ClipboardChromium::items()
463 { 462 {
464 // FIXME: According to the spec, we are supposed to return the same collecti on of items each 463 // FIXME: According to the spec, we are supposed to return the same collecti on of items each
465 // time. We now return a wrapper that always wraps the *same* set of items, so JS shouldn't be 464 // time. We now return a wrapper that always wraps the *same* set of items, so JS shouldn't be
466 // able to tell, but we probably still want to fix this. 465 // able to tell, but we probably still want to fix this.
467 return DataTransferItemListPolicyWrapper::create(this, m_dataObject); 466 return DataTransferItemListPolicyWrapper::create(this, m_dataObject);
468 } 467 }
469 468
470 } // namespace WebCore 469 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/platform/chromium/ClipboardChromium.h ('k') | Source/core/platform/chromium/DragImageChromiumSkia.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698