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

Side by Side Diff: Source/core/frame/Frame.cpp

Issue 235553006: Move Document pointer from Frame to LocalFrame. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
3 * 1999 Lars Knoll <knoll@kde.org> 3 * 1999 Lars Knoll <knoll@kde.org>
4 * 1999 Antti Koivisto <koivisto@kde.org> 4 * 1999 Antti Koivisto <koivisto@kde.org>
5 * 2000 Simon Hausmann <hausmann@kde.org> 5 * 2000 Simon Hausmann <hausmann@kde.org>
6 * 2000 Stefan Schimanski <1Stein@gmx.de> 6 * 2000 Stefan Schimanski <1Stein@gmx.de>
7 * 2001 George Staikos <staikos@kde.org> 7 * 2001 George Staikos <staikos@kde.org>
8 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. 8 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
9 * Copyright (C) 2005 Alexey Proskuryakov <ap@nypop.com> 9 * Copyright (C) 2005 Alexey Proskuryakov <ap@nypop.com>
10 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 10 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
(...skipping 28 matching lines...) Expand all
39 #include "core/html/HTMLFrameElementBase.h" 39 #include "core/html/HTMLFrameElementBase.h"
40 #include "core/inspector/InspectorInstrumentation.h" 40 #include "core/inspector/InspectorInstrumentation.h"
41 #include "core/loader/EmptyClients.h" 41 #include "core/loader/EmptyClients.h"
42 #include "core/loader/FrameLoaderClient.h" 42 #include "core/loader/FrameLoaderClient.h"
43 #include "core/page/Chrome.h" 43 #include "core/page/Chrome.h"
44 #include "core/page/ChromeClient.h" 44 #include "core/page/ChromeClient.h"
45 #include "core/page/EventHandler.h" 45 #include "core/page/EventHandler.h"
46 #include "core/page/FocusController.h" 46 #include "core/page/FocusController.h"
47 #include "core/page/Page.h" 47 #include "core/page/Page.h"
48 #include "core/rendering/RenderPart.h" 48 #include "core/rendering/RenderPart.h"
49 #include "core/rendering/RenderView.h"
50 #include "public/platform/WebLayer.h" 49 #include "public/platform/WebLayer.h"
51 #include "wtf/PassOwnPtr.h" 50 #include "wtf/PassOwnPtr.h"
52 #include "wtf/RefCountedLeakCounter.h" 51 #include "wtf/RefCountedLeakCounter.h"
53 52
54 namespace WebCore { 53 namespace WebCore {
55 54
56 using namespace HTMLNames; 55 using namespace HTMLNames;
57 56
58 namespace { 57 namespace {
59 58
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 return client; 144 return client;
146 } 145 }
147 146
148 ChromeClient& Frame::chromeClient() const 147 ChromeClient& Frame::chromeClient() const
149 { 148 {
150 if (Page* page = this->page()) 149 if (Page* page = this->page())
151 return page->chrome().client(); 150 return page->chrome().client();
152 return emptyChromeClient(); 151 return emptyChromeClient();
153 } 152 }
154 153
155 Document* Frame::document() const
156 {
157 return m_domWindow ? m_domWindow->document() : 0;
158 }
159
160 RenderView* Frame::contentRenderer() const
161 {
162 return document() ? document()->renderView() : 0;
163 }
164
165 RenderPart* Frame::ownerRenderer() const 154 RenderPart* Frame::ownerRenderer() const
166 { 155 {
167 if (!ownerElement()) 156 if (!ownerElement())
168 return 0; 157 return 0;
169 RenderObject* object = ownerElement()->renderer(); 158 RenderObject* object = ownerElement()->renderer();
170 if (!object) 159 if (!object)
171 return 0; 160 return 0;
172 // FIXME: If <object> is ever fixed to disassociate itself from frames 161 // FIXME: If <object> is ever fixed to disassociate itself from frames
173 // that it has started but canceled, then this can turn into an ASSERT 162 // that it has started but canceled, then this can turn into an ASSERT
174 // since ownerElement() would be 0 when the load is canceled. 163 // since ownerElement() would be 0 when the load is canceled.
(...skipping 23 matching lines...) Expand all
198 } 187 }
199 188
200 bool Frame::isMainFrame() const 189 bool Frame::isMainFrame() const
201 { 190 {
202 Page* page = this->page(); 191 Page* page = this->page();
203 return page && this == page->mainFrame(); 192 return page && this == page->mainFrame();
204 } 193 }
205 194
206 void Frame::disconnectOwnerElement() 195 void Frame::disconnectOwnerElement()
207 { 196 {
208 // FIXME: The semantics here are specific to LocalFrame and will need to cha nge
209 // when RemoteFrames no longer have Documents.
210 if (ownerElement()) { 197 if (ownerElement()) {
211 if (Document* doc = document())
212 doc->topDocument().clearAXObjectCache();
213 ownerElement()->clearContentFrame(); 198 ownerElement()->clearContentFrame();
214 if (page()) 199 if (page())
215 page()->decrementSubframeCount(); 200 page()->decrementSubframeCount();
216 } 201 }
217 m_ownerElement = 0; 202 m_ownerElement = 0;
218 } 203 }
219 204
220 } // namespace WebCore 205 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698