| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2000 Simon Hausmann (hausmann@kde.org) | 4 * (C) 2000 Simon Hausmann (hausmann@kde.org) |
| 5 * (C) 2001 Dirk Mueller (mueller@kde.org) | 5 * (C) 2001 Dirk Mueller (mueller@kde.org) |
| 6 * Copyright (C) 2004, 2006, 2008, 2009 Apple Inc. All rights reserved. | 6 * Copyright (C) 2004, 2006, 2008, 2009 Apple Inc. All rights reserved. |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 , m_marginWidth(-1) | 48 , m_marginWidth(-1) |
| 49 , m_marginHeight(-1) | 49 , m_marginHeight(-1) |
| 50 { | 50 { |
| 51 } | 51 } |
| 52 | 52 |
| 53 bool HTMLFrameElementBase::isURLAllowed() const | 53 bool HTMLFrameElementBase::isURLAllowed() const |
| 54 { | 54 { |
| 55 if (m_URL.isEmpty()) | 55 if (m_URL.isEmpty()) |
| 56 return true; | 56 return true; |
| 57 | 57 |
| 58 const KURL& completeURL = document().completeURL(m_URL); | 58 const KURL& completeURL = treeScope().completeURL(m_URL); |
| 59 | 59 |
| 60 if (protocolIsJavaScript(completeURL)) { | 60 if (protocolIsJavaScript(completeURL)) { |
| 61 Document* contentDoc = this->contentDocument(); | 61 Document* contentDoc = this->contentDocument(); |
| 62 if (contentDoc && !ScriptController::canAccessFromCurrentOrigin(contentD
oc->frame())) | 62 if (contentDoc && !ScriptController::canAccessFromCurrentOrigin(contentD
oc->frame())) |
| 63 return false; | 63 return false; |
| 64 } | 64 } |
| 65 | 65 |
| 66 Frame* parentFrame = document().frame(); | 66 Frame* parentFrame = document().frame(); |
| 67 if (parentFrame) | 67 if (parentFrame) |
| 68 return parentFrame->isURLAllowed(completeURL); | 68 return parentFrame->isURLAllowed(completeURL); |
| 69 | 69 |
| 70 return true; | 70 return true; |
| 71 } | 71 } |
| 72 | 72 |
| 73 void HTMLFrameElementBase::openURL(bool lockBackForwardList) | 73 void HTMLFrameElementBase::openURL(bool lockBackForwardList) |
| 74 { | 74 { |
| 75 if (!isURLAllowed()) | 75 if (!isURLAllowed()) |
| 76 return; | 76 return; |
| 77 | 77 |
| 78 if (m_URL.isEmpty()) | 78 if (m_URL.isEmpty()) |
| 79 m_URL = AtomicString(blankURL().string()); | 79 m_URL = AtomicString(blankURL().string()); |
| 80 | 80 |
| 81 Frame* parentFrame = document().frame(); | 81 Frame* parentFrame = document().frame(); |
| 82 if (!parentFrame) | 82 if (!parentFrame) |
| 83 return; | 83 return; |
| 84 | 84 |
| 85 // Support for <frame src="javascript:string"> | 85 // Support for <frame src="javascript:string"> |
| 86 KURL scriptURL; | 86 KURL scriptURL; |
| 87 KURL url = document().completeURL(m_URL); | 87 KURL url = treeScope().completeURL(m_URL); |
| 88 if (protocolIsJavaScript(m_URL)) { | 88 if (protocolIsJavaScript(m_URL)) { |
| 89 scriptURL = url; | 89 scriptURL = url; |
| 90 url = blankURL(); | 90 url = blankURL(); |
| 91 } | 91 } |
| 92 | 92 |
| 93 if (!loadOrRedirectSubframe(url, m_frameName, lockBackForwardList)) | 93 if (!loadOrRedirectSubframe(url, m_frameName, lockBackForwardList)) |
| 94 return; | 94 return; |
| 95 if (!contentFrame() || scriptURL.isEmpty()) | 95 if (!contentFrame() || scriptURL.isEmpty()) |
| 96 return; | 96 return; |
| 97 contentFrame()->script().executeScriptIfJavaScriptURL(scriptURL); | 97 contentFrame()->script().executeScriptIfJavaScriptURL(scriptURL); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 if (RenderPart* part = renderPart()) { | 166 if (RenderPart* part = renderPart()) { |
| 167 if (Frame* frame = contentFrame()) | 167 if (Frame* frame = contentFrame()) |
| 168 part->setWidget(frame->view()); | 168 part->setWidget(frame->view()); |
| 169 } | 169 } |
| 170 } | 170 } |
| 171 | 171 |
| 172 KURL HTMLFrameElementBase::location() const | 172 KURL HTMLFrameElementBase::location() const |
| 173 { | 173 { |
| 174 if (fastHasAttribute(srcdocAttr)) | 174 if (fastHasAttribute(srcdocAttr)) |
| 175 return KURL(ParsedURLString, "about:srcdoc"); | 175 return KURL(ParsedURLString, "about:srcdoc"); |
| 176 return document().completeURL(getAttribute(srcAttr)); | 176 return treeScope().completeURL(getAttribute(srcAttr)); |
| 177 } | 177 } |
| 178 | 178 |
| 179 void HTMLFrameElementBase::setLocation(const String& str) | 179 void HTMLFrameElementBase::setLocation(const String& str) |
| 180 { | 180 { |
| 181 m_URL = AtomicString(str); | 181 m_URL = AtomicString(str); |
| 182 | 182 |
| 183 if (inDocument()) | 183 if (inDocument()) |
| 184 openURL(false); | 184 openURL(false); |
| 185 } | 185 } |
| 186 | 186 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 | 221 |
| 222 int HTMLFrameElementBase::height() | 222 int HTMLFrameElementBase::height() |
| 223 { | 223 { |
| 224 document().updateLayoutIgnorePendingStylesheets(); | 224 document().updateLayoutIgnorePendingStylesheets(); |
| 225 if (!renderBox()) | 225 if (!renderBox()) |
| 226 return 0; | 226 return 0; |
| 227 return renderBox()->height(); | 227 return renderBox()->height(); |
| 228 } | 228 } |
| 229 | 229 |
| 230 } // namespace WebCore | 230 } // namespace WebCore |
| OLD | NEW |