Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 1fd2cd726bd5e479e196ba2ba1829ca4df770d49
      
https://github.com/WebKit/WebKit/commit/1fd2cd726bd5e479e196ba2ba1829ca4df770d49
  Author: David Kilzer <[email protected]>
  Date:   2026-07-20 (Mon, 20 Jul 2026)

  Changed paths:
    M Source/WebCore/platform/graphics/Font.cpp
    M Source/WebCore/platform/graphics/FontCascade.cpp

  Log Message:
  -----------
  Consistently use Ref instead of RefPtr for non-null GlyphBuffer::fontAt() 
results
<https://bugs.webkit.org/show_bug.cgi?id=319846>
<rdar://182743001>

Reviewed by Vitor Roriz.

`GlyphBuffer::fontAt()` returns the result of dereferencing a
`SingleThreadWeakPtr<const Font>`, whose `operator*` does a
`RELEASE_ASSERT()` that the font is live, so the returned reference is
never nullptr.  Hold it in `Ref<const Font>` rather than a nullable
`RefPtr` in `FontCascade::drawGlyphBuffer()` to express that invariant.

Also promote the bare `const Font&` local in the debug-only
`WebCore::operator<<(TextStream&, const GlyphBuffer&)` to a stack `Ref`,
so the font stays live across the non-trivial `boundsForGlyph()` call
instead of being borrowed from the weak reference.

No new tests since no change in behavior.

* Source/WebCore/platform/graphics/Font.cpp:
(WebCore::operator<<):
* Source/WebCore/platform/graphics/FontCascade.cpp:
(WebCore::FontCascade::drawGlyphBuffer):

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



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

Reply via email to