|
Lines 315-324
PassRefPtr<Text> Text::createWithLengthL
WebCore/dom/Text.cpp_sec1
|
| 315 |
unsigned end = start + min(charsLeft, maxChars); |
315 |
unsigned end = start + min(charsLeft, maxChars); |
| 316 |
|
316 |
|
| 317 |
// Check we are not on an unbreakable boundary. |
317 |
// Check we are not on an unbreakable boundary. |
| 318 |
TextBreakIterator* it = characterBreakIterator(data.characters(), dataLength); |
318 |
if (end < dataLength) { |
| 319 |
if (end < dataLength && !isTextBreak(it, end)) |
319 |
TextBreakIterator* it = characterBreakIterator(data.characters() + start, (end + 2 > dataLength) ? dataLength - start : end - start + 2); |
| 320 |
end = textBreakPreceding(it, end); |
320 |
if (!isTextBreak(it, end - start)) |
| 321 |
|
321 |
end = textBreakPreceding(it, end - start) + start; |
|
|
322 |
} |
| 323 |
|
| 322 |
// If we have maxChars of unbreakable characters the above could lead to |
324 |
// If we have maxChars of unbreakable characters the above could lead to |
| 323 |
// an infinite loop. |
325 |
// an infinite loop. |
| 324 |
// FIXME: It would be better to just have the old value of end before calling |
326 |
// FIXME: It would be better to just have the old value of end before calling |