forked from mirrors/gecko-dev
Bug 1844830 - patch 2 - Micro-optimize grapheme cluster checks used during textrun creation. r=gfx-reviewers,lsalzman
Depends on D184311 Differential Revision: https://phabricator.services.mozilla.com/D184312
This commit is contained in:
parent
764c268633
commit
df97265d72
2 changed files with 14 additions and 2 deletions
|
|
@ -3098,6 +3098,14 @@ static char16_t IsBoundarySpace(char16_t aChar, char16_t aNextChar) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
// In 8-bit text, there cannot be any cluster-extenders.
|
||||
static uint8_t IsBoundarySpace(uint8_t aChar, uint8_t aNextChar) {
|
||||
if (aChar == ' ' || aChar == 0x00A0) {
|
||||
return aChar;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef __GNUC__
|
||||
# define GFX_MAYBE_UNUSED __attribute__((unused))
|
||||
#else
|
||||
|
|
|
|||
|
|
@ -159,13 +159,17 @@ uint32_t GetFullWidthInverse(uint32_t aCh);
|
|||
bool IsClusterExtender(uint32_t aCh, uint8_t aCategory);
|
||||
|
||||
inline bool IsClusterExtender(uint32_t aCh) {
|
||||
return IsClusterExtender(aCh, GetGeneralCategory(aCh));
|
||||
// There are no cluster-extender characters before the first combining-
|
||||
// character block at U+03xx, so we short-circuit here to avoid the cost
|
||||
// of calling GetGeneralCategory for Latin-1 letters etc.
|
||||
return aCh >= 0x0300 && IsClusterExtender(aCh, GetGeneralCategory(aCh));
|
||||
}
|
||||
|
||||
bool IsClusterExtenderExcludingJoiners(uint32_t aCh, uint8_t aCategory);
|
||||
|
||||
inline bool IsClusterExtenderExcludingJoiners(uint32_t aCh) {
|
||||
return IsClusterExtenderExcludingJoiners(aCh, GetGeneralCategory(aCh));
|
||||
return aCh >= 0x0300 &&
|
||||
IsClusterExtenderExcludingJoiners(aCh, GetGeneralCategory(aCh));
|
||||
}
|
||||
|
||||
// Count the number of grapheme clusters in the given string
|
||||
|
|
|
|||
Loading…
Reference in a new issue