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

Side by Side Diff: third_party/WebKit/Source/core/dom/Document.cpp

Issue 2001083002: Explicit management of FrameSelection availability (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 2016-06-06T17:09:04 Created 4 years, 6 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) 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) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved.
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved.
(...skipping 2101 matching lines...) Expand 10 before | Expand all | Expand 10 after
2112 m_layoutView->setIsInWindow(true); 2112 m_layoutView->setIsInWindow(true);
2113 m_layoutView->setStyle(StyleResolver::styleForDocument(*this)); 2113 m_layoutView->setStyle(StyleResolver::styleForDocument(*this));
2114 m_layoutView->compositor()->setNeedsCompositingUpdate(CompositingUpdateAfter CompositingInputChange); 2114 m_layoutView->compositor()->setNeedsCompositingUpdate(CompositingUpdateAfter CompositingInputChange);
2115 2115
2116 ContainerNode::attach(context); 2116 ContainerNode::attach(context);
2117 2117
2118 // The TextAutosizer can't update layout view info while the Document is det ached, so update now in case anything changed. 2118 // The TextAutosizer can't update layout view info while the Document is det ached, so update now in case anything changed.
2119 if (TextAutosizer* autosizer = textAutosizer()) 2119 if (TextAutosizer* autosizer = textAutosizer())
2120 autosizer->updatePageInfo(); 2120 autosizer->updatePageInfo();
2121 2121
2122 m_frame->selection().documentAttached(this);
2122 m_lifecycle.advanceTo(DocumentLifecycle::StyleClean); 2123 m_lifecycle.advanceTo(DocumentLifecycle::StyleClean);
2123 } 2124 }
2124 2125
2125 void Document::detach(const AttachContext& context) 2126 void Document::detach(const AttachContext& context)
2126 { 2127 {
2127 TRACE_EVENT0("blink", "Document::detach"); 2128 TRACE_EVENT0("blink", "Document::detach");
2128 RELEASE_ASSERT(!m_frame || m_frame->tree().childCount() == 0); 2129 RELEASE_ASSERT(!m_frame || m_frame->tree().childCount() == 0);
2129 if (!isActive()) 2130 if (!isActive())
2130 return; 2131 return;
2131 2132
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
2204 for (Node& node : NodeTraversal::descendantsOf(*this)) { 2205 for (Node& node : NodeTraversal::descendantsOf(*this)) {
2205 cache->remove(&node); 2206 cache->remove(&node);
2206 } 2207 }
2207 } 2208 }
2208 } 2209 }
2209 2210
2210 styleEngine().didDetach(); 2211 styleEngine().didDetach();
2211 2212
2212 frameHost()->eventHandlerRegistry().documentDetached(*this); 2213 frameHost()->eventHandlerRegistry().documentDetached(*this);
2213 2214
2215 m_frame->selection().documentDetached(*this);
2214 m_frame->inputMethodController().documentDetached(); 2216 m_frame->inputMethodController().documentDetached();
2215 2217
2216 // If this Document is associated with a live DocumentLoader, the 2218 // If this Document is associated with a live DocumentLoader, the
2217 // DocumentLoader will take care of clearing the FetchContext. Deferring 2219 // DocumentLoader will take care of clearing the FetchContext. Deferring
2218 // to the DocumentLoader when possible also prevents prematurely clearing 2220 // to the DocumentLoader when possible also prevents prematurely clearing
2219 // the context in the case where multiple Documents end up associated with 2221 // the context in the case where multiple Documents end up associated with
2220 // a single DocumentLoader (e.g., navigating to a javascript: url). 2222 // a single DocumentLoader (e.g., navigating to a javascript: url).
2221 if (!loader()) 2223 if (!loader())
2222 m_fetcher->clearContext(); 2224 m_fetcher->clearContext();
2223 // If this document is the master for an HTMLImportsController, sever that 2225 // If this document is the master for an HTMLImportsController, sever that
(...skipping 3775 matching lines...) Expand 10 before | Expand all | Expand 10 after
5999 #ifndef NDEBUG 6001 #ifndef NDEBUG
6000 using namespace blink; 6002 using namespace blink;
6001 void showLiveDocumentInstances() 6003 void showLiveDocumentInstances()
6002 { 6004 {
6003 WeakDocumentSet& set = liveDocumentSet(); 6005 WeakDocumentSet& set = liveDocumentSet();
6004 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6006 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6005 for (Document* document : set) 6007 for (Document* document : set)
6006 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get String().utf8().data()); 6008 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get String().utf8().data());
6007 } 6009 }
6008 #endif 6010 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698