OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 // Freezed trie tree, see CharacterDataGenerator.cpp. | 77 // Freezed trie tree, see CharacterDataGenerator.cpp. |
78 extern const int32_t serializedCharacterDataSize; | 78 extern const int32_t serializedCharacterDataSize; |
79 extern const uint8_t serializedCharacterData[]; | 79 extern const uint8_t serializedCharacterData[]; |
80 | 80 |
81 static UTrie2* createTrie() { | 81 static UTrie2* createTrie() { |
82 // Create a Trie from the value array. | 82 // Create a Trie from the value array. |
83 ICUError error; | 83 ICUError error; |
84 UTrie2* trie = utrie2_openFromSerialized( | 84 UTrie2* trie = utrie2_openFromSerialized( |
85 UTrie2ValueBits::UTRIE2_16_VALUE_BITS, serializedCharacterData, | 85 UTrie2ValueBits::UTRIE2_16_VALUE_BITS, serializedCharacterData, |
86 serializedCharacterDataSize, nullptr, &error); | 86 serializedCharacterDataSize, nullptr, &error); |
87 ASSERT(error == U_ZERO_ERROR); | 87 DCHECK_EQ(error, U_ZERO_ERROR); |
88 return trie; | 88 return trie; |
89 } | 89 } |
90 | 90 |
91 static bool hasProperty(UChar32 c, CharacterProperty property) { | 91 static bool hasProperty(UChar32 c, CharacterProperty property) { |
92 static UTrie2* trie = nullptr; | 92 static UTrie2* trie = nullptr; |
93 if (!trie) | 93 if (!trie) |
94 trie = createTrie(); | 94 trie = createTrie(); |
95 return UTRIE2_GET16(trie, c) & static_cast<CharacterPropertyType>(property); | 95 return UTRIE2_GET16(trie, c) & static_cast<CharacterPropertyType>(property); |
96 } | 96 } |
97 | 97 |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 } | 254 } |
255 | 255 |
256 bool Character::isCommonOrInheritedScript(UChar32 character) { | 256 bool Character::isCommonOrInheritedScript(UChar32 character) { |
257 ICUError status; | 257 ICUError status; |
258 UScriptCode script = uscript_getScript(character, &status); | 258 UScriptCode script = uscript_getScript(character, &status); |
259 return U_SUCCESS(status) && | 259 return U_SUCCESS(status) && |
260 (script == USCRIPT_COMMON || script == USCRIPT_INHERITED); | 260 (script == USCRIPT_COMMON || script == USCRIPT_INHERITED); |
261 } | 261 } |
262 | 262 |
263 } // namespace blink | 263 } // namespace blink |
OLD | NEW |