Title: [291896] trunk/Source/WebCore
Revision
291896
Author
[email protected]
Date
2022-03-25 15:25:12 -0700 (Fri, 25 Mar 2022)

Log Message

FontCascade::widthForSimpleText needs the glyph only
https://bugs.webkit.org/show_bug.cgi?id=238385

Reviewed by Antti Koivisto.

widthForSimpleText operates on primary font only so let's just call PrimaryFont.glyphForCharacter() directly.
(This should provide a slight perf gain on text heavy pages. e.g. wikipedia over 50 page loads ->
 w/o: widthForSimpleText: 266286 calls, mean duration: 0.000201ms, total duration: 53.403753ms, max duration 0.016750ms
   w: widthForSimpleText: 266274 calls, mean duration: 0.000176ms, total duration: 46.949579ms, max duration 0.016917ms)

* platform/graphics/FontCascade.cpp:
(WebCore::FontCascade::widthForSimpleText const):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (291895 => 291896)


--- trunk/Source/WebCore/ChangeLog	2022-03-25 22:11:49 UTC (rev 291895)
+++ trunk/Source/WebCore/ChangeLog	2022-03-25 22:25:12 UTC (rev 291896)
@@ -1,3 +1,18 @@
+2022-03-25  Alan Bujtas  <[email protected]>
+
+        FontCascade::widthForSimpleText needs the glyph only
+        https://bugs.webkit.org/show_bug.cgi?id=238385
+
+        Reviewed by Antti Koivisto.
+
+        widthForSimpleText operates on primary font only so let's just call PrimaryFont.glyphForCharacter() directly.
+        (This should provide a slight perf gain on text heavy pages. e.g. wikipedia over 50 page loads ->
+         w/o: widthForSimpleText: 266286 calls, mean duration: 0.000201ms, total duration: 53.403753ms, max duration 0.016750ms
+           w: widthForSimpleText: 266274 calls, mean duration: 0.000176ms, total duration: 46.949579ms, max duration 0.016917ms)
+
+        * platform/graphics/FontCascade.cpp:
+        (WebCore::FontCascade::widthForSimpleText const):
+
 2022-03-25  Chris Dumez  <[email protected]>
 
         Unreviewed, update DerivedSources-output.xcfilelist to fix build.

Modified: trunk/Source/WebCore/platform/graphics/FontCascade.cpp (291895 => 291896)


--- trunk/Source/WebCore/platform/graphics/FontCascade.cpp	2022-03-25 22:11:49 UTC (rev 291895)
+++ trunk/Source/WebCore/platform/graphics/FontCascade.cpp	2022-03-25 22:25:12 UTC (rev 291896)
@@ -315,7 +315,7 @@
     auto& font = primaryFont();
     ASSERT(!font.syntheticBoldOffset()); // This function should only be called when RenderText::computeCanUseSimplifiedTextMeasuring() returns true, and that function requires no synthetic bold.
     for (size_t i = 0; i < text.length(); ++i) {
-        auto glyph = glyphDataForCharacter(text[i], false).glyph;
+        auto glyph = font.glyphForCharacter(text[i]);
         glyphBuffer.add(glyph, font, font.widthForGlyph(glyph), i);
     }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to