| 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*); | |
| 62 | |
| 63 private: | 61 private: |
| 64 static const int invalidOffset = -1; | 62 static const int invalidOffset = -1; |
| 65 | 63 |
| 66 RefPtr<Node> m_containerNode; | 64 RefPtr<Node> m_containerNode; |
| 67 mutable int m_offsetInContainer; | 65 mutable int m_offsetInContainer; |
| 68 RefPtr<Node> m_childBeforeBoundary; | 66 RefPtr<Node> m_childBeforeBoundary; |
| 69 }; | 67 }; |
| 70 | 68 |
| 71 inline RangeBoundaryPoint::RangeBoundaryPoint(PassRefPtr<Node> container) | 69 inline RangeBoundaryPoint::RangeBoundaryPoint(PassRefPtr<Node> container) |
| 72 : m_containerNode(container) | 70 : m_containerNode(container) |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 m_offsetInContainer = 0; | 173 m_offsetInContainer = 0; |
| 176 else if (m_offsetInContainer > 0) | 174 else if (m_offsetInContainer > 0) |
| 177 --m_offsetInContainer; | 175 --m_offsetInContainer; |
| 178 } | 176 } |
| 179 | 177 |
| 180 inline void RangeBoundaryPoint::invalidateOffset() const | 178 inline void RangeBoundaryPoint::invalidateOffset() const |
| 181 { | 179 { |
| 182 m_offsetInContainer = invalidOffset; | 180 m_offsetInContainer = invalidOffset; |
| 183 } | 181 } |
| 184 | 182 |
| 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) | 183 inline bool operator==(const RangeBoundaryPoint& a, const RangeBoundaryPoint& b) |
| 192 { | 184 { |
| 193 if (a.container() != b.container()) | 185 if (a.container() != b.container()) |
| 194 return false; | 186 return false; |
| 195 if (a.childBefore() || b.childBefore()) { | 187 if (a.childBefore() || b.childBefore()) { |
| 196 if (a.childBefore() != b.childBefore()) | 188 if (a.childBefore() != b.childBefore()) |
| 197 return false; | 189 return false; |
| 198 } else { | 190 } else { |
| 199 if (a.offset() != b.offset()) | 191 if (a.offset() != b.offset()) |
| 200 return false; | 192 return false; |
| 201 } | 193 } |
| 202 return true; | 194 return true; |
| 203 } | 195 } |
| 204 | 196 |
| 205 } | 197 } |
| 206 | 198 |
| 207 #endif | 199 #endif |
| OLD | NEW |