Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 69387ce22018858ece19528bd2b8255e5ae0db32
https://github.com/WebKit/WebKit/commit/69387ce22018858ece19528bd2b8255e5ae0db32
Author: Ahmad Saleem <[email protected]>
Date: 2026-08-23 (Sun, 23 Aug 2026)
Changed paths:
M Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp
Log Message:
-----------
canDrawText() refs both the fill and stroke gradient when only one is used
https://bugs.webkit.org/show_bug.cgi?id=322288
rdar://185524314
Reviewed by Gerald Squelart.
canDrawText() rejects text draws whose paint is a zero-size gradient, but which
gradient matters depends on whether the caller is filling or stroking. The check
was written as two unconditional RefPtr assignments with the fill/stroke test
folded into each if-condition, so every fillText() and strokeText() call queried
both GraphicsContext::strokeGradient() and GraphicsContext::fillGradient() and
paid a ref/deref pair for each - both accessors return a raw Gradient*, so the
RefPtr construction is a real refcount round trip - when by construction one of
the two results is discarded unused.
Select the gradient with the fill flag first and take a single reference. No
behavior change: filling still consults only the fill gradient and stroking only
the stroke gradient.
* Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp:
(WebCore::CanvasRenderingContext2DBase::canDrawText):
Canonical link: https://commits.webkit.org/319670@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications