OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 | 52 |
53 void childBeforeWillBeRemoved(); | 53 void childBeforeWillBeRemoved(); |
54 void invalidateOffset() const; | 54 void invalidateOffset() const; |
55 void ensureOffsetIsValid() const; | 55 void ensureOffsetIsValid() const; |
56 | 56 |
57 private: | 57 private: |
58 static const int invalidOffset = -1; | 58 static const int invalidOffset = -1; |
59 | 59 |
60 RefPtr<Node> m_containerNode; | 60 RefPtr<Node> m_containerNode; |
61 mutable int m_offsetInContainer; | 61 mutable int m_offsetInContainer; |
62 Node* m_childBeforeBoundary; | 62 RefPtr<Node> m_childBeforeBoundary; |
63 }; | 63 }; |
64 | 64 |
65 inline RangeBoundaryPoint::RangeBoundaryPoint(PassRefPtr<Node> container) | 65 inline RangeBoundaryPoint::RangeBoundaryPoint(PassRefPtr<Node> container) |
66 : m_containerNode(container) | 66 : m_containerNode(container) |
67 , m_offsetInContainer(0) | 67 , m_offsetInContainer(0) |
68 , m_childBeforeBoundary(0) | 68 , m_childBeforeBoundary(0) |
69 { | 69 { |
70 ASSERT(m_containerNode); | 70 ASSERT(m_containerNode); |
71 } | 71 } |
72 | 72 |
73 inline Node* RangeBoundaryPoint::container() const | 73 inline Node* RangeBoundaryPoint::container() const |
74 { | 74 { |
75 return m_containerNode.get(); | 75 return m_containerNode.get(); |
76 } | 76 } |
77 | 77 |
78 inline Node* RangeBoundaryPoint::childBefore() const | 78 inline Node* RangeBoundaryPoint::childBefore() const |
79 { | 79 { |
80 return m_childBeforeBoundary; | 80 return m_childBeforeBoundary.get(); |
81 } | 81 } |
82 | 82 |
83 inline void RangeBoundaryPoint::ensureOffsetIsValid() const | 83 inline void RangeBoundaryPoint::ensureOffsetIsValid() const |
84 { | 84 { |
85 if (m_offsetInContainer >= 0) | 85 if (m_offsetInContainer >= 0) |
86 return; | 86 return; |
87 | 87 |
88 ASSERT(m_childBeforeBoundary); | 88 ASSERT(m_childBeforeBoundary); |
89 m_offsetInContainer = m_childBeforeBoundary->nodeIndex() + 1; | 89 m_offsetInContainer = m_childBeforeBoundary->nodeIndex() + 1; |
90 } | 90 } |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 } else { | 182 } else { |
183 if (a.offset() != b.offset()) | 183 if (a.offset() != b.offset()) |
184 return false; | 184 return false; |
185 } | 185 } |
186 return true; | 186 return true; |
187 } | 187 } |
188 | 188 |
189 } | 189 } |
190 | 190 |
191 #endif | 191 #endif |
OLD | NEW |