Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 6d2dce3223e6d0cba79b5428703516fd0647566b
      
https://github.com/WebKit/WebKit/commit/6d2dce3223e6d0cba79b5428703516fd0647566b
  Author: Wenson Hsieh <wenson_hs...@apple.com>
  Date:   2024-02-12 (Mon, 12 Feb 2024)

  Changed paths:
    M Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml
    M Source/WebKit/Configurations/WebKitSwift.xcconfig
    M Source/WebKit/DerivedSources-input.xcfilelist
    M Source/WebKit/DerivedSources-output.xcfilelist
    M Source/WebKit/DerivedSources.make
    M Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm
    M Source/WebKit/UIProcess/API/Cocoa/WKPreferencesPrivate.h
    M Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
    M Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h
    M Source/WebKit/UIProcess/Cocoa/WKTextExtractionUtilities.h
    M Source/WebKit/UIProcess/Cocoa/WKTextExtractionUtilities.mm
    M Source/WebKit/WebKit.xcodeproj/project.pbxproj

  Log Message:
  -----------
  [Cocoa] Add text extraction support for internal Swift clients
https://bugs.webkit.org/show_bug.cgi?id=269207
rdar://121132700

Reviewed by Aditya Keerthi, Abrar Rahman Protyasha and Elliott Williams.

Make several adjustments to support for text extraction; see below for more 
details.

* Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml:

Add a new preference to guard runtime enablement of text extraction.

* Source/WebKit/Configurations/WebKitSwift.xcconfig:

Exclude `WKWebView+TextExtraction.swift` when using non-internal SDKs. Also, 
add the Swift frontend
flag `-experimental-spi-only-imports`, so that we can use `@_spiOnly`.

* Source/WebKit/DerivedSources-input.xcfilelist:

Add `WKWebView+TextExtraction.swift.in` to the derived sources input file list.

* Source/WebKit/DerivedSources-output.xcfilelist:

Add `WKWebView+TextExtraction.swift` to the derived sources output file list.

* Source/WebKit/DerivedSources.make:

Add a DerivedSources make rule for `WKWebView+TextExtraction.swift` (copied from
`WKWebView+TextExtraction.swift.in`, in WebKitAdditions).

* Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm:
(-[WKPreferences _setTextExtractionEnabled:]):
(-[WKPreferences _textExtractionEnabled]):

Add an SPI flag for internal clients to enable or disable text extraction.

* Source/WebKit/UIProcess/API/Cocoa/WKPreferencesPrivate.h:
* Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _requestTextExtraction:completionHandler:]):

Add a new category that implements an ObjC selector, 
`-_requestTextExtraction:completionHandler:`,
which is invoked via `.perform(Selector((…)))` from 
`WKWebView+TextExtraction.swift`.

* Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h:
* Source/WebKit/UIProcess/Cocoa/WKTextExtractionUtilities.h:
* Source/WebKit/UIProcess/Cocoa/WKTextExtractionUtilities.mm:
(WebKit::prepareTextExtractionSupport):

Add a helper method to ensure that `libWebKitSwift` is loaded into memory; 
called when an internal
client enables text extraction via the new preference.

* Source/WebKit/WebKit.xcodeproj/project.pbxproj:

Add the new `WKWebView+TextExtraction.swift` derived source to WebKitSwift.

Canonical link: https://commits.webkit.org/274511@main


_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to