Changeset 215385 in webkit
- Timestamp:
- Apr 14, 2017 6:14:15 PM (7 years ago)
- Location:
- trunk/Source
- Files:
-
- 2 added
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r215384 r215385 1 2017-04-14 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 [WK2] Support Icon creation from file URLs on iOS 4 https://bugs.webkit.org/show_bug.cgi?id=170809 5 <rdar://problem/31286130> 6 7 Reviewed by Tim Horton. 8 9 Minor tweaks and refactoring to support displaying a WebCore::Icon from a list of filepaths on iOS. Please see 10 below annotations for more details. No new tests yet, as behavior on Mac should not have changed, and behavior 11 on iOS will not change until later patches land. Tests will be added in a later patch. 12 13 Most of the changes here remove platform special-casing in FileInputType for iOS and Mac, refactoring the code 14 such that it works for both platforms while preserving behavior. 15 16 * html/FileInputType.cpp: 17 (WebCore::FileInputType::~FileInputType): 18 (WebCore::FileInputType::setFiles): 19 (WebCore::FileInputType::filesChosen): 20 * html/FileInputType.h: 21 22 Un-guard m_fileIconLoader on iOS, and un-guard m_displayString for Mac. Consolidate logic in both version of 23 filesChosen and remove the iOS-specific version. Behavior when passing in an empty display string and null Icon 24 will be the same as that of the existing filesChosen method on Mac. Also, introduce a version of setFiles that 25 takes an additional RequestIcon enum that indicates whether or not to additionally use the new filepaths to 26 request an Icon update. filesChosen invokes this with RequestIcon::No if a non-null Icon was specified, as is 27 the case when uploading a file via the image picker on iOS. 28 29 * html/HTMLInputElement.cpp: 30 (WebCore::HTMLInputElement::displayString): 31 * html/HTMLInputElement.h: 32 * html/InputType.cpp: 33 * html/InputType.h: 34 * loader/EmptyClients.h: 35 * page/ChromeClient.h: 36 37 Introduce ChromeClient::createIconForFiles, which generates an icon representing the content at a list of file 38 paths. See WebKit and WebKit2 ChangeLogs for more details. 39 40 * platform/FileChooser.h: 41 (WebCore::FileChooserClient::filesChosen): 42 * rendering/RenderFileUploadControl.cpp: 43 (WebCore::RenderFileUploadControl::fileTextValue): 44 45 Remove platform special-casing when generating the text to display when uploading a file. If a displayString 46 is specified, then we use the contents of the displayString; otherwise, fall back to using the input element's 47 FileList to compute the display string. 48 1 49 2017-04-14 Brady Eidson <beidson@apple.com> 2 50 -
trunk/Source/WebCore/html/FileInputType.cpp
r210845 r215385 101 101 m_fileChooser->invalidate(); 102 102 103 #if !PLATFORM(IOS)104 // FIXME: Is this correct? Why don't we do this on iOS?105 103 if (m_fileIconLoader) 106 104 m_fileIconLoader->invalidate(); 107 #endif108 105 } 109 106 … … 302 299 } 303 300 304 #if !PLATFORM(IOS)305 306 301 void FileInputType::requestIcon(const Vector<String>& paths) 307 302 { … … 326 321 } 327 322 328 #endif329 330 323 void FileInputType::applyFileChooserSettings(const FileChooserSettings& settings) 331 324 { … … 337 330 338 331 void FileInputType::setFiles(RefPtr<FileList>&& files) 332 { 333 setFiles(WTFMove(files), RequestIcon::Yes); 334 } 335 336 void FileInputType::setFiles(RefPtr<FileList>&& files, RequestIcon shouldRequestIcon) 339 337 { 340 338 if (!files) … … 362 360 input->updateValidity(); 363 361 364 #if !PLATFORM(IOS) 365 Vector<String> paths;366 paths.reserveInitialCapacity(length);367 for (unsigned i = 0; i < length; ++i)368 paths.uncheckedAppend(m_fileList->item(i)->path());369 requestIcon(paths);370 #endif 362 if (shouldRequestIcon == RequestIcon::Yes) { 363 Vector<String> paths; 364 paths.reserveInitialCapacity(length); 365 for (unsigned i = 0; i < length; ++i) 366 paths.uncheckedAppend(m_fileList->item(i)->path()); 367 requestIcon(paths); 368 } 371 369 372 370 if (input->renderer()) … … 381 379 } 382 380 383 #if PLATFORM(IOS)384 385 381 void FileInputType::filesChosen(const Vector<FileChooserFileInfo>& paths, const String& displayString, Icon* icon) 386 382 { 387 m_displayString = displayString; 388 filesChosen(paths); 389 iconLoaded(icon); 383 if (!displayString.isEmpty()) 384 m_displayString = displayString; 385 386 setFiles(createFileList(paths), icon ? RequestIcon::No : RequestIcon::Yes); 387 388 if (icon) 389 iconLoaded(icon); 390 390 } 391 391 … … 393 393 { 394 394 return m_displayString; 395 }396 397 #endif398 399 void FileInputType::filesChosen(const Vector<FileChooserFileInfo>& files)400 {401 setFiles(createFileList(files));402 395 } 403 396 -
trunk/Source/WebCore/html/FileInputType.h
r210319 r215385 62 62 FileList* files() final; 63 63 void setFiles(RefPtr<FileList>&&) final; 64 #if PLATFORM(IOS) 64 enum class RequestIcon { Yes, No }; 65 void setFiles(RefPtr<FileList>&&, RequestIcon); 65 66 String displayString() const final; 66 #endif67 67 bool canSetValue(const String&) final; 68 68 bool getTypeSpecificValue(String&) final; // Checked first, before internal storage or the value attribute. … … 80 80 String defaultToolTip() const final; 81 81 82 // FileChooserClient implementation. 83 void filesChosen(const Vector<FileChooserFileInfo>&) final; 84 #if PLATFORM(IOS) 85 void filesChosen(const Vector<FileChooserFileInfo>&, const String& displayString, Icon*) final; 86 #endif 82 void filesChosen(const Vector<FileChooserFileInfo>&, const String& displayString = { }, Icon* = nullptr) final; 87 83 88 84 // FileIconLoaderClient implementation. … … 95 91 96 92 RefPtr<FileChooser> m_fileChooser; 97 #if !PLATFORM(IOS)98 93 std::unique_ptr<FileIconLoader> m_fileIconLoader; 99 #endif100 94 101 95 Ref<FileList> m_fileList; 102 96 RefPtr<Icon> m_icon; 103 #if PLATFORM(IOS)104 97 String m_displayString; 105 #endif106 98 }; 107 99 -
trunk/Source/WebCore/html/HTMLInputElement.cpp
r211964 r215385 1359 1359 } 1360 1360 1361 #if PLATFORM(IOS)1362 1361 String HTMLInputElement::displayString() const 1363 1362 { 1364 1363 return m_inputType->displayString(); 1365 1364 } 1366 #endif1367 1365 1368 1366 bool HTMLInputElement::canReceiveDroppedFiles() const -
trunk/Source/WebCore/html/HTMLInputElement.h
r210780 r215385 247 247 248 248 Icon* icon() const; 249 #if PLATFORM(IOS)250 249 String displayString() const; 251 #endif 250 252 251 // These functions are used for rendering the input active during a 253 252 // drag-and-drop operation. -
trunk/Source/WebCore/html/InputType.cpp
r210319 r215385 742 742 } 743 743 744 #if PLATFORM(IOS)745 746 744 String InputType::displayString() const 747 745 { … … 749 747 return String(); 750 748 } 751 752 #endif753 749 754 750 bool InputType::shouldResetOnDocumentActivation() -
trunk/Source/WebCore/html/InputType.h
r210319 r215385 304 304 #if PLATFORM(IOS) 305 305 virtual DateComponents::Type dateType() const; 306 #endif 306 307 virtual String displayString() const; 307 #endif308 308 309 309 protected: -
trunk/Source/WebCore/loader/EmptyClients.h
r211033 r215385 205 205 void didAssociateFormControls(const Vector<RefPtr<Element>>&) final { } 206 206 bool shouldNotifyOnFormChanges() final { return false; } 207 208 RefPtr<Icon> createIconForFiles(const Vector<String>& /* filenames */) final { return nullptr; } 207 209 }; 208 210 -
trunk/Source/WebCore/page/ChromeClient.h
r212982 r215385 32 32 #include "HTMLMediaElementEnums.h" 33 33 #include "HostWindow.h" 34 #include "Icon.h" 34 35 #include "LayerFlushThrottleState.h" 35 36 #include "MediaProducer.h" … … 466 467 467 468 virtual void reportProcessCPUTime(int64_t, ActivityStateForCPUSampling) { } 469 virtual RefPtr<Icon> createIconForFiles(const Vector<String>& /* filenames */) = 0; 468 470 469 471 protected: -
trunk/Source/WebCore/platform/FileChooser.h
r204312 r215385 74 74 virtual ~FileChooserClient() { } 75 75 76 virtual void filesChosen(const Vector<FileChooserFileInfo>&) = 0; 77 #if PLATFORM(IOS) 78 // FIXME: This function is almost identical to FileChooser::filesChosen(). We should merge this 79 // function with FileChooser::filesChosen() and hence remove the PLATFORM(IOS)-guard. 80 virtual void filesChosen(const Vector<FileChooserFileInfo>&, const String& displayString, Icon*) = 0; 81 #endif 76 virtual void filesChosen(const Vector<FileChooserFileInfo>&, const String& displayString = { }, Icon* = nullptr) = 0; 82 77 }; 83 78 -
trunk/Source/WebCore/rendering/RenderFileUploadControl.cpp
r200041 r215385 34 34 #include "RenderTheme.h" 35 35 #include "ShadowRoot.h" 36 #include "StringTruncator.h" 36 37 #include "TextRun.h" 37 38 #include "VisiblePosition.h" 38 39 #include <math.h> 39 40 #if PLATFORM(IOS)41 #include "StringTruncator.h"42 #endif43 40 44 41 namespace WebCore { … … 267 264 String RenderFileUploadControl::fileTextValue() const 268 265 { 266 auto& input = inputElement(); 269 267 ASSERT(inputElement().files()); 270 #if PLATFORM(IOS) 271 if (inputElement().files()->length()) 272 return StringTruncator::rightTruncate(inputElement().displayString(), maxFilenameWidth(), style().fontCascade()); 273 #endif 274 return theme().fileListNameForWidth(inputElement().files(), style().fontCascade(), maxFilenameWidth(), inputElement().multiple()); 268 if (input.files()->length() && !input.displayString().isEmpty()) 269 return StringTruncator::rightTruncate(input.displayString(), maxFilenameWidth(), style().fontCascade()); 270 return theme().fileListNameForWidth(input.files(), style().fontCascade(), maxFilenameWidth(), input.multiple()); 275 271 } 276 272 -
trunk/Source/WebKit/ios/ChangeLog
r213355 r215385 1 2017-04-14 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 [WK2] Support Icon creation from file URLs on iOS 4 https://bugs.webkit.org/show_bug.cgi?id=170809 5 <rdar://problem/31286130> 6 7 Reviewed by Tim Horton. 8 9 Adjust for changes in the ChromeClient in WebCore. 10 11 * WebCoreSupport/WebChromeClientIOS.h: 12 * WebCoreSupport/WebChromeClientIOS.mm: 13 (WebChromeClientIOS::createIconForFiles): 14 1 15 2017-03-02 Sam Weinig <sam@webkit.org> 2 16 -
trunk/Source/WebKit/ios/WebCoreSupport/WebChromeClientIOS.h
r211033 r215385 90 90 void focusedElementChanged(WebCore::Element*) final; 91 91 void showPlaybackTargetPicker(bool hasVideo) final; 92 RefPtr<WebCore::Icon> createIconForFiles(const Vector<String>& filenames) final; 92 93 93 94 #if ENABLE(ORIENTATION_EVENTS) -
trunk/Source/WebKit/ios/WebCoreSupport/WebChromeClientIOS.mm
r211033 r215385 356 356 } 357 357 358 RefPtr<Icon> WebChromeClientIOS::createIconForFiles(const Vector<String>& filenames) 359 { 360 return Icon::createIconForFiles(filenames); 361 } 362 358 363 #if ENABLE(ORIENTATION_EVENTS) 359 364 -
trunk/Source/WebKit/mac/ChangeLog
r215316 r215385 1 2017-04-14 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 [WK2] Support Icon creation from file URLs on iOS 4 https://bugs.webkit.org/show_bug.cgi?id=170809 5 <rdar://problem/31286130> 6 7 Reviewed by Tim Horton. 8 9 Adjust for changes in the ChromeClient in WebCore. 10 11 * WebCoreSupport/WebChromeClient.h: 12 * WebCoreSupport/WebChromeClient.mm: 13 (WebChromeClient::loadIconForFiles): 14 (WebChromeClient::createIconForFiles): 15 1 16 2017-04-12 Dan Bernstein <mitz@apple.com> 2 17 -
trunk/Source/WebKit/mac/WebCoreSupport/WebChromeClient.h
r211042 r215385 129 129 void runOpenPanel(WebCore::Frame&, WebCore::FileChooser&) override; 130 130 void loadIconForFiles(const Vector<String>&, WebCore::FileIconLoader&) final; 131 RefPtr<WebCore::Icon> createIconForFiles(const Vector<String>& filenames) override; 131 132 132 133 #if !PLATFORM(IOS) -
trunk/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm
r211042 r215385 763 763 void WebChromeClient::loadIconForFiles(const Vector<String>& filenames, FileIconLoader& iconLoader) 764 764 { 765 iconLoader.iconLoaded(Icon::createIconForFiles(filenames)); 765 iconLoader.iconLoaded(createIconForFiles(filenames)); 766 } 767 768 RefPtr<Icon> WebChromeClient::createIconForFiles(const Vector<String>& filenames) 769 { 770 return Icon::createIconForFiles(filenames); 766 771 } 767 772 -
trunk/Source/WebKit2/ChangeLog
r215384 r215385 1 2017-04-14 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 [WK2] Support Icon creation from file URLs on iOS 4 https://bugs.webkit.org/show_bug.cgi?id=170809 5 <rdar://problem/31286130> 6 7 Reviewed by Tim Horton. 8 9 Refactors file icon generation logic to support showing an Icon representing the content at a list of file paths 10 on iOS. Pulls out logic in WKFileUploadPanel responsible for generating the thumbnail image for a file input into 11 separate helpers in WebIconUtilities, and then uses these utilities in both WKFileUploadPanel and 12 WebChromeClientIOS. 13 14 * Shared/ios/WebIconUtilities.h: Added. 15 * Shared/ios/WebIconUtilities.mm: Added. 16 (WebKit::squareCropRectForSize): 17 (WebKit::squareImage): 18 (WebKit::thumbnailSizedImageForImage): 19 (WebKit::fallbackIconForFile): 20 (WebKit::iconForImageFile): 21 (WebKit::iconForVideoFile): 22 (WebKit::iconForFile): 23 24 Add logic for generating thumbnail icons, moved from WKFileUploadPanel.mm. 25 26 * UIProcess/ios/forms/WKFileUploadPanel.mm: 27 (squareCropRectForSize): Deleted. 28 (squareImage): Deleted. 29 (thumbnailSizedImageForImage): Deleted. 30 (fallbackIconForFile): Deleted. 31 (iconForImageFile): Deleted. 32 (iconForVideoFile): Deleted. 33 (iconForFile): Deleted. 34 35 Remove logic for generating thumbnail icons. 36 37 * WebKit2.xcodeproj/project.pbxproj: 38 * WebProcess/WebCoreSupport/WebChromeClient.cpp: 39 (WebKit::WebChromeClient::loadIconForFiles): 40 (WebKit::WebChromeClient::createIconForFiles): 41 42 Rather than call Icon::createIconForFiles directly, loadIconForFiles now consults ChromeClient::createIconForFiles 43 instead. On other platforms, this just turns around and calls Icon::createIconForFiles, but on iOS, we use the 44 utilities introduced in WebIconUtilities to generate a file icon. 45 46 * WebProcess/WebCoreSupport/WebChromeClient.h: 47 * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm: 48 (WebKit::WebChromeClient::createIconForFiles): 49 1 50 2017-04-14 Brady Eidson <beidson@apple.com> 2 51 -
trunk/Source/WebKit2/UIProcess/ios/forms/WKFileUploadPanel.mm
r214723 r215385 39 39 #import "WKStringCF.h" 40 40 #import "WKURLCF.h" 41 #import "WebIconUtilities.h" 41 42 #import "WebOpenPanelResultListenerProxy.h" 42 43 #import "WebPageProxy.h" … … 51 52 using namespace WebKit; 52 53 53 SOFT_LINK_FRAMEWORK(AVFoundation);54 SOFT_LINK_CLASS(AVFoundation, AVAssetImageGenerator);55 SOFT_LINK_CLASS(AVFoundation, AVURLAsset);56 57 SOFT_LINK_FRAMEWORK(CoreMedia);58 SOFT_LINK_CONSTANT(CoreMedia, kCMTimeZero, CMTime);59 60 54 SOFT_LINK_FRAMEWORK(Photos); 61 55 SOFT_LINK_CLASS(Photos, PHAsset); … … 65 59 SOFT_LINK_CONSTANT(Photos, PHImageRequestOptionsVersionCurrent, NSString *); 66 60 67 #define kCMTimeZero getkCMTimeZero()68 69 61 #pragma clang diagnostic push 70 62 #pragma clang diagnostic ignored "-Wdeprecated-declarations" … … 86 78 return _UIImageGetWebKitTakePhotoOrVideoIcon(); 87 79 } 88 89 #pragma mark - Icon generation90 91 static const CGFloat iconSideLength = 100;92 93 static CGRect squareCropRectForSize(CGSize size)94 {95 CGFloat smallerSide = MIN(size.width, size.height);96 CGRect cropRect = CGRectMake(0, 0, smallerSide, smallerSide);97 98 if (size.width < size.height)99 cropRect.origin.y = std::round((size.height - smallerSide) / 2);100 else101 cropRect.origin.x = std::round((size.width - smallerSide) / 2);102 103 return cropRect;104 }105 106 static UIImage *squareImage(CGImageRef image)107 {108 if (!image)109 return nil;110 111 CGSize imageSize = CGSizeMake(CGImageGetWidth(image), CGImageGetHeight(image));112 if (imageSize.width == imageSize.height)113 return [UIImage imageWithCGImage:image];114 115 CGRect squareCropRect = squareCropRectForSize(imageSize);116 RetainPtr<CGImageRef> squareImage = adoptCF(CGImageCreateWithImageInRect(image, squareCropRect));117 return [UIImage imageWithCGImage:squareImage.get()];118 }119 120 static UIImage *thumbnailSizedImageForImage(CGImageRef image)121 {122 UIImage *squaredImage = squareImage(image);123 if (!squaredImage)124 return nil;125 126 CGRect destRect = CGRectMake(0, 0, iconSideLength, iconSideLength);127 UIGraphicsBeginImageContext(destRect.size);128 CGContextSetInterpolationQuality(UIGraphicsGetCurrentContext(), kCGInterpolationHigh);129 [squaredImage drawInRect:destRect];130 UIImage *resultImage = UIGraphicsGetImageFromCurrentImageContext();131 UIGraphicsEndImageContext();132 return resultImage;133 }134 135 static UIImage* fallbackIconForFile(NSURL *file)136 {137 ASSERT_ARG(file, [file isFileURL]);138 139 UIDocumentInteractionController *interactionController = [UIDocumentInteractionController interactionControllerWithURL:file];140 return thumbnailSizedImageForImage(interactionController.icons[0].CGImage);141 }142 143 static UIImage* iconForImageFile(NSURL *file)144 {145 ASSERT_ARG(file, [file isFileURL]);146 147 NSDictionary *options = @{148 (id)kCGImageSourceCreateThumbnailFromImageIfAbsent: @YES,149 (id)kCGImageSourceThumbnailMaxPixelSize: @(iconSideLength),150 (id)kCGImageSourceCreateThumbnailWithTransform: @YES,151 };152 RetainPtr<CGImageSource> imageSource = adoptCF(CGImageSourceCreateWithURL((CFURLRef)file, 0));153 RetainPtr<CGImageRef> thumbnail = adoptCF(CGImageSourceCreateThumbnailAtIndex(imageSource.get(), 0, (CFDictionaryRef)options));154 if (!thumbnail) {155 LOG_ERROR("WKFileUploadPanel: Error creating thumbnail image for image: %@", file);156 return fallbackIconForFile(file);157 }158 159 return thumbnailSizedImageForImage(thumbnail.get());160 }161 162 static UIImage* iconForVideoFile(NSURL *file)163 {164 ASSERT_ARG(file, [file isFileURL]);165 166 RetainPtr<AVURLAsset> asset = adoptNS([allocAVURLAssetInstance() initWithURL:file options:nil]);167 RetainPtr<AVAssetImageGenerator> generator = adoptNS([allocAVAssetImageGeneratorInstance() initWithAsset:asset.get()]);168 [generator setAppliesPreferredTrackTransform:YES];169 170 NSError *error = nil;171 RetainPtr<CGImageRef> imageRef = adoptCF([generator copyCGImageAtTime:kCMTimeZero actualTime:nil error:&error]);172 if (!imageRef) {173 LOG_ERROR("WKFileUploadPanel: Error creating image for video '%@': %@", file, error);174 return fallbackIconForFile(file);175 }176 177 return thumbnailSizedImageForImage(imageRef.get());178 }179 180 static UIImage* iconForFile(NSURL *file)181 {182 ASSERT_ARG(file, [file isFileURL]);183 184 NSString *fileExtension = file.pathExtension;185 if (!fileExtension.length)186 return nil;187 188 RetainPtr<CFStringRef> fileUTI = adoptCF(UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, (CFStringRef)fileExtension, 0));189 190 if (UTTypeConformsTo(fileUTI.get(), kUTTypeImage))191 return iconForImageFile(file);192 193 if (UTTypeConformsTo(fileUTI.get(), kUTTypeMovie))194 return iconForVideoFile(file);195 196 return fallbackIconForFile(file);197 }198 199 80 200 81 #pragma mark - _WKFileUploadItem -
trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
r215247 r215385 2008 2008 F409BA181E6E64BC009DA28E /* WKDragDestinationAction.h in Headers */ = {isa = PBXBuildFile; fileRef = F409BA171E6E64B3009DA28E /* WKDragDestinationAction.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2009 2009 F43370971E4D72ED00052B0E /* _WKTestingDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = F43370961E4D6A4400052B0E /* _WKTestingDelegate.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2010 F44DFEB21E9E752F0038D196 /* WebIconUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = F44DFEB01E9E752F0038D196 /* WebIconUtilities.h */; }; 2011 F44DFEB31E9E752F0038D196 /* WebIconUtilities.mm in Sources */ = {isa = PBXBuildFile; fileRef = F44DFEB11E9E752F0038D196 /* WebIconUtilities.mm */; }; 2010 2012 F6113E25126CE1820057D0A7 /* APIUserContentURLPattern.h in Headers */ = {isa = PBXBuildFile; fileRef = F6113E24126CE1820057D0A7 /* APIUserContentURLPattern.h */; }; 2011 2013 F6113E28126CE19B0057D0A7 /* WKUserContentURLPattern.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F6113E26126CE19B0057D0A7 /* WKUserContentURLPattern.cpp */; }; … … 4340 4342 F409BA171E6E64B3009DA28E /* WKDragDestinationAction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKDragDestinationAction.h; sourceTree = "<group>"; }; 4341 4343 F43370961E4D6A4400052B0E /* _WKTestingDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKTestingDelegate.h; sourceTree = "<group>"; }; 4344 F44DFEB01E9E752F0038D196 /* WebIconUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebIconUtilities.h; path = ios/WebIconUtilities.h; sourceTree = "<group>"; }; 4345 F44DFEB11E9E752F0038D196 /* WebIconUtilities.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WebIconUtilities.mm; path = ios/WebIconUtilities.mm; sourceTree = "<group>"; }; 4342 4346 F6113E24126CE1820057D0A7 /* APIUserContentURLPattern.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIUserContentURLPattern.h; sourceTree = "<group>"; }; 4343 4347 F6113E26126CE19B0057D0A7 /* WKUserContentURLPattern.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKUserContentURLPattern.cpp; sourceTree = "<group>"; }; … … 5338 5342 A118A9EC1907AD6F00F7C92B /* QuickLookDocumentData.cpp */, 5339 5343 A118A9ED1907AD6F00F7C92B /* QuickLookDocumentData.h */, 5344 F44DFEB01E9E752F0038D196 /* WebIconUtilities.h */, 5345 F44DFEB11E9E752F0038D196 /* WebIconUtilities.mm */, 5340 5346 2DA944991884E4F000ED86DB /* WebIOSEventFactory.h */, 5341 5347 2DA9449A1884E4F000ED86DB /* WebIOSEventFactory.mm */, … … 8257 8263 1AD25E96167AB08100EA9BCD /* DownloadProxyMap.h in Headers */, 8258 8264 1AB7D61A1288B9D900CFD08C /* DownloadProxyMessages.h in Headers */, 8265 F44DFEB21E9E752F0038D196 /* WebIconUtilities.h in Headers */, 8259 8266 C517388112DF8F4F00EE3F47 /* DragControllerAction.h in Headers */, 8260 8267 BC8452A81162C80900CAB9B5 /* DrawingArea.h in Headers */, … … 10296 10303 BC111AE4112F5C2600337BAB /* WebProcess.cpp in Sources */, 10297 10304 7C6E70FB18B2DC7A00F24E2E /* WebProcessCocoa.mm in Sources */, 10305 F44DFEB31E9E752F0038D196 /* WebIconUtilities.mm in Sources */, 10298 10306 1A043A0A124D11A900FFBFB5 /* WebProcessConnection.cpp in Sources */, 10299 10307 1A043F6912514D8B00FFBFB5 /* WebProcessConnectionMessageReceiver.cpp in Sources */, -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp
r212982 r215385 783 783 void WebChromeClient::loadIconForFiles(const Vector<String>& filenames, FileIconLoader& loader) 784 784 { 785 loader.iconLoaded( Icon::createIconForFiles(filenames));785 loader.iconLoaded(createIconForFiles(filenames)); 786 786 } 787 787 … … 796 796 { 797 797 m_page.send(Messages::WebPageProxy::SetCursorHiddenUntilMouseMoves(hiddenUntilMouseMoves)); 798 } 799 800 RefPtr<Icon> WebChromeClient::createIconForFiles(const Vector<String>& filenames) 801 { 802 return Icon::createIconForFiles(filenames); 798 803 } 799 804 -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h
r212982 r215385 335 335 void imageOrMediaDocumentSizeChanged(const WebCore::IntSize&) final; 336 336 337 RefPtr<WebCore::Icon> createIconForFiles(const Vector<String>& filenames) final; 338 337 339 #if ENABLE(VIDEO) && USE(GSTREAMER) 338 340 void requestInstallMissingMediaPlugins(const String& /*details*/, const String& /*description*/, WebCore::MediaPlayerRequestInstallMissingPluginsCallback&) final; -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm
r211033 r215385 30 30 31 31 #import "DrawingArea.h" 32 #import "UIKitSPI.h" 32 33 #import "WebCoreArgumentCoders.h" 33 34 #import "WebFrame.h" 35 #import "WebIconUtilities.h" 34 36 #import "WebPage.h" 35 37 #import "WebPageProxyMessages.h" 38 #import <WebCore/Icon.h> 36 39 #import <WebCore/NotImplemented.h> 40 #import <wtf/RefPtr.h> 41 42 using namespace WebCore; 37 43 38 44 namespace WebKit { … … 144 150 } 145 151 152 RefPtr<Icon> WebChromeClient::createIconForFiles(const Vector<String>& filenames) 153 { 154 if (!filenames.size()) 155 return nullptr; 156 157 // FIXME: We should generate an icon showing multiple files here, if applicable. Currently, if there are multiple 158 // files, we only use the first URL to generate an icon. 159 return Icon::createIconForImage(iconForFile([NSURL fileURLWithPath:filenames[0]]).CGImage); 160 } 161 146 162 } // namespace WebKit 147 163
Note: See TracChangeset
for help on using the changeset viewer.