[webkit-changes] [WebKit/WebKit] de25a6: WKSnapshotConfiguration should have an SPI option ...

Jeff Miller noreply at github.com
Fri Nov 11 15:46:30 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: de25a61cb481e50d2c33495ed974079dd7462962
      https://github.com/WebKit/WebKit/commit/de25a61cb481e50d2c33495ed974079dd7462962
  Author: Jeff Miller <jeffm at apple.com>
  Date:   2022-11-11 (Fri, 11 Nov 2022)

  Changed paths:
    M Source/WebKit/UIProcess/API/Cocoa/WKSnapshotConfiguration.mm
    A Source/WebKit/UIProcess/API/Cocoa/WKSnapshotConfigurationPrivate.h
    M Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
    M Source/WebKit/WebKit.xcodeproj/project.pbxproj
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewSnapshot.mm

  Log Message:
  -----------
  WKSnapshotConfiguration should have an SPI option to exclude selection highlighting
https://bugs.webkit.org/show_bug.cgi?id=247634
<rdar://99892167>

Reviewed by Tim Horton.

Add a _includesSelectionHighlighting property to WKSnapshotConfiguration on macOS. This controls
whether -[WKWebView takeSnapshotWithConfiguration:completionHandler:] captures the snapshot using
SnapshotOptionsExcludeSelectionHighlighting. By default, this property is YES to maintain
compatibility with existing clients.

* Source/WebKit/UIProcess/API/Cocoa/WKSnapshotConfiguration.mm:
(-[WKSnapshotConfiguration init]):
Initialize _includesSelectionHighlighting.

(-[WKSnapshotConfiguration copyWithZone:]):
Copy _includesSelectionHighlighting.

(-[WKSnapshotConfiguration _includesSelectionHighlighting]):
Added. This property can't be synthesized because it's defined in a category.

(-[WKSnapshotConfiguration _setIncludesSelectionHighlighting:]):
Ditto.

* Source/WebKit/UIProcess/API/Cocoa/WKSnapshotConfigurationPrivate.h:
Added.

* Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView takeSnapshotWithConfiguration:completionHandler:]):
Optionally pass SnapshotOptionsExcludeSelectionHighlighting to takeSnapshot().

* Source/WebKit/WebKit.xcodeproj/project.pbxproj:
Added WKSnapshotConfigurationPrivate.h.

* Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewSnapshot.mm:
(TEST):
Added a test that displays selected text and verifies that a snapshot can be captured without
selection highlighting.

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




More information about the webkit-changes mailing list