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

Side by Side Diff: Source/core/rendering/break_lines.cpp

Issue 23618052: TextBreakIterator should use the C++ icu API instead of the C one (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Downcast to icu::RuleBasedBreakIterator Created 7 years, 2 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
« no previous file with comments | « Source/core/rendering/RenderText.cpp ('k') | Source/platform/text/TextBoundaries.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2005, 2007, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2005, 2007, 2010 Apple Inc. All rights reserved.
3 * Copyright (C) 2011 Google Inc. All rights reserved. 3 * Copyright (C) 2011 Google Inc. All rights reserved.
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 * 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 157
158 if (isBreakableSpace<treatNoBreakSpaceAsBreak>(ch) || shouldBreakAfter(l astLastCh, lastCh, ch)) 158 if (isBreakableSpace<treatNoBreakSpaceAsBreak>(ch) || shouldBreakAfter(l astLastCh, lastCh, ch))
159 return i; 159 return i;
160 160
161 if (needsLineBreakIterator<treatNoBreakSpaceAsBreak>(ch) || needsLineBre akIterator<treatNoBreakSpaceAsBreak>(lastCh)) { 161 if (needsLineBreakIterator<treatNoBreakSpaceAsBreak>(ch) || needsLineBre akIterator<treatNoBreakSpaceAsBreak>(lastCh)) {
162 if (nextBreak < i) { 162 if (nextBreak < i) {
163 // Don't break if positioned at start of primary context and the re is no prior context. 163 // Don't break if positioned at start of primary context and the re is no prior context.
164 if (i || priorContextLength) { 164 if (i || priorContextLength) {
165 TextBreakIterator* breakIterator = lazyBreakIterator.get(pri orContextLength); 165 TextBreakIterator* breakIterator = lazyBreakIterator.get(pri orContextLength);
166 if (breakIterator) { 166 if (breakIterator) {
167 nextBreak = textBreakFollowing(breakIterator, i - 1 + pr iorContextLength); 167 nextBreak = breakIterator->following(i - 1 + priorContex tLength);
168 if (nextBreak >= 0) { 168 if (nextBreak >= 0) {
169 nextBreak -= priorContextLength; 169 nextBreak -= priorContextLength;
170 } 170 }
171 } 171 }
172 } 172 }
173 } 173 }
174 if (i == nextBreak && !isBreakableSpace<treatNoBreakSpaceAsBreak>(la stCh)) 174 if (i == nextBreak && !isBreakableSpace<treatNoBreakSpaceAsBreak>(la stCh))
175 return i; 175 return i;
176 } 176 }
177 177
178 lastLastCh = lastCh; 178 lastLastCh = lastCh;
179 lastCh = ch; 179 lastCh = ch;
180 } 180 }
181 181
182 return len; 182 return len;
183 } 183 }
184 184
185 int nextBreakablePositionIgnoringNBSP(LazyLineBreakIterator& lazyBreakIterator, int pos) 185 int nextBreakablePositionIgnoringNBSP(LazyLineBreakIterator& lazyBreakIterator, int pos)
186 { 186 {
187 String string = lazyBreakIterator.string(); 187 String string = lazyBreakIterator.string();
188 if (string.is8Bit()) 188 if (string.is8Bit())
189 return nextBreakablePosition<LChar, false>(lazyBreakIterator, string.cha racters8(), string.length(), pos); 189 return nextBreakablePosition<LChar, false>(lazyBreakIterator, string.cha racters8(), string.length(), pos);
190 return nextBreakablePosition<UChar, false>(lazyBreakIterator, string.charact ers16(), string.length(), pos); 190 return nextBreakablePosition<UChar, false>(lazyBreakIterator, string.charact ers16(), string.length(), pos);
191 } 191 }
192 192
193 } // namespace WebCore 193 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderText.cpp ('k') | Source/platform/text/TextBoundaries.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698