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

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

Issue 189573002: Convert HTMLFrameOwnerElement and FocusController to use Frame. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Missed a null check Created 6 years, 8 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
« no previous file with comments | « Source/core/html/HTMLFrameOwnerElement.h ('k') | Source/core/inspector/InspectorDOMAgent.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) 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
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(LocalFrame& frame) 54 void HTMLFrameOwnerElement::setContentFrame(Frame& 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 (LocalFrame* frame = contentFrame()) { 83 if (Frame* frame = contentFrame()) {
84 RefPtr<LocalFrame> protect(frame); 84 RefPtr<Frame> protect(frame);
85 frame->loader().frameDetached(); 85 if (frame->isLocalFrame())
86 toLocalFrame(frame)->loader().frameDetached();
86 frame->disconnectOwnerElement(); 87 frame->disconnectOwnerElement();
87 } 88 }
88 } 89 }
89 90
90 HTMLFrameOwnerElement::~HTMLFrameOwnerElement() 91 HTMLFrameOwnerElement::~HTMLFrameOwnerElement()
91 { 92 {
92 if (m_contentFrame) 93 if (m_contentFrame)
93 m_contentFrame->disconnectOwnerElement(); 94 m_contentFrame->disconnectOwnerElement();
94 } 95 }
95 96
(...skipping 21 matching lines...) Expand all
117 { 118 {
118 Document* doc = contentDocument(); 119 Document* doc = contentDocument();
119 if (doc && doc->isSVGDocument()) 120 if (doc && doc->isSVGDocument())
120 return toSVGDocument(doc); 121 return toSVGDocument(doc);
121 return 0; 122 return 0;
122 } 123 }
123 124
124 bool HTMLFrameOwnerElement::loadOrRedirectSubframe(const KURL& url, const Atomic String& frameName, bool lockBackForwardList) 125 bool HTMLFrameOwnerElement::loadOrRedirectSubframe(const KURL& url, const Atomic String& frameName, bool lockBackForwardList)
125 { 126 {
126 RefPtr<LocalFrame> parentFrame = document().frame(); 127 RefPtr<LocalFrame> parentFrame = document().frame();
127 if (contentFrame()) { 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.
128 contentFrame()->navigationScheduler().scheduleLocationChange(&document() , url.string(), Referrer(document().outgoingReferrer(), document().referrerPolic y()), lockBackForwardList); 129 if (contentFrame() && contentFrame()->isLocalFrame()) {
130 toLocalFrame(contentFrame())->navigationScheduler().scheduleLocationChan ge(&document(), url.string(), Referrer(document().outgoingReferrer(), document() .referrerPolicy()), lockBackForwardList);
129 return true; 131 return true;
130 } 132 }
131 133
132 if (!document().securityOrigin()->canDisplay(url)) { 134 if (!document().securityOrigin()->canDisplay(url)) {
133 FrameLoader::reportLocalLoadFailed(parentFrame.get(), url.string()); 135 FrameLoader::reportLocalLoadFailed(parentFrame.get(), url.string());
134 return false; 136 return false;
135 } 137 }
136 138
137 if (!SubframeLoadingDisabler::canLoadFrame(*this)) 139 if (!SubframeLoadingDisabler::canLoadFrame(*this))
138 return false; 140 return false;
(...skipping 28 matching lines...) Expand all
167 // FIXME: In this case the LocalFrame will have finished loading before 169 // FIXME: In this case the LocalFrame will have finished loading before
168 // it's being added to the child list. It would be a good idea to 170 // 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. 171 // create the child first, then invoke the loader separately.
170 if (childFrame->loader().state() == FrameStateComplete && !childFrame->loade r().policyDocumentLoader()) 172 if (childFrame->loader().state() == FrameStateComplete && !childFrame->loade r().policyDocumentLoader())
171 childFrame->loader().checkCompleted(); 173 childFrame->loader().checkCompleted();
172 return true; 174 return true;
173 } 175 }
174 176
175 177
176 } // namespace WebCore 178 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/html/HTMLFrameOwnerElement.h ('k') | Source/core/inspector/InspectorDOMAgent.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698