Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: d32d0c71f389cd84817e27eaf9fdab64c78d2c00
https://github.com/WebKit/WebKit/commit/d32d0c71f389cd84817e27eaf9fdab64c78d2c00
Author: Wenson Hsieh <[email protected]>
Date: 2025-09-17 (Wed, 17 Sep 2025)
Changed paths:
M Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
M Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h
M Source/WebKit/UIProcess/WebFrameProxy.cpp
M Source/WebKit/UIProcess/WebFrameProxy.h
M Source/WebKit/WebProcess/WebPage/WebFrame.cpp
M Source/WebKit/WebProcess/WebPage/WebFrame.h
M Source/WebKit/WebProcess/WebPage/WebFrame.messages.in
M Source/WebKit/WebProcess/WebPage/WebPage.cpp
M Source/WebKit/WebProcess/WebPage/WebPage.h
M Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm
M Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
M Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewSnapshot.mm
A Tools/TestWebKitAPI/Tests/WebKitCocoa/node-snapshotting.html
M Tools/TestWebKitAPI/cocoa/CGImagePixelReader.cpp
M Tools/TestWebKitAPI/cocoa/CGImagePixelReader.h
Log Message:
-----------
[Cocoa] Add a way for clients to take snapshots of nodes using `_WKJSHandle`
https://bugs.webkit.org/show_bug.cgi?id=299019
rdar://160776803
Reviewed by Timothy Hatcher and Abrar Rahman Protyasha.
Add support for `-[WKWebView _takeSnapshotOfNode:completionHandler:]`; see
below for more details.
Test: WKWebView.SnapshotNodeByJSHandle
* Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _takeSnapshotOfNode:completionHandler:]):
Implement the new method on `WKWebView`. This grabs the `WebFrameProxy` using
the handle's frame ID
(from frame info data), and sends an async message to take a snapshot of the
node that corresponds
to the given JS handle ID.
* Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h:
* Source/WebKit/UIProcess/WebFrameProxy.cpp:
(WebKit::WebFrameProxy::takeSnapshotOfNode):
* Source/WebKit/UIProcess/WebFrameProxy.h:
* Source/WebKit/WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::takeSnapshotOfNode):
Add plumbing from `WebFrameProxy` <-> `WebFrame`. We don't need to go through
`WebPageProxy` in this
case, because we already have the frame identifier of the target.
* Source/WebKit/WebProcess/WebPage/WebFrame.h:
* Source/WebKit/WebProcess/WebPage/WebFrame.messages.in:
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::shareableBitmapSnapshotForNode):
Move this helper method out of iOS-specific code, and into platform-agnostic
code in the `.cpp` so
we can use it in `takeSnapshotOfNode`.
* Source/WebKit/WebProcess/WebPage/WebPage.h:
* Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::shareableBitmapSnapshotForNode): Deleted.
* Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewSnapshot.mm:
(-[WKWebView takeSnapshotOfNode:]):
(TestWebKitAPI::TEST(WKWebView, SnapshotNodeByJSHandle)):
Add a new API test.
* Tools/TestWebKitAPI/Tests/WebKitCocoa/node-snapshotting.html: Added.
* Tools/TestWebKitAPI/cocoa/CGImagePixelReader.cpp:
(TestWebKitAPI::CGImagePixelReader::cssColorAt const):
Add a helper method to extract the color at the given `(x, y)` coordinates, as
a serialized string
for CSS.
* Tools/TestWebKitAPI/cocoa/CGImagePixelReader.h:
Canonical link: https://commits.webkit.org/300105@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes