commit 3c213707b73adac686fd208ff1f109d7a39bea2e
parent 7252cb0aa54684bb7dde137be692a1483027aa78
Author: Jonathan Kew <jkew@mozilla.com>
Date: Mon, 10 Nov 2025 22:10:58 +0000
Bug 1999164 - If unicode-range is simply 0..10FFFF, don't bother to create a gfxCharacterMap for it as nothing will be masked. r=layout-reviewers,firefox-style-system-reviewers,emilio
This virtually eliminates GetUnicodeRangeAsCharacterMap from the profile with the testcase here.
Differential Revision: https://phabricator.services.mozilla.com/D272045
Diffstat:
1 file changed, 5 insertions(+), 0 deletions(-)
diff --git a/layout/style/FontFaceImpl.cpp b/layout/style/FontFaceImpl.cpp
@@ -609,6 +609,11 @@ static already_AddRefed<gfxCharacterMap> ComputeCharacterMap(
if (ranges.IsEmpty()) {
return nullptr;
}
+ // A single range covering the entire Unicode code space is equivalent to
+ // having no range at all.
+ if (ranges.Length() == 1 && ranges[0] == StyleUnicodeRange{0, 0x10ffff}) {
+ return nullptr;
+ }
auto charMap = MakeRefPtr<gfxCharacterMap>(256);
for (auto& range : ranges) {
charMap->SetRange(range.start, range.end);