Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1264)

Unified Diff: Source/web/WebFrame.cpp

Issue 1119823003: Allow createLocalChild to specify previous sibling frame. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/web/WebRemoteFrameImpl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | Source/web/WebRemoteFrameImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698