Chromium Code Reviews| 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 if (m_widget && m_widget->isPluginContainer()) | |
| 154 m_widget = nullptr; | |
| 155 #endif | |
| 148 frame->disconnectOwnerElement(); | 156 frame->disconnectOwnerElement(); |
| 149 } | 157 } |
| 150 } | 158 } |
| 151 | 159 |
| 152 HTMLFrameOwnerElement::~HTMLFrameOwnerElement() | 160 HTMLFrameOwnerElement::~HTMLFrameOwnerElement() |
| 153 { | 161 { |
| 162 #if ENABLE(OILPAN) | |
| 163 // An owner must by now have been informed of detachment | |
| 164 // when the frame was closed. | |
| 165 ASSERT(!m_contentFrame); | |
| 166 #else | |
| 154 if (m_contentFrame) | 167 if (m_contentFrame) |
| 155 m_contentFrame->disconnectOwnerElement(); | 168 m_contentFrame->disconnectOwnerElement(); |
| 169 #endif | |
|
haraken
2014/09/22 05:35:23
Just help me understand:
- In oilpan builds, it i
sof
2014/09/22 09:52:51
For this CL, it was decided not to start assuming
haraken
2014/09/22 10:07:47
It looks like this is the final part I don't yet f
| |
| 156 } | 170 } |
| 157 | 171 |
| 158 Document* HTMLFrameOwnerElement::contentDocument() const | 172 Document* HTMLFrameOwnerElement::contentDocument() const |
| 159 { | 173 { |
| 160 return (m_contentFrame && m_contentFrame->isLocalFrame()) ? toLocalFrame(m_c ontentFrame)->document() : 0; | 174 return (m_contentFrame && m_contentFrame->isLocalFrame()) ? toLocalFrame(m_c ontentFrame)->document() : 0; |
| 161 } | 175 } |
| 162 | 176 |
| 163 LocalDOMWindow* HTMLFrameOwnerElement::contentWindow() const | 177 LocalDOMWindow* HTMLFrameOwnerElement::contentWindow() const |
| 164 { | 178 { |
| 165 return m_contentFrame ? m_contentFrame->domWindow() : 0; | 179 return m_contentFrame ? m_contentFrame->domWindow() : 0; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 217 cache->childrenChanged(renderWidget); | 231 cache->childrenChanged(renderWidget); |
| 218 } | 232 } |
| 219 | 233 |
| 220 Widget* HTMLFrameOwnerElement::ownedWidget() const | 234 Widget* HTMLFrameOwnerElement::ownedWidget() const |
| 221 { | 235 { |
| 222 return m_widget.get(); | 236 return m_widget.get(); |
| 223 } | 237 } |
| 224 | 238 |
| 225 bool HTMLFrameOwnerElement::loadOrRedirectSubframe(const KURL& url, const Atomic String& frameName, bool lockBackForwardList) | 239 bool HTMLFrameOwnerElement::loadOrRedirectSubframe(const KURL& url, const Atomic String& frameName, bool lockBackForwardList) |
| 226 { | 240 { |
| 227 RefPtr<LocalFrame> parentFrame = document().frame(); | 241 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. | 242 // 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()) { | 243 if (contentFrame() && contentFrame()->isLocalFrame()) { |
| 230 toLocalFrame(contentFrame())->navigationScheduler().scheduleLocationChan ge(&document(), url.string(), Referrer(document().outgoingReferrer(), document() .referrerPolicy()), lockBackForwardList); | 244 toLocalFrame(contentFrame())->navigationScheduler().scheduleLocationChan ge(&document(), url.string(), Referrer(document().outgoingReferrer(), document() .referrerPolicy()), lockBackForwardList); |
| 231 return true; | 245 return true; |
| 232 } | 246 } |
| 233 | 247 |
| 234 if (!document().securityOrigin()->canDisplay(url)) { | 248 if (!document().securityOrigin()->canDisplay(url)) { |
| 235 FrameLoader::reportLocalLoadFailed(parentFrame.get(), url.string()); | 249 FrameLoader::reportLocalLoadFailed(parentFrame.get(), url.string()); |
| 236 return false; | 250 return false; |
| 237 } | 251 } |
| 238 | 252 |
| 239 if (!SubframeLoadingDisabler::canLoadFrame(*this)) | 253 if (!SubframeLoadingDisabler::canLoadFrame(*this)) |
| 240 return false; | 254 return false; |
| 241 | 255 |
| 242 String referrer = SecurityPolicy::generateReferrerHeader(document().referrer Policy(), url, document().outgoingReferrer()); | 256 String referrer = SecurityPolicy::generateReferrerHeader(document().referrer Policy(), url, document().outgoingReferrer()); |
| 243 return parentFrame->loader().client()->createFrame(url, frameName, Referrer( referrer, document().referrerPolicy()), this); | 257 return parentFrame->loader().client()->createFrame(url, frameName, Referrer( referrer, document().referrerPolicy()), this); |
| 244 } | 258 } |
| 245 | 259 |
| 260 void HTMLFrameOwnerElement::trace(Visitor* visitor) | |
| 261 { | |
| 262 visitor->trace(m_contentFrame); | |
| 263 HTMLElement::trace(visitor); | |
| 264 FrameOwner::trace(visitor); | |
| 265 } | |
| 266 | |
| 246 | 267 |
| 247 } // namespace blink | 268 } // namespace blink |
| OLD | NEW |