| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 | 44 |
| 45 RenderPart* HTMLFrameOwnerElement::renderPart() const | 45 RenderPart* HTMLFrameOwnerElement::renderPart() const |
| 46 { | 46 { |
| 47 // HTMLObjectElement and HTMLEmbedElement may return arbitrary renderers | 47 // HTMLObjectElement and HTMLEmbedElement may return arbitrary renderers |
| 48 // when using fallback content. | 48 // when using fallback content. |
| 49 if (!renderer() || !renderer()->isRenderPart()) | 49 if (!renderer() || !renderer()->isRenderPart()) |
| 50 return 0; | 50 return 0; |
| 51 return toRenderPart(renderer()); | 51 return toRenderPart(renderer()); |
| 52 } | 52 } |
| 53 | 53 |
| 54 void HTMLFrameOwnerElement::setContentFrame(Frame& frame) | 54 void HTMLFrameOwnerElement::setContentFrame(LocalFrame& frame) |
| 55 { | 55 { |
| 56 // Make sure we will not end up with two frames referencing the same owner e
lement. | 56 // Make sure we will not end up with two frames referencing the same owner e
lement. |
| 57 ASSERT(!m_contentFrame || m_contentFrame->ownerElement() != this); | 57 ASSERT(!m_contentFrame || m_contentFrame->ownerElement() != this); |
| 58 // Disconnected frames should not be allowed to load. | 58 // Disconnected frames should not be allowed to load. |
| 59 ASSERT(inDocument()); | 59 ASSERT(inDocument()); |
| 60 m_contentFrame = &frame; | 60 m_contentFrame = &frame; |
| 61 | 61 |
| 62 for (ContainerNode* node = this; node; node = node->parentOrShadowHostNode()
) | 62 for (ContainerNode* node = this; node; node = node->parentOrShadowHostNode()
) |
| 63 node->incrementConnectedSubframeCount(); | 63 node->incrementConnectedSubframeCount(); |
| 64 } | 64 } |
| 65 | 65 |
| 66 void HTMLFrameOwnerElement::clearContentFrame() | 66 void HTMLFrameOwnerElement::clearContentFrame() |
| 67 { | 67 { |
| 68 if (!m_contentFrame) | 68 if (!m_contentFrame) |
| 69 return; | 69 return; |
| 70 | 70 |
| 71 m_contentFrame = 0; | 71 m_contentFrame = 0; |
| 72 | 72 |
| 73 for (ContainerNode* node = this; node; node = node->parentOrShadowHostNode()
) | 73 for (ContainerNode* node = this; node; node = node->parentOrShadowHostNode()
) |
| 74 node->decrementConnectedSubframeCount(); | 74 node->decrementConnectedSubframeCount(); |
| 75 } | 75 } |
| 76 | 76 |
| 77 void HTMLFrameOwnerElement::disconnectContentFrame() | 77 void HTMLFrameOwnerElement::disconnectContentFrame() |
| 78 { | 78 { |
| 79 // FIXME: Currently we don't do this in removedFrom because this causes an | 79 // FIXME: Currently we don't do this in removedFrom because this causes an |
| 80 // unload event in the subframe which could execute script that could then | 80 // unload event in the subframe which could execute script that could then |
| 81 // reach up into this document and then attempt to look back down. We should | 81 // reach up into this document and then attempt to look back down. We should |
| 82 // see if this behavior is really needed as Gecko does not allow this. | 82 // see if this behavior is really needed as Gecko does not allow this. |
| 83 if (Frame* frame = contentFrame()) { | 83 if (LocalFrame* frame = contentFrame()) { |
| 84 RefPtr<Frame> protect(frame); | 84 RefPtr<LocalFrame> protect(frame); |
| 85 if (frame->isLocalFrame()) | 85 frame->loader().frameDetached(); |
| 86 toLocalFrame(frame)->loader().frameDetached(); | |
| 87 frame->disconnectOwnerElement(); | 86 frame->disconnectOwnerElement(); |
| 88 } | 87 } |
| 89 } | 88 } |
| 90 | 89 |
| 91 HTMLFrameOwnerElement::~HTMLFrameOwnerElement() | 90 HTMLFrameOwnerElement::~HTMLFrameOwnerElement() |
| 92 { | 91 { |
| 93 if (m_contentFrame) | 92 if (m_contentFrame) |
| 94 m_contentFrame->disconnectOwnerElement(); | 93 m_contentFrame->disconnectOwnerElement(); |
| 95 } | 94 } |
| 96 | 95 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 118 { | 117 { |
| 119 Document* doc = contentDocument(); | 118 Document* doc = contentDocument(); |
| 120 if (doc && doc->isSVGDocument()) | 119 if (doc && doc->isSVGDocument()) |
| 121 return toSVGDocument(doc); | 120 return toSVGDocument(doc); |
| 122 return 0; | 121 return 0; |
| 123 } | 122 } |
| 124 | 123 |
| 125 bool HTMLFrameOwnerElement::loadOrRedirectSubframe(const KURL& url, const Atomic
String& frameName, bool lockBackForwardList) | 124 bool HTMLFrameOwnerElement::loadOrRedirectSubframe(const KURL& url, const Atomic
String& frameName, bool lockBackForwardList) |
| 126 { | 125 { |
| 127 RefPtr<LocalFrame> parentFrame = document().frame(); | 126 RefPtr<LocalFrame> parentFrame = document().frame(); |
| 128 // FIXME(kenrb): The necessary semantics for RemoteFrames have not been work
ed out yet, but this will likely need some logic to handle them. | 127 if (contentFrame()) { |
| 129 if (contentFrame() && contentFrame()->isLocalFrame()) { | 128 contentFrame()->navigationScheduler().scheduleLocationChange(&document()
, url.string(), Referrer(document().outgoingReferrer(), document().referrerPolic
y()), lockBackForwardList); |
| 130 toLocalFrame(contentFrame())->navigationScheduler().scheduleLocationChan
ge(&document(), url.string(), Referrer(document().outgoingReferrer(), document()
.referrerPolicy()), lockBackForwardList); | |
| 131 return true; | 129 return true; |
| 132 } | 130 } |
| 133 | 131 |
| 134 if (!document().securityOrigin()->canDisplay(url)) { | 132 if (!document().securityOrigin()->canDisplay(url)) { |
| 135 FrameLoader::reportLocalLoadFailed(parentFrame.get(), url.string()); | 133 FrameLoader::reportLocalLoadFailed(parentFrame.get(), url.string()); |
| 136 return false; | 134 return false; |
| 137 } | 135 } |
| 138 | 136 |
| 139 if (!SubframeLoadingDisabler::canLoadFrame(*this)) | 137 if (!SubframeLoadingDisabler::canLoadFrame(*this)) |
| 140 return false; | 138 return false; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 169 // FIXME: In this case the LocalFrame will have finished loading before | 167 // FIXME: In this case the LocalFrame will have finished loading before |
| 170 // it's being added to the child list. It would be a good idea to | 168 // it's being added to the child list. It would be a good idea to |
| 171 // create the child first, then invoke the loader separately. | 169 // create the child first, then invoke the loader separately. |
| 172 if (childFrame->loader().state() == FrameStateComplete && !childFrame->loade
r().policyDocumentLoader()) | 170 if (childFrame->loader().state() == FrameStateComplete && !childFrame->loade
r().policyDocumentLoader()) |
| 173 childFrame->loader().checkCompleted(); | 171 childFrame->loader().checkCompleted(); |
| 174 return true; | 172 return true; |
| 175 } | 173 } |
| 176 | 174 |
| 177 | 175 |
| 178 } // namespace WebCore | 176 } // namespace WebCore |
| OLD | NEW |