OLD | NEW |
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 "core/frame/FrameHost.h" |
8 #include "core/frame/RemoteFrame.h" | 9 #include "core/frame/RemoteFrame.h" |
9 #include "core/html/HTMLFrameOwnerElement.h" | 10 #include "core/html/HTMLFrameOwnerElement.h" |
10 #include "platform/UserGestureIndicator.h" | 11 #include "platform/UserGestureIndicator.h" |
11 #include "platform/heap/Handle.h" | 12 #include "platform/heap/Handle.h" |
12 #include "web/OpenedFrameTracker.h" | 13 #include "web/OpenedFrameTracker.h" |
13 #include "web/WebLocalFrameImpl.h" | 14 #include "web/WebLocalFrameImpl.h" |
14 #include "web/WebRemoteFrameImpl.h" | 15 #include "web/WebRemoteFrameImpl.h" |
15 #include <algorithm> | 16 #include <algorithm> |
16 | 17 |
17 namespace blink { | 18 namespace blink { |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 m_lastChild = child; | 116 m_lastChild = child; |
116 | 117 |
117 if (oldLast) { | 118 if (oldLast) { |
118 child->m_previousSibling = oldLast; | 119 child->m_previousSibling = oldLast; |
119 oldLast->m_nextSibling = child; | 120 oldLast->m_nextSibling = child; |
120 } else { | 121 } else { |
121 m_firstChild = child; | 122 m_firstChild = child; |
122 } | 123 } |
123 | 124 |
124 toCoreFrame(this)->tree().invalidateScopedChildCount(); | 125 toCoreFrame(this)->tree().invalidateScopedChildCount(); |
| 126 toCoreFrame(this)->host()->incrementSubframeCount(); |
125 } | 127 } |
126 | 128 |
127 void WebFrame::removeChild(WebFrame* child) | 129 void WebFrame::removeChild(WebFrame* child) |
128 { | 130 { |
129 child->m_parent = 0; | 131 child->m_parent = 0; |
130 | 132 |
131 if (m_firstChild == child) | 133 if (m_firstChild == child) |
132 m_firstChild = child->m_nextSibling; | 134 m_firstChild = child->m_nextSibling; |
133 else | 135 else |
134 child->m_previousSibling->m_nextSibling = child->m_nextSibling; | 136 child->m_previousSibling->m_nextSibling = child->m_nextSibling; |
135 | 137 |
136 if (m_lastChild == child) | 138 if (m_lastChild == child) |
137 m_lastChild = child->m_previousSibling; | 139 m_lastChild = child->m_previousSibling; |
138 else | 140 else |
139 child->m_nextSibling->m_previousSibling = child->m_previousSibling; | 141 child->m_nextSibling->m_previousSibling = child->m_previousSibling; |
140 | 142 |
141 child->m_previousSibling = child->m_nextSibling = 0; | 143 child->m_previousSibling = child->m_nextSibling = 0; |
142 | 144 |
143 toCoreFrame(this)->tree().invalidateScopedChildCount(); | 145 toCoreFrame(this)->tree().invalidateScopedChildCount(); |
| 146 toCoreFrame(this)->host()->decrementSubframeCount(); |
144 } | 147 } |
145 | 148 |
146 WebFrame* WebFrame::parent() const | 149 WebFrame* WebFrame::parent() const |
147 { | 150 { |
148 return m_parent; | 151 return m_parent; |
149 } | 152 } |
150 | 153 |
151 WebFrame* WebFrame::top() const | 154 WebFrame* WebFrame::top() const |
152 { | 155 { |
153 WebFrame* frame = const_cast<WebFrame*>(this); | 156 WebFrame* frame = const_cast<WebFrame*>(this); |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 } | 263 } |
261 | 264 |
262 void WebFrame::clearWeakFrames(Visitor* visitor) | 265 void WebFrame::clearWeakFrames(Visitor* visitor) |
263 { | 266 { |
264 if (!isFrameAlive(visitor, m_opener)) | 267 if (!isFrameAlive(visitor, m_opener)) |
265 m_opener = nullptr; | 268 m_opener = nullptr; |
266 } | 269 } |
267 #endif | 270 #endif |
268 | 271 |
269 } // namespace blink | 272 } // namespace blink |
OLD | NEW |