Chromium Code Reviews| Index: Source/web/WebFrame.cpp |
| diff --git a/Source/web/WebFrame.cpp b/Source/web/WebFrame.cpp |
| index ca855dca8a7f4a72e69996046ad8a91ae3dffd39..c4704ff90f861d82da94e5edf4f7dd071cf65d8d 100644 |
| --- a/Source/web/WebFrame.cpp |
| +++ b/Source/web/WebFrame.cpp |
| @@ -142,6 +142,33 @@ void WebFrame::setOpener(WebFrame* opener) |
| m_opener = opener; |
| } |
| +void WebFrame::insertAfter(WebFrame* newChild, WebFrame* previousSibling) |
| +{ |
| + newChild->m_parent = this; |
| + |
| + WebFrame* next; |
| + if (!previousSibling) { |
| + // Insert at the beginning if no previous sibling is specified. |
| + next = m_firstChild; |
| + m_firstChild = newChild; |
| + } else { |
| + ASSERT(previousSibling->m_parent == this); |
| + next = previousSibling->m_nextSibling; |
| + previousSibling->m_nextSibling = newChild; |
| + newChild->m_previousSibling = previousSibling; |
| + } |
| + |
| + if (next) { |
| + newChild->m_nextSibling = next; |
| + next->m_previousSibling = newChild; |
| + } else { |
| + m_lastChild = newChild; |
| + } |
| + |
| + toCoreFrame(this)->tree().invalidateScopedChildCount(); |
| + toCoreFrame(this)->host()->incrementSubframeCount(); |
| +} |
| + |
| void WebFrame::appendChild(WebFrame* child) |
| { |
|
dcheng
2015/05/01 23:39:36
Should we re-express this in terms of insertAfter(
alexmos
2015/05/02 00:21:45
Done. Thanks for reminding me to do it! Any thou
dcheng
2015/05/04 17:30:36
The original check was to make sure we didn't acci
alexmos
2015/05/04 21:38:54
Hmm, that doesn't seem to work, because we call in
|
| // FIXME: Original code asserts that the frames have the same Page. We |