diff options
Diffstat (limited to 'chromium/third_party/WebKit/Source/wtf/TreeNode.h')
-rw-r--r-- | chromium/third_party/WebKit/Source/wtf/TreeNode.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/chromium/third_party/WebKit/Source/wtf/TreeNode.h b/chromium/third_party/WebKit/Source/wtf/TreeNode.h index 15c7679bef3..561eca53af2 100644 --- a/chromium/third_party/WebKit/Source/wtf/TreeNode.h +++ b/chromium/third_party/WebKit/Source/wtf/TreeNode.h @@ -44,6 +44,8 @@ namespace WTF { // * It ASSERT()s invalid input. The callers have to ensure that given parameter is sound. // * There is no branch-leaf difference. Every node can be a parent of other node. // +// FIXME: oilpan: Trace tree node edges to ensure we don't have dangling pointers. +// As it is used in HTMLImport it is safe since they all die together. template <class T> class TreeNode { public: @@ -135,6 +137,16 @@ public: return child; } + void takeChildrenFrom(NodeType* oldParent) + { + ASSERT(oldParent != this); + while (oldParent->hasChildren()) { + NodeType* child = oldParent->firstChild(); + oldParent->removeChild(child); + this->appendChild(child); + } + } + private: NodeType* m_next; NodeType* m_previous; |