| OLD | NEW |
| 1 /* | 1 /* |
| 2 * (C) 1999 Lars Knoll (knoll@kde.org) | 2 * (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Apple Inc. All rights | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Apple Inc. All rights |
| 4 * reserved. | 4 * reserved. |
| 5 * Copyright (C) 2007-2009 Torch Mobile, Inc. | 5 * Copyright (C) 2007-2009 Torch Mobile, Inc. |
| 6 * Copyright (C) 2011 Google Inc. All rights reserved. | 6 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 | 248 |
| 249 template <typename CharacterType, LineBreakType lineBreakType> | 249 template <typename CharacterType, LineBreakType lineBreakType> |
| 250 static inline int nextBreakablePosition( | 250 static inline int nextBreakablePosition( |
| 251 LazyLineBreakIterator& lazyBreakIterator, | 251 LazyLineBreakIterator& lazyBreakIterator, |
| 252 const CharacterType* str, | 252 const CharacterType* str, |
| 253 unsigned length, | 253 unsigned length, |
| 254 int pos) { | 254 int pos) { |
| 255 int len = static_cast<int>(length); | 255 int len = static_cast<int>(length); |
| 256 int nextBreak = -1; | 256 int nextBreak = -1; |
| 257 | 257 |
| 258 CharacterType lastLastCh = | 258 UChar lastLastCh = |
| 259 pos > 1 ? str[pos - 2] : static_cast<CharacterType>( | 259 pos > 1 ? str[pos - 2] : lazyBreakIterator.secondToLastCharacter(); |
| 260 lazyBreakIterator.secondToLastCharacter()); | 260 UChar lastCh = pos > 0 ? str[pos - 1] : lazyBreakIterator.lastCharacter(); |
| 261 CharacterType lastCh = | |
| 262 pos > 0 ? str[pos - 1] | |
| 263 : static_cast<CharacterType>(lazyBreakIterator.lastCharacter()); | |
| 264 ULineBreak lastLineBreak; | 261 ULineBreak lastLineBreak; |
| 265 if (lineBreakType == LineBreakType::BreakAll) | 262 if (lineBreakType == LineBreakType::BreakAll) |
| 266 lastLineBreak = lineBreakPropertyValue(lastLastCh, lastCh); | 263 lastLineBreak = lineBreakPropertyValue(lastLastCh, lastCh); |
| 267 unsigned priorContextLength = lazyBreakIterator.priorContextLength(); | 264 unsigned priorContextLength = lazyBreakIterator.priorContextLength(); |
| 268 for (int i = pos; i < len; i++) { | 265 for (int i = pos; i < len; i++) { |
| 269 CharacterType ch = str[i]; | 266 CharacterType ch = str[i]; |
| 270 | 267 |
| 271 if (isBreakableSpace(ch) || shouldBreakAfter(lastLastCh, lastCh, ch)) | 268 if (isBreakableSpace(ch) || shouldBreakAfter(lastLastCh, lastCh, ch)) |
| 272 return i; | 269 return i; |
| 273 | 270 |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 | 380 |
| 384 int LazyLineBreakIterator::nextBreakablePositionKeepAll(int pos) { | 381 int LazyLineBreakIterator::nextBreakablePositionKeepAll(int pos) { |
| 385 if (m_string.is8Bit()) | 382 if (m_string.is8Bit()) |
| 386 return nextBreakablePosition<LChar, LineBreakType::Normal>( | 383 return nextBreakablePosition<LChar, LineBreakType::Normal>( |
| 387 *this, m_string.characters8(), m_string.length(), pos); | 384 *this, m_string.characters8(), m_string.length(), pos); |
| 388 return nextBreakablePositionKeepAllInternal(*this, m_string.characters16(), | 385 return nextBreakablePositionKeepAllInternal(*this, m_string.characters16(), |
| 389 m_string.length(), pos); | 386 m_string.length(), pos); |
| 390 } | 387 } |
| 391 | 388 |
| 392 } // namespace blink | 389 } // namespace blink |
| OLD | NEW |