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

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

Issue 2128553002: Make rootScroller the layout viewport. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@viewportScrollCallbackInterface
Patch Set: Rebase + comment fix in test Created 4 years, 5 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 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 provideContextFeaturesToDocumentFrom(*this, *m_frame->page()); 454 provideContextFeaturesToDocumentFrom(*this, *m_frame->page());
455 455
456 m_fetcher = m_frame->loader().documentLoader()->fetcher(); 456 m_fetcher = m_frame->loader().documentLoader()->fetcher();
457 FrameFetchContext::provideDocumentToContext(m_fetcher->context(), this); 457 FrameFetchContext::provideDocumentToContext(m_fetcher->context(), this);
458 } else if (m_importsController) { 458 } else if (m_importsController) {
459 m_fetcher = FrameFetchContext::createContextAndFetcher(nullptr, this); 459 m_fetcher = FrameFetchContext::createContextAndFetcher(nullptr, this);
460 } else { 460 } else {
461 m_fetcher = ResourceFetcher::create(nullptr); 461 m_fetcher = ResourceFetcher::create(nullptr);
462 } 462 }
463 463
464 ViewportScrollCallback* applyScroll = nullptr; 464 m_rootScrollerController = RootScrollerController::create(*this);
465 if (isInMainFrame()) {
466 applyScroll = RootViewportScrollCallback::create(
467 &frameHost()->topControls(), &frameHost()->overscrollController());
468 } else {
469 applyScroll =
470 ChildViewportScrollCallback::create();
471 }
472
473 m_rootScrollerController =
474 RootScrollerController::create(*this, applyScroll);
475 465
476 // We depend on the url getting immediately set in subframes, but we 466 // We depend on the url getting immediately set in subframes, but we
477 // also depend on the url NOT getting immediately set in opened windows. 467 // also depend on the url NOT getting immediately set in opened windows.
478 // See fast/dom/early-frame-url.html 468 // See fast/dom/early-frame-url.html
479 // and fast/dom/location-new-window-no-crash.html, respectively. 469 // and fast/dom/location-new-window-no-crash.html, respectively.
480 // FIXME: Can/should we unify this behavior? 470 // FIXME: Can/should we unify this behavior?
481 if (initializer.shouldSetURL()) 471 if (initializer.shouldSetURL())
482 setURL(initializer.url()); 472 setURL(initializer.url());
483 473
484 initSecurityContext(initializer); 474 initSecurityContext(initializer);
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 // frames when there's only a <head>, but such documents are pretty rare. 584 // frames when there's only a <head>, but such documents are pretty rare.
595 if (m_documentElement && !isHTMLDocument()) 585 if (m_documentElement && !isHTMLDocument())
596 beginLifecycleUpdatesIfRenderingReady(); 586 beginLifecycleUpdatesIfRenderingReady();
597 } 587 }
598 588
599 void Document::setRootScroller(Element* newScroller, ExceptionState& exceptionSt ate) 589 void Document::setRootScroller(Element* newScroller, ExceptionState& exceptionSt ate)
600 { 590 {
601 m_rootScrollerController->set(newScroller); 591 m_rootScrollerController->set(newScroller);
602 } 592 }
603 593
594 void Document::initializeRootScroller(ViewportScrollCallback* callback)
595 {
596 m_rootScrollerController->setViewportScrollCallback(callback);
597 }
598
604 Element* Document::rootScroller() const 599 Element* Document::rootScroller() const
605 { 600 {
606 return m_rootScrollerController->get(); 601 return m_rootScrollerController->get();
607 } 602 }
608 603
609 const Element* Document::effectiveRootScroller() const 604 const Element* Document::effectiveRootScroller() const
610 { 605 {
611 return m_rootScrollerController->effectiveRootScroller(); 606 return m_rootScrollerController->effectiveRootScroller();
612 } 607 }
613 608
(...skipping 5421 matching lines...) Expand 10 before | Expand all | Expand 10 after
6035 } 6030 }
6036 6031
6037 void showLiveDocumentInstances() 6032 void showLiveDocumentInstances()
6038 { 6033 {
6039 WeakDocumentSet& set = liveDocumentSet(); 6034 WeakDocumentSet& set = liveDocumentSet();
6040 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6035 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6041 for (Document* document : set) 6036 for (Document* document : set)
6042 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get String().utf8().data()); 6037 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get String().utf8().data());
6043 } 6038 }
6044 #endif 6039 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.h ('k') | third_party/WebKit/Source/core/frame/FrameView.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698