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

Side by Side Diff: third_party/WebKit/Source/core/editing/commands/SmartReplaceICU.cpp

Issue 2812643002: Fix names of local constants after blink rename. (Closed)
Patch Set: Created 3 years, 8 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) 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2007 Apple Inc. All rights reserved.
3 * Copyright (C) 2008 Tony Chang <idealisms@gmail.com> 3 * Copyright (C) 2008 Tony Chang <idealisms@gmail.com>
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 } 42 }
43 43
44 // This is mostly a port of the code in WebCore/editing/SmartReplaceCF.cpp 44 // This is mostly a port of the code in WebCore/editing/SmartReplaceCF.cpp
45 // except we use icu in place of CoreFoundations character classes. 45 // except we use icu in place of CoreFoundations character classes.
46 static USet* GetSmartSet(bool is_previous_character) { 46 static USet* GetSmartSet(bool is_previous_character) {
47 static USet* pre_smart_set = nullptr; 47 static USet* pre_smart_set = nullptr;
48 static USet* post_smart_set = nullptr; 48 static USet* post_smart_set = nullptr;
49 USet* smart_set = is_previous_character ? pre_smart_set : post_smart_set; 49 USet* smart_set = is_previous_character ? pre_smart_set : post_smart_set;
50 if (!smart_set) { 50 if (!smart_set) {
51 // Whitespace and newline (kCFCharacterSetWhitespaceAndNewline) 51 // Whitespace and newline (kCFCharacterSetWhitespaceAndNewline)
52 static const UChar* k_whitespace_and_new_line = 52 static const UChar* kWhitespaceAndNewLine = reinterpret_cast<const UChar*>(
53 reinterpret_cast<const UChar*>( 53 u"[[:WSpace:] [\\u000A\\u000B\\u000C\\u000D\\u0085]]");
54 u"[[:WSpace:] [\\u000A\\u000B\\u000C\\u000D\\u0085]]");
55 UErrorCode ec = U_ZERO_ERROR; 54 UErrorCode ec = U_ZERO_ERROR;
56 smart_set = uset_openPattern( 55 smart_set = uset_openPattern(
57 k_whitespace_and_new_line, 56 kWhitespaceAndNewLine,
58 LengthOfNullTerminatedString(k_whitespace_and_new_line), &ec); 57 LengthOfNullTerminatedString(kWhitespaceAndNewLine), &ec);
59 DCHECK(U_SUCCESS(ec)) << ec; 58 DCHECK(U_SUCCESS(ec)) << ec;
60 59
61 // CJK ranges 60 // CJK ranges
62 uset_addRange(smart_set, 0x1100, 61 uset_addRange(smart_set, 0x1100,
63 0x1100 + 256); // Hangul Jamo (0x1100 - 0x11FF) 62 0x1100 + 256); // Hangul Jamo (0x1100 - 0x11FF)
64 uset_addRange(smart_set, 0x2E80, 63 uset_addRange(smart_set, 0x2E80,
65 0x2E80 + 352); // CJK & Kangxi Radicals (0x2E80 - 0x2FDF) 64 0x2E80 + 352); // CJK & Kangxi Radicals (0x2E80 - 0x2FDF)
66 // Ideograph Descriptions, CJK Symbols, Hiragana, Katakana, Bopomofo, Hangul 65 // Ideograph Descriptions, CJK Symbols, Hiragana, Katakana, Bopomofo, Hangul
67 // Compatibility Jamo, Kanbun, & Bopomofo Ext (0x2FF0 - 0x31BF) 66 // Compatibility Jamo, Kanbun, & Bopomofo Ext (0x2FF0 - 0x31BF)
68 uset_addRange(smart_set, 0x2FF0, 0x2FF0 + 464); 67 uset_addRange(smart_set, 0x2FF0, 0x2FF0 + 464);
(...skipping 14 matching lines...) Expand all
83 smart_set, 0x2F800, 82 smart_set, 0x2F800,
84 0x2F800 + 0x021E); // CJK Compatibility Ideographs (0x2F800 - 0x2FA1D) 83 0x2F800 + 0x021E); // CJK Compatibility Ideographs (0x2F800 - 0x2FA1D)
85 84
86 if (is_previous_character) { 85 if (is_previous_character) {
87 AddAllCodePoints(smart_set, "([\"\'#$/-`{"); 86 AddAllCodePoints(smart_set, "([\"\'#$/-`{");
88 pre_smart_set = smart_set; 87 pre_smart_set = smart_set;
89 } else { 88 } else {
90 AddAllCodePoints(smart_set, ")].,;:?\'!\"%*-/}"); 89 AddAllCodePoints(smart_set, ")].,;:?\'!\"%*-/}");
91 90
92 // Punctuation (kCFCharacterSetPunctuation) 91 // Punctuation (kCFCharacterSetPunctuation)
93 static const UChar* k_punctuation_class = 92 static const UChar* kPunctuationClass =
94 reinterpret_cast<const UChar*>(u"[:P:]"); 93 reinterpret_cast<const UChar*>(u"[:P:]");
95 UErrorCode ec = U_ZERO_ERROR; 94 UErrorCode ec = U_ZERO_ERROR;
96 USet* icu_punct = uset_openPattern( 95 USet* icu_punct = uset_openPattern(
97 k_punctuation_class, 96 kPunctuationClass, LengthOfNullTerminatedString(kPunctuationClass),
98 LengthOfNullTerminatedString(k_punctuation_class), &ec); 97 &ec);
99 DCHECK(U_SUCCESS(ec)) << ec; 98 DCHECK(U_SUCCESS(ec)) << ec;
100 uset_addAll(smart_set, icu_punct); 99 uset_addAll(smart_set, icu_punct);
101 uset_close(icu_punct); 100 uset_close(icu_punct);
102 101
103 post_smart_set = smart_set; 102 post_smart_set = smart_set;
104 } 103 }
105 } 104 }
106 return smart_set; 105 return smart_set;
107 } 106 }
108 107
109 bool IsCharacterSmartReplaceExempt(UChar32 c, bool is_previous_character) { 108 bool IsCharacterSmartReplaceExempt(UChar32 c, bool is_previous_character) {
110 return uset_contains(GetSmartSet(is_previous_character), c); 109 return uset_contains(GetSmartSet(is_previous_character), c);
111 } 110 }
112 } 111 }
113 112
114 #endif // !OS(MACOSX) 113 #endif // !OS(MACOSX)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698