| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef RootScrollerController_h | 5 #ifndef RootScrollerController_h |
| 6 #define RootScrollerController_h | 6 #define RootScrollerController_h |
| 7 | 7 |
| 8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
| 9 #include "platform/heap/Handle.h" | 9 #include "platform/heap/Handle.h" |
| 10 | 10 |
| 11 namespace blink { | 11 namespace blink { |
| 12 | 12 |
| 13 class Document; | 13 class Document; |
| 14 class Element; | 14 class Element; |
| 15 class GraphicsLayer; |
| 15 class ViewportScrollCallback; | 16 class ViewportScrollCallback; |
| 16 | 17 |
| 17 // Manages the root scroller associated with a given document. The root scroller | 18 // Manages the root scroller associated with a given document. The root scroller |
| 18 // causes top controls movement, overscroll effects and prevents chaining | 19 // causes top controls movement, overscroll effects and prevents chaining |
| 19 // scrolls up further in the DOM. It can be set from script using | 20 // scrolls up further in the DOM. It can be set from script using |
| 20 // document.setRootScroller. | 21 // document.setRootScroller. |
| 21 // | 22 // |
| 22 // There are two notions of a root scroller in this class: m_rootScroller and | 23 // There are two notions of a root scroller in this class: m_rootScroller and |
| 23 // m_effectiveRootScroller. The former is the Element that was set as the root | 24 // m_effectiveRootScroller. The former is the Element that was set as the root |
| 24 // scroller using document.setRootScroller. If the page didn't set a root | 25 // scroller using document.setRootScroller. If the page didn't set a root |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 // This returns the Element that's actually being used to control viewport | 64 // This returns the Element that's actually being used to control viewport |
| 64 // actions right now. This is different from get() if a root scroller hasn't | 65 // actions right now. This is different from get() if a root scroller hasn't |
| 65 // been set, or if the set root scroller isn't currently a valid scroller. | 66 // been set, or if the set root scroller isn't currently a valid scroller. |
| 66 Element* effectiveRootScroller() const; | 67 Element* effectiveRootScroller() const; |
| 67 | 68 |
| 68 // This class needs to be informed of changes in layout so that it can | 69 // This class needs to be informed of changes in layout so that it can |
| 69 // determine if the current root scroller is still valid or if it must be | 70 // determine if the current root scroller is still valid or if it must be |
| 70 // replaced by the defualt root scroller. | 71 // replaced by the defualt root scroller. |
| 71 void didUpdateLayout(); | 72 void didUpdateLayout(); |
| 72 | 73 |
| 74 // This class needs to be informed of changes to compositing so that it can |
| 75 // update the compositor when the effective root scroller changes. |
| 76 void didUpdateCompositing(); |
| 77 |
| 78 GraphicsLayer* rootScrollerLayer(); |
| 79 |
| 73 // TODO(bokan): Temporarily exposed to allow ScrollCustomization to | 80 // TODO(bokan): Temporarily exposed to allow ScrollCustomization to |
| 74 // differentiate between real custom callback and the built-in viewport | 81 // differentiate between real custom callback and the built-in viewport |
| 75 // apply scroll. | 82 // apply scroll. |
| 76 const ViewportScrollCallback* viewportScrollCallback() | 83 const ViewportScrollCallback* viewportScrollCallback() |
| 77 { | 84 { |
| 78 return m_viewportApplyScroll; | 85 return m_viewportApplyScroll; |
| 79 } | 86 } |
| 80 | 87 |
| 81 void setViewportScrollCallback(ViewportScrollCallback*); | 88 void setViewportScrollCallback(ViewportScrollCallback*); |
| 82 | 89 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 101 // m_viewportApplyScroll has been set, this element is guaranteed to have it | 108 // m_viewportApplyScroll has been set, this element is guaranteed to have it |
| 102 // set as its applyScroll callback. This can be nullptr during | 109 // set as its applyScroll callback. This can be nullptr during |
| 103 // initialization and will not be set until m_viewportApplyScroll is | 110 // initialization and will not be set until m_viewportApplyScroll is |
| 104 // provided. | 111 // provided. |
| 105 WeakMember<Element> m_effectiveRootScroller; | 112 WeakMember<Element> m_effectiveRootScroller; |
| 106 }; | 113 }; |
| 107 | 114 |
| 108 } // namespace blink | 115 } // namespace blink |
| 109 | 116 |
| 110 #endif // RootScrollerController_h | 117 #endif // RootScrollerController_h |
| OLD | NEW |