RESOLVED FIXED 161809
[Cocoa] Reduce uses of CGFonts in favor of CTFonts
https://bugs.webkit.org/show_bug.cgi?id=161809
Summary [Cocoa] Reduce uses of CGFonts in favor of CTFonts
Myles C. Maxfield
Reported 2016-09-09 12:01:09 PDT
[Cocoa] Improve performance of populating glyph caches in the fast text codepath
Attachments
WIP (4.43 KB, patch)
2016-09-09 12:02 PDT, Myles C. Maxfield
no flags
WIP (4.44 KB, patch)
2016-09-09 12:46 PDT, Myles C. Maxfield
no flags
WIP (10.61 KB, patch)
2016-09-09 15:41 PDT, Myles C. Maxfield
no flags
WIP (10.64 KB, patch)
2016-09-09 15:47 PDT, Myles C. Maxfield
no flags
WIP (15.99 KB, patch)
2016-09-09 18:40 PDT, Myles C. Maxfield
no flags
WIP (16.35 KB, patch)
2016-09-10 12:14 PDT, Myles C. Maxfield
no flags
ASSERTs testing (16.43 KB, patch)
2016-09-10 14:12 PDT, Myles C. Maxfield
no flags
Measuring perf (16.29 KB, patch)
2016-09-10 14:19 PDT, Myles C. Maxfield
no flags
No regression (15.39 KB, patch)
2016-09-11 23:51 PDT, Myles C. Maxfield
no flags
Patch (8.01 KB, patch)
2016-09-12 10:25 PDT, Myles C. Maxfield
dbates: review+
Myles C. Maxfield
Comment 1 2016-09-09 12:02:14 PDT
Myles C. Maxfield
Comment 2 2016-09-09 12:46:23 PDT
WebKit Commit Bot
Comment 3 2016-09-09 15:16:30 PDT
Attachment 288430 [details] did not pass style-queue: ERROR: Source/WebCore/platform/graphics/mac/GlyphPageMac.cpp:80: One line control clauses should not use braces. [whitespace/braces] [4] ERROR: Source/WebCore/ChangeLog:8: You should remove the 'No new tests' and either add and list tests, or explain why no new tests were possible. [changelog/nonewtests] [5] Total errors found: 2 in 5 files If any of these errors are false positives, please file a bug against check-webkit-style.
Myles C. Maxfield
Comment 4 2016-09-09 15:41:09 PDT
WebKit Commit Bot
Comment 5 2016-09-09 15:43:46 PDT
Attachment 288445 [details] did not pass style-queue: ERROR: Source/WebCore/platform/graphics/mac/GlyphPageMac.cpp:109: One line control clauses should not use braces. [whitespace/braces] [4] ERROR: Source/WebCore/ChangeLog:8: You should remove the 'No new tests' and either add and list tests, or explain why no new tests were possible. [changelog/nonewtests] [5] Total errors found: 2 in 7 files If any of these errors are false positives, please file a bug against check-webkit-style.
Myles C. Maxfield
Comment 6 2016-09-09 15:47:46 PDT
WebKit Commit Bot
Comment 7 2016-09-09 15:50:35 PDT
Attachment 288446 [details] did not pass style-queue: ERROR: Source/WebCore/platform/graphics/mac/GlyphPageMac.cpp:110: One line control clauses should not use braces. [whitespace/braces] [4] ERROR: Source/WebCore/ChangeLog:8: You should remove the 'No new tests' and either add and list tests, or explain why no new tests were possible. [changelog/nonewtests] [5] Total errors found: 2 in 7 files If any of these errors are false positives, please file a bug against check-webkit-style.
Myles C. Maxfield
Comment 8 2016-09-09 18:40:42 PDT
Myles C. Maxfield
Comment 9 2016-09-10 12:14:50 PDT
Myles C. Maxfield
Comment 10 2016-09-10 14:12:21 PDT
Created attachment 288496 [details] ASSERTs testing
Myles C. Maxfield
Comment 11 2016-09-10 14:19:32 PDT
Created attachment 288497 [details] Measuring perf
Myles C. Maxfield
Comment 12 2016-09-11 23:51:41 PDT
Created attachment 288555 [details] No regression
Myles C. Maxfield
Comment 13 2016-09-12 10:25:24 PDT
Daniel Bates
Comment 14 2016-09-12 12:17:03 PDT
Comment on attachment 288577 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=288577&action=review > Source/WTF/wtf/unicode/CharacterNames.h:73 > +const UChar narrowNoBreakSpace = 0x202F; Please add this definitions such that it appears in this list of definitions in sorted order according to the UNIX sort command. > Source/WTF/wtf/unicode/CharacterNames.h:136 > +using WTF::Unicode::narrowNoBreakSpace; Ditto. > Source/WebCore/platform/graphics/GlyphPage.h:45 > + GlyphData(Glyph glyph = 0, const Font* font = 0) We should take this opportunity to change 0 to nullptr for the default value of the second argument. > Source/WebCore/platform/graphics/mac/GlyphPageMac.cpp:43 > +static bool shouldFillWithVerticalGlyphs(const UChar* buffer, unsigned bufferLength, const Font& font) We may want to consider having this function take a WTF::StringView (or maybe introduce a WTF::ArrayView) instead of passing a buffer and length. Among other benefits, using a WTF::StringView helps ensure that we always have the correct buffer length for the buffer. I know that currently the caller GlyphPage::fill() is passed a raw pointer to a buffer and a length. We may want to look to change these signatures as well. > Source/WebCore/platform/graphics/mac/GlyphPageMac.cpp:49 > + if (!font.hasVerticalGlyphs()) > + return false; > + for (unsigned i = 0; i < bufferLength; ++i) { > + if (!FontCascade::isCJKIdeograph(buffer[i])) > + return true; I am assuming that we no longer need to consider whether the font is a system font or the font is for text combine as part of knowing whether a font has vertical glyphs.
Myles C. Maxfield
Comment 15 2016-09-12 14:44:15 PDT
Comment on attachment 288577 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=288577&action=review >> Source/WebCore/platform/graphics/mac/GlyphPageMac.cpp:43 >> +static bool shouldFillWithVerticalGlyphs(const UChar* buffer, unsigned bufferLength, const Font& font) > > We may want to consider having this function take a WTF::StringView (or maybe introduce a WTF::ArrayView) instead of passing a buffer and length. Among other benefits, using a WTF::StringView helps ensure that we always have the correct buffer length for the buffer. I know that currently the caller GlyphPage::fill() is passed a raw pointer to a buffer and a length. We may want to look to change these signatures as well. StringView is not a good candidate because it can hold both 8-bit characters and 16-bit characters, but this function only accepts 16-bit characters. Something like an ArrayView would be a better fit, but I think implementing that is out of scope for this patch. >> Source/WebCore/platform/graphics/mac/GlyphPageMac.cpp:49 >> + return true; > > I am assuming that we no longer need to consider whether the font is a system font or the font is for text combine as part of knowing whether a font has vertical glyphs. In the (deleted) code below, we only call CTFontGetVerticalGlyphsForCharacters() if the font is not a system font and the font is not for text combine.
Myles C. Maxfield
Comment 16 2016-09-12 14:46:43 PDT
Note You need to log in before you can comment on or make changes to this bug.