[webkit-changes] [WebKit/WebKit] e587e8: REGRESSION (287436 at main): Gradients don't show in ...

Simon Fraser noreply at github.com
Thu Jan 9 23:27:42 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: e587e812d90c10cdb12a076eb9f4c6b5b8b39af1
      https://github.com/WebKit/WebKit/commit/e587e812d90c10cdb12a076eb9f4c6b5b8b39af1
  Author: Simon Fraser <simon.fraser at apple.com>
  Date:   2025-01-09 (Thu, 09 Jan 2025)

  Changed paths:
    M Source/WebCore/platform/graphics/GraphicsContext.cpp
    M Source/WebCore/platform/graphics/GraphicsContext.h
    M Source/WebCore/platform/graphics/cg/GraphicsContextCG.h
    M Source/WebKit/WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.cpp
    M Tools/TestWebKitAPI/SourcesCocoa.txt
    M Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
    A Tools/TestWebKitAPI/Tests/WebKitCocoa/DrawingToPDF.mm
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/ElementTargetingTests.mm

  Log Message:
  -----------
  REGRESSION (287436 at main): Gradients don't show in PDF output
https://bugs.webkit.org/show_bug.cgi?id=285714
rdar://142650768

Reviewed by Said Abou-Hallawa.

287436 at main extended the RenderingMode enum with new values, but failed to enlarge the one bit in GraphicsContextCG
that stores a RenderingMode. This had the effect of causing `renderingMode()` for a `PDFDocument` to return
`Unaccelerated`, which hid a bug.

Extending `m_renderingMode` to two bits revealed that intermediate buffers, such as the one created for
tiled gradient rendering, would get a `PDFDocument` type, which breaks their rendering, preventing
gradients from showing in generated PDFs, and print output.

Fix by adding `renderingModeForCompatibleBuffer()` and calling it in places where GraphicsContext creates buffers.

Tested via an API test that examines PDF output.

* Source/WebCore/platform/graphics/GraphicsContext.cpp:
(WebCore::GraphicsContext::renderingModeForCompatibleBuffer const):
(WebCore::GraphicsContext::createImageBuffer const):
(WebCore::GraphicsContext::createAlignedImageBuffer const):
* Source/WebCore/platform/graphics/GraphicsContext.h:
* Source/WebCore/platform/graphics/cg/GraphicsContextCG.h:
* Source/WebKit/WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.cpp:
(WebKit::RemoteDisplayListRecorderProxy::createImageBuffer const):
(WebKit::RemoteDisplayListRecorderProxy::createAlignedImageBuffer const):
* Tools/TestWebKitAPI/SourcesCocoa.txt:
* Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/DrawingToPDF.mm: Added.
(TestWebKitAPI::TEST(DrawingToPDF, GradientIntoPDF)):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/ElementTargetingTests.mm:

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



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list