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 OverscrollController; | |
16 class TopControls; | |
17 class ViewportScrollCallback; | 15 class ViewportScrollCallback; |
18 | 16 |
19 // Manages the root scroller associated with a given document. The root scroller | 17 // Manages the root scroller associated with a given document. The root scroller |
20 // causes top controls movement, overscroll effects and prevents chaining | 18 // causes top controls movement, overscroll effects and prevents chaining |
21 // scrolls up further in the DOM. It can be set from script using | 19 // scrolls up further in the DOM. It can be set from script using |
22 // document.setRootScroller. | 20 // document.setRootScroller. |
23 // | 21 // |
24 // There are two notions of a root scroller in this class: m_rootScroller and | 22 // There are two notions of a root scroller in this class: m_rootScroller and |
25 // m_effectiveRootScroller. The former is the Element that was set as the root | 23 // m_effectiveRootScroller. The former is the Element that was set as the root |
26 // scroller using document.setRootScroller. If the page didn't set a root | 24 // scroller using document.setRootScroller. If the page didn't set a root |
(...skipping 15 matching lines...) Expand all Loading... |
42 // ViewportScrollCallback can be provided. If it is, RootScrollerController | 40 // ViewportScrollCallback can be provided. If it is, RootScrollerController |
43 // will ensure that the effectiveRootScroller element always has this set as | 41 // will ensure that the effectiveRootScroller element always has this set as |
44 // the apply scroll callback. | 42 // the apply scroll callback. |
45 static RootScrollerController* create( | 43 static RootScrollerController* create( |
46 Document& document, | 44 Document& document, |
47 ViewportScrollCallback* applyScrollCallback) | 45 ViewportScrollCallback* applyScrollCallback) |
48 { | 46 { |
49 return new RootScrollerController(document, applyScrollCallback); | 47 return new RootScrollerController(document, applyScrollCallback); |
50 } | 48 } |
51 | 49 |
52 // Creates an apply scroll callback that handles viewport actions like | |
53 // TopControls movement and Overscroll. The TopControls and | |
54 // OverscrollController are given to the ViewportScrollCallback but are not | |
55 // owned or kept alive by it. | |
56 static ViewportScrollCallback* createViewportApplyScroll( | |
57 TopControls*, OverscrollController*); | |
58 | |
59 DECLARE_TRACE(); | 50 DECLARE_TRACE(); |
60 | 51 |
61 // Sets the element that will be used as the root scroller. This can be | 52 // Sets the element that will be used as the root scroller. This can be |
62 // nullptr, in which case we'll use the default element (documentElement) as | 53 // nullptr, in which case we'll use the default element (documentElement) as |
63 // the effective root scroller. | 54 // the effective root scroller. |
64 void set(Element*); | 55 void set(Element*); |
65 | 56 |
66 // Returns the element currently set as the root scroller from script. This | 57 // Returns the element currently set as the root scroller from script. This |
67 // differs from the effective root scroller since the set Element may not | 58 // differs from the effective root scroller since the set Element may not |
68 // currently be a valid root scroller. e.g. If the page sets an Element | 59 // currently be a valid root scroller. e.g. If the page sets an Element |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 WeakMember<Document> m_document; | 93 WeakMember<Document> m_document; |
103 Member<ViewportScrollCallback> m_viewportApplyScroll; | 94 Member<ViewportScrollCallback> m_viewportApplyScroll; |
104 | 95 |
105 WeakMember<Element> m_rootScroller; | 96 WeakMember<Element> m_rootScroller; |
106 WeakMember<Element> m_effectiveRootScroller; | 97 WeakMember<Element> m_effectiveRootScroller; |
107 }; | 98 }; |
108 | 99 |
109 } // namespace blink | 100 } // namespace blink |
110 | 101 |
111 #endif // RootScrollerController_h | 102 #endif // RootScrollerController_h |
OLD | NEW |