OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
8 * | 8 * |
9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 parent->addChild(child); | 91 parent->addChild(child); |
92 else if (toScrollView(child->parent())) | 92 else if (toScrollView(child->parent())) |
93 toScrollView(child->parent())->removeChild(child); | 93 toScrollView(child->parent())->removeChild(child); |
94 return; | 94 return; |
95 } | 95 } |
96 widgetNewParentMap().set(child, parent); | 96 widgetNewParentMap().set(child, parent); |
97 } | 97 } |
98 | 98 |
99 HTMLFrameOwnerElement::HTMLFrameOwnerElement(const QualifiedName& tagName, Docum
ent& document) | 99 HTMLFrameOwnerElement::HTMLFrameOwnerElement(const QualifiedName& tagName, Docum
ent& document) |
100 : HTMLElement(tagName, document) | 100 : HTMLElement(tagName, document) |
101 , m_contentFrame(0) | 101 , m_contentFrame(nullptr) |
102 , m_widget(nullptr) | 102 , m_widget(nullptr) |
103 , m_sandboxFlags(SandboxNone) | 103 , m_sandboxFlags(SandboxNone) |
104 { | 104 { |
105 } | 105 } |
106 | 106 |
107 RenderPart* HTMLFrameOwnerElement::renderPart() const | 107 RenderPart* HTMLFrameOwnerElement::renderPart() const |
108 { | 108 { |
109 // HTMLObjectElement and HTMLEmbedElement may return arbitrary renderers | 109 // HTMLObjectElement and HTMLEmbedElement may return arbitrary renderers |
110 // when using fallback content. | 110 // when using fallback content. |
111 if (!renderer() || !renderer()->isRenderPart()) | 111 if (!renderer() || !renderer()->isRenderPart()) |
(...skipping 11 matching lines...) Expand all Loading... |
123 | 123 |
124 for (ContainerNode* node = this; node; node = node->parentOrShadowHostNode()
) | 124 for (ContainerNode* node = this; node; node = node->parentOrShadowHostNode()
) |
125 node->incrementConnectedSubframeCount(); | 125 node->incrementConnectedSubframeCount(); |
126 } | 126 } |
127 | 127 |
128 void HTMLFrameOwnerElement::clearContentFrame() | 128 void HTMLFrameOwnerElement::clearContentFrame() |
129 { | 129 { |
130 if (!m_contentFrame) | 130 if (!m_contentFrame) |
131 return; | 131 return; |
132 | 132 |
133 m_contentFrame = 0; | 133 m_contentFrame = nullptr; |
134 | 134 |
135 for (ContainerNode* node = this; node; node = node->parentOrShadowHostNode()
) | 135 for (ContainerNode* node = this; node; node = node->parentOrShadowHostNode()
) |
136 node->decrementConnectedSubframeCount(); | 136 node->decrementConnectedSubframeCount(); |
137 } | 137 } |
138 | 138 |
139 void HTMLFrameOwnerElement::disconnectContentFrame() | 139 void HTMLFrameOwnerElement::disconnectContentFrame() |
140 { | 140 { |
141 // FIXME: Currently we don't do this in removedFrom because this causes an | 141 // FIXME: Currently we don't do this in removedFrom because this causes an |
142 // unload event in the subframe which could execute script that could then | 142 // unload event in the subframe which could execute script that could then |
143 // reach up into this document and then attempt to look back down. We should | 143 // reach up into this document and then attempt to look back down. We should |
144 // see if this behavior is really needed as Gecko does not allow this. | 144 // see if this behavior is really needed as Gecko does not allow this. |
145 if (Frame* frame = contentFrame()) { | 145 if (RefPtrWillBeRawPtr<Frame> frame = contentFrame()) { |
146 RefPtr<Frame> protect(frame); | |
147 frame->detach(); | 146 frame->detach(); |
| 147 #if ENABLE(OILPAN) |
| 148 // FIXME: Oilpan: the plugin container is released and finalized here |
| 149 // in order to work around the current inability to make the plugin |
| 150 // container a FrameDestructionObserver (it needs to effectively be on |
| 151 // the heap, and Widget isn't). Hence, release it here while its |
| 152 // frame reference is still valid. |
| 153 // |
| 154 // As yet unknown if we can "get away" with releasing it slightly earlie
r.. |
| 155 if (m_widget && m_widget->isPluginContainer()) |
| 156 m_widget = nullptr; |
| 157 #endif |
148 frame->disconnectOwnerElement(); | 158 frame->disconnectOwnerElement(); |
149 } | 159 } |
150 } | 160 } |
151 | 161 |
152 HTMLFrameOwnerElement::~HTMLFrameOwnerElement() | 162 HTMLFrameOwnerElement::~HTMLFrameOwnerElement() |
153 { | 163 { |
| 164 #if ENABLE(OILPAN) |
| 165 // An owner must by now have been informed of detachment |
| 166 // when the frame was closed. |
| 167 ASSERT(!m_contentFrame); |
| 168 #else |
154 if (m_contentFrame) | 169 if (m_contentFrame) |
155 m_contentFrame->disconnectOwnerElement(); | 170 m_contentFrame->disconnectOwnerElement(); |
| 171 #endif |
156 } | 172 } |
157 | 173 |
158 Document* HTMLFrameOwnerElement::contentDocument() const | 174 Document* HTMLFrameOwnerElement::contentDocument() const |
159 { | 175 { |
160 return (m_contentFrame && m_contentFrame->isLocalFrame()) ? toLocalFrame(m_c
ontentFrame)->document() : 0; | 176 return (m_contentFrame && m_contentFrame->isLocalFrame()) ? toLocalFrame(m_c
ontentFrame)->document() : 0; |
161 } | 177 } |
162 | 178 |
163 LocalDOMWindow* HTMLFrameOwnerElement::contentWindow() const | 179 LocalDOMWindow* HTMLFrameOwnerElement::contentWindow() const |
164 { | 180 { |
165 return m_contentFrame ? m_contentFrame->domWindow() : 0; | 181 return m_contentFrame ? m_contentFrame->domWindow() : 0; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 cache->childrenChanged(renderWidget); | 233 cache->childrenChanged(renderWidget); |
218 } | 234 } |
219 | 235 |
220 Widget* HTMLFrameOwnerElement::ownedWidget() const | 236 Widget* HTMLFrameOwnerElement::ownedWidget() const |
221 { | 237 { |
222 return m_widget.get(); | 238 return m_widget.get(); |
223 } | 239 } |
224 | 240 |
225 bool HTMLFrameOwnerElement::loadOrRedirectSubframe(const KURL& url, const Atomic
String& frameName, bool lockBackForwardList) | 241 bool HTMLFrameOwnerElement::loadOrRedirectSubframe(const KURL& url, const Atomic
String& frameName, bool lockBackForwardList) |
226 { | 242 { |
227 RefPtr<LocalFrame> parentFrame = document().frame(); | 243 RefPtrWillBeRawPtr<LocalFrame> parentFrame = document().frame(); |
228 // FIXME(kenrb): The necessary semantics for RemoteFrames have not been work
ed out yet, but this will likely need some logic to handle them. | 244 // FIXME(kenrb): The necessary semantics for RemoteFrames have not been work
ed out yet, but this will likely need some logic to handle them. |
229 if (contentFrame() && contentFrame()->isLocalFrame()) { | 245 if (contentFrame() && contentFrame()->isLocalFrame()) { |
230 toLocalFrame(contentFrame())->navigationScheduler().scheduleLocationChan
ge(&document(), url.string(), Referrer(document().outgoingReferrer(), document()
.referrerPolicy()), lockBackForwardList); | 246 toLocalFrame(contentFrame())->navigationScheduler().scheduleLocationChan
ge(&document(), url.string(), Referrer(document().outgoingReferrer(), document()
.referrerPolicy()), lockBackForwardList); |
231 return true; | 247 return true; |
232 } | 248 } |
233 | 249 |
234 if (!document().securityOrigin()->canDisplay(url)) { | 250 if (!document().securityOrigin()->canDisplay(url)) { |
235 FrameLoader::reportLocalLoadFailed(parentFrame.get(), url.string()); | 251 FrameLoader::reportLocalLoadFailed(parentFrame.get(), url.string()); |
236 return false; | 252 return false; |
237 } | 253 } |
238 | 254 |
239 if (!SubframeLoadingDisabler::canLoadFrame(*this)) | 255 if (!SubframeLoadingDisabler::canLoadFrame(*this)) |
240 return false; | 256 return false; |
241 | 257 |
242 String referrer = SecurityPolicy::generateReferrerHeader(document().referrer
Policy(), url, document().outgoingReferrer()); | 258 String referrer = SecurityPolicy::generateReferrerHeader(document().referrer
Policy(), url, document().outgoingReferrer()); |
243 return parentFrame->loader().client()->createFrame(url, frameName, Referrer(
referrer, document().referrerPolicy()), this); | 259 return parentFrame->loader().client()->createFrame(url, frameName, Referrer(
referrer, document().referrerPolicy()), this); |
244 } | 260 } |
245 | 261 |
| 262 void HTMLFrameOwnerElement::trace(Visitor* visitor) |
| 263 { |
| 264 visitor->trace(m_contentFrame); |
| 265 HTMLElement::trace(visitor); |
| 266 FrameOwner::trace(visitor); |
| 267 } |
| 268 |
246 | 269 |
247 } // namespace blink | 270 } // namespace blink |
OLD | NEW |