Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 5bc70c9bb57be8ea68ce676112183d98df4cda71
https://github.com/WebKit/WebKit/commit/5bc70c9bb57be8ea68ce676112183d98df4cda71
Author: Gerald Squelart <[email protected]>
Date: 2026-02-05 (Thu, 05 Feb 2026)
Changed paths:
M Source/WebCore/platform/graphics/FontCascade.cpp
M Source/WebCore/platform/graphics/FontCascade.h
M Source/WebCore/platform/graphics/FontCascadeCache.cpp
M Source/WebCore/platform/graphics/FontCascadeFonts.h
M Source/WebCore/platform/graphics/TextMeasurementCache.h
M Tools/TestWebKitAPI/Tests/WebCore/MonospaceFontTests.cpp
Log Message:
-----------
Cache GlyphOverflow with widths for calls that need both
https://bugs.webkit.org/show_bug.cgi?id=306235
rdar://168526001
Reviewed by Simon Fraser.
Add GlyphOverflow to the cache, to be used by FontCascade::width() when
a GlyphOverflow is needed, for example from
CanvasRenderingContext2D::measureText().
If other code paths only needs the width, the same cache can provide it.
This new GlyphGeometryCache allows for longer strings as keys,
based on the typical usage found in canvas-based applications.
* Source/WebCore/platform/graphics/FontCascade.cpp:
(WebCore::FontCascade::width const):
(WebCore::FontCascade::widthForSimpleTextSlow const):
(WebCore::FontCascade::widthForSimpleTextWithFixedPitch const):
* Source/WebCore/platform/graphics/FontCascade.h:
(WebCore::FontCascade::widthForTextUsingSimplifiedMeasuring const):
(WebCore::GlyphOverflow): Moved to FontCascadeFonts.h.
* Source/WebCore/platform/graphics/FontCascadeCache.cpp:
(WebCore::FontCascadeCache::clearMeasurementCaches):
* Source/WebCore/platform/graphics/FontCascadeFonts.h:
(WebCore::GlyphOverflow): Moved from FontCascade.h.
(WTF::MarkableTraits<WebCore::GlyphOverflow>::isEmptyValue):
(WTF::MarkableTraits<WebCore::GlyphOverflow>::emptyValue):
(WebCore::FontCascadeFonts::glyphGeometryCache):
(WebCore::FontCascadeFonts::glyphGeometryCache const):
(WebCore::FontCascadeFonts::widthCache): Deleted.
(WebCore::FontCascadeFonts::widthCache const): Deleted.
* Source/WebCore/platform/graphics/TextMeasurementCache.h:
* Tools/TestWebKitAPI/Tests/WebCore/MonospaceFontTests.cpp:
(TestWebKitAPI::TEST(MonospaceFontsTest, EnsureMonospaceFontInvariants)):
Canonical link: https://commits.webkit.org/306839@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications