Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(46)

Side by Side Diff: third_party/WebKit/Source/platform/fonts/Character.h

Issue 1644893002: Revert of Improve performance of Character::isCJKIdeographOrSymbol by using trie tree (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 14 matching lines...) Expand all
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #ifndef Character_h 31 #ifndef Character_h
32 #define Character_h 32 #define Character_h
33 33
34 #include "platform/PlatformExport.h" 34 #include "platform/PlatformExport.h"
35 #include "platform/fonts/CharacterProperty.h"
36 #include "platform/text/TextDirection.h" 35 #include "platform/text/TextDirection.h"
37 #include "platform/text/TextPath.h" 36 #include "platform/text/TextPath.h"
38 #include "platform/text/TextRun.h" 37 #include "platform/text/TextRun.h"
39 #include "wtf/Allocator.h" 38 #include "wtf/Allocator.h"
40 #include "wtf/HashSet.h" 39 #include "wtf/HashSet.h"
41 #include "wtf/text/CharacterNames.h" 40 #include "wtf/text/CharacterNames.h"
42 #include "wtf/text/WTFString.h" 41 #include "wtf/text/WTFString.h"
43 42
44 namespace blink { 43 namespace blink {
45 44
46 class PLATFORM_EXPORT Character { 45 class PLATFORM_EXPORT Character {
47 STATIC_ONLY(Character); 46 STATIC_ONLY(Character);
48 public: 47 public:
49 static CodePath characterRangeCodePath(const LChar*, unsigned) { return Simp lePath; } 48 static CodePath characterRangeCodePath(const LChar*, unsigned) { return Simp lePath; }
50 static CodePath characterRangeCodePath(const UChar*, unsigned len); 49 static CodePath characterRangeCodePath(const UChar*, unsigned len);
51 50
52 static inline bool isInRange(UChar32 character, UChar32 lowerBound, UChar32 upperBound) 51 static inline bool isInRange(UChar32 character, UChar32 lowerBound, UChar32 upperBound)
53 { 52 {
54 return character >= lowerBound && character <= upperBound; 53 return character >= lowerBound && character <= upperBound;
55 } 54 }
56 55
57 static inline bool isUnicodeVariationSelector(UChar32 character) 56 static inline bool isUnicodeVariationSelector(UChar32 character)
58 { 57 {
59 // http://www.unicode.org/Public/UCD/latest/ucd/StandardizedVariants.htm l 58 // http://www.unicode.org/Public/UCD/latest/ucd/StandardizedVariants.htm l
60 return isInRange(character, 0x180B, 0x180D) // MONGOLIAN FREE VARIATION SELECTOR ONE to THREE 59 return isInRange(character, 0x180B, 0x180D) // MONGOLIAN FREE VARIATION SELECTOR ONE to THREE
61 || isInRange(character, 0xFE00, 0xFE0F) // VARIATION SELECTOR-1 to 1 6 60 || isInRange(character, 0xFE00, 0xFE0F) // VARIATION SELECTOR-1 to 1 6
62 || isInRange(character, 0xE0100, 0xE01EF); // VARIATION SELECTOR-17 to 256 61 || isInRange(character, 0xE0100, 0xE01EF); // VARIATION SELECTOR-17 to 256
63 } 62 }
64 63
64 static bool isCJKIdeograph(UChar32);
65 static bool isCJKIdeographOrSymbol(UChar32); 65 static bool isCJKIdeographOrSymbol(UChar32);
66 66
67 static unsigned expansionOpportunityCount(const LChar*, size_t length, TextD irection, bool& isAfterExpansion, const TextJustify); 67 static unsigned expansionOpportunityCount(const LChar*, size_t length, TextD irection, bool& isAfterExpansion, const TextJustify);
68 static unsigned expansionOpportunityCount(const UChar*, size_t length, TextD irection, bool& isAfterExpansion, const TextJustify); 68 static unsigned expansionOpportunityCount(const UChar*, size_t length, TextD irection, bool& isAfterExpansion, const TextJustify);
69 69
70 static bool isUprightInMixedVertical(UChar32 character); 70 static bool isUprightInMixedVertical(UChar32 character);
71 71
72 static bool treatAsSpace(UChar c) 72 static bool treatAsSpace(UChar c)
73 { 73 {
74 return c == spaceCharacter 74 return c == spaceCharacter
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 // This function returns true for 0x000B also, so that this is backward compatible. 125 // This function returns true for 0x000B also, so that this is backward compatible.
126 // Otherwise, the test LayoutTests/canvas/philip/tests/2d.text.draw.spac e.collapse.space.html will fail 126 // Otherwise, the test LayoutTests/canvas/philip/tests/2d.text.draw.spac e.collapse.space.html will fail
127 return c == 0x0009 || (c >= 0x000A && c <= 0x000D); 127 return c == 0x0009 || (c >= 0x000A && c <= 0x000D);
128 } 128 }
129 129
130 static String normalizeSpaces(const LChar*, unsigned length); 130 static String normalizeSpaces(const LChar*, unsigned length);
131 static String normalizeSpaces(const UChar*, unsigned length); 131 static String normalizeSpaces(const UChar*, unsigned length);
132 132
133 static bool isCommonOrInheritedScript(UChar32); 133 static bool isCommonOrInheritedScript(UChar32);
134 134
135 private:
136 static bool hasProperty(UChar32, CharacterProperty);
137 }; 135 };
138 136
139 } // namespace blink 137 } // namespace blink
140 138
141 #endif 139 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/blink_platform.gyp ('k') | third_party/WebKit/Source/platform/fonts/Character.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698