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

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

Issue 2285253003: Move TopDocumentRootScrollerController to a separate object on FrameHost (Closed)
Patch Set: None Created 4 years, 3 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 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 ? m_frame->localDOMWindow()->maybeCustomElements() 466 ? m_frame->localDOMWindow()->maybeCustomElements()
467 : nullptr; 467 : nullptr;
468 if (registry && m_registrationContext) 468 if (registry && m_registrationContext)
469 registry->entangle(m_registrationContext); 469 registry->entangle(m_registrationContext);
470 } else if (m_importsController) { 470 } else if (m_importsController) {
471 m_fetcher = FrameFetchContext::createContextAndFetcher(nullptr, this); 471 m_fetcher = FrameFetchContext::createContextAndFetcher(nullptr, this);
472 } else { 472 } else {
473 m_fetcher = ResourceFetcher::create(nullptr); 473 m_fetcher = ResourceFetcher::create(nullptr);
474 } 474 }
475 475
476 // TODO(bokan): This will probably blow up if we don't have an m_frame here 476 m_rootScrollerController = RootScrollerController::create(*this);
477 // since we'll assume a child RootScrollerController. crbug.com/505516.
478 m_rootScrollerController = isInMainFrame()
479 ? TopDocumentRootScrollerController::create(*this)
480 : RootScrollerController::create(*this);
481 477
482 // We depend on the url getting immediately set in subframes, but we 478 // We depend on the url getting immediately set in subframes, but we
483 // also depend on the url NOT getting immediately set in opened windows. 479 // also depend on the url NOT getting immediately set in opened windows.
484 // See fast/dom/early-frame-url.html 480 // See fast/dom/early-frame-url.html
485 // and fast/dom/location-new-window-no-crash.html, respectively. 481 // and fast/dom/location-new-window-no-crash.html, respectively.
486 // FIXME: Can/should we unify this behavior? 482 // FIXME: Can/should we unify this behavior?
487 if (initializer.shouldSetURL()) 483 if (initializer.shouldSetURL())
488 setURL(initializer.url()); 484 setURL(initializer.url());
489 485
490 initSecurityContext(initializer); 486 initSecurityContext(initializer);
(...skipping 1640 matching lines...) Expand 10 before | Expand all | Expand 10 after
2131 2127
2132 // The TextAutosizer can't update layout view info while the Document is det ached, so update now in case anything changed. 2128 // The TextAutosizer can't update layout view info while the Document is det ached, so update now in case anything changed.
2133 if (TextAutosizer* autosizer = textAutosizer()) 2129 if (TextAutosizer* autosizer = textAutosizer())
2134 autosizer->updatePageInfo(); 2130 autosizer->updatePageInfo();
2135 2131
2136 m_frame->selection().documentAttached(this); 2132 m_frame->selection().documentAttached(this);
2137 m_lifecycle.advanceTo(DocumentLifecycle::StyleClean); 2133 m_lifecycle.advanceTo(DocumentLifecycle::StyleClean);
2138 2134
2139 if (view()) 2135 if (view())
2140 view()->didAttachDocument(); 2136 view()->didAttachDocument();
2141
2142 // Needs to be called after view()->didAttachDocument().
2143 m_rootScrollerController->didAttachDocument();
2144 } 2137 }
2145 2138
2146 void Document::detachLayoutTree(const AttachContext& context) 2139 void Document::detachLayoutTree(const AttachContext& context)
2147 { 2140 {
2148 TRACE_EVENT0("blink", "Document::detach"); 2141 TRACE_EVENT0("blink", "Document::detach");
2149 RELEASE_ASSERT(!m_frame || m_frame->tree().childCount() == 0); 2142 RELEASE_ASSERT(!m_frame || m_frame->tree().childCount() == 0);
2150 if (!isActive()) 2143 if (!isActive())
2151 return; 2144 return;
2152 2145
2153 // Frame navigation can cause a new Document to be attached. Don't allow tha t, since that will 2146 // Frame navigation can cause a new Document to be attached. Don't allow tha t, since that will
(...skipping 3896 matching lines...) Expand 10 before | Expand all | Expand 10 after
6050 } 6043 }
6051 6044
6052 void showLiveDocumentInstances() 6045 void showLiveDocumentInstances()
6053 { 6046 {
6054 WeakDocumentSet& set = liveDocumentSet(); 6047 WeakDocumentSet& set = liveDocumentSet();
6055 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6048 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6056 for (Document* document : set) 6049 for (Document* document : set)
6057 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get String().utf8().data()); 6050 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get String().utf8().data());
6058 } 6051 }
6059 #endif 6052 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698