| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) |
| 3 * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010 Apple Inc. All right r
eserved. | 3 * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010 Apple Inc. All right r
eserved. |
| 4 * Copyright (C) 2010 Google Inc. All rights reserved. | 4 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 5 * | 5 * |
| 6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
| 10 * | 10 * |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 { | 78 { |
| 79 return m_obj && m_obj->preservesNewline() && m_obj->isText() && toRender
Text(m_obj)->textLength() | 79 return m_obj && m_obj->preservesNewline() && m_obj->isText() && toRender
Text(m_obj)->textLength() |
| 80 && !toRenderText(m_obj)->isWordBreak() && toRenderText(m_obj)->chara
cterAt(m_pos) == '\n'; | 80 && !toRenderText(m_obj)->isWordBreak() && toRenderText(m_obj)->chara
cterAt(m_pos) == '\n'; |
| 81 } | 81 } |
| 82 | 82 |
| 83 inline bool atParagraphSeparator() | 83 inline bool atParagraphSeparator() |
| 84 { | 84 { |
| 85 return (m_obj && m_obj->isBR()) || atTextParagraphSeparator(); | 85 return (m_obj && m_obj->isBR()) || atTextParagraphSeparator(); |
| 86 } | 86 } |
| 87 | 87 |
| 88 UChar characterAt(unsigned) const; |
| 88 UChar current() const; | 89 UChar current() const; |
| 89 UChar previousInSameNode() const; | 90 UChar previousInSameNode() const; |
| 90 ALWAYS_INLINE WTF::Unicode::Direction direction() const; | 91 ALWAYS_INLINE WTF::Unicode::Direction direction() const; |
| 91 | 92 |
| 92 private: | 93 private: |
| 93 RenderObject* m_root; | 94 RenderObject* m_root; |
| 94 | 95 |
| 95 // FIXME: These should be private. | 96 // FIXME: These should be private. |
| 96 public: | 97 public: |
| 97 RenderObject* m_obj; | 98 RenderObject* m_obj; |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 } | 346 } |
| 346 // bidiNext can return 0, so use moveTo instead of moveToStartOf | 347 // bidiNext can return 0, so use moveTo instead of moveToStartOf |
| 347 moveTo(bidiNextSkippingEmptyInlines(m_root, m_obj, resolver), 0); | 348 moveTo(bidiNextSkippingEmptyInlines(m_root, m_obj, resolver), 0); |
| 348 } | 349 } |
| 349 | 350 |
| 350 inline bool InlineIterator::atEnd() const | 351 inline bool InlineIterator::atEnd() const |
| 351 { | 352 { |
| 352 return !m_obj; | 353 return !m_obj; |
| 353 } | 354 } |
| 354 | 355 |
| 355 inline UChar InlineIterator::current() const | 356 inline UChar InlineIterator::characterAt(unsigned index) const |
| 356 { | 357 { |
| 357 if (!m_obj || !m_obj->isText()) | 358 if (!m_obj || !m_obj->isText()) |
| 358 return 0; | 359 return 0; |
| 359 | 360 |
| 360 RenderText* text = toRenderText(m_obj); | 361 RenderText* text = toRenderText(m_obj); |
| 361 if (m_pos >= text->textLength()) | 362 if (index >= text->textLength()) |
| 362 return 0; | 363 return 0; |
| 363 | 364 |
| 364 return text->characterAt(m_pos); | 365 return text->characterAt(index); |
| 366 } |
| 367 |
| 368 inline UChar InlineIterator::current() const |
| 369 { |
| 370 return characterAt(m_pos); |
| 365 } | 371 } |
| 366 | 372 |
| 367 inline UChar InlineIterator::previousInSameNode() const | 373 inline UChar InlineIterator::previousInSameNode() const |
| 368 { | 374 { |
| 369 if (!m_obj || !m_obj->isText() || !m_pos) | 375 if (!m_pos) |
| 370 return 0; | 376 return 0; |
| 371 | 377 |
| 372 RenderText* text = toRenderText(m_obj); | 378 return characterAt(m_pos - 1); |
| 373 return text->characterAt(m_pos - 1); | |
| 374 } | 379 } |
| 375 | 380 |
| 376 ALWAYS_INLINE WTF::Unicode::Direction InlineIterator::direction() const | 381 ALWAYS_INLINE WTF::Unicode::Direction InlineIterator::direction() const |
| 377 { | 382 { |
| 378 if (UChar c = current()) | 383 if (UChar c = current()) |
| 379 return WTF::Unicode::direction(c); | 384 return WTF::Unicode::direction(c); |
| 380 | 385 |
| 381 if (m_obj && m_obj->isListMarker()) | 386 if (m_obj && m_obj->isListMarker()) |
| 382 return m_obj->style()->isLeftToRightDirection() ? WTF::Unicode::LeftToRi
ght : WTF::Unicode::RightToLeft; | 387 return m_obj->style()->isLeftToRightDirection() ? WTF::Unicode::LeftToRi
ght : WTF::Unicode::RightToLeft; |
| 383 | 388 |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 m_sor = m_eor; | 516 m_sor = m_eor; |
| 512 } | 517 } |
| 513 | 518 |
| 514 m_direction = WTF::Unicode::OtherNeutral; | 519 m_direction = WTF::Unicode::OtherNeutral; |
| 515 m_status.eor = WTF::Unicode::OtherNeutral; | 520 m_status.eor = WTF::Unicode::OtherNeutral; |
| 516 } | 521 } |
| 517 | 522 |
| 518 } | 523 } |
| 519 | 524 |
| 520 #endif // InlineIterator_h | 525 #endif // InlineIterator_h |
| OLD | NEW |