Changeset 260407 in webkit


Ignore:
Timestamp:
Apr 20, 2020 5:27:46 PM (4 years ago)
Author:
Nikos Mouchtaris
Message:

WK2 Quicklook for attachments
https://bugs.webkit.org/show_bug.cgi?id=208891

Reviewed by Darin Adler.

Source/WebCore:

Added to HTMLAttachmentElement to have member image representing
QuickLook thumbnail. Added code to render this image on both iOS and Mac.

No new tests. Test will be added after additions to test infrastructure.

  • html/HTMLAttachmentElement.cpp:

(WebCore::HTMLAttachmentElement::updateThumbnailRepresentation):
Allow setting of thumbnail member.

  • html/HTMLAttachmentElement.h:
  • rendering/RenderThemeIOS.mm:

Added rendering of image member of attachment element.
(WebCore::RenderAttachmentInfo::RenderAttachmentInfo):
(WebCore::paintAttachmentIcon):
(WebCore::RenderThemeIOS::paintAttachment):

  • rendering/RenderThemeMac.mm:

(WebCore::paintAttachmentIcon):

Source/WebKit:

Allow attachment elements to render QuickLook thumbnail generated
from contents of the file as its icon, rather than the default
icons associated with each mime type.

  • Configurations/WebKit.xcconfig:

Link QuickLook thumbnailing framework.

  • UIProcess/API/APIAttachment.h:
  • UIProcess/API/Cocoa/WKWebView.mm:

(-[WKWebView _insertAttachmentWithFileWrapper:contentType:completion:]):

  • UIProcess/Cocoa/WebPageProxyCocoa.mm:

Create thumbnail request and add to queue.
(WebKit::convertNSImageToBitmap):
(WebKit::convertUIImageToBitmap):
(WebKit::WebPageProxy::getQLThumbnailForGenerationRequestion):
(WebKit::WebPageProxy::getQLThumbnailForFileWrapper):
(WebKit::WebPageProxy::getQLThumbnailForAttachment):

  • UIProcess/QLThumbnailLoad.h: Added.
  • UIProcess/QLThumbnailLoad.mm: Added.

Add code to request thumbnail for file data.
(-[WKQLThumbnailQueueManager init]):
(+[WKQLThumbnailQueueManager sharedInstance]):
(-[WKQLThumbnailLoadOperation initWithAttachment:identifier:]):
(-[WKQLThumbnailLoadOperation initWithURL:identifier:]):
(-[WKQLThumbnailLoadOperation start]):
(-[WKQLThumbnailLoadOperation isAsynchronous]):
(-[WKQLThumbnailLoadOperation isExecuting]):
(-[WKQLThumbnailLoadOperation setExecuting:]):
(-[WKQLThumbnailLoadOperation isFinished]):
(-[WKQLThumbnailLoadOperation setFinished:]):

  • UIProcess/WebPageProxy.cpp:
  • UIProcess/WebPageProxy.h:
  • WebKit.xcodeproj/project.pbxproj:
  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::updateAttachmentIcon):
Set thumbnail of attachment element

  • WebProcess/WebPage/WebPage.h:
  • WebProcess/WebPage/WebPage.messages.in:

Thumbnail request message.

Location:
trunk/Source
Files:
2 added
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/wtf/PlatformHave.h

    r260182 r260407  
    678678#define HAVE_MEDIA_USAGE_FRAMEWORK 1
    679679#endif
     680
     681#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101500) || PLATFORM(IOS_FAMILY)
     682#define HAVE_QUICKLOOK_THUMBNAILING 1
     683#endif
  • trunk/Source/WebCore/ChangeLog

    r260404 r260407  
     12020-04-20  Nikos Mouchtaris  <nmouchtaris@apple.com>
     2
     3        WK2 Quicklook for attachments
     4        https://bugs.webkit.org/show_bug.cgi?id=208891
     5
     6        Reviewed by Darin Adler.
     7
     8        Added to HTMLAttachmentElement to have member image representing
     9        QuickLook thumbnail. Added code to render this image on both iOS and Mac.
     10
     11        No new tests. Test will be added after additions to test infrastructure.
     12
     13        * html/HTMLAttachmentElement.cpp:
     14        (WebCore::HTMLAttachmentElement::updateThumbnailRepresentation):
     15        Allow setting of thumbnail member.
     16        * html/HTMLAttachmentElement.h:
     17        * rendering/RenderThemeIOS.mm:
     18        Added rendering of image member of attachment element.
     19        (WebCore::RenderAttachmentInfo::RenderAttachmentInfo):
     20        (WebCore::paintAttachmentIcon):
     21        (WebCore::RenderThemeIOS::paintAttachment):
     22        * rendering/RenderThemeMac.mm:
     23        (WebCore::paintAttachmentIcon):
     24
    1252020-04-20  Yusuke Suzuki  <ysuzuki@apple.com>
    226
  • trunk/Source/WebCore/html/HTMLAttachmentElement.cpp

    r253762 r260407  
    250250}
    251251
     252void HTMLAttachmentElement::updateThumbnail(const RefPtr<Image>& thumbnail)
     253{
     254    m_thumbnail = thumbnail;
     255   
     256    if (auto* renderer = this->renderer())
     257        renderer->invalidate();
     258}
     259
    252260} // namespace WebCore
    253261
  • trunk/Source/WebCore/html/HTMLAttachmentElement.h

    r246490 r260407  
    3434class File;
    3535class HTMLImageElement;
     36class Image;
    3637class RenderAttachment;
     38class ShareableBitmap;
    3739class SharedBuffer;
    3840
     
    5759    WEBCORE_EXPORT void updateAttributes(Optional<uint64_t>&& newFileSize, const String& newContentType, const String& newFilename);
    5860    WEBCORE_EXPORT void updateEnclosingImageWithData(const String& contentType, Ref<SharedBuffer>&& data);
     61    WEBCORE_EXPORT void updateThumbnail(const RefPtr<Image>& thumbnail);
    5962
    6063    InsertedIntoAncestorResult insertedIntoAncestor(InsertionType, ContainerNode&) final;
     
    6871    String attachmentType() const;
    6972    String attachmentPath() const;
    70 
     73    RefPtr<Image> thumbnail() const { return m_thumbnail; }
    7174    RenderAttachment* renderer() const;
    7275
     
    8891    RefPtr<File> m_file;
    8992    String m_uniqueIdentifier;
     93    RefPtr<Image> m_thumbnail;
    9094};
    9195
  • trunk/Source/WebCore/rendering/RenderThemeIOS.mm

    r259703 r260407  
    16201620
    16211621    RetainPtr<UIImage> icon;
     1622    RefPtr<Image> thumbnailIcon;
    16221623
    16231624    int baseline { 0 };
     
    18041805        FloatSize iconSize;
    18051806        icon = iconForAttachment(attachment, iconSize);
    1806         if (icon) {
    1807             iconRect = FloatRect(FloatPoint((attachmentRect.width() / 2) - (iconSize.width() / 2), 0), iconSize);
     1807        thumbnailIcon = attachment.attachmentElement().thumbnail();
     1808       
     1809        if (thumbnailIcon || icon) {
     1810            auto visibleIconSize = thumbnailIcon ? FloatSize(attachmentIconSize, attachmentIconSize) : iconSize;
     1811            iconRect = FloatRect(FloatPoint((attachmentRect.width() / 2) - (visibleIconSize.width() / 2), 0), visibleIconSize);
    18081812            yOffset += iconRect.height() + attachmentItemMargin;
    18091813        }
     
    18401844static void paintAttachmentIcon(GraphicsContext& context, RenderAttachmentInfo& info)
    18411845{
    1842     if (!info.icon)
    1843         return;
    1844 
    1845     auto iconImage = BitmapImage::create([info.icon CGImage]);
    1846     context.drawImage(iconImage.get(), info.iconRect);
     1846    RefPtr<Image> iconImage;
     1847    if (info.thumbnailIcon)
     1848        iconImage = info.thumbnailIcon;
     1849    else if (info.icon)
     1850        iconImage = BitmapImage::create([info.icon CGImage]);
     1851   
     1852    context.drawImage(*iconImage, info.iconRect);
    18471853}
    18481854
     
    19201926    if (info.hasProgress)
    19211927        paintAttachmentProgress(context, info);
    1922     else if (info.icon)
     1928    else if (info.icon || info.thumbnailIcon)
    19231929        paintAttachmentIcon(context, info);
    19241930
  • trunk/Source/WebCore/rendering/RenderThemeMac.mm

    r259575 r260407  
    27782778static void paintAttachmentIcon(const RenderAttachment& attachment, GraphicsContext& context, AttachmentLayout& layout)
    27792779{
     2780    if (auto thumbnailIcon = attachment.attachmentElement().thumbnail()) {
     2781        context.drawImage(*thumbnailIcon, layout.iconRect);
     2782        return;
     2783    }
    27802784    auto icon = iconForAttachment(attachment);
    27812785    if (!icon)
  • trunk/Source/WebKit/ChangeLog

    r260405 r260407  
     12020-04-20  Nikos Mouchtaris  <nmouchtaris@apple.com>
     2
     3        WK2 Quicklook for attachments
     4        https://bugs.webkit.org/show_bug.cgi?id=208891
     5
     6        Reviewed by Darin Adler.
     7
     8        Allow attachment elements to render QuickLook thumbnail generated
     9        from contents of the file as its icon, rather than the default
     10        icons associated with each mime type.
     11
     12        * Configurations/WebKit.xcconfig:
     13        Link QuickLook thumbnailing framework.
     14        * UIProcess/API/APIAttachment.h:
     15        * UIProcess/API/Cocoa/WKWebView.mm:
     16        (-[WKWebView _insertAttachmentWithFileWrapper:contentType:completion:]):
     17        * UIProcess/Cocoa/WebPageProxyCocoa.mm:
     18        Create thumbnail request and add to queue.
     19        (WebKit::convertNSImageToBitmap):
     20        (WebKit::convertUIImageToBitmap):
     21        (WebKit::WebPageProxy::getQLThumbnailForGenerationRequestion):
     22        (WebKit::WebPageProxy::getQLThumbnailForFileWrapper):
     23        (WebKit::WebPageProxy::getQLThumbnailForAttachment):
     24        * UIProcess/QLThumbnailLoad.h: Added.
     25        * UIProcess/QLThumbnailLoad.mm: Added.
     26        Add code to request thumbnail for file data.
     27        (-[WKQLThumbnailQueueManager init]):
     28        (+[WKQLThumbnailQueueManager sharedInstance]):
     29        (-[WKQLThumbnailLoadOperation initWithAttachment:identifier:]):
     30        (-[WKQLThumbnailLoadOperation initWithURL:identifier:]):
     31        (-[WKQLThumbnailLoadOperation start]):
     32        (-[WKQLThumbnailLoadOperation isAsynchronous]):
     33        (-[WKQLThumbnailLoadOperation isExecuting]):
     34        (-[WKQLThumbnailLoadOperation setExecuting:]):
     35        (-[WKQLThumbnailLoadOperation isFinished]):
     36        (-[WKQLThumbnailLoadOperation setFinished:]):
     37        * UIProcess/WebPageProxy.cpp:
     38        * UIProcess/WebPageProxy.h:
     39        * WebKit.xcodeproj/project.pbxproj:
     40        * WebProcess/WebPage/WebPage.cpp:
     41        (WebKit::WebPage::updateAttachmentIcon):
     42        Set thumbnail of attachment element
     43        * WebProcess/WebPage/WebPage.h:
     44        * WebProcess/WebPage/WebPage.messages.in:
     45        Thumbnail request message.
     46
    1472020-04-20  Kate Cheney  <katherine_cheney@apple.com>
    248
  • trunk/Source/WebKit/Configurations/WebKit.xcconfig

    r260334 r260407  
    125125WK_AUTHKIT_LDFLAGS_MACOS_SINCE_1015 = -framework AuthKit;
    126126
    127 FRAMEWORK_AND_LIBRARY_LDFLAGS = -lobjc -framework CFNetwork -framework CoreAudio -framework CoreFoundation -framework CoreGraphics -framework CoreText -framework Foundation -framework ImageIO -framework IOKit -framework IOSurface -framework WebKitLegacy -lnetwork $(WK_ACCESSIBILITY_LDFLAGS) $(WK_APPKIT_LDFLAGS) $(WK_ASSERTION_SERVICES_LDFLAGS) $(WK_RUNNINGBOARD_SERVICES_LDFLAGS) $(WK_AUTHKIT_LDFLAGS) $(WK_CARBON_LDFLAGS) $(WK_CORE_PREDICTION_LDFLAGS) $(WK_CORE_SERVICES_LDFLAGS) $(WK_GRAPHICS_SERVICES_LDFLAGS) $(WK_LIBSANDBOX_LDFLAGS) $(WK_LIBWEBRTC_LDFLAGS) $(WK_MOBILE_CORE_SERVICES_LDFLAGS) $(WK_MOBILE_GESTALT_LDFLAGS) $(WK_OPENGL_LDFLAGS) $(WK_PDFKIT_LDFLAGS) $(WK_SAFE_BROWSING_LDFLAGS) $(WK_SECURITY_INTERFACE_LDFLAGS) $(WK_UIKIT_LDFLAGS) $(WK_URL_FORMATTING_LDFLAGS) $(WK_WEBINSPECTORUI_LDFLAGS);
     127WK_QUICKLOOK_THUMBNAILING_LDFLAGS = $(WK_QUICKLOOK_THUMBNAILING_LDFLAGS_$(WK_PLATFORM_NAME));
     128WK_QUICKLOOK_THUMBNAILING_LDFLAGS_macosx = $(WK_QUICKLOOK_THUMBNAILING_LDFLAGS$(WK_MACOS_1015));
     129WK_QUICKLOOK_THUMBNAILING_LDFLAGS_MACOS_SINCE_1015 = -framework QuickLookThumbnailing;
     130WK_QUICKLOOK_THUMBNAILING_LDFLAGS_iphoneos = -framework QuickLookThumbnailing;
     131WK_QUICKLOOK_THUMBNAILING_LDFLAGS_iphonesimulator = -framework QuickLookThumbnailing;
     132
     133FRAMEWORK_AND_LIBRARY_LDFLAGS = -lobjc -framework CFNetwork -framework CoreAudio -framework CoreFoundation -framework CoreGraphics -framework CoreText -framework Foundation -framework ImageIO -framework IOKit -framework IOSurface -framework WebKitLegacy -framework QuickLookThumbnailing -lnetwork $(WK_ACCESSIBILITY_LDFLAGS) $(WK_APPKIT_LDFLAGS) $(WK_ASSERTION_SERVICES_LDFLAGS) $(WK_RUNNINGBOARD_SERVICES_LDFLAGS) $(WK_AUTHKIT_LDFLAGS) $(WK_CARBON_LDFLAGS) $(WK_CORE_PREDICTION_LDFLAGS) $(WK_CORE_SERVICES_LDFLAGS) $(WK_GRAPHICS_SERVICES_LDFLAGS) $(WK_LIBSANDBOX_LDFLAGS) $(WK_LIBWEBRTC_LDFLAGS) $(WK_MOBILE_CORE_SERVICES_LDFLAGS) $(WK_MOBILE_GESTALT_LDFLAGS) $(WK_OPENGL_LDFLAGS) $(WK_PDFKIT_LDFLAGS) $(WK_SAFE_BROWSING_LDFLAGS) $(WK_SECURITY_INTERFACE_LDFLAGS) $(WK_UIKIT_LDFLAGS) $(WK_URL_FORMATTING_LDFLAGS) $(WK_WEBINSPECTORUI_LDFLAGS) $(WK_QUICKLOOK_THUMBNAILING_LDFLAGS);
    128134
    129135// Prevent C++ standard library basic_stringstream, operator new, delete and their related exception types from being exported as weak symbols.
  • trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm

    r260350 r260407  
    4747#import "PageClient.h"
    4848#import "ProvisionalPageProxy.h"
     49#import "QuickLookThumbnailLoader.h"
    4950#import "RemoteLayerTreeScrollingPerformanceData.h"
    5051#import "RemoteObjectRegistry.h"
     
    21612162            capturedHandler(error == WebKit::CallbackBase::Error::None);
    21622163    });
    2163 
     2164#if HAVE(QUICKLOOK_THUMBNAILING)
     2165    _page->requestThumbnailWithFileWrapper(fileWrapper, identifier);
     2166#endif
    21642167    return wrapper(attachment);
    21652168#else
  • trunk/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm

    r260366 r260407  
    3434#import "LoadParameters.h"
    3535#import "PageClient.h"
     36#import "QuickLookThumbnailLoader.h"
    3637#import "SafeBrowsingSPI.h"
    3738#import "SafeBrowsingWarning.h"
     
    388389#endif
    389390
     391#if HAVE(QUICKLOOK_THUMBNAILING)
     392#if PLATFORM(MAC)
     393using PlatformImage = NSImage*;
     394#elif PLATFORM(IOS_FAMILY)
     395using PlatformImage = UIImage*;
     396#endif
     397
     398static RefPtr<WebKit::ShareableBitmap> convertPlatformImageToBitmap(PlatformImage image, const WebCore::IntSize& size)
     399{
     400    WebKit::ShareableBitmap::Configuration bitmapConfiguration;
     401    auto bitmap = WebKit::ShareableBitmap::createShareable(size, bitmapConfiguration);
     402    if (!bitmap)
     403        return nullptr;
     404
     405    auto graphicsContext = bitmap->createGraphicsContext();
     406    if (!graphicsContext)
     407        return nullptr;
     408#if PLATFORM(IOS_FAMILY)
     409    UIGraphicsPushContext(graphicsContext->platformContext());
     410    [image drawInRect:CGRectMake(0, 0, bitmap->size().width(), bitmap->size().height())];
     411    UIGraphicsPopContext();
     412#elif PLATFORM(MAC)
     413    auto savedContext = adoptNS([NSGraphicsContext currentContext]);
     414
     415    [NSGraphicsContext setCurrentContext:[NSGraphicsContext graphicsContextWithCGContext:graphicsContext->platformContext() flipped:YES]];
     416    [image drawInRect:NSMakeRect(0, 0, bitmap->size().width(), bitmap->size().height()) fromRect:NSZeroRect operation:NSCompositingOperationSourceOver fraction:1 respectFlipped:YES hints:nil];
     417
     418    [NSGraphicsContext setCurrentContext:savedContext.get()];
     419#endif
     420    return bitmap;
     421}
     422
     423void WebPageProxy::requestThumbnailWithOperation(WKQLThumbnailLoadOperation *operation)
     424{
     425    [operation setCompletionBlock:^{
     426        dispatch_async(dispatch_get_main_queue(), ^{
     427            auto identifier = [operation identifier];
     428            auto convertedImage = convertPlatformImageToBitmap([operation thumbnail], WebCore::IntSize(400, 400));
     429            if (!convertedImage)
     430                return;
     431            this->updateAttachmentIcon(identifier, convertedImage);
     432        });
     433    }];
     434       
     435    [[WKQLThumbnailQueueManager sharedInstance].qlThumbnailGenerationQueue addOperation:operation];
     436}
     437
     438
     439void WebPageProxy::requestThumbnailWithFileWrapper(NSFileWrapper* fileWrapper, const String& identifier)
     440{
     441    auto operation = adoptNS([[WKQLThumbnailLoadOperation alloc] initWithAttachment:fileWrapper identifier:identifier]);
     442    requestThumbnailWithOperation(operation.get());
     443}
     444
     445void WebPageProxy::requestThumbnailWithPath(const String& identifier, const String& filePath)
     446{
     447    auto operation = adoptNS([[WKQLThumbnailLoadOperation alloc] initWithURL:filePath identifier:identifier]);
     448    requestThumbnailWithOperation(operation.get());
     449   
     450}
     451
     452#endif
    390453} // namespace WebKit
    391454
  • trunk/Source/WebKit/UIProcess/WebPageProxy.cpp

    r260405 r260407  
    94969496}
    94979497
     9498#if HAVE(QUICKLOOK_THUMBNAILING)
     9499void WebPageProxy::updateAttachmentIcon(const String& identifier, const RefPtr<ShareableBitmap>& bitmap)
     9500{
     9501    if (!hasRunningProcess())
     9502        return;
     9503   
     9504    ShareableBitmap::Handle handle;
     9505    if (bitmap)
     9506        bitmap->createHandle(handle);
     9507
     9508    send(Messages::WebPage::UpdateAttachmentIcon(identifier, handle));
     9509}
     9510#endif
     9511
    94989512void WebPageProxy::registerAttachmentIdentifierFromData(const String& identifier, const String& contentType, const String& preferredFileName, const IPC::SharedBufferDataReference& data)
    94999513{
     
    95239537    attachment->setFilePath(filePath);
    95249538    m_attachmentIdentifierToAttachmentMap.set(identifier, attachment.copyRef());
    9525 
    95269539    platformRegisterAttachment(WTFMove(attachment), filePath);
     9540#if HAVE(QUICKLOOK_THUMBNAILING)
     9541    requestThumbnailWithPath(identifier, filePath);
     9542#endif
    95279543}
    95289544
  • trunk/Source/WebKit/UIProcess/WebPageProxy.h

    r260381 r260407  
    202202class SharedBufferDataReference;
    203203}
     204OBJC_CLASS NSFileWrapper;
     205OBJC_CLASS WKQLThumbnailLoadOperation;
    204206
    205207namespace WebCore {
     
    15971599    void registerAttachmentIdentifier(const String&);
    15981600    void didInvalidateDataForAttachment(API::Attachment&);
    1599 
     1601#if HAVE(QUICKLOOK_THUMBNAILING)
     1602    void updateAttachmentIcon(const String&, const RefPtr<ShareableBitmap>&);
     1603    void requestThumbnailWithPath(const String&, const String&);
     1604    void requestThumbnailWithFileWrapper(NSFileWrapper*, const String&);
     1605    void requestThumbnailWithOperation(WKQLThumbnailLoadOperation*);
     1606#endif
    16001607    enum class ShouldUpdateAttachmentAttributes : bool { No, Yes };
    16011608    ShouldUpdateAttachmentAttributes willUpdateAttachmentAttributes(const API::Attachment&);
  • trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj

    r260381 r260407  
    165165                1A07D2FA1919B3A900ECDA16 /* model.py in Copy Message Generation Scripts */ = {isa = PBXBuildFile; fileRef = 0FC08570187CE0A900780D86 /* model.py */; };
    166166                1A07D2FB1919B3A900ECDA16 /* parser.py in Copy Message Generation Scripts */ = {isa = PBXBuildFile; fileRef = 0FC08571187CE0A900780D86 /* parser.py */; };
     167                1A0C225E243575CD00ED614D /* QuickLookThumbnailLoader.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AEE57242409F142002005D6 /* QuickLookThumbnailLoader.mm */; };
    167168                1A0EC603124A9F2C007EF4A5 /* PluginProcessManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A0EC601124A9F2C007EF4A5 /* PluginProcessManager.h */; };
    168169                1A0EC6C0124BBD9B007EF4A5 /* PluginProcessMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A0EC6BE124BBD9B007EF4A5 /* PluginProcessMessages.h */; };
     
    380381                1AE49A4911FFA8CE0048B464 /* JSNPMethod.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AE49A4711FFA8CE0048B464 /* JSNPMethod.h */; };
    381382                1AE52F981920267200A1FA37 /* WKContextConfigurationRef.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AE52F9419201F6B00A1FA37 /* WKContextConfigurationRef.h */; settings = {ATTRIBUTES = (Private, ); }; };
     383                1AEE57252409F142002005D6 /* QuickLookThumbnailLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AEE57232409F142002005D6 /* QuickLookThumbnailLoader.h */; };
    382384                1AEFCC1211D01F96008219D3 /* PluginInfoStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AEFCC1011D01F96008219D3 /* PluginInfoStore.h */; };
    383385                1AEFD27911D16C81008219D3 /* ArgumentCoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AEFD27811D16C81008219D3 /* ArgumentCoder.h */; };
     
    26642666                1AE52F9419201F6B00A1FA37 /* WKContextConfigurationRef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKContextConfigurationRef.h; sourceTree = "<group>"; };
    26652667                1AE5B7F911E7AED200BA6767 /* NetscapePluginMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = NetscapePluginMac.mm; sourceTree = "<group>"; };
     2668                1AEE57232409F142002005D6 /* QuickLookThumbnailLoader.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = QuickLookThumbnailLoader.h; sourceTree = "<group>"; };
     2669                1AEE57242409F142002005D6 /* QuickLookThumbnailLoader.mm */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; path = QuickLookThumbnailLoader.mm; sourceTree = "<group>"; };
    26662670                1AEFCC1011D01F96008219D3 /* PluginInfoStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginInfoStore.h; sourceTree = "<group>"; };
    26672671                1AEFCC1111D01F96008219D3 /* PluginInfoStore.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginInfoStore.cpp; sourceTree = "<group>"; };
     
    89348938                                4683569B21E81CC7006E27A3 /* ProvisionalPageProxy.cpp */,
    89358939                                4683569A21E81CC7006E27A3 /* ProvisionalPageProxy.h */,
     8940                                1AEE57232409F142002005D6 /* QuickLookThumbnailLoader.h */,
     8941                                1AEE57242409F142002005D6 /* QuickLookThumbnailLoader.mm */,
    89368942                                BC111B08112F5E3C00337BAB /* ResponsivenessTimer.cpp */,
    89378943                                1A30066C1110F4F70031937C /* ResponsivenessTimer.h */,
     
    1100011006                                83048AE61ACA45DC0082C832 /* ProcessThrottlerClient.h in Headers */,
    1100111007                                A1E688701F6E2BAB007006A6 /* QuarantineSPI.h in Headers */,
     11008                                1AEE57252409F142002005D6 /* QuickLookThumbnailLoader.h in Headers */,
    1100211009                                57FD318222B3515E008D0E8B /* RedirectSOAuthorizationSession.h in Headers */,
    1100311010                                9B1229D223FF2BCC008CA751 /* RemoteAudioDestinationIdentifier.h in Headers */,
     
    1132811335                                BCE0E425168B7A280057E66A /* WebProcessSupplement.h in Headers */,
    1132911336                                1A1E093418861D3800D2DC49 /* WebProgressTrackerClient.h in Headers */,
    11330                                 5109099723DACBF2003B1E4C /* WKScriptMessageHandlerWithReply.h in Headers */,
    1133111337                                512F589D12A8838800629530 /* WebProtectionSpace.h in Headers */,
    1133211338                                461CCCA6231485AA00B659B9 /* WebRemoteObjectRegistry.h in Headers */,
     
    1168211688                                1A7E377918E4A4FE003D0FFF /* WKScriptMessage.h in Headers */,
    1168311689                                1A7E377518E4A33A003D0FFF /* WKScriptMessageHandler.h in Headers */,
     11690                                5109099723DACBF2003B1E4C /* WKScriptMessageHandlerWithReply.h in Headers */,
    1168411691                                7CC99A3618EF7CBC0048C8B4 /* WKScriptMessageInternal.h in Headers */,
    1168511692                                0FCB4E5418BBE044000FCFC9 /* WKScrollView.h in Headers */,
     
    1273912746                                2D54C31B212F4DA60049C174 /* ProcessLauncher.cpp in Sources */,
    1274012747                                CD2865EF2255562000606AC7 /* ProcessTaskStateObserver.mm in Sources */,
     12748                                1A0C225E243575CD00ED614D /* QuickLookThumbnailLoader.mm in Sources */,
    1274112749                                9B1229CE23FF25F2008CA751 /* RemoteAudioDestinationManager.cpp in Sources */,
    1274212750                                CDAC20F723FC726C0021DEE3 /* RemoteCDMFactoryProxyMessageReceiver.cpp in Sources */,
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp

    r260381 r260407  
    68426842}
    68436843
     6844void WebPage::updateAttachmentIcon(const String& identifier, const ShareableBitmap::Handle& qlThumbnailHandle)
     6845{
     6846    if (auto attachment = attachmentElementWithIdentifier(identifier)) {
     6847        if (RefPtr<ShareableBitmap> thumbnail = !qlThumbnailHandle.isNull() ? ShareableBitmap::create(qlThumbnailHandle) : nullptr)
     6848            attachment->updateThumbnail(thumbnail->createImage());
     6849    }
     6850}
     6851
    68446852RefPtr<HTMLAttachmentElement> WebPage::attachmentElementWithIdentifier(const String& identifier) const
    68456853{
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.h

    r260381 r260407  
    5050#include "SandboxExtension.h"
    5151#include "ShareSheetCallbackID.h"
     52#include "ShareableBitmap.h"
    5253#include "SharedMemory.h"
    5354#include "StorageNamespaceIdentifier.h"
     
    12191220    void insertAttachment(const String& identifier, Optional<uint64_t>&& fileSize, const String& fileName, const String& contentType, CallbackID);
    12201221    void updateAttachmentAttributes(const String& identifier, Optional<uint64_t>&& fileSize, const String& contentType, const String& fileName, const IPC::SharedBufferDataReference& enclosingImageData, CallbackID);
     1222    void updateAttachmentIcon(const String& identifier, const ShareableBitmap::Handle& qlThumbnailHandle);
    12211223#endif
    12221224
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in

    r260381 r260407  
    561561    InsertAttachment(String identifier, Optional<uint64_t> fileSize, String fileName, String contentType, WebKit::CallbackID callbackID)
    562562    UpdateAttachmentAttributes(String identifier, Optional<uint64_t> fileSize, String contentType, String fileName, IPC::SharedBufferDataReference enclosingImageData, WebKit::CallbackID callbackID)
     563    UpdateAttachmentIcon(String identifier, WebKit::ShareableBitmap::Handle qlThumbnailHandle)
    563564#endif
    564565
Note: See TracChangeset for help on using the changeset viewer.