[webkit-changes] [WebKit/WebKit] 602025: Expose WKSnapshotConfiguration._usesTransparentBac...

Blaze Jayne noreply at github.com
Mon Oct 2 19:12:19 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 602025fdc4dc982b18d8ac3e040296ff13b06ff6
      https://github.com/WebKit/WebKit/commit/602025fdc4dc982b18d8ac3e040296ff13b06ff6
  Author: BJ Burg <bburg at apple.com>
  Date:   2023-10-02 (Mon, 02 Oct 2023)

  Changed paths:
    M Source/WebKit/UIProcess/API/Cocoa/WKSnapshotConfiguration.mm
    M Source/WebKit/UIProcess/API/Cocoa/WKSnapshotConfigurationPrivate.h
    M Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm

  Log Message:
  -----------
  Expose WKSnapshotConfiguration._usesTransparentBackground as SPI
https://bugs.webkit.org/show_bug.cgi?id=262501
<rdar://116260533>

Reviewed by Timothy Hatcher and Patrick Angle.

To help clients move away from `-[WKWebProcessPlugInNodeHandle renderedImageWithOptions:]`,
make it possible to snapshot page contents with transparency by compositing on a transparent
background color. Transparent backgrounds are always used by WebPage::snapshotNode(), but
not the generic viewport snapshot method. Make it possible to do the same with WKWebView API.

* Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView takeSnapshotWithConfiguration:completionHandler:]):
Add in `SnapshotOptionsTransparentBackground` if `-_usesTransparentBackground` is YES.

* Source/WebKit/UIProcess/API/Cocoa/WKSnapshotConfigurationPrivate.h:
Add `_usesTransparentBackground` / `_setUsesTransparentBackground`.

* Source/WebKit/UIProcess/API/Cocoa/WKSnapshotConfiguration.mm:
(-[WKSnapshotConfiguration init]):
(-[WKSnapshotConfiguration copyWithZone:]):
Add new field to `-copyWithZone:`.

(-[WKSnapshotConfiguration _usesTransparentBackground]):
(-[WKSnapshotConfiguration _setUsesTransparentBackground:]):
Added.

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




More information about the webkit-changes mailing list