OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "platform/text/Character.h" | 5 #include "platform/text/Character.h" |
6 | 6 |
7 #include "platform/text/ICUError.h" | 7 #include "platform/text/ICUError.h" |
8 #include <unicode/uvernum.h> | 8 #include <unicode/uvernum.h> |
9 | 9 |
10 #if defined(USING_SYSTEM_ICU) || (U_ICU_VERSION_MAJOR_NUM <= 57) | 10 #if defined(USING_SYSTEM_ICU) || (U_ICU_VERSION_MAJOR_NUM <= 57) |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 R"([\U0001F6A3][\U0001F6B4-\U0001F6B6][\U0001F6C0][\U0001F6CC])" | 182 R"([\U0001F6A3][\U0001F6B4-\U0001F6B6][\U0001F6C0][\U0001F6CC])" |
183 R"([\U0001F918][\U0001F919-\U0001F91E][\U0001F926][\U0001F930])" | 183 R"([\U0001F918][\U0001F919-\U0001F91E][\U0001F926][\U0001F930])" |
184 R"([\U0001F933-\U0001F939][\U0001F93C-\U0001F93E]])"; | 184 R"([\U0001F933-\U0001F939][\U0001F93C-\U0001F93E]])"; |
185 | 185 |
186 static void applyPatternAndFreeze(icu::UnicodeSet* unicodeSet, | 186 static void applyPatternAndFreeze(icu::UnicodeSet* unicodeSet, |
187 const char* pattern) { | 187 const char* pattern) { |
188 ICUError err; | 188 ICUError err; |
189 // Use ICU's invariant-character initialization method. | 189 // Use ICU's invariant-character initialization method. |
190 unicodeSet->applyPattern(icu::UnicodeString(pattern, -1, US_INV), err); | 190 unicodeSet->applyPattern(icu::UnicodeString(pattern, -1, US_INV), err); |
191 unicodeSet->freeze(); | 191 unicodeSet->freeze(); |
192 ASSERT(err == U_ZERO_ERROR); | 192 DCHECK_EQ(err, U_ZERO_ERROR); |
193 } | 193 } |
194 | 194 |
195 bool Character::isEmoji(UChar32 ch) { | 195 bool Character::isEmoji(UChar32 ch) { |
196 return Character::isEmojiTextDefault(ch) || | 196 return Character::isEmojiTextDefault(ch) || |
197 Character::isEmojiEmojiDefault(ch); | 197 Character::isEmojiEmojiDefault(ch); |
198 } | 198 } |
199 | 199 |
200 bool Character::isEmojiTextDefault(UChar32 ch) { | 200 bool Character::isEmojiTextDefault(UChar32 ch) { |
201 DEFINE_STATIC_LOCAL(icu::UnicodeSet, emojiTextSet, ()); | 201 DEFINE_STATIC_LOCAL(icu::UnicodeSet, emojiTextSet, ()); |
202 if (emojiTextSet.isEmpty()) | 202 if (emojiTextSet.isEmpty()) |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 | 237 |
238 bool Character::IsEmojiKeycapBase(UChar32 ch) { | 238 bool Character::IsEmojiKeycapBase(UChar32 ch) { |
239 return (ch >= '0' && ch <= '9') || ch == '#' || ch == '*'; | 239 return (ch >= '0' && ch <= '9') || ch == '#' || ch == '*'; |
240 } | 240 } |
241 | 241 |
242 bool Character::IsRegionalIndicator(UChar32 ch) { | 242 bool Character::IsRegionalIndicator(UChar32 ch) { |
243 return (ch >= 0x1F1E6 && ch <= 0x1F1FF); | 243 return (ch >= 0x1F1E6 && ch <= 0x1F1FF); |
244 } | 244 } |
245 | 245 |
246 }; // namespace blink | 246 }; // namespace blink |
OLD | NEW |