| 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 (Frame* frame = contentFrame()) { |
| 84 RefPtr<Frame> protect(frame); | 84 RefPtr<Frame> protect(frame); |
| 85 frame->loader().frameDetached(); | 85 frame->loader().frameDetached(); |
| 86 frame->disconnectOwnerElement(); | 86 frame->disconnectOwnerElement(); |
| 87 } | 87 } |
| 88 } | 88 } |
| 89 | 89 |
| 90 HTMLFrameOwnerElement::~HTMLFrameOwnerElement() | 90 HTMLFrameOwnerElement::~HTMLFrameOwnerElement() |
| 91 { | 91 { |
| 92 if (m_contentFrame) | 92 if (m_contentFrame) { |
| 93 RenderObject* renderObject = renderer(); |
| 94 if (renderObject && renderObject->isWidget() && m_widget) |
| 95 toRenderWidget(renderObject)->detachWidget(m_widget.get()); |
| 96 |
| 93 m_contentFrame->disconnectOwnerElement(); | 97 m_contentFrame->disconnectOwnerElement(); |
| 98 } |
| 94 } | 99 } |
| 95 | 100 |
| 96 Document* HTMLFrameOwnerElement::contentDocument() const | 101 Document* HTMLFrameOwnerElement::contentDocument() const |
| 97 { | 102 { |
| 98 return m_contentFrame ? m_contentFrame->document() : 0; | 103 return m_contentFrame ? m_contentFrame->document() : 0; |
| 99 } | 104 } |
| 100 | 105 |
| 101 DOMWindow* HTMLFrameOwnerElement::contentWindow() const | 106 DOMWindow* HTMLFrameOwnerElement::contentWindow() const |
| 102 { | 107 { |
| 103 return m_contentFrame ? m_contentFrame->domWindow() : 0; | 108 return m_contentFrame ? m_contentFrame->domWindow() : 0; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 114 } | 119 } |
| 115 | 120 |
| 116 SVGDocument* HTMLFrameOwnerElement::getSVGDocument(ExceptionState& exceptionStat
e) const | 121 SVGDocument* HTMLFrameOwnerElement::getSVGDocument(ExceptionState& exceptionStat
e) const |
| 117 { | 122 { |
| 118 Document* doc = contentDocument(); | 123 Document* doc = contentDocument(); |
| 119 if (doc && doc->isSVGDocument()) | 124 if (doc && doc->isSVGDocument()) |
| 120 return toSVGDocument(doc); | 125 return toSVGDocument(doc); |
| 121 return 0; | 126 return 0; |
| 122 } | 127 } |
| 123 | 128 |
| 129 void HTMLFrameOwnerElement::setWidget(PassRefPtr<Widget> widget) |
| 130 { |
| 131 if (widget == m_widget) |
| 132 return; |
| 133 |
| 134 RenderWidget* renderWidget = toRenderWidget(renderer()); |
| 135 |
| 136 if (renderWidget) |
| 137 renderWidget->detachWidget(m_widget.get()); |
| 138 |
| 139 m_widget = widget; |
| 140 |
| 141 if (renderWidget) |
| 142 renderWidget->attachWidget(m_widget.get()); |
| 143 } |
| 144 |
| 145 Widget* HTMLFrameOwnerElement::widget() const |
| 146 { |
| 147 return m_widget.get(); |
| 148 } |
| 149 |
| 124 bool HTMLFrameOwnerElement::loadOrRedirectSubframe(const KURL& url, const Atomic
String& frameName, bool lockBackForwardList) | 150 bool HTMLFrameOwnerElement::loadOrRedirectSubframe(const KURL& url, const Atomic
String& frameName, bool lockBackForwardList) |
| 125 { | 151 { |
| 126 RefPtr<Frame> parentFrame = document().frame(); | 152 RefPtr<Frame> parentFrame = document().frame(); |
| 127 if (contentFrame()) { | 153 if (contentFrame()) { |
| 128 contentFrame()->navigationScheduler().scheduleLocationChange(document().
securityOrigin(), url.string(), parentFrame->loader().outgoingReferrer(), lockBa
ckForwardList); | 154 contentFrame()->navigationScheduler().scheduleLocationChange(document().
securityOrigin(), url.string(), parentFrame->loader().outgoingReferrer(), lockBa
ckForwardList); |
| 129 return true; | 155 return true; |
| 130 } | 156 } |
| 131 | 157 |
| 132 if (!document().securityOrigin()->canDisplay(url)) { | 158 if (!document().securityOrigin()->canDisplay(url)) { |
| 133 FrameLoader::reportLocalLoadFailed(parentFrame.get(), url.string()); | 159 FrameLoader::reportLocalLoadFailed(parentFrame.get(), url.string()); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 146 } | 172 } |
| 147 | 173 |
| 148 // All new frames will have m_isComplete set to true at this point due to sy
nchronously loading | 174 // All new frames will have m_isComplete set to true at this point due to sy
nchronously loading |
| 149 // an empty document in FrameLoader::init(). But many frames will now be sta
rting an | 175 // an empty document in FrameLoader::init(). But many frames will now be sta
rting an |
| 150 // asynchronous load of url, so we set m_isComplete to false and then check
if the load is | 176 // asynchronous load of url, so we set m_isComplete to false and then check
if the load is |
| 151 // actually completed below. (Note that we set m_isComplete to false even fo
r synchronous | 177 // actually completed below. (Note that we set m_isComplete to false even fo
r synchronous |
| 152 // loads, so that checkCompleted() below won't bail early.) | 178 // loads, so that checkCompleted() below won't bail early.) |
| 153 // FIXME: Can we remove this entirely? m_isComplete normally gets set to fal
se when a load is committed. | 179 // FIXME: Can we remove this entirely? m_isComplete normally gets set to fal
se when a load is committed. |
| 154 childFrame->loader().started(); | 180 childFrame->loader().started(); |
| 155 | 181 |
| 156 RenderObject* renderObject = renderer(); | |
| 157 FrameView* view = childFrame->view(); | 182 FrameView* view = childFrame->view(); |
| 158 if (renderObject && renderObject->isWidget() && view) | 183 if (view) |
| 159 toRenderWidget(renderObject)->setWidget(view); | 184 setWidget(view); |
| 160 | 185 |
| 161 // Some loads are performed synchronously (e.g., about:blank and loads | 186 // Some loads are performed synchronously (e.g., about:blank and loads |
| 162 // cancelled by returning a null ResourceRequest from requestFromDelegate). | 187 // cancelled by returning a null ResourceRequest from requestFromDelegate). |
| 163 // In these cases, the synchronous load would have finished | 188 // In these cases, the synchronous load would have finished |
| 164 // before we could connect the signals, so make sure to send the | 189 // before we could connect the signals, so make sure to send the |
| 165 // completed() signal for the child by hand and mark the load as being | 190 // completed() signal for the child by hand and mark the load as being |
| 166 // complete. | 191 // complete. |
| 167 // FIXME: In this case the Frame will have finished loading before | 192 // FIXME: In this case the Frame will have finished loading before |
| 168 // it's being added to the child list. It would be a good idea to | 193 // it's being added to the child list. It would be a good idea to |
| 169 // create the child first, then invoke the loader separately. | 194 // create the child first, then invoke the loader separately. |
| 170 if (childFrame->loader().state() == FrameStateComplete && !childFrame->loade
r().policyDocumentLoader()) | 195 if (childFrame->loader().state() == FrameStateComplete && !childFrame->loade
r().policyDocumentLoader()) |
| 171 childFrame->loader().checkCompleted(); | 196 childFrame->loader().checkCompleted(); |
| 172 return true; | 197 return true; |
| 173 } | 198 } |
| 174 | 199 |
| 175 | 200 |
| 176 } // namespace WebCore | 201 } // namespace WebCore |
| OLD | NEW |