Changeset 196036 in webkit
- Timestamp:
- Feb 2, 2016 4:08:33 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r196033 r196036 1 2016-02-02 Tim Horton <timothy_horton@apple.com> 2 3 <attachment> should attempt to guess the icon from the file extension if all else fails 4 https://bugs.webkit.org/show_bug.cgi?id=153804 5 <rdar://problem/24448146> 6 7 Reviewed by Anders Carlsson. 8 9 * fast/attachment/attachment-icon-from-file-extension-expected.html: Added. 10 * fast/attachment/attachment-icon-from-file-extension.html: Added. 11 1 12 2016-02-02 Saam barati <sbarati@apple.com> 2 13 -
trunk/Source/WebCore/ChangeLog
r196031 r196036 1 2016-02-02 Tim Horton <timothy_horton@apple.com> 2 3 <attachment> should attempt to guess the icon from the file extension if all else fails 4 https://bugs.webkit.org/show_bug.cgi?id=153804 5 <rdar://problem/24448146> 6 7 Reviewed by Anders Carlsson. 8 9 Test: fast/attachment/attachment-icon-from-file-extension.html 10 11 * platform/graphics/Icon.h: 12 * platform/graphics/mac/IconMac.mm: 13 (WebCore::Icon::createIconForFileExtension): 14 * rendering/RenderThemeMac.mm: 15 (WebCore::iconForAttachment): 16 If we can't find an icon any other way, try assuming that the title is a filename, 17 grab its extension, and have NSWorkspace try to work out an icon for it. 18 1 19 2016-02-02 Antti Koivisto <antti@apple.com> 2 20 -
trunk/Source/WebCore/platform/graphics/Icon.h
r195678 r196036 64 64 static RefPtr<Icon> createIconForUTI(const String&); 65 65 static RefPtr<Icon> createIconForMIMEType(const String&); 66 static RefPtr<Icon> createIconForFileExtension(const String&); 66 67 #endif 67 68 -
trunk/Source/WebCore/platform/graphics/mac/IconMac.mm
r195678 r196036 74 74 } 75 75 76 RefPtr<Icon> Icon::createIconForFileExtension(const String& fileExtension) 77 { 78 NSImage *image = [[NSWorkspace sharedWorkspace] iconForFileType:[@"." stringByAppendingString:fileExtension]]; 79 if (!image) 80 return nullptr; 81 82 return adoptRef(new Icon(image)); 83 } 84 76 85 RefPtr<Icon> Icon::createIconForUTI(const String& UTI) 77 86 { -
trunk/Source/WebCore/rendering/RenderThemeMac.mm
r196028 r196036 2354 2354 } 2355 2355 2356 NSString *fileExtension = [static_cast<NSString *>(attachment.attachmentElement().attachmentTitle()) pathExtension]; 2357 if (fileExtension.length) { 2358 if (auto icon = Icon::createIconForFileExtension(fileExtension)) 2359 return icon; 2360 } 2361 2356 2362 return Icon::createIconForUTI("public.data"); 2357 2363 }
Note: See TracChangeset
for help on using the changeset viewer.