Title: [181058] trunk/Source/WebCore
Revision
181058
Author
[email protected]
Date
2015-03-04 17:43:07 -0800 (Wed, 04 Mar 2015)

Log Message

<attachment> icons are low-resolution when transformed or under page scale
https://bugs.webkit.org/show_bug.cgi?id=142262
<rdar://problem/20035480>

Reviewed by Dean Jackson.

We should use Icon::createIconForFiles, just like <input type="file"> does,
instead of directly talking to IconServices. This results both in less code
and in NSImage's multiresolution magic making the icons sharp even under
the influence of transforms and page scale.

* WebCore.xcodeproj/project.pbxproj:
* platform/spi/mac/IconServicesSPI.h: Removed.
* platform/spi/mac/LaunchServicesSPI.h: Removed.
Get rid of IconServicesSPI.h and LaunchServicesSPI.h.

* platform/graphics/Icon.h:
Include RetainPtr just once.
paint() should take a GraphicsContext reference (null is not an option)
and a FloatRect (after all, it just turns around and converts to NSRect).

* platform/graphics/ios/IconIOS.mm:
(WebCore::Icon::paint):
* platform/graphics/mac/IconMac.mm:
(WebCore::Icon::createIconForFiles):
(WebCore::Icon::paint):
* platform/graphics/efl/IconEfl.cpp:
(WebCore::Icon::paint):
* platform/graphics/gtk/IconGtk.cpp:
(WebCore::Icon::paint):
* platform/graphics/win/IconWin.cpp:
(WebCore::Icon::paint):
Adapt to the paint() signature changes, fix some style, etc.

* rendering/RenderFileUploadControl.cpp:
(WebCore::RenderFileUploadControl::paintObject):
* rendering/RenderThemeIOS.mm:
(WebCore::RenderThemeIOS::paintFileUploadIconDecorations):
Adapt to the paint() signature changes.

* rendering/RenderThemeMac.mm:
(WebCore::paintAttachmentIcon):
Use Icon::createIconForFiles instead of IconServices.

Modified Paths

Removed Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (181057 => 181058)


--- trunk/Source/WebCore/ChangeLog	2015-03-05 01:40:45 UTC (rev 181057)
+++ trunk/Source/WebCore/ChangeLog	2015-03-05 01:43:07 UTC (rev 181058)
@@ -1,3 +1,49 @@
+2015-03-04  Timothy Horton  <[email protected]>
+
+        <attachment> icons are low-resolution when transformed or under page scale
+        https://bugs.webkit.org/show_bug.cgi?id=142262
+        <rdar://problem/20035480>
+
+        Reviewed by Dean Jackson.
+
+        We should use Icon::createIconForFiles, just like <input type="file"> does,
+        instead of directly talking to IconServices. This results both in less code
+        and in NSImage's multiresolution magic making the icons sharp even under
+        the influence of transforms and page scale.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * platform/spi/mac/IconServicesSPI.h: Removed.
+        * platform/spi/mac/LaunchServicesSPI.h: Removed.
+        Get rid of IconServicesSPI.h and LaunchServicesSPI.h.
+
+        * platform/graphics/Icon.h:
+        Include RetainPtr just once.
+        paint() should take a GraphicsContext reference (null is not an option)
+        and a FloatRect (after all, it just turns around and converts to NSRect).
+
+        * platform/graphics/ios/IconIOS.mm:
+        (WebCore::Icon::paint):
+        * platform/graphics/mac/IconMac.mm:
+        (WebCore::Icon::createIconForFiles):
+        (WebCore::Icon::paint):
+        * platform/graphics/efl/IconEfl.cpp:
+        (WebCore::Icon::paint):
+        * platform/graphics/gtk/IconGtk.cpp:
+        (WebCore::Icon::paint):
+        * platform/graphics/win/IconWin.cpp:
+        (WebCore::Icon::paint):
+        Adapt to the paint() signature changes, fix some style, etc.
+
+        * rendering/RenderFileUploadControl.cpp:
+        (WebCore::RenderFileUploadControl::paintObject):
+        * rendering/RenderThemeIOS.mm:
+        (WebCore::RenderThemeIOS::paintFileUploadIconDecorations):
+        Adapt to the paint() signature changes.
+
+        * rendering/RenderThemeMac.mm:
+        (WebCore::paintAttachmentIcon):
+        Use Icon::createIconForFiles instead of IconServices.
+
 2015-03-04  Tim Horton  <[email protected]>
 
         <attachment> should not appear selected when the cursor is adjacent to it

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (181057 => 181058)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2015-03-05 01:40:45 UTC (rev 181057)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2015-03-05 01:43:07 UTC (rev 181058)
@@ -1125,8 +1125,6 @@
 		2D6E468417D660F500ECF8BB /* PDFDocumentImageMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D6E468217D660F500ECF8BB /* PDFDocumentImageMac.mm */; };
 		2D70BA1318074DDF0001908A /* PlatformCALayerMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D70BA1218074DDF0001908A /* PlatformCALayerMac.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		2D70BA1518074F860001908A /* PlatformCALayer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D70BA1418074F850001908A /* PlatformCALayer.cpp */; };
-		2D74E99C1A9D3F3200DFB3D4 /* IconServicesSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D74E99B1A9D3F3200DFB3D4 /* IconServicesSPI.h */; };
-		2D74E99E1A9D402900DFB3D4 /* LaunchServicesSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D74E99D1A9D402900DFB3D4 /* LaunchServicesSPI.h */; };
 		2D76BB821945632400CFD29A /* RunLoopObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D76BB801945632400CFD29A /* RunLoopObserver.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		2D76BB8419456F8100CFD29A /* RunLoopObserver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D76BB8319456F8100CFD29A /* RunLoopObserver.cpp */; };
 		2D8287F616E4A0380086BD00 /* HitTestLocation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D8287F416E4A0380086BD00 /* HitTestLocation.cpp */; };
@@ -8199,8 +8197,6 @@
 		2D6E468217D660F500ECF8BB /* PDFDocumentImageMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PDFDocumentImageMac.mm; sourceTree = "<group>"; };
 		2D70BA1218074DDF0001908A /* PlatformCALayerMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PlatformCALayerMac.h; path = ca/mac/PlatformCALayerMac.h; sourceTree = "<group>"; };
 		2D70BA1418074F850001908A /* PlatformCALayer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PlatformCALayer.cpp; path = ca/PlatformCALayer.cpp; sourceTree = "<group>"; };
-		2D74E99B1A9D3F3200DFB3D4 /* IconServicesSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IconServicesSPI.h; sourceTree = "<group>"; };
-		2D74E99D1A9D402900DFB3D4 /* LaunchServicesSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LaunchServicesSPI.h; sourceTree = "<group>"; };
 		2D76BB801945632400CFD29A /* RunLoopObserver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RunLoopObserver.h; sourceTree = "<group>"; };
 		2D76BB8319456F8100CFD29A /* RunLoopObserver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RunLoopObserver.cpp; sourceTree = "<group>"; };
 		2D8287F416E4A0380086BD00 /* HitTestLocation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HitTestLocation.cpp; sourceTree = "<group>"; };
@@ -17720,8 +17716,6 @@
 			isa = PBXGroup;
 			children = (
 				2D59F1BE1A0044C6001F3D29 /* DataDetectorsSPI.h */,
-				2D74E99B1A9D3F3200DFB3D4 /* IconServicesSPI.h */,
-				2D74E99D1A9D402900DFB3D4 /* LaunchServicesSPI.h */,
 				2D413F601A187A3F0041A521 /* LookupSPI.h */,
 				1C6466271A12C3F90094603C /* NSFontSPI.h */,
 				9321D58F1A3906FA008052BE /* NSImmediateActionGestureRecognizerSPI.h */,
@@ -24337,7 +24331,6 @@
 				2E37DFDB12DBAFB800A6B233 /* DOMURL.h in Headers */,
 				CD9DE18217AAD6A400EA386D /* DOMURLMediaSource.h in Headers */,
 				15C770A6100D41CD005BA267 /* DOMValidityState.h in Headers */,
-				2D74E99C1A9D3F3200DFB3D4 /* IconServicesSPI.h in Headers */,
 				BC1A37C0097C715F0019F3D8 /* DOMViews.h in Headers */,
 				31C0FF490E4CEFDD007D6FE5 /* DOMWebKitAnimationEvent.h in Headers */,
 				31C0FF4B0E4CEFDD007D6FE5 /* DOMWebKitAnimationEventInternal.h in Headers */,
@@ -26540,7 +26533,6 @@
 				B2227A880D00BF220071B782 /* SVGPatternElement.h in Headers */,
 				B2227A8C0D00BF220071B782 /* SVGPointList.h in Headers */,
 				B2227A8F0D00BF220071B782 /* SVGPolyElement.h in Headers */,
-				2D74E99E1A9D402900DFB3D4 /* LaunchServicesSPI.h in Headers */,
 				2D58D8551A15F65F00A5F726 /* DataDetection.h in Headers */,
 				B2227A910D00BF220071B782 /* SVGPolygonElement.h in Headers */,
 				B2227A940D00BF220071B782 /* SVGPolylineElement.h in Headers */,

Modified: trunk/Source/WebCore/platform/graphics/Icon.h (181057 => 181058)


--- trunk/Source/WebCore/platform/graphics/Icon.h	2015-03-05 01:40:45 UTC (rev 181057)
+++ trunk/Source/WebCore/platform/graphics/Icon.h	2015-03-05 01:43:07 UTC (rev 181058)
@@ -21,17 +21,16 @@
 #ifndef Icon_h
 #define Icon_h
 
+#include <wtf/Forward.h>
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
-#include <wtf/Forward.h>
+#include <wtf/RetainPtr.h>
 #include <wtf/Vector.h>
 
 #if PLATFORM(IOS)
 #include "NativeImagePtr.h"
 #include <CoreGraphics/CoreGraphics.h>
-#include <wtf/RetainPtr.h>
 #elif PLATFORM(MAC)
-#include <wtf/RetainPtr.h>
 OBJC_CLASS NSImage;
 #elif PLATFORM(WIN)
 typedef struct HICON__* HICON;
@@ -42,7 +41,7 @@
 namespace WebCore {
 
 class GraphicsContext;
-class IntRect;
+class FloatRect;
     
 class Icon : public RefCounted<Icon> {
 public:
@@ -50,7 +49,7 @@
 
     WEBCORE_EXPORT ~Icon();
 
-    void paint(GraphicsContext*, const IntRect&);
+    void paint(GraphicsContext&, const FloatRect&);
 
 #if PLATFORM(WIN)
     static PassRefPtr<Icon> create(HICON hIcon) { return adoptRef(new Icon(hIcon)); }

Modified: trunk/Source/WebCore/platform/graphics/efl/IconEfl.cpp (181057 => 181058)


--- trunk/Source/WebCore/platform/graphics/efl/IconEfl.cpp	2015-03-05 01:40:45 UTC (rev 181057)
+++ trunk/Source/WebCore/platform/graphics/efl/IconEfl.cpp	2015-03-05 01:43:07 UTC (rev 181058)
@@ -57,7 +57,7 @@
     return 0;
 }
 
-void Icon::paint(GraphicsContext*, const IntRect&)
+void Icon::paint(GraphicsContext&, const FloatRect&)
 {
     notImplemented();
 }

Modified: trunk/Source/WebCore/platform/graphics/gtk/IconGtk.cpp (181057 => 181058)


--- trunk/Source/WebCore/platform/graphics/gtk/IconGtk.cpp	2015-03-05 01:40:45 UTC (rev 181057)
+++ trunk/Source/WebCore/platform/graphics/gtk/IconGtk.cpp	2015-03-05 01:43:07 UTC (rev 181058)
@@ -113,13 +113,13 @@
     return 0;
 }
 
-void Icon::paint(GraphicsContext* context, const IntRect& rect)
+void Icon::paint(GraphicsContext& context, const FloatRect& rect)
 {
-    if (context->paintingDisabled())
+    if (context.paintingDisabled())
         return;
 
     // TODO: Scale/clip the image if necessary.
-    cairo_t* cr = context->platformContext()->cr();
+    cairo_t* cr = context.platformContext()->cr();
     cairo_save(cr);
     gdk_cairo_set_source_pixbuf(cr, m_icon, rect.x(), rect.y());
     cairo_paint(cr);

Modified: trunk/Source/WebCore/platform/graphics/ios/IconIOS.mm (181057 => 181058)


--- trunk/Source/WebCore/platform/graphics/ios/IconIOS.mm	2015-03-05 01:40:45 UTC (rev 181057)
+++ trunk/Source/WebCore/platform/graphics/ios/IconIOS.mm	2015-03-05 01:43:07 UTC (rev 181058)
@@ -55,21 +55,20 @@
     return adoptRef(new Icon(imageRef));
 }
 
-void Icon::paint(GraphicsContext* context, const IntRect& destRect)
+void Icon::paint(GraphicsContext& context, const FloatRect& destRect)
 {
-    if (context->paintingDisabled())
+    if (context.paintingDisabled())
         return;
 
-    GraphicsContextStateSaver stateSaver(*context);
+    GraphicsContextStateSaver stateSaver(context);
 
     float width = CGImageGetWidth(m_cgImage.get());
     float height = CGImageGetHeight(m_cgImage.get());
     FloatSize size(width, height);
-    FloatRect srcRect(0, 0, width, height);
-    ColorSpace colorSpace = ColorSpaceDeviceRGB;
+    FloatRect srcRect(FloatPoint(), size);
 
-    context->setImageInterpolationQuality(InterpolationHigh);
-    context->drawNativeImage(m_cgImage.get(), size, colorSpace, destRect, srcRect);
+    context.setImageInterpolationQuality(InterpolationHigh);
+    context.drawNativeImage(m_cgImage.get(), size, ColorSpaceDeviceRGB, destRect, srcRect);
 }
 
 }

Modified: trunk/Source/WebCore/platform/graphics/mac/IconMac.mm (181057 => 181058)


--- trunk/Source/WebCore/platform/graphics/mac/IconMac.mm	2015-03-05 01:40:45 UTC (rev 181057)
+++ trunk/Source/WebCore/platform/graphics/mac/IconMac.mm	2015-03-05 01:43:07 UTC (rev 181058)
@@ -49,7 +49,7 @@
 PassRefPtr<Icon> Icon::createIconForFiles(const Vector<String>& filenames)
 {
     if (filenames.isEmpty())
-        return 0;
+        return nullptr;
 
     bool useIconFromFirstFile;
     useIconFromFirstFile = filenames.size() == 1;
@@ -57,31 +57,29 @@
         // Don't pass relative filenames -- we don't want a result that depends on the current directory.
         // Need 0U here to disambiguate String::operator[] from operator(NSString*, int)[]
         if (filenames[0].isEmpty() || filenames[0][0U] != '/')
-            return 0;
+            return nullptr;
 
-        NSImage* image = [[NSWorkspace sharedWorkspace] iconForFile:filenames[0]];
+        NSImage *image = [[NSWorkspace sharedWorkspace] iconForFile:filenames[0]];
         if (!image)
-            return 0;
+            return nullptr;
 
         return adoptRef(new Icon(image));
     }
-    NSImage* image = [NSImage imageNamed:NSImageNameMultipleDocuments];
+    NSImage *image = [NSImage imageNamed:NSImageNameMultipleDocuments];
     if (!image)
-        return 0;
+        return nullptr;
 
     return adoptRef(new Icon(image));
 }
 
-void Icon::paint(GraphicsContext* context, const IntRect& rect)
+void Icon::paint(GraphicsContext& context, const FloatRect& rect)
 {
-    if (context->paintingDisabled())
+    if (context.paintingDisabled())
         return;
 
-    LocalCurrentGraphicsContext localCurrentGC(context);
+    LocalCurrentGraphicsContext localCurrentGC(&context);
 
-    [m_nsImage.get() drawInRect:rect
-        fromRect:NSMakeRect(0, 0, [m_nsImage.get() size].width, [m_nsImage.get() size].height)
-        operation:NSCompositeSourceOver fraction:1.0f];
+    [m_nsImage drawInRect:rect fromRect:NSMakeRect(0, 0, [m_nsImage size].width, [m_nsImage size].height) operation:NSCompositeSourceOver fraction:1.0f];
 }
 
 }

Modified: trunk/Source/WebCore/platform/graphics/win/IconWin.cpp (181057 => 181058)


--- trunk/Source/WebCore/platform/graphics/win/IconWin.cpp	2015-03-05 01:40:45 UTC (rev 181057)
+++ trunk/Source/WebCore/platform/graphics/win/IconWin.cpp	2015-03-05 01:43:07 UTC (rev 181058)
@@ -73,12 +73,12 @@
     return adoptRef(new Icon(hIcon));
 }
 
-void Icon::paint(GraphicsContext* context, const IntRect& r)
+void Icon::paint(GraphicsContext& context, const FloatRect& r)
 {
-    if (context->paintingDisabled())
+    if (context.paintingDisabled())
         return;
 
-    LocalWindowsContext windowContext(context, r);
+    LocalWindowsContext windowContext(&context, enclosingIntRect(r));
     DrawIconEx(windowContext.hdc(), r.x(), r.y(), m_hIcon, r.width(), r.height(), 0, 0, DI_NORMAL);
 }
 

Deleted: trunk/Source/WebCore/platform/spi/mac/IconServicesSPI.h (181057 => 181058)


--- trunk/Source/WebCore/platform/spi/mac/IconServicesSPI.h	2015-03-05 01:40:45 UTC (rev 181057)
+++ trunk/Source/WebCore/platform/spi/mac/IconServicesSPI.h	2015-03-05 01:43:07 UTC (rev 181058)
@@ -1,34 +0,0 @@
-/*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import "LaunchServicesSPI.h"
-#import "SoftLinking.h"
-#import <objc/runtime.h>
-
-SOFT_LINK_PRIVATE_FRAMEWORK(IconServices)
-
-typedef UInt32 ISScale;
-
-SOFT_LINK(IconServices, _ISCreateCGImageFromBindingWithSizeScaleAndOptions, CGImageRef, (LSBindingRef binding, CGSize size, ISScale scale, CFDictionaryRef options), (binding, size, scale, options))

Deleted: trunk/Source/WebCore/platform/spi/mac/LaunchServicesSPI.h (181057 => 181058)


--- trunk/Source/WebCore/platform/spi/mac/LaunchServicesSPI.h	2015-03-05 01:40:45 UTC (rev 181057)
+++ trunk/Source/WebCore/platform/spi/mac/LaunchServicesSPI.h	2015-03-05 01:43:07 UTC (rev 181058)
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#if USE(APPLE_INTERNAL_SDK)
-
-#include <LaunchServices/LaunchServicesPriv.h>
-
-#else
-
-WTF_EXTERN_C_BEGIN
-typedef struct _LSBinding* LSBindingRef;
-LSBindingRef _LSBindingCreateWithURL(CFAllocatorRef, CFURLRef);
-WTF_EXTERN_C_END
-
-#endif

Modified: trunk/Source/WebCore/rendering/RenderFileUploadControl.cpp (181057 => 181058)


--- trunk/Source/WebCore/rendering/RenderFileUploadControl.cpp	2015-03-05 01:40:45 UTC (rev 181057)
+++ trunk/Source/WebCore/rendering/RenderFileUploadControl.cpp	2015-03-05 01:43:07 UTC (rev 181058)
@@ -186,7 +186,7 @@
             }
 #else
             // Draw the file icon
-            inputElement().icon()->paint(paintInfo.context, IntRect(roundToInt(iconX), roundToInt(iconY), iconWidth, iconHeight));
+            inputElement().icon()->paint(*paintInfo.context, IntRect(roundToInt(iconX), roundToInt(iconY), iconWidth, iconHeight));
 #endif
         }
     }

Modified: trunk/Source/WebCore/rendering/RenderThemeIOS.mm (181057 => 181058)


--- trunk/Source/WebCore/rendering/RenderThemeIOS.mm	2015-03-05 01:40:45 UTC (rev 181057)
+++ trunk/Source/WebCore/rendering/RenderThemeIOS.mm	2015-03-05 01:43:07 UTC (rev 181058)
@@ -1054,7 +1054,7 @@
 
     // Foreground picture frame and icon.
     paintInfo.context->fillRoundedRect(FloatRoundedRect(thumbnailPictureFrameRect, cornerSize, cornerSize, cornerSize, cornerSize), pictureFrameColor, ColorSpaceDeviceRGB);
-    icon->paint(paintInfo.context, thumbnailRect);
+    icon->paint(*paintInfo.context, thumbnailRect);
 
     return false;
 }

Modified: trunk/Source/WebCore/rendering/RenderThemeMac.mm (181057 => 181058)


--- trunk/Source/WebCore/rendering/RenderThemeMac.mm	2015-03-05 01:40:45 UTC (rev 181057)
+++ trunk/Source/WebCore/rendering/RenderThemeMac.mm	2015-03-05 01:43:07 UTC (rev 181058)
@@ -42,10 +42,9 @@
 #import "HTMLMediaElement.h"
 #import "HTMLNames.h"
 #import "HTMLPlugInImageElement.h"
-#import "IconServicesSPI.h"
+#import "Icon.h"
 #import "Image.h"
 #import "ImageBuffer.h"
-#import "LaunchServicesSPI.h"
 #import "LocalCurrentGraphicsContext.h"
 #import "LocalizedStrings.h"
 #import "MediaControlElements.h"
@@ -2322,20 +2321,13 @@
 
 static void paintAttachmentIcon(const RenderAttachment& attachment, GraphicsContext& context, AttachmentLayout& layout)
 {
-    File* file = attachment.attachmentElement().file();
-    RetainPtr<LSBindingRef> lsBinding = adoptCF(_LSBindingCreateWithURL(kCFAllocatorDefault, (CFURLRef)[NSURL fileURLWithPath:file ? file->path() : String()]));
-    if (!lsBinding)
-        return;
-
-    // FIXME: This should take transforms and page scale into account, not just deviceScaleFactor.
-    FloatSize iconSizeInPoints(attachmentIconSize, attachmentIconSize);
-    iconSizeInPoints.scale(attachment.document().deviceScaleFactor());
-
-    RetainPtr<CGImageRef> icon = adoptCF(_ISCreateCGImageFromBindingWithSizeScaleAndOptions(lsBinding.get(), iconSizeInPoints, 1, nil));
+    Vector<String> filenames;
+    if (File* file = attachment.attachmentElement().file())
+        filenames.append(file->path());
+    RefPtr<Icon> icon = Icon::createIconForFiles(filenames);
     if (!icon)
         return;
-
-    context.drawNativeImage(icon.get(), iconSizeInPoints, ColorSpaceDeviceRGB, layout.iconRect, FloatRect(FloatPoint(), iconSizeInPoints));
+    icon->paint(context, layout.iconRect);
 }
 
 static void addAttachmentTitleBackgroundRightCorner(Path& path, const FloatRect* fromRect, const FloatRect* toRect)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to