Changeset 147912 in webkit
- Timestamp:
- Apr 8, 2013 6:35:18 AM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r147911 r147912 1 2013-04-08 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 DragImage should not depend on Frame and CachedImage 4 https://bugs.webkit.org/show_bug.cgi?id=21357 5 6 Reviewed by Sam Weinig. 7 8 Remove Frame and CachedImage dependencies from DragImage. 9 10 * dom/Clipboard.h: 11 (WebCore): Add forward delcaration for CacheImage since it's not 12 included anymore in DragImage.h. 13 * page/DragController.cpp: 14 (WebCore::DragController::startDrag): Use 15 Frame::dragImageForSelection() and call 16 dissolveDragImageToFraction() for the returned DragImage. Pass the 17 font rendering mode to createDragImageForLink, instead of a Frame 18 that is only used to get the font rendering mode. 19 (WebCore::DragController::doImageDrag): Get the suggested filename 20 for the cached image and pass it to 21 createDragImageIconForCachedImageFilename(). 22 * platform/DragImage.cpp: 23 (WebCore::createDragImageForLink): Receive a FontRenderingMode 24 instead of a Frame. 25 * platform/DragImage.h: 26 (WebCore): Remove createDragImageForSelection, change 27 createDragImageForLink to receive a FontRenderingMode instead of a 28 frame, and rename createDragImageIconForCachedImage as 29 createDragImageIconForCachedImageFilename since it nows received 30 the suggested filename of the cached image. 31 * platform/blackberry/DragImageBlackBerry.cpp: 32 (WebCore::createDragImageIconForCachedImageFilename): Adapt to API 33 changes. 34 * platform/efl/DragImageEfl.cpp: 35 (WebCore::createDragImageIconForCachedImageFilename): Ditto. 36 * platform/gtk/DragImageGtk.cpp: 37 (WebCore::createDragImageIconForCachedImageFilename): Ditto. 38 * platform/mac/DragImageMac.mm: 39 (WebCore::dissolveDragImageToFraction): Return early if the passed 40 image is NULL. 41 (WebCore::createDragImageIconForCachedImageFilename): Adapt to API 42 changes. 43 (WebCore::createDragImageForLink): Ditto. 44 * platform/qt/DragImageQt.cpp: 45 (WebCore::createDragImageIconForCachedImageFilename): Ditto. 46 * platform/win/DragImageWin.cpp: 47 (WebCore::createDragImageIconForCachedImageFilename): Ditto. 48 (WebCore::createDragImageForLink): Ditto. 49 * platform/wx/DragImageWx.cpp: 50 (WebCore::createDragImageIconForCachedImageFilename): Ditto. 51 1 52 2013-04-08 Raphael Kubo da Costa <raphael.kubo.da.costa@intel.com> 2 53 -
trunk/Source/WebCore/dom/Clipboard.h
r146644 r147912 34 34 namespace WebCore { 35 35 36 class CachedImage; 36 37 class DataTransferItemList; 37 38 class DragData; -
trunk/Source/WebCore/page/DragController.cpp
r147135 r147912 800 800 m_client->willPerformDragSourceAction(DragSourceActionSelection, dragOrigin, clipboard); 801 801 if (!dragImage) { 802 dragImage = createDragImageForSelection(src);802 dragImage = dissolveDragImageToFraction(src->dragImageForSelection(), DragImageAlpha); 803 803 dragLoc = dragLocForSelectionDrag(src); 804 804 m_dragOffset = IntPoint(dragOrigin.x() - dragLoc.x(), dragOrigin.y() - dragLoc.y()); … … 844 844 m_client->willPerformDragSourceAction(DragSourceActionLink, dragOrigin, clipboard); 845 845 if (!dragImage) { 846 dragImage = createDragImageForLink(linkURL, hitTestResult.textContent(), src );846 dragImage = createDragImageForLink(linkURL, hitTestResult.textContent(), src->settings() ? src->settings()->fontRenderingMode() : NormalRenderingMode); 847 847 IntSize size = dragImageSize(dragImage); 848 848 m_dragOffset = IntPoint(-size.width() / 2, -LinkDragBorderInset); … … 894 894 origin.setY((int)(dy + 0.5)); 895 895 } else { 896 dragImage = createDragImageIconForCachedImage(getCachedImage(element)); 897 if (dragImage) 898 origin = IntPoint(DragIconRightInset - dragImageSize(dragImage).width(), DragIconBottomInset); 896 if (CachedImage* cachedImage = getCachedImage(element)) { 897 dragImage = createDragImageIconForCachedImageFilename(cachedImage->response().suggestedFilename()); 898 if (dragImage) 899 origin = IntPoint(DragIconRightInset - dragImageSize(dragImage).width(), DragIconBottomInset); 900 } 899 901 } 900 902 -
trunk/Source/WebCore/platform/DragImage.cpp
r77935 r147912 30 30 #include "DragController.h" 31 31 32 #include "F rame.h"32 #include "FontRenderingMode.h" 33 33 34 34 namespace WebCore { … … 65 65 return scaleDragImage(image, FloatSize(scalex, scaley)); 66 66 } 67 68 DragImageRef createDragImageForSelection(Frame* frame)69 {70 DragImageRef image = frame->dragImageForSelection();71 if (image)72 image = dissolveDragImageToFraction(image, DragController::DragImageAlpha);73 return image;74 }75 67 76 68 #if !PLATFORM(MAC) && (!PLATFORM(WIN) || OS(WINCE)) 77 DragImageRef createDragImageForLink(KURL&, const String&, F rame*)69 DragImageRef createDragImageForLink(KURL&, const String&, FontRenderingMode) 78 70 { 79 71 return 0; -
trunk/Source/WebCore/platform/DragImage.h
r147888 r147912 27 27 #define DragImage_h 28 28 29 #include "FontRenderingMode.h" 29 30 #include "ImageOrientation.h" 30 31 #include "IntSize.h" … … 51 52 52 53 namespace WebCore { 53 54 class CachedImage; 55 class Frame; 54 56 55 class Image; 57 56 class KURL; … … 82 81 83 82 DragImageRef createDragImageFromImage(Image*, RespectImageOrientationEnum = DoNotRespectImageOrientation); 84 DragImageRef createDragImageForSelection(Frame*); 85 DragImageRef createDragImageIconForCachedImage(CachedImage*); 86 DragImageRef createDragImageForLink(KURL&, const String& label, Frame*); 83 DragImageRef createDragImageIconForCachedImageFilename(const String&); 84 DragImageRef createDragImageForLink(KURL&, const String& label, FontRenderingMode); 87 85 void deleteDragImage(DragImageRef); 88 86 } -
trunk/Source/WebCore/platform/blackberry/DragImageBlackBerry.cpp
r113486 r147912 20 20 #include "DragImage.h" 21 21 22 #include "CachedImage.h"23 22 #include "FloatSize.h" 24 23 #include "Image.h" … … 33 32 } 34 33 35 void* createDragImageIconForCachedImage (CachedImage*)34 void* createDragImageIconForCachedImageFilename(const String&) 36 35 { 37 36 notImplemented(); -
trunk/Source/WebCore/platform/efl/DragImageEfl.cpp
r113486 r147912 22 22 #include "DragImage.h" 23 23 24 #include "CachedImage.h"25 24 #include "Image.h" 26 25 #include "NotImplemented.h" … … 57 56 } 58 57 59 DragImageRef createDragImageIconForCachedImage (CachedImage*)58 DragImageRef createDragImageIconForCachedImageFilename(const String&) 60 59 { 61 60 notImplemented(); -
trunk/Source/WebCore/platform/gtk/DragImageGtk.cpp
r147643 r147912 20 20 #include "DragImage.h" 21 21 22 #include "CachedImage.h"23 22 #include "Image.h" 24 23 #include "RefPtrCairo.h" … … 83 82 } 84 83 85 DragImageRef createDragImageIconForCachedImage (CachedImage*)84 DragImageRef createDragImageIconForCachedImageFilename(const String&) 86 85 { 87 86 return 0; -
trunk/Source/WebCore/platform/mac/DragImageMac.mm
r141678 r147912 29 29 #if ENABLE(DRAG_SUPPORT) 30 30 #import "BitmapImage.h" 31 #import "CachedImage.h"32 31 #import "Font.h" 33 32 #import "FontCache.h" … … 38 37 #import "KURL.h" 39 38 #import "ResourceResponse.h" 40 #import "Settings.h"41 39 #import "StringTruncator.h" 42 40 #import "TextRun.h" … … 68 66 RetainPtr<NSImage> dissolveDragImageToFraction(RetainPtr<NSImage> image, float delta) 69 67 { 68 if (!image) 69 return nil; 70 70 71 RetainPtr<NSImage> dissolvedImage(AdoptNS, [[NSImage alloc] initWithSize:[image.get() size]]); 71 72 … … 124 125 } 125 126 126 RetainPtr<NSImage> createDragImageIconForCachedImage(CachedImage* image) 127 { 128 const String& filename = image->response().suggestedFilename(); 127 RetainPtr<NSImage> createDragImageIconForCachedImageFilename(const String& filename) 128 { 129 129 NSString *extension = nil; 130 130 size_t dotIndex = filename.reverseFind('.'); … … 268 268 } 269 269 270 DragImageRef createDragImageForLink(KURL& url, const String& title, Frame* frame) 271 { 272 if (!frame) 273 return nil; 270 DragImageRef createDragImageForLink(KURL& url, const String& title, FontRenderingMode) 271 { 274 272 NSString *label = nsStringNilIfEmpty(title); 275 273 NSURL *cocoaURL = url; -
trunk/Source/WebCore/platform/qt/DragImageQt.cpp
r130636 r147912 27 27 #include "DragImage.h" 28 28 29 #include "CachedImage.h"30 29 #include "Image.h" 31 30 … … 70 69 } 71 70 72 DragImageRef createDragImageIconForCachedImage (CachedImage*)71 DragImageRef createDragImageIconForCachedImageFilename(const String&) 73 72 { 74 73 return 0; -
trunk/Source/WebCore/platform/win/DragImageWin.cpp
r141378 r147912 27 27 #include "DragImage.h" 28 28 29 #include "CachedImage.h"30 29 #include "Font.h" 31 30 #include "FontCache.h" 32 31 #include "FontDescription.h" 33 32 #include "FontSelector.h" 34 #include "Frame.h"35 33 #include "GraphicsContext.h" 36 34 #include "HWndDC.h" 37 35 #include "Image.h" 38 #include "Settings.h"39 36 #include "StringTruncator.h" 40 37 #include "TextRun.h" … … 70 67 } 71 68 72 DragImageRef createDragImageIconForCachedImage(CachedImage* image) 73 { 74 if (!image) 75 return 0; 76 77 String filename = image->response().suggestedFilename(); 78 69 DragImageRef createDragImageIconForCachedImageFilename(const String& filename) 70 { 79 71 SHFILEINFO shfi = {0}; 80 72 if (FAILED(SHGetFileInfo(static_cast<LPCWSTR>(filename.charactersWithNullTermination()), FILE_ATTRIBUTE_NORMAL, … … 130 122 } 131 123 132 DragImageRef createDragImageForLink(KURL& url, const String& inLabel, F rame* frame)124 DragImageRef createDragImageForLink(KURL& url, const String& inLabel, FontRenderingMode fontRenderingMode) 133 125 { 134 126 // This is more or less an exact match for the Mac OS X code. … … 138 130 FontCachePurgePreventer fontCachePurgePreventer; 139 131 140 if (f rame->settings() && frame->settings()->fontRenderingMode()== AlternateRenderingMode) {132 if (fontRenderingMode == AlternateRenderingMode) { 141 133 static const Font alternateRenderingModeLabelFont = dragLabelFont(DragLinkLabelFontsize, true, AlternateRenderingMode); 142 134 static const Font alternateRenderingModeURLFont = dragLabelFont(DragLinkUrlFontSize, false, AlternateRenderingMode); -
trunk/Source/WebCore/platform/wx/DragImageWx.cpp
r113486 r147912 26 26 #include "config.h" 27 27 #include "DragImage.h" 28 #include "CachedImage.h" 28 29 29 #include "FloatSize.h" 30 30 #include "Image.h" … … 56 56 } 57 57 58 DragImageRef createDragImageIconForCachedImage (CachedImage*)58 DragImageRef createDragImageIconForCachedImageFilename(const String&) 59 59 { 60 60 return 0;
Note: See TracChangeset
for help on using the changeset viewer.