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

Side by Side Diff: third_party/WebKit/Source/platform/fonts/shaping/CaseMappingHarfBuzzBufferFiller.cpp

Issue 2813533003: Add "Unicode" suffixes to some functions of WTF::String and WTF::StringImpl. (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 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "CaseMappingHarfBuzzBufferFiller.h" 5 #include "CaseMappingHarfBuzzBufferFiller.h"
6 6
7 #include "platform/wtf/text/WTFString.h" 7 #include "platform/wtf/text/WTFString.h"
8 8
9 namespace blink { 9 namespace blink {
10 10
(...skipping 14 matching lines...) Expand all
25 unsigned buffer_length, 25 unsigned buffer_length,
26 unsigned start_index, 26 unsigned start_index,
27 unsigned num_characters) 27 unsigned num_characters)
28 : harf_buzz_buffer_(harf_buzz_buffer) { 28 : harf_buzz_buffer_(harf_buzz_buffer) {
29 if (case_map_intend == CaseMapIntend::kKeepSameCase) { 29 if (case_map_intend == CaseMapIntend::kKeepSameCase) {
30 hb_buffer_add_utf16(harf_buzz_buffer_, ToUint16(buffer), buffer_length, 30 hb_buffer_add_utf16(harf_buzz_buffer_, ToUint16(buffer), buffer_length,
31 start_index, num_characters); 31 start_index, num_characters);
32 } else { 32 } else {
33 String case_mapped_text; 33 String case_mapped_text;
34 if (case_map_intend == CaseMapIntend::kUpperCase) { 34 if (case_map_intend == CaseMapIntend::kUpperCase) {
35 case_mapped_text = String(buffer, buffer_length).Upper(locale); 35 case_mapped_text = String(buffer, buffer_length).UpperUnicode(locale);
36 } else { 36 } else {
37 case_mapped_text = String(buffer, buffer_length).Lower(locale); 37 case_mapped_text = String(buffer, buffer_length).LowerUnicode(locale);
38 } 38 }
39 39
40 if (case_mapped_text.length() != buffer_length) { 40 if (case_mapped_text.length() != buffer_length) {
41 FillSlowCase(case_map_intend, locale, buffer, buffer_length, start_index, 41 FillSlowCase(case_map_intend, locale, buffer, buffer_length, start_index,
42 num_characters); 42 num_characters);
43 return; 43 return;
44 } 44 }
45 45
46 ASSERT(case_mapped_text.length() == buffer_length); 46 ASSERT(case_mapped_text.length() == buffer_length);
47 ASSERT(!case_mapped_text.Is8Bit()); 47 ASSERT(!case_mapped_text.Is8Bit());
(...skipping 16 matching lines...) Expand all
64 hb_buffer_add_utf16(harf_buzz_buffer_, ToUint16(buffer), buffer_length, 64 hb_buffer_add_utf16(harf_buzz_buffer_, ToUint16(buffer), buffer_length,
65 start_index, 0); 65 start_index, 0);
66 66
67 for (unsigned char_index = start_index; 67 for (unsigned char_index = start_index;
68 char_index < start_index + num_characters;) { 68 char_index < start_index + num_characters;) {
69 unsigned new_char_index = char_index; 69 unsigned new_char_index = char_index;
70 U16_FWD_1(buffer, new_char_index, num_characters); 70 U16_FWD_1(buffer, new_char_index, num_characters);
71 String char_by_char(&buffer[char_index], new_char_index - char_index); 71 String char_by_char(&buffer[char_index], new_char_index - char_index);
72 String case_mapped_char; 72 String case_mapped_char;
73 if (case_map_intend == CaseMapIntend::kUpperCase) 73 if (case_map_intend == CaseMapIntend::kUpperCase)
74 case_mapped_char = char_by_char.Upper(locale); 74 case_mapped_char = char_by_char.UpperUnicode(locale);
75 else 75 else
76 case_mapped_char = char_by_char.Lower(locale); 76 case_mapped_char = char_by_char.LowerUnicode(locale);
77 77
78 for (unsigned j = 0; j < case_mapped_char.length();) { 78 for (unsigned j = 0; j < case_mapped_char.length();) {
79 UChar32 codepoint = 0; 79 UChar32 codepoint = 0;
80 U16_NEXT(case_mapped_char.Characters16(), j, case_mapped_char.length(), 80 U16_NEXT(case_mapped_char.Characters16(), j, case_mapped_char.length(),
81 codepoint); 81 codepoint);
82 // Add all characters of the case mapping result at the same cluster 82 // Add all characters of the case mapping result at the same cluster
83 // position. 83 // position.
84 hb_buffer_add(harf_buzz_buffer_, codepoint, char_index); 84 hb_buffer_add(harf_buzz_buffer_, codepoint, char_index);
85 } 85 }
86 char_index = new_char_index; 86 char_index = new_char_index;
87 } 87 }
88 88
89 // Record post-context 89 // Record post-context
90 hb_buffer_add_utf16(harf_buzz_buffer_, ToUint16(buffer), buffer_length, 90 hb_buffer_add_utf16(harf_buzz_buffer_, ToUint16(buffer), buffer_length,
91 start_index + num_characters, 0); 91 start_index + num_characters, 0);
92 } 92 }
93 93
94 } // namespace blink 94 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutText.cpp ('k') | third_party/WebKit/Source/platform/wtf/text/AtomicString.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698