OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 child->m_parent = child->m_next = child->m_previous = 0; | 128 child->m_parent = child->m_next = child->m_previous = 0; |
129 | 129 |
130 if (oldNext) | 130 if (oldNext) |
131 oldNext->m_previous = oldPrevious; | 131 oldNext->m_previous = oldPrevious; |
132 if (oldPrevious) | 132 if (oldPrevious) |
133 oldPrevious->m_next = oldNext; | 133 oldPrevious->m_next = oldNext; |
134 | 134 |
135 return child; | 135 return child; |
136 } | 136 } |
137 | 137 |
| 138 void takeChildrenFrom(NodeType* oldParent) |
| 139 { |
| 140 ASSERT(oldParent != this); |
| 141 while (oldParent->hasChildren()) { |
| 142 NodeType* child = oldParent->firstChild(); |
| 143 oldParent->removeChild(child); |
| 144 this->appendChild(child); |
| 145 } |
| 146 } |
| 147 |
138 private: | 148 private: |
139 NodeType* m_next; | 149 NodeType* m_next; |
140 NodeType* m_previous; | 150 NodeType* m_previous; |
141 NodeType* m_parent; | 151 NodeType* m_parent; |
142 NodeType* m_firstChild; | 152 NodeType* m_firstChild; |
143 NodeType* m_lastChild; | 153 NodeType* m_lastChild; |
144 }; | 154 }; |
145 | 155 |
146 template<class T> | 156 template<class T> |
147 inline typename TreeNode<T>::NodeType* traverseNext(const TreeNode<T>* current,
const TreeNode<T>* stayWithin = 0) | 157 inline typename TreeNode<T>::NodeType* traverseNext(const TreeNode<T>* current,
const TreeNode<T>* stayWithin = 0) |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 return next; | 195 return next; |
186 } | 196 } |
187 | 197 |
188 } | 198 } |
189 | 199 |
190 using WTF::TreeNode; | 200 using WTF::TreeNode; |
191 using WTF::traverseNext; | 201 using WTF::traverseNext; |
192 using WTF::traverseNextPostOrder; | 202 using WTF::traverseNextPostOrder; |
193 | 203 |
194 #endif | 204 #endif |
OLD | NEW |