| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 public: | 38 public: |
| 39 PositionIterator() | 39 PositionIterator() |
| 40 : m_anchorNode(0) | 40 : m_anchorNode(0) |
| 41 , m_nodeAfterPositionInAnchor(0) | 41 , m_nodeAfterPositionInAnchor(0) |
| 42 , m_offsetInAnchor(0) | 42 , m_offsetInAnchor(0) |
| 43 { | 43 { |
| 44 } | 44 } |
| 45 | 45 |
| 46 PositionIterator(const Position& pos) | 46 PositionIterator(const Position& pos) |
| 47 : m_anchorNode(pos.anchorNode()) | 47 : m_anchorNode(pos.anchorNode()) |
| 48 , m_nodeAfterPositionInAnchor(m_anchorNode->childNode(pos.deprecatedEdit
ingOffset())) | 48 , m_nodeAfterPositionInAnchor(m_anchorNode->traverseToChildAt(pos.deprec
atedEditingOffset())) |
| 49 , m_offsetInAnchor(m_nodeAfterPositionInAnchor ? 0 : pos.deprecatedEditi
ngOffset()) | 49 , m_offsetInAnchor(m_nodeAfterPositionInAnchor ? 0 : pos.deprecatedEditi
ngOffset()) |
| 50 { | 50 { |
| 51 } | 51 } |
| 52 operator Position() const; | 52 operator Position() const; |
| 53 | 53 |
| 54 void increment(); | 54 void increment(); |
| 55 void decrement(); | 55 void decrement(); |
| 56 | 56 |
| 57 Node* node() const { return m_anchorNode; } | 57 Node* node() const { return m_anchorNode; } |
| 58 int offsetInLeafNode() const { return m_offsetInAnchor; } | 58 int offsetInLeafNode() const { return m_offsetInAnchor; } |
| 59 | 59 |
| 60 bool atStart() const; | 60 bool atStart() const; |
| 61 bool atEnd() const; | 61 bool atEnd() const; |
| 62 bool atStartOfNode() const; | 62 bool atStartOfNode() const; |
| 63 bool atEndOfNode() const; | 63 bool atEndOfNode() const; |
| 64 bool isCandidate() const; | 64 bool isCandidate() const; |
| 65 | 65 |
| 66 private: | 66 private: |
| 67 Node* m_anchorNode; | 67 Node* m_anchorNode; |
| 68 Node* m_nodeAfterPositionInAnchor; // If this is non-null, m_nodeAfterPositi
onInAnchor->parentNode() == m_anchorNode; | 68 Node* m_nodeAfterPositionInAnchor; // If this is non-null, m_nodeAfterPositi
onInAnchor->parentNode() == m_anchorNode; |
| 69 int m_offsetInAnchor; | 69 int m_offsetInAnchor; |
| 70 }; | 70 }; |
| 71 | 71 |
| 72 } // namespace WebCore | 72 } // namespace WebCore |
| 73 | 73 |
| 74 #endif // PositionIterator_h | 74 #endif // PositionIterator_h |
| OLD | NEW |