| OLD | NEW |
| (Empty) |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef TopDocumentRootScrollerController_h | |
| 6 #define TopDocumentRootScrollerController_h | |
| 7 | |
| 8 #include "core/CoreExport.h" | |
| 9 #include "core/page/scrolling/RootScrollerController.h" | |
| 10 #include "platform/heap/Handle.h" | |
| 11 | |
| 12 namespace blink { | |
| 13 | |
| 14 class Document; | |
| 15 class Element; | |
| 16 class GraphicsLayer; | |
| 17 class ScrollStateCallback; | |
| 18 class ViewportScrollCallback; | |
| 19 | |
| 20 // The RootScrollerController used to manage the root scroller for the top | |
| 21 // level Document on a page. In addition to the regular RootScroller duties | |
| 22 // such as keeping track of which Element is set as root scroller and which is | |
| 23 // the effective root scroller, this class is also responsible for setting the | |
| 24 // ViewportApplyScroll on the one Element on a page that should apply viewport | |
| 25 // scrolling actions. | |
| 26 class CORE_EXPORT TopDocumentRootScrollerController | |
| 27 : public RootScrollerController { | |
| 28 public: | |
| 29 static TopDocumentRootScrollerController* create(Document&); | |
| 30 | |
| 31 DECLARE_VIRTUAL_TRACE(); | |
| 32 | |
| 33 // This class needs to be informed of changes to compositing so that it can | |
| 34 // update the compositor when the effective root scroller changes. | |
| 35 void didUpdateCompositing() override; | |
| 36 | |
| 37 // This class needs to be informed when the document has been attached to a | |
| 38 // FrameView so that we can initialize the viewport scroll callback. | |
| 39 void didAttachDocument() override; | |
| 40 | |
| 41 // Returns true if the given ScrollStateCallback is the ViewportScrollCallba
ck managed | |
| 42 // by this class. | |
| 43 // TODO(bokan): Temporarily needed to allow ScrollCustomization to | |
| 44 // differentiate between real custom callback and the built-in viewport | |
| 45 // apply scroll. crbug.com/623079. | |
| 46 bool isViewportScrollCallback( | |
| 47 const ScrollStateCallback*) const override; | |
| 48 | |
| 49 protected: | |
| 50 TopDocumentRootScrollerController(Document&); | |
| 51 | |
| 52 // Ensures the effective root scroller is currently valid and replaces it | |
| 53 // with the default if not. | |
| 54 void updateEffectiveRootScroller() override; | |
| 55 | |
| 56 private: | |
| 57 // Ensures that the element that should be used as the root scroller on the | |
| 58 // page has the m_viewportApplyScroll callback set on it. | |
| 59 void setViewportApplyScrollOnRootScroller(); | |
| 60 | |
| 61 // The apply-scroll callback that moves top controls and produces | |
| 62 // overscroll effects. This class makes sure this callback is set on the | |
| 63 // appropriate root scroller element. | |
| 64 Member<ViewportScrollCallback> m_viewportApplyScroll; | |
| 65 | |
| 66 // Tracks which element currently has the m_viewportApplyScroll set to it. | |
| 67 WeakMember<Element> m_currentViewportApplyScrollHost; | |
| 68 }; | |
| 69 | |
| 70 } // namespace blink | |
| 71 | |
| 72 #endif // RootScrollerController_h | |
| OLD | NEW |