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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 void setOffset(int offset); | 51 void setOffset(int offset); |
52 | 52 |
53 void setToBeforeChild(Node&); | 53 void setToBeforeChild(Node&); |
54 void setToStartOfNode(Node&); | 54 void setToStartOfNode(Node&); |
55 void setToEndOfNode(Node&); | 55 void setToEndOfNode(Node&); |
56 | 56 |
57 void childBeforeWillBeRemoved(); | 57 void childBeforeWillBeRemoved(); |
58 void invalidateOffset() const; | 58 void invalidateOffset() const; |
59 void ensureOffsetIsValid() const; | 59 void ensureOffsetIsValid() const; |
60 | 60 |
61 void trace(Visitor*); | 61 DEFINE_INLINE_TRACE() |
| 62 { |
| 63 visitor->trace(m_containerNode); |
| 64 visitor->trace(m_childBeforeBoundary); |
| 65 } |
62 | 66 |
63 private: | 67 private: |
64 static const int invalidOffset = -1; | 68 static const int invalidOffset = -1; |
65 | 69 |
66 RefPtrWillBeMember<Node> m_containerNode; | 70 RefPtrWillBeMember<Node> m_containerNode; |
67 mutable int m_offsetInContainer; | 71 mutable int m_offsetInContainer; |
68 RefPtrWillBeMember<Node> m_childBeforeBoundary; | 72 RefPtrWillBeMember<Node> m_childBeforeBoundary; |
69 }; | 73 }; |
70 | 74 |
71 inline RangeBoundaryPoint::RangeBoundaryPoint(PassRefPtrWillBeRawPtr<Node> conta
iner) | 75 inline RangeBoundaryPoint::RangeBoundaryPoint(PassRefPtrWillBeRawPtr<Node> conta
iner) |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 m_offsetInContainer = 0; | 179 m_offsetInContainer = 0; |
176 else if (m_offsetInContainer > 0) | 180 else if (m_offsetInContainer > 0) |
177 --m_offsetInContainer; | 181 --m_offsetInContainer; |
178 } | 182 } |
179 | 183 |
180 inline void RangeBoundaryPoint::invalidateOffset() const | 184 inline void RangeBoundaryPoint::invalidateOffset() const |
181 { | 185 { |
182 m_offsetInContainer = invalidOffset; | 186 m_offsetInContainer = invalidOffset; |
183 } | 187 } |
184 | 188 |
185 inline void RangeBoundaryPoint::trace(Visitor* visitor) | |
186 { | |
187 visitor->trace(m_containerNode); | |
188 visitor->trace(m_childBeforeBoundary); | |
189 } | |
190 | |
191 inline bool operator==(const RangeBoundaryPoint& a, const RangeBoundaryPoint& b) | 189 inline bool operator==(const RangeBoundaryPoint& a, const RangeBoundaryPoint& b) |
192 { | 190 { |
193 if (a.container() != b.container()) | 191 if (a.container() != b.container()) |
194 return false; | 192 return false; |
195 if (a.childBefore() || b.childBefore()) { | 193 if (a.childBefore() || b.childBefore()) { |
196 if (a.childBefore() != b.childBefore()) | 194 if (a.childBefore() != b.childBefore()) |
197 return false; | 195 return false; |
198 } else { | 196 } else { |
199 if (a.offset() != b.offset()) | 197 if (a.offset() != b.offset()) |
200 return false; | 198 return false; |
201 } | 199 } |
202 return true; | 200 return true; |
203 } | 201 } |
204 | 202 |
205 } | 203 } |
206 | 204 |
207 #endif | 205 #endif |
OLD | NEW |