[webkit-changes] [WebKit/WebKit] b51c7a: Drawing SystemImages have multiple context state h...
Kimmo Kinnunen
noreply at github.com
Sun Mar 12 09:26:51 PDT 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: b51c7a93f9151e1d799a6a399274e0d84def4144
https://github.com/WebKit/WebKit/commit/b51c7a93f9151e1d799a6a399274e0d84def4144
Author: Kimmo Kinnunen <kkinnunen at apple.com>
Date: 2023-03-12 (Sun, 12 Mar 2023)
Changed paths:
M Source/WebCore/Modules/applepay/ApplePayLogoSystemImage.mm
M Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp
M Tools/TestWebKitAPI/Tests/WebCore/DisplayListRecorderTests.cpp
Log Message:
-----------
Drawing SystemImages have multiple context state handling errors
https://bugs.webkit.org/show_bug.cgi?id=253640
rdar://106502760
Reviewed by Simon Fraser.
Problems :
1. Drawing system images through display list recorder would not apply
the pending graphics context state. This could, for example, leave
out antialias setting when it would be intended.
2. Drawing ApplePay system image would change the graphics context
transform but not reset it.
3. The drawing implementation of the ApplePay image is custom, it might
further mutate the CGContext without WebKit knowing it. It would
mutate at least the clip state of the underlying CGContext.
This could cause rendering problems until the state stack would
reset the clip.
Fix 1. by making DisplayListRecorder apply the pending state before
recording the draw item.
Fix 2., 3. by adding CGContextSaveGState() and corresponding restore.
Also use the CGContext methods instead of GraphicsContext methods,
for consistency. Future commits might add mechanisms to ensure bugs
like this are harder to do.
* Source/WebCore/Modules/applepay/ApplePayLogoSystemImage.mm:
(WebCore::ApplePayLogoSystemImage::draw const):
* Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp:
(WebCore::DisplayList::Recorder::drawSystemImage):
* Tools/TestWebKitAPI/Tests/WebCore/DisplayListRecorderTests.cpp:
Canonical link: https://commits.webkit.org/261549@main
More information about the webkit-changes
mailing list