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

Side by Side 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, 7 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 unified diff | Download patch
« no previous file with comments | « no previous file | Source/web/WebRemoteFrameImpl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "public/web/WebFrame.h" 6 #include "public/web/WebFrame.h"
7 7
8 #include "bindings/core/v8/WindowProxyManager.h" 8 #include "bindings/core/v8/WindowProxyManager.h"
9 #include "core/frame/FrameHost.h" 9 #include "core/frame/FrameHost.h"
10 #include "core/frame/FrameView.h" 10 #include "core/frame/FrameView.h"
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 135
136 void WebFrame::setOpener(WebFrame* opener) 136 void WebFrame::setOpener(WebFrame* opener)
137 { 137 {
138 if (m_opener) 138 if (m_opener)
139 m_opener->m_openedFrameTracker->remove(this); 139 m_opener->m_openedFrameTracker->remove(this);
140 if (opener) 140 if (opener)
141 opener->m_openedFrameTracker->add(this); 141 opener->m_openedFrameTracker->add(this);
142 m_opener = opener; 142 m_opener = opener;
143 } 143 }
144 144
145 void WebFrame::insertAfter(WebFrame* newChild, WebFrame* previousSibling)
146 {
147 newChild->m_parent = this;
148
149 WebFrame* next;
150 if (!previousSibling) {
151 // Insert at the beginning if no previous sibling is specified.
152 next = m_firstChild;
153 m_firstChild = newChild;
154 } else {
155 ASSERT(previousSibling->m_parent == this);
156 next = previousSibling->m_nextSibling;
157 previousSibling->m_nextSibling = newChild;
158 newChild->m_previousSibling = previousSibling;
159 }
160
161 if (next) {
162 newChild->m_nextSibling = next;
163 next->m_previousSibling = newChild;
164 } else {
165 m_lastChild = newChild;
166 }
167
168 toCoreFrame(this)->tree().invalidateScopedChildCount();
169 toCoreFrame(this)->host()->incrementSubframeCount();
170 }
171
145 void WebFrame::appendChild(WebFrame* child) 172 void WebFrame::appendChild(WebFrame* child)
146 { 173 {
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
147 // FIXME: Original code asserts that the frames have the same Page. We 174 // FIXME: Original code asserts that the frames have the same Page. We
148 // should add an equivalent check... figure out what. 175 // should add an equivalent check... figure out what.
149 child->m_parent = this; 176 child->m_parent = this;
150 WebFrame* oldLast = m_lastChild; 177 WebFrame* oldLast = m_lastChild;
151 m_lastChild = child; 178 m_lastChild = child;
152 179
153 if (oldLast) { 180 if (oldLast) {
154 child->m_previousSibling = oldLast; 181 child->m_previousSibling = oldLast;
155 oldLast->m_nextSibling = child; 182 oldLast->m_nextSibling = child;
156 } else { 183 } else {
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 bool WebFrame::isFrameAlive(VisitorDispatcher visitor, const WebFrame* frame ) { return isFrameAliveImpl(visitor, frame); } \ 345 bool WebFrame::isFrameAlive(VisitorDispatcher visitor, const WebFrame* frame ) { return isFrameAliveImpl(visitor, frame); } \
319 void WebFrame::clearWeakFrames(VisitorDispatcher visitor) { clearWeakFramesI mpl(visitor); } 346 void WebFrame::clearWeakFrames(VisitorDispatcher visitor) { clearWeakFramesI mpl(visitor); }
320 347
321 DEFINE_VISITOR_METHOD(Visitor*) 348 DEFINE_VISITOR_METHOD(Visitor*)
322 DEFINE_VISITOR_METHOD(InlinedGlobalMarkingVisitor) 349 DEFINE_VISITOR_METHOD(InlinedGlobalMarkingVisitor)
323 350
324 #undef DEFINE_VISITOR_METHOD 351 #undef DEFINE_VISITOR_METHOD
325 #endif 352 #endif
326 353
327 } // namespace blink 354 } // namespace blink
OLDNEW
« 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