Bug 1614868 - Ignore combining diacritic characters in history search. r=jfkthame,mak

IsCombiningDiacritic(-1) returns false, so there is no need to specially
handle -1 in GetLowerUTF8Codepoint_inline.

It is no longer necessary for GetNaked to check whether a character is a
combining character because all callers now skip combining diacritics
and GetNaked already makes sure that decomposition removes a diacritic
and not something else.

Differential Revision: https://phabricator.services.mozilla.com/D62533
This commit is contained in:
Alex Henrie
2020-02-17 20:42:04 +00:00
parent 1bada138c8
commit a8ea431566
3 changed files with 25 additions and 11 deletions

View File

@@ -315,6 +315,9 @@ uint32_t GetNaked(uint32_t aCh) {
static const UNormalizer2* normalizer;
static HashMap<uint32_t, uint32_t> nakedCharCache;
NS_ASSERTION(!IsCombiningDiacritic(aCh),
"This character needs to be skipped");
HashMap<uint32_t, uint32_t>::Ptr entry = nakedCharCache.lookup(aCh);
if (entry.found()) {
return entry->value();
@@ -340,13 +343,6 @@ uint32_t GetNaked(uint32_t aCh) {
return aCh;
}
if (u_getIntPropertyValue(aCh, UCHAR_GENERAL_CATEGORY) & U_GC_M_MASK) {
// The character is itself a combining character, and we don't want to use
// its decomposition into multiple combining characters.
baseChar = aCh;
goto cache;
}
if (NS_IS_HIGH_SURROGATE(decomposition[0])) {
baseChar = SURROGATE_TO_UCS4(decomposition[0], decomposition[1]);
combiners = decomposition + 2;