| Index: third_party/WebKit/Source/core/page/scrolling/RootScrollerController.h
|
| diff --git a/third_party/WebKit/Source/core/page/scrolling/RootScrollerController.h b/third_party/WebKit/Source/core/page/scrolling/RootScrollerController.h
|
| index 9a0dae610cb946ede9c9ed38ceac0c980c2a869e..c28c4f5fed14b07a2d9fe9306f8dc26262be85d8 100644
|
| --- a/third_party/WebKit/Source/core/page/scrolling/RootScrollerController.h
|
| +++ b/third_party/WebKit/Source/core/page/scrolling/RootScrollerController.h
|
| @@ -13,41 +13,36 @@ namespace blink {
|
| class Document;
|
| class Element;
|
| class GraphicsLayer;
|
| +class ScrollableArea;
|
| class ScrollStateCallback;
|
| -class ViewportScrollCallback;
|
|
|
| -// Manages the root scroller associated with a given document. The root scroller
|
| -// causes top controls movement, overscroll effects and prevents chaining
|
| -// scrolls up further in the DOM. It can be set from script using
|
| +// Manages the root scroller associated with a given document. The root
|
| +// scroller causes top controls movement, overscroll effects and prevents
|
| +// chaining scrolls up further in the DOM. It can be set from script using
|
| // document.setRootScroller.
|
| //
|
| // There are two notions of a root scroller in this class: m_rootScroller and
|
| // m_effectiveRootScroller. The former is the Element that was set as the root
|
| // scroller using document.setRootScroller. If the page didn't set a root
|
| // scroller this will be nullptr. The "effective" root scroller is the current
|
| -// element we're using internally to apply viewport scroll actions. i.e It's the
|
| -// element with the ViewportScrollCallback set as its apply-scroll callback.
|
| -// The effective root scroller will only be null during document initialization.
|
| +// element we're using internally to apply viewport scrolling actions. The
|
| +// effective root scroller will only be null during document initialization.
|
| //
|
| -// If the root scroller element is a valid element to become the root scroller,
|
| -// it will be promoted to the effective root scroller. If it is not valid, the
|
| -// effective root scroller will fall back to a default Element (see
|
| +// If the currently set m_rootScroller is a valid element to become the root
|
| +// scroller, it will be promoted to the effective root scroller. If it is not
|
| +// valid, the effective root scroller will fall back to a default Element (see
|
| // defaultEffectiveRootScroller()). The rules for what makes an element a valid
|
| // root scroller are set in isValidRootScroller(). The validity of the current
|
| // root scroller is re-checked after each layout.
|
| class CORE_EXPORT RootScrollerController
|
| : public GarbageCollected<RootScrollerController> {
|
| public:
|
| - // Creates a RootScrollerController for the given document. You should use
|
| - // setViewportScrollCallback to provide this class with a scroll callback
|
| - // that RootScrollerController will keep applied to the current RootScroller
|
| - // so that special actions can occur on scrolling.
|
| - static RootScrollerController* create(Document& document)
|
| - {
|
| - return new RootScrollerController(document);
|
| - }
|
| + // Creates a RootScrollerController for the given document. Note, instances
|
| + // of this class need to be made aware of lifecycle events, see the
|
| + // didUpdateLayout, didUpdateCompositing, etc. type methods below.
|
| + static RootScrollerController* create(Document&);
|
|
|
| - DECLARE_TRACE();
|
| + DECLARE_VIRTUAL_TRACE();
|
|
|
| // Sets the element that will be used as the root scroller. This can be
|
| // nullptr, in which case we'll use the default element (documentElement) as
|
| @@ -74,36 +69,50 @@ public:
|
|
|
| // This class needs to be informed of changes to compositing so that it can
|
| // update the compositor when the effective root scroller changes.
|
| - void didUpdateCompositing();
|
| + virtual void didUpdateCompositing();
|
|
|
| // This class needs to be informed when the document has been attached to a
|
| // FrameView so that we can initialize the viewport scroll callback.
|
| - void didAttachDocument();
|
| + virtual void didAttachDocument();
|
|
|
| + // Returns the GraphicsLayer for the current effective root scroller
|
| + // element.
|
| GraphicsLayer* rootScrollerLayer();
|
|
|
| + // Returns true if the given ScrollStateCallback is the ViewportScrollCallback managed
|
| + // by this class.
|
| // TODO(bokan): Temporarily needed to allow ScrollCustomization to
|
| // differentiate between real custom callback and the built-in viewport
|
| - // apply scroll.
|
| - bool isViewportScrollCallback(const ScrollStateCallback*) const;
|
| + // apply scroll. crbug.com/623079.
|
| + virtual bool isViewportScrollCallback(const ScrollStateCallback*) const;
|
|
|
| -private:
|
| +protected:
|
| RootScrollerController(Document&);
|
|
|
| - Element* defaultEffectiveRootScroller();
|
| -
|
| // Ensures the effective root scroller is currently valid and replaces it
|
| // with the default if not.
|
| - void updateEffectiveRootScroller();
|
| + virtual void updateEffectiveRootScroller();
|
|
|
| - // Called only from the top Document's RootScrollerController. Ensures that
|
| - // the element that should be used as the root scroller on the page has the
|
| - // m_viewportApplyScroll callback set on it.
|
| - void setViewportApplyScrollOnRootScroller();
|
| + // Returns the ScrollableArea to use to scroll the given Element.
|
| + ScrollableArea* scrollableAreaFor(const Element&) const;
|
|
|
| + // The owning Document whose root scroller this object manages.
|
| WeakMember<Document> m_document;
|
| - Member<ViewportScrollCallback> m_viewportApplyScroll;
|
|
|
| +private:
|
| +
|
| + // Determines whether the given element meets the criteria to become the
|
| + // effective root scroller.
|
| + bool isValidRootScroller(const Element&) const;
|
| +
|
| + // Returns the Element that should be used if the currently set
|
| + // m_rootScroller isn't valid to be a root scroller.
|
| + Element* defaultEffectiveRootScroller();
|
| +
|
| + // The Element that was set from script as rootScroller. Depending on its
|
| + // validity to be the root scroller (e.g. a display: none element isn't a
|
| + // valid root scroller), this may not actually be the Element being used as
|
| + // the root scroller.
|
| WeakMember<Element> m_rootScroller;
|
|
|
| // The element currently being used as the root scroller. If
|
| @@ -112,10 +121,6 @@ private:
|
| // initialization and will not be set until m_viewportApplyScroll is
|
| // provided.
|
| WeakMember<Element> m_effectiveRootScroller;
|
| -
|
| - // Tracks which element currently has the m_viewportApplyScroll set to it.
|
| - // This will only ever be set on the top Document's RootScrollerController.
|
| - WeakMember<Element> m_currentViewportApplyScrollHost;
|
| };
|
|
|
| } // namespace blink
|
|
|