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

Unified Diff: Source/core/frame/Frame.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/frame/Frame.h ('k') | Source/core/frame/LocalFrame.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/frame/Frame.cpp
diff --git a/Source/core/frame/Frame.cpp b/Source/core/frame/Frame.cpp
index f0e9ee750cf512ad87c65aaea8271635f279a487..0865ffa5337121288b0d4ee8d3182760b641f9b1 100644
--- a/Source/core/frame/Frame.cpp
+++ b/Source/core/frame/Frame.cpp
@@ -79,10 +79,16 @@ Frame::Frame(FrameHost* host, HTMLFrameOwnerElement* ownerElement)
#ifndef NDEBUG
frameCounter.increment();
#endif
+
+ if (this->ownerElement()) {
+ page()->incrementSubframeCount();
+ this->ownerElement()->setContentFrame(*this);
+ }
}
Frame::~Frame()
{
+ disconnectOwnerElement();
setDOMWindow(nullptr);
// FIXME: We should not be doing all this work inside the destructor
@@ -179,4 +185,18 @@ bool Frame::isMainFrame() const
return page && this == page->mainFrame();
}
+void Frame::disconnectOwnerElement()
+{
+ // FIXME: The semantics here are specific to LocalFrame and will need to change
+ // when RemoteFrames no longer have Documents.
+ if (ownerElement()) {
+ if (Document* doc = document())
+ doc->topDocument().clearAXObjectCache();
+ ownerElement()->clearContentFrame();
+ if (page())
+ page()->decrementSubframeCount();
+ }
+ m_ownerElement = 0;
+}
+
} // namespace WebCore
« no previous file with comments | « Source/core/frame/Frame.h ('k') | Source/core/frame/LocalFrame.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698