Skip to content

REGRESSION(309060@main): Gradient rendering performance regressed by not caching stop in device colorspace.#62945

Merged
webkit-commit-queue merged 1 commit into
WebKit:mainfrom
mattwoodrow:eng/gradient-dest-colorspace
Apr 17, 2026
Merged

REGRESSION(309060@main): Gradient rendering performance regressed by not caching stop in device colorspace.#62945
webkit-commit-queue merged 1 commit into
WebKit:mainfrom
mattwoodrow:eng/gradient-dest-colorspace

Conversation

@mattwoodrow
Copy link
Copy Markdown
Contributor

@mattwoodrow mattwoodrow commented Apr 17, 2026

f5492c8

REGRESSION(309060@main): Gradient rendering performance regressed by not caching stop in device colorspace.
https://bugs.webkit.org/show_bug.cgi?id=312535
<rdar://174044547>

Reviewed by Dan Glastonbury.

This change switched back to rendering gradients in sRGB instead of device
colourspace.

I think we can do this again, as long as the 'device' (destination ImageBuffer)
colourspace isn't a linear one, and should be approximately equal to sRGB for
interpolation.

The regressing changeset added tests, so these should confirm this doesn't
reintroduce the bug.

* Source/WebCore/platform/graphics/Gradient.h:
* Source/WebCore/platform/graphics/cg/GradientCG.cpp:
(WebCore::nonLinearDestinationColorSpace):
(WebCore::Gradient::paint):
* Source/WebCore/platform/graphics/cg/GradientRendererCG.cpp:
(WTF::RetainPtr<CGGradientRef>>::createValueForKey):
(WebCore::GradientRendererCG::GradientRendererCG):
(WebCore::GradientRendererCG::makeGradient const):
(WebCore::GradientRendererCG::makeGradientBySampling const):
(WebCore::GradientRendererCG::createGradientBySampling):
* Source/WebCore/platform/graphics/cg/GradientRendererCG.h:
(WebCore::GradientRendererCG::GradientRendererCG):
(WebCore::GradientRendererCG::colorSpace const):
(WebCore::GradientRendererCG::createGradientBySampling):

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

c6cf873

Misc iOS, visionOS, tvOS & watchOS macOS Linux Windows Apple Internal
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe 🛠 win ⏳ 🛠 ios-apple
✅ 🧪 bindings ✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug ✅ 🧪 wpe-wk2 🧪 win-tests ⏳ 🛠 mac-apple
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 ✅ 🧪 api-mac ✅ 🧪 api-wpe ⏳ 🛠 vision-apple
✅ 🧪 ios-wk2-wpt ✅ 🧪 api-mac-debug ✅ 🛠 gtk3-libwebrtc
✅ 🧪 api-ios ✅ 🧪 mac-wk1 ✅ 🛠 gtk
✅ 🛠 ios-safer-cpp ✅ 🧪 mac-wk2 ✅ 🧪 gtk-wk2
✅ 🛠 vision ✅ 🧪 mac-AS-debug-wk2 ✅ 🧪 api-gtk
✅ 🛠 🧪 merge ✅ 🛠 vision-sim ✅ 🧪 mac-wk2-stress ✅ 🛠 playstation
✅ 🧪 vision-wk2 ❌ 🧪 mac-intel-wk2
✅ 🛠 tv ✅ 🛠 mac-safer-cpp
✅ 🛠 tv-sim
✅ 🛠 watch
✅ 🛠 watch-sim

@mattwoodrow mattwoodrow self-assigned this Apr 17, 2026
@mattwoodrow mattwoodrow added the Layout and Rendering For bugs with layout and rendering of Web pages. label Apr 17, 2026
@mattwoodrow mattwoodrow requested review from djg and smfr April 17, 2026 02:07
Copy link
Copy Markdown
Contributor

@djg djg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

Copy link
Copy Markdown
Contributor

@smfr smfr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could use a better title.

@mattwoodrow mattwoodrow changed the title REGRESSION(309060@main): Gradient rendering performance REGRESSION(309060@main): Gradient rendering performance regressed by not caching stop in device colorspace. Apr 17, 2026
@mattwoodrow mattwoodrow force-pushed the eng/gradient-dest-colorspace branch from 016cda2 to c6cf873 Compare April 17, 2026 03:09
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Apr 17, 2026
@mattwoodrow mattwoodrow added merge-queue Applied to send a pull request to merge-queue and removed merging-blocked Applied to prevent a change from being merged labels Apr 17, 2026
…not caching stop in device colorspace.

https://bugs.webkit.org/show_bug.cgi?id=312535
<rdar://174044547>

Reviewed by Dan Glastonbury.

This change switched back to rendering gradients in sRGB instead of device
colourspace.

I think we can do this again, as long as the 'device' (destination ImageBuffer)
colourspace isn't a linear one, and should be approximately equal to sRGB for
interpolation.

The regressing changeset added tests, so these should confirm this doesn't
reintroduce the bug.

* Source/WebCore/platform/graphics/Gradient.h:
* Source/WebCore/platform/graphics/cg/GradientCG.cpp:
(WebCore::nonLinearDestinationColorSpace):
(WebCore::Gradient::paint):
* Source/WebCore/platform/graphics/cg/GradientRendererCG.cpp:
(WTF::RetainPtr<CGGradientRef>>::createValueForKey):
(WebCore::GradientRendererCG::GradientRendererCG):
(WebCore::GradientRendererCG::makeGradient const):
(WebCore::GradientRendererCG::makeGradientBySampling const):
(WebCore::GradientRendererCG::createGradientBySampling):
* Source/WebCore/platform/graphics/cg/GradientRendererCG.h:
(WebCore::GradientRendererCG::GradientRendererCG):
(WebCore::GradientRendererCG::colorSpace const):
(WebCore::GradientRendererCG::createGradientBySampling):

Canonical link: https://commits.webkit.org/311433@main
@webkit-commit-queue webkit-commit-queue force-pushed the eng/gradient-dest-colorspace branch from c6cf873 to f5492c8 Compare April 17, 2026 07:20
@webkit-commit-queue
Copy link
Copy Markdown
Collaborator

Committed 311433@main (f5492c8): https://commits.webkit.org/311433@main

Reviewed commits have been landed. Closing PR #62945 and removing active labels.

@webkit-commit-queue webkit-commit-queue merged commit f5492c8 into WebKit:main Apr 17, 2026
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Apr 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Layout and Rendering For bugs with layout and rendering of Web pages.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants