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

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

Issue 2273163002: Cleanup and refactor RootScrollerController. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed class comment 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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 #include "core/loader/ImageLoader.h" 196 #include "core/loader/ImageLoader.h"
197 #include "core/loader/NavigationScheduler.h" 197 #include "core/loader/NavigationScheduler.h"
198 #include "core/loader/appcache/ApplicationCacheHost.h" 198 #include "core/loader/appcache/ApplicationCacheHost.h"
199 #include "core/observer/ResizeObserverController.h" 199 #include "core/observer/ResizeObserverController.h"
200 #include "core/page/ChromeClient.h" 200 #include "core/page/ChromeClient.h"
201 #include "core/page/EventWithHitTestResults.h" 201 #include "core/page/EventWithHitTestResults.h"
202 #include "core/page/FocusController.h" 202 #include "core/page/FocusController.h"
203 #include "core/page/FrameTree.h" 203 #include "core/page/FrameTree.h"
204 #include "core/page/Page.h" 204 #include "core/page/Page.h"
205 #include "core/page/PointerLockController.h" 205 #include "core/page/PointerLockController.h"
206 #include "core/page/scrolling/ChildViewportScrollCallback.h"
207 #include "core/page/scrolling/RootScrollerController.h" 206 #include "core/page/scrolling/RootScrollerController.h"
208 #include "core/page/scrolling/RootViewportScrollCallback.h"
209 #include "core/page/scrolling/ScrollStateCallback.h" 207 #include "core/page/scrolling/ScrollStateCallback.h"
210 #include "core/page/scrolling/ScrollingCoordinator.h" 208 #include "core/page/scrolling/ScrollingCoordinator.h"
211 #include "core/page/scrolling/SnapCoordinator.h" 209 #include "core/page/scrolling/SnapCoordinator.h"
210 #include "core/page/scrolling/ViewportScrollCallback.h"
212 #include "core/svg/SVGDocumentExtensions.h" 211 #include "core/svg/SVGDocumentExtensions.h"
213 #include "core/svg/SVGScriptElement.h" 212 #include "core/svg/SVGScriptElement.h"
214 #include "core/svg/SVGTitleElement.h" 213 #include "core/svg/SVGTitleElement.h"
215 #include "core/svg/SVGUseElement.h" 214 #include "core/svg/SVGUseElement.h"
216 #include "core/timing/DOMWindowPerformance.h" 215 #include "core/timing/DOMWindowPerformance.h"
217 #include "core/timing/Performance.h" 216 #include "core/timing/Performance.h"
218 #include "core/workers/SharedWorkerRepositoryClient.h" 217 #include "core/workers/SharedWorkerRepositoryClient.h"
219 #include "core/xml/parser/XMLDocumentParser.h" 218 #include "core/xml/parser/XMLDocumentParser.h"
220 #include "platform/DateComponents.h" 219 #include "platform/DateComponents.h"
221 #include "platform/EventDispatchForbiddenScope.h" 220 #include "platform/EventDispatchForbiddenScope.h"
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 // frames when there's only a <head>, but such documents are pretty rare. 596 // frames when there's only a <head>, but such documents are pretty rare.
598 if (m_documentElement && !isHTMLDocument()) 597 if (m_documentElement && !isHTMLDocument())
599 beginLifecycleUpdatesIfRenderingReady(); 598 beginLifecycleUpdatesIfRenderingReady();
600 } 599 }
601 600
602 void Document::setRootScroller(Element* newScroller, ExceptionState& exceptionSt ate) 601 void Document::setRootScroller(Element* newScroller, ExceptionState& exceptionSt ate)
603 { 602 {
604 m_rootScrollerController->set(newScroller); 603 m_rootScrollerController->set(newScroller);
605 } 604 }
606 605
607 void Document::initializeRootScroller(ViewportScrollCallback* callback)
608 {
609 m_rootScrollerController->setViewportScrollCallback(callback);
610 }
611
612 Element* Document::rootScroller() const 606 Element* Document::rootScroller() const
613 { 607 {
614 return m_rootScrollerController->get(); 608 return m_rootScrollerController->get();
615 } 609 }
616 610
617 bool Document::isViewportScrollCallback(const ScrollStateCallback* callback)
618 {
619 if (!callback)
620 return false;
621
622 return callback == m_rootScrollerController->viewportScrollCallback();
623 }
624
625 bool Document::isInMainFrame() const 611 bool Document::isInMainFrame() const
626 { 612 {
627 return frame() && frame()->isMainFrame(); 613 return frame() && frame()->isMainFrame();
628 } 614 }
629 615
630 AtomicString Document::convertLocalName(const AtomicString& name) 616 AtomicString Document::convertLocalName(const AtomicString& name)
631 { 617 {
632 return isHTMLDocument() ? name.lower() : name; 618 return isHTMLDocument() ? name.lower() : name;
633 } 619 }
634 620
(...skipping 1493 matching lines...) Expand 10 before | Expand all | Expand 10 after
2128 2114
2129 // The TextAutosizer can't update layout view info while the Document is det ached, so update now in case anything changed. 2115 // The TextAutosizer can't update layout view info while the Document is det ached, so update now in case anything changed.
2130 if (TextAutosizer* autosizer = textAutosizer()) 2116 if (TextAutosizer* autosizer = textAutosizer())
2131 autosizer->updatePageInfo(); 2117 autosizer->updatePageInfo();
2132 2118
2133 m_frame->selection().documentAttached(this); 2119 m_frame->selection().documentAttached(this);
2134 m_lifecycle.advanceTo(DocumentLifecycle::StyleClean); 2120 m_lifecycle.advanceTo(DocumentLifecycle::StyleClean);
2135 2121
2136 if (view()) 2122 if (view())
2137 view()->didAttachDocument(); 2123 view()->didAttachDocument();
2124
2125 // Needs to be called after view()->didAttachDocument().
2126 m_rootScrollerController->didAttachDocument();
2138 } 2127 }
2139 2128
2140 void Document::detachLayoutTree(const AttachContext& context) 2129 void Document::detachLayoutTree(const AttachContext& context)
2141 { 2130 {
2142 TRACE_EVENT0("blink", "Document::detach"); 2131 TRACE_EVENT0("blink", "Document::detach");
2143 RELEASE_ASSERT(!m_frame || m_frame->tree().childCount() == 0); 2132 RELEASE_ASSERT(!m_frame || m_frame->tree().childCount() == 0);
2144 if (!isActive()) 2133 if (!isActive())
2145 return; 2134 return;
2146 2135
2147 // Frame navigation can cause a new Document to be attached. Don't allow tha t, since that will 2136 // Frame navigation can cause a new Document to be attached. Don't allow tha t, since that will
(...skipping 3892 matching lines...) Expand 10 before | Expand all | Expand 10 after
6040 } 6029 }
6041 6030
6042 void showLiveDocumentInstances() 6031 void showLiveDocumentInstances()
6043 { 6032 {
6044 WeakDocumentSet& set = liveDocumentSet(); 6033 WeakDocumentSet& set = liveDocumentSet();
6045 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6034 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6046 for (Document* document : set) 6035 for (Document* document : set)
6047 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get String().utf8().data()); 6036 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get String().utf8().data());
6048 } 6037 }
6049 #endif 6038 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.h ('k') | third_party/WebKit/Source/core/dom/Element.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698