OLD | NEW |
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 Loading... |
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 |
OLD | NEW |