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

Side by Side Diff: Source/core/frame/LocalFrame.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, 9 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/frame/LocalFrame.h ('k') | Source/core/html/HTMLFrameElementBase.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) 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 , m_editor(Editor::create(*this)) 96 , m_editor(Editor::create(*this))
97 , m_spellChecker(SpellChecker::create(*this)) 97 , m_spellChecker(SpellChecker::create(*this))
98 , m_selection(adoptPtr(new FrameSelection(this))) 98 , m_selection(adoptPtr(new FrameSelection(this)))
99 , m_eventHandler(adoptPtr(new EventHandler(this))) 99 , m_eventHandler(adoptPtr(new EventHandler(this)))
100 , m_inputMethodController(InputMethodController::create(*this)) 100 , m_inputMethodController(InputMethodController::create(*this))
101 , m_pageZoomFactor(parentPageZoomFactor(this)) 101 , m_pageZoomFactor(parentPageZoomFactor(this))
102 , m_textZoomFactor(parentTextZoomFactor(this)) 102 , m_textZoomFactor(parentTextZoomFactor(this))
103 , m_orientation(0) 103 , m_orientation(0)
104 , m_inViewSourceMode(false) 104 , m_inViewSourceMode(false)
105 { 105 {
106 if (this->ownerElement()) {
107 page()->incrementSubframeCount();
108 this->ownerElement()->setContentFrame(*this);
109 }
110 } 106 }
111 107
112 PassRefPtr<LocalFrame> LocalFrame::create(FrameLoaderClient* client, FrameHost* host, HTMLFrameOwnerElement* ownerElement) 108 PassRefPtr<LocalFrame> LocalFrame::create(FrameLoaderClient* client, FrameHost* host, HTMLFrameOwnerElement* ownerElement)
113 { 109 {
114 RefPtr<LocalFrame> frame = adoptRef(new LocalFrame(client, host, ownerElemen t)); 110 RefPtr<LocalFrame> frame = adoptRef(new LocalFrame(client, host, ownerElemen t));
115 if (!frame->ownerElement()) 111 if (!frame->ownerElement())
116 frame->page()->setMainFrame(frame); 112 frame->page()->setMainFrame(frame);
117 InspectorInstrumentation::frameAttachedToParent(frame.get()); 113 InspectorInstrumentation::frameAttachedToParent(frame.get());
118 return frame.release(); 114 return frame.release();
119 } 115 }
120 116
121 LocalFrame::~LocalFrame() 117 LocalFrame::~LocalFrame()
122 { 118 {
123 setView(nullptr); 119 setView(nullptr);
124 loader().clear(); 120 loader().clear();
125 setDOMWindow(nullptr); 121 setDOMWindow(nullptr);
126
127 disconnectOwnerElement();
128 } 122 }
129 123
130 bool LocalFrame::inScope(TreeScope* scope) const 124 bool LocalFrame::inScope(TreeScope* scope) const
131 { 125 {
132 ASSERT(scope); 126 ASSERT(scope);
133 Document* doc = document(); 127 Document* doc = document();
134 if (!doc) 128 if (!doc)
135 return false; 129 return false;
136 HTMLFrameOwnerElement* owner = doc->ownerElement(); 130 HTMLFrameOwnerElement* owner = doc->ownerElement();
137 if (!owner) 131 if (!owner)
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 page()->scrollingCoordinator()->willDestroyScrollableArea(m_view.get()); 268 page()->scrollingCoordinator()->willDestroyScrollableArea(m_view.get());
275 } 269 }
276 270
277 void LocalFrame::detachFromFrameHost() 271 void LocalFrame::detachFromFrameHost()
278 { 272 {
279 // We should never be detatching the page during a Layout. 273 // We should never be detatching the page during a Layout.
280 RELEASE_ASSERT(!m_view || !m_view->isInPerformLayout()); 274 RELEASE_ASSERT(!m_view || !m_view->isInPerformLayout());
281 Frame::detachFromFrameHost(); 275 Frame::detachFromFrameHost();
282 } 276 }
283 277
284 void LocalFrame::disconnectOwnerElement()
285 {
286 if (ownerElement()) {
287 if (Document* doc = document())
288 doc->topDocument().clearAXObjectCache();
289 ownerElement()->clearContentFrame();
290 if (page())
291 page()->decrementSubframeCount();
292 }
293 m_ownerElement = 0;
294 }
295
296 String LocalFrame::documentTypeString() const 278 String LocalFrame::documentTypeString() const
297 { 279 {
298 if (DocumentType* doctype = document()->doctype()) 280 if (DocumentType* doctype = document()->doctype())
299 return createMarkup(doctype); 281 return createMarkup(doctype);
300 282
301 return String(); 283 return String();
302 } 284 }
303 285
304 String LocalFrame::selectedText() const 286 String LocalFrame::selectedText() const
305 { 287 {
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 { 611 {
630 if (!m_host) 612 if (!m_host)
631 return 0; 613 return 0;
632 614
633 double ratio = m_host->deviceScaleFactor(); 615 double ratio = m_host->deviceScaleFactor();
634 ratio *= pageZoomFactor(); 616 ratio *= pageZoomFactor();
635 return ratio; 617 return ratio;
636 } 618 }
637 619
638 } // namespace WebCore 620 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/frame/LocalFrame.h ('k') | Source/core/html/HTMLFrameElementBase.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698