Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 286c709225989fd38e69c4917db4be57129670f8
https://github.com/WebKit/WebKit/commit/286c709225989fd38e69c4917db4be57129670f8
Author: Said Abou-Hallawa <[email protected]>
Date: 2026-03-17 (Tue, 17 Mar 2026)
Changed paths:
M Source/WebCore/platform/graphics/GraphicsContext.cpp
M Source/WebCore/platform/graphics/displaylists/DisplayListItem.cpp
M Source/WebCore/platform/graphics/displaylists/DisplayListItem.h
M Source/WebCore/platform/graphics/displaylists/DisplayListItems.cpp
M Source/WebCore/platform/graphics/displaylists/DisplayListItems.h
M Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewSnapshot.mm
Log Message:
-----------
Remote snapshotting may flip part of the page
https://bugs.webkit.org/show_bug.cgi?id=308365
rdar://170868383
Reviewed by Kimmo Kinnunen.
The remote snapshotting relies on first recording the drawing of the Frame to a
DisplayList in GPUProcess. Then the DisplayList is replayed back to the
destination
GraphicsContext.
Parts of the rendering code like RenderLayer::paintLayerByApplyingTransform()
may
use the following pattern to change the CTM and restore it at the end:
oldCTM = context.getCTM();
context.setCTM(newCTM);
...
context.setCTM(oldCTM);
If the context is a DisplayListRecorder, getCTM() does not include the flipping
transformation. Calling setCTM(), in this case, will add SetCTM to DisplayList.
When replaying back SetCTM, it sets the CTM to the `oldCTM`, so the flipping
transformation will be lost.
To fix this issue, setCTM::apply() will take a new argument called
`baseTransform`.
This argument is eqaul to the destination context CTM before replaying back the
DisplayList.
Test: Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewSnapshot.mm
* Source/WebCore/platform/graphics/GraphicsContext.cpp:
(WebCore::GraphicsContext::drawDisplayList):
* Source/WebCore/platform/graphics/displaylists/DisplayListItem.cpp:
(WebCore::DisplayList::applyItem):
* Source/WebCore/platform/graphics/displaylists/DisplayListItem.h:
* Source/WebCore/platform/graphics/displaylists/DisplayListItems.cpp:
(WebCore::DisplayList::SetCTM::apply const):
* Source/WebCore/platform/graphics/displaylists/DisplayListItems.h:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewSnapshot.mm:
(TestWebKitAPI::enableRemoteSnapshotting):
(TestWebKitAPI::TEST(WKWebView, RemoteSnapshotWithTransform)):
Canonical link: https://commits.webkit.org/309441@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications