| 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 } | 91 } |
| 92 | 92 |
| 93 HTMLFrameOwnerElement::HTMLFrameOwnerElement(const QualifiedName& tagName, Docum
ent& document) | 93 HTMLFrameOwnerElement::HTMLFrameOwnerElement(const QualifiedName& tagName, Docum
ent& document) |
| 94 : HTMLElement(tagName, document) | 94 : HTMLElement(tagName, document) |
| 95 , m_contentFrame(0) | 95 , m_contentFrame(0) |
| 96 , m_widget(nullptr) | 96 , m_widget(nullptr) |
| 97 , m_sandboxFlags(SandboxNone) | 97 , m_sandboxFlags(SandboxNone) |
| 98 { | 98 { |
| 99 } | 99 } |
| 100 | 100 |
| 101 void HTMLFrameOwnerElement::dispatchLoad() | |
| 102 { | |
| 103 dispatchEvent(Event::create(EventTypeNames::load)); | |
| 104 } | |
| 105 | |
| 106 RenderPart* HTMLFrameOwnerElement::renderPart() const | |
| 107 { | |
| 108 // HTMLObjectElement and HTMLEmbedElement may return arbitrary renderers | |
| 109 // when using fallback content. | |
| 110 if (!renderer() || !renderer()->isRenderPart()) | |
| 111 return 0; | |
| 112 return toRenderPart(renderer()); | |
| 113 } | |
| 114 | |
| 115 void HTMLFrameOwnerElement::setContentFrame(Frame& frame) | 101 void HTMLFrameOwnerElement::setContentFrame(Frame& frame) |
| 116 { | 102 { |
| 117 // Make sure we will not end up with two frames referencing the same owner e
lement. | 103 // Make sure we will not end up with two frames referencing the same owner e
lement. |
| 118 ASSERT(!m_contentFrame || m_contentFrame->owner() != this); | 104 ASSERT(!m_contentFrame || m_contentFrame->owner() != this); |
| 119 // Disconnected frames should not be allowed to load. | 105 // Disconnected frames should not be allowed to load. |
| 120 ASSERT(inDocument()); | 106 ASSERT(inDocument()); |
| 121 m_contentFrame = &frame; | 107 m_contentFrame = &frame; |
| 122 | 108 |
| 123 for (ContainerNode* node = this; node; node = node->parentOrShadowHostNode()
) | 109 for (ContainerNode* node = this; node; node = node->parentOrShadowHostNode()
) |
| 124 node->incrementConnectedSubframeCount(); | 110 node->incrementConnectedSubframeCount(); |
| 125 } | 111 } |
| 126 | 112 |
| 127 void HTMLFrameOwnerElement::clearContentFrame() | 113 void HTMLFrameOwnerElement::clearContentFrame() |
| 128 { | 114 { |
| 129 if (!m_contentFrame) | 115 if (!m_contentFrame) |
| 130 return; | 116 return; |
| 131 | 117 |
| 132 m_contentFrame = 0; | 118 m_contentFrame = 0; |
| 133 | 119 |
| 134 for (ContainerNode* node = this; node; node = node->parentOrShadowHostNode()
) | 120 for (ContainerNode* node = this; node; node = node->parentOrShadowHostNode()
) |
| 135 node->decrementConnectedSubframeCount(); | 121 node->decrementConnectedSubframeCount(); |
| 136 } | 122 } |
| 137 | 123 |
| 124 void HTMLFrameOwnerElement::dispatchLoad() |
| 125 { |
| 126 dispatchEvent(Event::create(EventTypeNames::load)); |
| 127 } |
| 128 |
| 129 RenderPart* HTMLFrameOwnerElement::renderPart() const |
| 130 { |
| 131 // HTMLObjectElement and HTMLEmbedElement may return arbitrary renderers |
| 132 // when using fallback content. |
| 133 if (!renderer() || !renderer()->isRenderPart()) |
| 134 return 0; |
| 135 return toRenderPart(renderer()); |
| 136 } |
| 137 |
| 138 void HTMLFrameOwnerElement::disconnectContentFrame() | 138 void HTMLFrameOwnerElement::disconnectContentFrame() |
| 139 { | 139 { |
| 140 // FIXME: Currently we don't do this in removedFrom because this causes an | 140 // FIXME: Currently we don't do this in removedFrom because this causes an |
| 141 // unload event in the subframe which could execute script that could then | 141 // unload event in the subframe which could execute script that could then |
| 142 // reach up into this document and then attempt to look back down. We should | 142 // reach up into this document and then attempt to look back down. We should |
| 143 // see if this behavior is really needed as Gecko does not allow this. | 143 // see if this behavior is really needed as Gecko does not allow this. |
| 144 if (Frame* frame = contentFrame()) { | 144 if (Frame* frame = contentFrame()) { |
| 145 RefPtr<Frame> protect(frame); | 145 RefPtr<Frame> protect(frame); |
| 146 if (frame->isLocalFrame()) | 146 if (frame->isLocalFrame()) |
| 147 toLocalFrame(frame)->loader().frameDetached(); | 147 toLocalFrame(frame)->loader().frameDetached(); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 // FIXME: In this case the LocalFrame will have finished loading before | 266 // FIXME: In this case the LocalFrame will have finished loading before |
| 267 // it's being added to the child list. It would be a good idea to | 267 // it's being added to the child list. It would be a good idea to |
| 268 // create the child first, then invoke the loader separately. | 268 // create the child first, then invoke the loader separately. |
| 269 if (childFrame->loader().state() == FrameStateComplete && !childFrame->loade
r().policyDocumentLoader()) | 269 if (childFrame->loader().state() == FrameStateComplete && !childFrame->loade
r().policyDocumentLoader()) |
| 270 childFrame->loader().checkCompleted(); | 270 childFrame->loader().checkCompleted(); |
| 271 return true; | 271 return true; |
| 272 } | 272 } |
| 273 | 273 |
| 274 | 274 |
| 275 } // namespace WebCore | 275 } // namespace WebCore |
| OLD | NEW |