⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 273778 in webkit


Ignore:
Timestamp:
Mar 2, 2021, 5:56:54 PM (6 years ago)
Author:
Wenson Hsieh
Message:

[iOS] Image extraction should install image overlay content
​https://bugs.webkit.org/show_bug.cgi?id=222621

Reviewed by Tim Horton.

Take some initial steps towards refactoring image extraction on iOS. See WebKitAdditions for more details.

  • Platform/cocoa/ImageExtractionUtilities.h: Added.
  • Platform/cocoa/ImageExtractionUtilities.mm: Added.

Add a new file to contain image-extraction-related functionality; see WebKitAdditions.

  • SourcesCocoa.txt:
  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::updateWithImageExtractionResult):

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

(WebKit::WebPage::updateWithImageExtractionResult):

Add IPC plumbing between WebPageProxy (in the UI process) and WebPage to allow clients to push image
extraction results down to a given element on the page.

  • WebProcess/WebPage/WebPage.h:
  • WebProcess/WebPage/WebPage.messages.in:
Location:
trunk/Source/WebKit
Files:
2 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r273775 r273778  
     12021-03-02  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        [iOS] Image extraction should install image overlay content
     4        https://bugs.webkit.org/show_bug.cgi?id=222621
     5
     6        Reviewed by Tim Horton.
     7
     8        Take some initial steps towards refactoring image extraction on iOS. See WebKitAdditions for more details.
     9
     10        * Platform/cocoa/ImageExtractionUtilities.h: Added.
     11        * Platform/cocoa/ImageExtractionUtilities.mm: Added.
     12
     13        Add a new file to contain image-extraction-related functionality; see WebKitAdditions.
     14
     15        * SourcesCocoa.txt:
     16        * UIProcess/WebPageProxy.cpp:
     17        (WebKit::WebPageProxy::updateWithImageExtractionResult):
     18        * UIProcess/WebPageProxy.h:
     19        * UIProcess/ios/WKContentViewInteraction.mm:
     20        * WebKit.xcodeproj/project.pbxproj:
     21        * WebProcess/WebPage/WebPage.cpp:
     22        (WebKit::WebPage::updateWithImageExtractionResult):
     23
     24        Add IPC plumbing between `WebPageProxy` (in the UI process) and `WebPage` to allow clients to push image
     25        extraction results down to a given element on the page.
     26
     27        * WebProcess/WebPage/WebPage.h:
     28        * WebProcess/WebPage/WebPage.messages.in:
     29
    1302021-03-02  Peng Liu  <peng.liu6@apple.com>
    231
  • trunk/Source/WebKit/SourcesCocoa.txt

    r273522 r273778  
    7272Platform/classifier/ResourceLoadStatisticsClassifier.cpp
    7373
     74Platform/cocoa/ImageExtractionUtilities.mm
    7475Platform/cocoa/LayerHostingContext.mm
    7576Platform/cocoa/PaymentAuthorizationPresenter.mm
  • trunk/Source/WebKit/UIProcess/WebPageProxy.cpp

    r273657 r273778  
    82768276    pageClient().requestImageExtraction(imageURL, imageData, WTFMove(completionHandler));
    82778277}
     8278
     8279void WebPageProxy::updateWithImageExtractionResult(ImageExtractionResult&& results, const ElementContext& context, const FloatPoint& location, CompletionHandler<void(bool textExistsAtLocation)>&& completionHandler)
     8280{
     8281    if (!hasRunningProcess()) {
     8282        completionHandler(false);
     8283        return;
     8284    }
     8285
     8286    sendWithAsyncReply(Messages::WebPage::UpdateWithImageExtractionResult(WTFMove(results), context, location), WTFMove(completionHandler));
     8287}
    82788288#endif
    82798289
  • trunk/Source/WebKit/UIProcess/WebPageProxy.h

    r273574 r273778  
    16231623#if ENABLE(IMAGE_EXTRACTION)
    16241624    void requestImageExtraction(const URL& imageURL, const ShareableBitmap::Handle& imageData, CompletionHandler<void(WebCore::ImageExtractionResult&&)>&&);
     1625    void updateWithImageExtractionResult(WebCore::ImageExtractionResult&&, const WebCore::ElementContext&, const WebCore::FloatPoint& location, CompletionHandler<void(bool textExistsAtLocation)>&&);
    16251626#endif
    16261627
  • trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj

    r273593 r273778  
    19981998                F430E9422247335F005FE053 /* WebsiteMetaViewportPolicy.h in Headers */ = {isa = PBXBuildFile; fileRef = F430E941224732A9005FE053 /* WebsiteMetaViewportPolicy.h */; };
    19991999                F430E94422473DFF005FE053 /* WebContentMode.h in Headers */ = {isa = PBXBuildFile; fileRef = F430E94322473DB8005FE053 /* WebContentMode.h */; };
     2000                F4351B9E25EEC84C00D63892 /* ImageExtractionUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = F4351B9D25EEC84C00D63892 /* ImageExtractionUtilities.h */; };
    20002001                F438CD1C2241421400DE6DDA /* WKWebpagePreferences.h in Headers */ = {isa = PBXBuildFile; fileRef = F438CD1B224140A600DE6DDA /* WKWebpagePreferences.h */; settings = {ATTRIBUTES = (Public, ); }; };
    20012002                F438CD1F22414D4000DE6DDA /* WKWebpagePreferencesInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = F438CD1E22414D4000DE6DDA /* WKWebpagePreferencesInternal.h */; };
    … …  
    58775878                F430E941224732A9005FE053 /* WebsiteMetaViewportPolicy.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebsiteMetaViewportPolicy.h; sourceTree = "<group>"; };
    58785879                F430E94322473DB8005FE053 /* WebContentMode.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebContentMode.h; sourceTree = "<group>"; };
     5880                F4351B9D25EEC84C00D63892 /* ImageExtractionUtilities.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ImageExtractionUtilities.h; sourceTree = "<group>"; };
     5881                F4351B9F25EEC87800D63892 /* ImageExtractionUtilities.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = ImageExtractionUtilities.mm; sourceTree = "<group>"; };
    58795882                F438CD1B224140A600DE6DDA /* WKWebpagePreferences.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WKWebpagePreferences.h; sourceTree = "<group>"; };
    58805883                F438CD1D22414AD600DE6DDA /* WKWebpagePreferences.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = WKWebpagePreferences.mm; sourceTree = "<group>"; };
    … …  
    80308033                                51D124861E734AE3002B2820 /* WKHTTPCookieStoreInternal.h */,
    80318034                                DF462E0E23F22F5300EFF35F /* WKHTTPCookieStorePrivate.h */,
    8032                                 49917DA6252D649E0050313F /* WKMediaPlaybackState.h */,
    80338035                                1AB40EE31BF677E300BA81BE /* WKMenuItemIdentifiers.mm */,
    80348036                                1AB40EE41BF677E300BA81BE /* WKMenuItemIdentifiersPrivate.h */,
    … …  
    83628364                                F4FE0A3C24635667002631E1 /* CocoaFont.h */,
    83638365                                4482734624528F6000A95493 /* CocoaImage.h */,
     8366                                F4351B9D25EEC84C00D63892 /* ImageExtractionUtilities.h */,
     8367                                F4351B9F25EEC87800D63892 /* ImageExtractionUtilities.mm */,
    83648368                                BCE0937614FB128B001138D9 /* LayerHostingContext.h */,
    83658369                                BCE0937514FB128B001138D9 /* LayerHostingContext.mm */,
    … …  
    1178911793                                51C0C9741DDD76000032CAD3 /* IconLoadingDelegate.h in Headers */,
    1179011794                                51E351CB180F2CCC00E53BE9 /* IDBUtilities.h in Headers */,
     11795                                F4351B9E25EEC84C00D63892 /* ImageExtractionUtilities.h in Headers */,
    1179111796                                BCCF6B2512C93E7A008F9C35 /* ImageOptions.h in Headers */,
    1179211797                                1A1EC69E1872092100B951F0 /* ImportanceAssertion.h in Headers */,
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp

    r273574 r273778  
    72597259}
    72607260
     7261void WebPage::updateWithImageExtractionResult(ImageExtractionResult&& result, const ElementContext& context, const FloatPoint& location, CompletionHandler<void(bool)>&& completionHandler)
     7262{
     7263    auto elementToUpdate = elementForContext(context);
     7264    if (!is<HTMLElement>(elementToUpdate)) {
     7265        completionHandler(false);
     7266        return;
     7267    }
     7268
     7269    downcast<HTMLElement>(*elementToUpdate).updateWithImageExtractionResult(WTFMove(result));
     7270
     7271    // FIXME: Hit-test with location and return whether or not there is overlay text at the given location.
     7272    completionHandler(true);
     7273}
     7274
    72617275#endif // ENABLE(IMAGE_EXTRACTION)
    72627276
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.h

    r273102 r273778  
    13781378#if ENABLE(IMAGE_EXTRACTION)
    13791379    void requestImageExtraction(WebCore::Element&);
     1380    void updateWithImageExtractionResult(WebCore::ImageExtractionResult&&, const WebCore::ElementContext&, const WebCore::FloatPoint& location, CompletionHandler<void(bool)>&&);
    13801381#endif
    13811382
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in

    r273102 r273778  
    634634
    635635    LastNavigationWasAppBound() -> (bool wasAppBound) Async
     636
     637#if ENABLE(IMAGE_EXTRACTION)
     638    UpdateWithImageExtractionResult(struct WebCore::ImageExtractionResult result, struct WebCore::ElementContext element, WebCore::FloatPoint location) -> (bool textExistsAtLocation) Async
     639#endif
    636640}
Note: See TracChangeset for help on using the changeset viewer.