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 reserv
ed. | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Apple Inc. All rights reserv
ed. |
4 * Copyright (C) 2007-2009 Torch Mobile, Inc. | 4 * Copyright (C) 2007-2009 Torch Mobile, Inc. |
5 * Copyright (C) 2011 Google Inc. All rights reserved. | 5 * Copyright (C) 2011 Google Inc. All rights reserved. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 const unsigned char* tableRow = asciiLineBreakTable[ch - asciiLineBreakT
ableFirstChar]; | 144 const unsigned char* tableRow = asciiLineBreakTable[ch - asciiLineBreakT
ableFirstChar]; |
145 int nextChIndex = nextCh - asciiLineBreakTableFirstChar; | 145 int nextChIndex = nextCh - asciiLineBreakTableFirstChar; |
146 return tableRow[nextChIndex / 8] & (1 << (nextChIndex % 8)); | 146 return tableRow[nextChIndex / 8] & (1 << (nextChIndex % 8)); |
147 } | 147 } |
148 // Otherwise defer to the Unicode algorithm by returning false. | 148 // Otherwise defer to the Unicode algorithm by returning false. |
149 return false; | 149 return false; |
150 } | 150 } |
151 | 151 |
152 inline bool needsLineBreakIterator(UChar ch) | 152 inline bool needsLineBreakIterator(UChar ch) |
153 { | 153 { |
154 return ch > asciiLineBreakTableLastChar && ch != noBreakSpace; | 154 return ch > asciiLineBreakTableLastChar && ch != noBreakSpaceCharacter; |
155 } | 155 } |
156 | 156 |
157 template<typename CharacterType> | 157 template<typename CharacterType> |
158 static inline int nextBreakablePosition(LazyLineBreakIterator& lazyBreakIterator
, const CharacterType* str, unsigned length, int pos) | 158 static inline int nextBreakablePosition(LazyLineBreakIterator& lazyBreakIterator
, const CharacterType* str, unsigned length, int pos) |
159 { | 159 { |
160 int len = static_cast<int>(length); | 160 int len = static_cast<int>(length); |
161 int nextBreak = -1; | 161 int nextBreak = -1; |
162 | 162 |
163 CharacterType lastLastCh = pos > 1 ? str[pos - 2] : static_cast<CharacterTyp
e>(lazyBreakIterator.secondToLastCharacter()); | 163 CharacterType lastLastCh = pos > 1 ? str[pos - 2] : static_cast<CharacterTyp
e>(lazyBreakIterator.secondToLastCharacter()); |
164 CharacterType lastCh = pos > 0 ? str[pos - 1] : static_cast<CharacterType>(l
azyBreakIterator.lastCharacter()); | 164 CharacterType lastCh = pos > 0 ? str[pos - 1] : static_cast<CharacterType>(l
azyBreakIterator.lastCharacter()); |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 } | 287 } |
288 | 288 |
289 int LazyLineBreakIterator::nextBreakablePositionKeepAll(int pos) | 289 int LazyLineBreakIterator::nextBreakablePositionKeepAll(int pos) |
290 { | 290 { |
291 if (m_string.is8Bit()) | 291 if (m_string.is8Bit()) |
292 return nextBreakablePosition<LChar>(*this, m_string.characters8(), m_str
ing.length(), pos); | 292 return nextBreakablePosition<LChar>(*this, m_string.characters8(), m_str
ing.length(), pos); |
293 return nextBreakablePositionKeepAllInternal(*this, m_string.characters16(),
m_string.length(), pos); | 293 return nextBreakablePositionKeepAllInternal(*this, m_string.characters16(),
m_string.length(), pos); |
294 } | 294 } |
295 | 295 |
296 } // namespace blink | 296 } // namespace blink |
OLD | NEW |