diff options
Diffstat (limited to 'WebCore/page/FrameTree.cpp')
-rw-r--r-- | WebCore/page/FrameTree.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/WebCore/page/FrameTree.cpp b/WebCore/page/FrameTree.cpp index 0e15379..f3f32ec 100644 --- a/WebCore/page/FrameTree.cpp +++ b/WebCore/page/FrameTree.cpp @@ -63,11 +63,35 @@ Frame* FrameTree::parent(bool checkForDisconnectedFrame) const return m_parent; } +bool FrameTree::transferChild(PassRefPtr<Frame> child) +{ + Frame* oldParent = child->tree()->parent(); + if (oldParent == m_thisFrame) + return false; // |child| is already a child of m_thisFrame. + + if (oldParent) + oldParent->tree()->removeChild(child.get()); + + ASSERT(child->page() == m_thisFrame->page()); + child->tree()->m_parent = m_thisFrame; + + // We need to ensure that the child still has a unique frame name with respect to its new parent. + child->tree()->setName(child->tree()->m_name); + + actuallyAppendChild(child); // Note, on return |child| is null. + return true; +} + void FrameTree::appendChild(PassRefPtr<Frame> child) { ASSERT(child->page() == m_thisFrame->page()); child->tree()->m_parent = m_thisFrame; + actuallyAppendChild(child); // Note, on return |child| is null. +} +void FrameTree::actuallyAppendChild(PassRefPtr<Frame> child) +{ + ASSERT(child->tree()->m_parent == m_thisFrame); Frame* oldLast = m_lastChild; m_lastChild = child.get(); |