| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007 Apple 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 | 33 |
| 34 namespace blink { | 34 namespace blink { |
| 35 | 35 |
| 36 static CFMutableCharacterSetRef getSmartSet(bool isPreviousCharacter) { | 36 static CFMutableCharacterSetRef getSmartSet(bool isPreviousCharacter) { |
| 37 static CFMutableCharacterSetRef preSmartSet = nullptr; | 37 static CFMutableCharacterSetRef preSmartSet = nullptr; |
| 38 static CFMutableCharacterSetRef postSmartSet = nullptr; | 38 static CFMutableCharacterSetRef postSmartSet = nullptr; |
| 39 CFMutableCharacterSetRef smartSet = | 39 CFMutableCharacterSetRef smartSet = |
| 40 isPreviousCharacter ? preSmartSet : postSmartSet; | 40 isPreviousCharacter ? preSmartSet : postSmartSet; |
| 41 if (!smartSet) { | 41 if (!smartSet) { |
| 42 smartSet = CFCharacterSetCreateMutable(kCFAllocatorDefault); | 42 smartSet = CFCharacterSetCreateMutable(kCFAllocatorDefault); |
| 43 CFCharacterSetAddCharactersInString( | 43 CFCharacterSetAddCharactersInString(smartSet, |
| 44 smartSet, isPreviousCharacter ? CFSTR("([\"\'#$/-`{") | 44 isPreviousCharacter |
| 45 : CFSTR(")].,;:?\'!\"%*-/}")); | 45 ? CFSTR("([\"\'#$/-`{") |
| 46 CFCharacterSetUnion(smartSet, CFCharacterSetGetPredefined( | 46 : CFSTR(")].,;:?\'!\"%*-/}")); |
| 47 kCFCharacterSetWhitespaceAndNewline)); | 47 CFCharacterSetUnion( |
| 48 smartSet, |
| 49 CFCharacterSetGetPredefined(kCFCharacterSetWhitespaceAndNewline)); |
| 48 // Adding CJK ranges | 50 // Adding CJK ranges |
| 49 CFCharacterSetAddCharactersInRange( | 51 CFCharacterSetAddCharactersInRange( |
| 50 smartSet, CFRangeMake(0x1100, 256)); // Hangul Jamo (0x1100 - 0x11FF) | 52 smartSet, CFRangeMake(0x1100, 256)); // Hangul Jamo (0x1100 - 0x11FF) |
| 51 CFCharacterSetAddCharactersInRange( | 53 CFCharacterSetAddCharactersInRange( |
| 52 smartSet, | 54 smartSet, |
| 53 CFRangeMake(0x2E80, 352)); // CJK & Kangxi Radicals (0x2E80 - 0x2FDF) | 55 CFRangeMake(0x2E80, 352)); // CJK & Kangxi Radicals (0x2E80 - 0x2FDF) |
| 54 // Ideograph Descriptions, CJK Symbols, Hiragana, Katakana, Bopomofo, Hangul | 56 // Ideograph Descriptions, CJK Symbols, Hiragana, Katakana, Bopomofo, Hangul |
| 55 // Compatibility Jamo, Kanbun, & Bopomofo Ext (0x2FF0 - 0x31BF) | 57 // Compatibility Jamo, Kanbun, & Bopomofo Ext (0x2FF0 - 0x31BF) |
| 56 CFCharacterSetAddCharactersInRange(smartSet, CFRangeMake(0x2FF0, 464)); | 58 CFCharacterSetAddCharactersInRange(smartSet, CFRangeMake(0x2FF0, 464)); |
| 57 // Enclosed CJK, CJK Ideographs (Uni Han & Ext A), & Yi (0x3200 - 0xA4CF) | 59 // Enclosed CJK, CJK Ideographs (Uni Han & Ext A), & Yi (0x3200 - 0xA4CF) |
| (...skipping 29 matching lines...) Expand all Loading... |
| 87 } | 89 } |
| 88 return smartSet; | 90 return smartSet; |
| 89 } | 91 } |
| 90 | 92 |
| 91 bool isCharacterSmartReplaceExempt(UChar32 c, bool isPreviousCharacter) { | 93 bool isCharacterSmartReplaceExempt(UChar32 c, bool isPreviousCharacter) { |
| 92 return CFCharacterSetIsLongCharacterMember(getSmartSet(isPreviousCharacter), | 94 return CFCharacterSetIsLongCharacterMember(getSmartSet(isPreviousCharacter), |
| 93 c); | 95 c); |
| 94 } | 96 } |
| 95 | 97 |
| 96 } // namespace blink | 98 } // namespace blink |
| OLD | NEW |