Changeset 262089 in webkit


Ignore:
Timestamp:
May 22, 2020 5:52:00 PM (4 years ago)
Author:
James Savage
Message:

Create Swift overlay for WebKit framework
https://bugs.webkit.org/show_bug.cgi?id=211270
<rdar://problem/60549174>

Reviewed by Brady Eidson.

Provides Swift-only overlay methods for our NS_REFINED_FOR_SWIFT API.
The overlay does not provide different API than its Objective-C counterparts,
so overlay testing focuses on ensuring that the overlay produces the
expected interface, and provides the expected mappings to and from ObjC.

The overlay is defined in a separate Xcode project (from WebKit) by
recommendation from the Swift team. Due to build system constraints this
project cannot be a sibbling of WebKit.xcodeproj, and must live in a
subdirectory. However, because it generally acts as part of the WebKit
framework, it still uses the same Version.xcconfig and source file
locations as standard WebKit sources.

  • SwiftOverlay/Configurations/Base.xcconfig: Added. Set some default

warnings and product configuration.

  • SwiftOverlay/Configurations/WebKitSwiftOverlay-maccatalyst.xcconfig: Added.

Override SDK configurations to build for Catalyst.

  • SwiftOverlay/Configurations/WebKitSwiftOverlay.xcconfig: Added.

These flags were all provided by the Xcode template.

  • SwiftOverlay/Configurations/WebKitSwiftOverlayTests-maccatalyst.xcconfig: Added.

See above.

  • SwiftOverlay/Configurations/WebKitSwiftOverlayTests.xcconfig: Added.

See above.

  • SwiftOverlay/SwiftOverlay/install-swiftmodules.sh: Added. Provided by the

Swift team.

  • SwiftOverlay/Tests/WebKitSwiftOverlayTests-Info.plist: Added.
  • SwiftOverlay/Tests/WebKitTests.swift: Added.

(WebKitTests.testAPI): This ensures that the function names come through as we

expect them to. It also ensures that the functions were correctly set to
public visiblity.

(WebKitTests.testWKPDFConfigurationRect): This does the same as the above, but

also exercises the null <-> nil conversion, and that regular values are
correctly round tripped to Objective-C.

  • SwiftOverlay/WebKitSwiftOverlay.xcodeproj/project.pbxproj: Added.
  • SwiftOverlay/WebKitSwiftOverlay.xcodeproj/xcshareddata/xcschemes/Everything (Catalyst).xcscheme: Added.
  • SwiftOverlay/WebKitSwiftOverlay.xcodeproj/xcshareddata/xcschemes/Everything.xcscheme: Added.
  • UIProcess/API/Cocoa/WebKitSwiftOverlay.swift: Added.

(WKPDFConfiguration.rect): Provide mapping of CGRect.null to nil for Swift.
(WKWebView.callAsyncJavaScript(_:arguments:in:completion:)): Provide a Result
in the completion handler, and default value for arguments.
(WKWebView.evaluateJavaScript(_:in:completion:)): Ditto.
(WKWebView.createPDF(configuration:completionHandler:)): Provide a Swift function

that takes a Result<Data, Error> instead of (Data?, Error?) tuple. Provide
a default value for the configuration.

(WKWebView.createWebArchiveData(completionHandler:)): See above.
(WKWebView.find(_:configuration:completionHandler:)): See above.

Location:
trunk/Source/WebKit
Files:
19 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r262087 r262089  
     12020-05-22  James Savage  <james.savage@apple.com>
     2
     3        Create Swift overlay for WebKit framework
     4        https://bugs.webkit.org/show_bug.cgi?id=211270
     5        <rdar://problem/60549174>
     6
     7        Reviewed by Brady Eidson.
     8
     9        Provides Swift-only overlay methods for our NS_REFINED_FOR_SWIFT API.
     10        The overlay does not provide different API than its Objective-C counterparts,
     11        so overlay testing focuses on ensuring that the overlay produces the
     12        expected interface, and provides the expected mappings to and from ObjC.
     13
     14        The overlay is defined in a separate Xcode project (from WebKit) by
     15        recommendation from the Swift team. Due to build system constraints this
     16        project cannot be a sibbling of WebKit.xcodeproj, and must live in a
     17        subdirectory. However, because it generally acts as part of the WebKit
     18        framework, it still uses the same Version.xcconfig and source file
     19        locations as standard WebKit sources.
     20
     21        * SwiftOverlay/Configurations/Base.xcconfig: Added. Set some default
     22            warnings and product configuration.
     23        * SwiftOverlay/Configurations/WebKitSwiftOverlay-maccatalyst.xcconfig: Added.
     24            Override SDK configurations to build for Catalyst.
     25        * SwiftOverlay/Configurations/WebKitSwiftOverlay.xcconfig: Added.
     26            These flags were all provided by the Xcode template.
     27        * SwiftOverlay/Configurations/WebKitSwiftOverlayTests-maccatalyst.xcconfig: Added.
     28            See above.
     29        * SwiftOverlay/Configurations/WebKitSwiftOverlayTests.xcconfig: Added.
     30            See above.
     31        * SwiftOverlay/SwiftOverlay/install-swiftmodules.sh: Added. Provided by the
     32            Swift team.
     33        * SwiftOverlay/Tests/WebKitSwiftOverlayTests-Info.plist: Added.
     34        * SwiftOverlay/Tests/WebKitTests.swift: Added.
     35        (WebKitTests.testAPI): This ensures that the function names come through as we
     36            expect them to. It also ensures that the functions were correctly set to
     37            public visiblity.
     38        (WebKitTests.testWKPDFConfigurationRect): This does the same as the above, but
     39            also exercises the null <-> nil conversion, and that regular values are
     40            correctly round tripped to Objective-C.
     41        * SwiftOverlay/WebKitSwiftOverlay.xcodeproj/project.pbxproj: Added.
     42        * SwiftOverlay/WebKitSwiftOverlay.xcodeproj/xcshareddata/xcschemes/Everything (Catalyst).xcscheme: Added.
     43        * SwiftOverlay/WebKitSwiftOverlay.xcodeproj/xcshareddata/xcschemes/Everything.xcscheme: Added.
     44        * UIProcess/API/Cocoa/WebKitSwiftOverlay.swift: Added.
     45        (WKPDFConfiguration.rect): Provide mapping of CGRect.null to nil for Swift.
     46        (WKWebView.callAsyncJavaScript(_:arguments:in:completion:)): Provide a Result
     47        in the completion handler, and default value for arguments.
     48        (WKWebView.evaluateJavaScript(_:in:completion:)): Ditto.
     49        (WKWebView.createPDF(configuration:completionHandler:)): Provide a Swift function
     50            that takes a Result<Data, Error> instead of (Data?, Error?) tuple. Provide
     51            a default value for the configuration.
     52        (WKWebView.createWebArchiveData(completionHandler:)): See above.
     53        (WKWebView.find(_:configuration:completionHandler:)): See above.
     54
    1552020-05-22  Chris Dumez  <cdumez@apple.com>
    256
Note: See TracChangeset for help on using the changeset viewer.