Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(592)

Side by Side Diff: Source/core/html/HTMLFrameElementBase.cpp

Issue 126443005: Use TreeScope::completeURL and baseURL instead of the Document versions (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased again, passes tests Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/html/HTMLFormElement.cpp ('k') | Source/core/html/HTMLHtmlElement.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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
OLDNEW
« no previous file with comments | « Source/core/html/HTMLFormElement.cpp ('k') | Source/core/html/HTMLHtmlElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698