| 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 25 matching lines...) Expand all Loading... |
| 36 class InlineIterator { | 36 class InlineIterator { |
| 37 public: | 37 public: |
| 38 enum IncrementRule { | 38 enum IncrementRule { |
| 39 FastIncrementInIsolatedRenderer, | 39 FastIncrementInIsolatedRenderer, |
| 40 FastIncrementInTextNode | 40 FastIncrementInTextNode |
| 41 }; | 41 }; |
| 42 | 42 |
| 43 InlineIterator() | 43 InlineIterator() |
| 44 : m_root(0) | 44 : m_root(0) |
| 45 , m_obj(0) | 45 , m_obj(0) |
| 46 , m_nextBreakablePosition(-1) |
| 46 , m_pos(0) | 47 , m_pos(0) |
| 47 , m_nextBreakablePosition(-1) | |
| 48 { | 48 { |
| 49 } | 49 } |
| 50 | 50 |
| 51 InlineIterator(RenderObject* root, RenderObject* o, unsigned p) | 51 InlineIterator(RenderObject* root, RenderObject* o, unsigned p) |
| 52 : m_root(root) | 52 : m_root(root) |
| 53 , m_obj(o) | 53 , m_obj(o) |
| 54 , m_nextBreakablePosition(-1) |
| 54 , m_pos(p) | 55 , m_pos(p) |
| 55 , m_nextBreakablePosition(-1) | |
| 56 { | 56 { |
| 57 } | 57 } |
| 58 | 58 |
| 59 void clear() { moveTo(0, 0); } | 59 void clear() { moveTo(0, 0); } |
| 60 | 60 |
| 61 void moveToStartOf(RenderObject* object) | 61 void moveToStartOf(RenderObject* object) |
| 62 { | 62 { |
| 63 moveTo(object, 0); | 63 moveTo(object, 0); |
| 64 } | 64 } |
| 65 | 65 |
| 66 void moveTo(RenderObject* object, unsigned offset, int nextBreak = -1) | 66 void moveTo(RenderObject* object, unsigned offset, int nextBreak = -1) |
| 67 { | 67 { |
| 68 m_obj = object; | 68 m_obj = object; |
| 69 m_pos = offset; | 69 m_pos = offset; |
| 70 m_nextBreakablePosition = nextBreak; | 70 m_nextBreakablePosition = nextBreak; |
| 71 } | 71 } |
| 72 | 72 |
| 73 RenderObject* object() const { return m_obj; } | 73 RenderObject* object() const { return m_obj; } |
| 74 void setObject(RenderObject* object) { m_obj = object; } | 74 void setObject(RenderObject* object) { m_obj = object; } |
| 75 | 75 |
| 76 int nextBreakablePosition() const { return m_nextBreakablePosition; } |
| 77 void setNextBreakablePosition(int position) { m_nextBreakablePosition = posi
tion; } |
| 78 |
| 76 unsigned offset() const { return m_pos; } | 79 unsigned offset() const { return m_pos; } |
| 77 RenderObject* root() const { return m_root; } | 80 RenderObject* root() const { return m_root; } |
| 78 | 81 |
| 79 void fastIncrementInTextNode(); | 82 void fastIncrementInTextNode(); |
| 80 void increment(InlineBidiResolver* = 0, IncrementRule = FastIncrementInTextN
ode); | 83 void increment(InlineBidiResolver* = 0, IncrementRule = FastIncrementInTextN
ode); |
| 81 bool atEnd() const; | 84 bool atEnd() const; |
| 82 | 85 |
| 83 inline bool atTextParagraphSeparator() const | 86 inline bool atTextParagraphSeparator() const |
| 84 { | 87 { |
| 85 return m_obj && m_obj->preservesNewline() && m_obj->isText() && toRender
Text(m_obj)->textLength() | 88 return m_obj && m_obj->preservesNewline() && m_obj->isText() && toRender
Text(m_obj)->textLength() |
| 86 && !toRenderText(m_obj)->isWordBreak() && toRenderText(m_obj)->chara
cterAt(m_pos) == '\n'; | 89 && !toRenderText(m_obj)->isWordBreak() && toRenderText(m_obj)->chara
cterAt(m_pos) == '\n'; |
| 87 } | 90 } |
| 88 | 91 |
| 89 inline bool atParagraphSeparator() const | 92 inline bool atParagraphSeparator() const |
| 90 { | 93 { |
| 91 return (m_obj && m_obj->isBR()) || atTextParagraphSeparator(); | 94 return (m_obj && m_obj->isBR()) || atTextParagraphSeparator(); |
| 92 } | 95 } |
| 93 | 96 |
| 94 UChar characterAt(unsigned) const; | 97 UChar characterAt(unsigned) const; |
| 95 UChar current() const; | 98 UChar current() const; |
| 96 UChar previousInSameNode() const; | 99 UChar previousInSameNode() const; |
| 97 ALWAYS_INLINE WTF::Unicode::Direction direction() const; | 100 ALWAYS_INLINE WTF::Unicode::Direction direction() const; |
| 98 | 101 |
| 99 private: | 102 private: |
| 100 RenderObject* m_root; | 103 RenderObject* m_root; |
| 101 RenderObject* m_obj; | 104 RenderObject* m_obj; |
| 102 | 105 |
| 106 int m_nextBreakablePosition; |
| 107 |
| 103 // FIXME: These should be private. | 108 // FIXME: These should be private. |
| 104 public: | 109 public: |
| 105 unsigned m_pos; | 110 unsigned m_pos; |
| 106 int m_nextBreakablePosition; | |
| 107 }; | 111 }; |
| 108 | 112 |
| 109 inline bool operator==(const InlineIterator& it1, const InlineIterator& it2) | 113 inline bool operator==(const InlineIterator& it1, const InlineIterator& it2) |
| 110 { | 114 { |
| 111 return it1.m_pos == it2.m_pos && it1.object() == it2.object(); | 115 return it1.m_pos == it2.m_pos && it1.object() == it2.object(); |
| 112 } | 116 } |
| 113 | 117 |
| 114 inline bool operator!=(const InlineIterator& it1, const InlineIterator& it2) | 118 inline bool operator!=(const InlineIterator& it1, const InlineIterator& it2) |
| 115 { | 119 { |
| 116 return it1.m_pos != it2.m_pos || it1.object() != it2.object(); | 120 return it1.m_pos != it2.m_pos || it1.object() != it2.object(); |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 inline void InlineBidiResolver::increment() | 439 inline void InlineBidiResolver::increment() |
| 436 { | 440 { |
| 437 m_current.increment(this, InlineIterator::FastIncrementInIsolatedRenderer); | 441 m_current.increment(this, InlineIterator::FastIncrementInIsolatedRenderer); |
| 438 } | 442 } |
| 439 | 443 |
| 440 template <> | 444 template <> |
| 441 inline bool InlineBidiResolver::isEndOfLine(const InlineIterator& end) | 445 inline bool InlineBidiResolver::isEndOfLine(const InlineIterator& end) |
| 442 { | 446 { |
| 443 bool inEndOfLine = m_current == end || m_current.atEnd() || (inIsolate() &&
m_current.object() == end.object()); | 447 bool inEndOfLine = m_current == end || m_current.atEnd() || (inIsolate() &&
m_current.object() == end.object()); |
| 444 if (inIsolate() && inEndOfLine) { | 448 if (inIsolate() && inEndOfLine) { |
| 445 m_current.moveTo(m_current.object(), end.m_pos, m_current.m_nextBreakabl
ePosition); | 449 m_current.moveTo(m_current.object(), end.m_pos, m_current.nextBreakableP
osition()); |
| 446 m_last = m_current; | 450 m_last = m_current; |
| 447 updateStatusLastFromCurrentDirection(WTF::Unicode::OtherNeutral); | 451 updateStatusLastFromCurrentDirection(WTF::Unicode::OtherNeutral); |
| 448 } | 452 } |
| 449 return inEndOfLine; | 453 return inEndOfLine; |
| 450 } | 454 } |
| 451 | 455 |
| 452 static inline bool isIsolatedInline(RenderObject* object) | 456 static inline bool isIsolatedInline(RenderObject* object) |
| 453 { | 457 { |
| 454 ASSERT(object); | 458 ASSERT(object); |
| 455 return object->isRenderInline() && isIsolated(object->style()->unicodeBidi()
); | 459 return object->isRenderInline() && isIsolated(object->style()->unicodeBidi()
); |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 651 m_sor = m_eor; | 655 m_sor = m_eor; |
| 652 } | 656 } |
| 653 | 657 |
| 654 m_direction = WTF::Unicode::OtherNeutral; | 658 m_direction = WTF::Unicode::OtherNeutral; |
| 655 m_status.eor = WTF::Unicode::OtherNeutral; | 659 m_status.eor = WTF::Unicode::OtherNeutral; |
| 656 } | 660 } |
| 657 | 661 |
| 658 } | 662 } |
| 659 | 663 |
| 660 #endif // InlineIterator_h | 664 #endif // InlineIterator_h |
| OLD | NEW |