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 TopDocumentRootScrollerController_h | 5 #ifndef TopDocumentRootScrollerController_h |
6 #define TopDocumentRootScrollerController_h | 6 #define TopDocumentRootScrollerController_h |
7 | 7 |
8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
9 #include "core/page/scrolling/RootScrollerController.h" | 9 #include "core/page/scrolling/RootScrollerController.h" |
10 #include "platform/geometry/IntSize.h" | 10 #include "platform/geometry/IntSize.h" |
11 #include "platform/heap/Handle.h" | 11 #include "platform/heap/Handle.h" |
12 | 12 |
13 namespace blink { | 13 namespace blink { |
14 | 14 |
15 class Element; | 15 class Element; |
16 class FrameHost; | 16 class Page; |
17 class GraphicsLayer; | 17 class GraphicsLayer; |
18 class PaintLayer; | 18 class PaintLayer; |
19 class RootFrameViewport; | 19 class RootFrameViewport; |
20 class ScrollStateCallback; | 20 class ScrollStateCallback; |
21 class ScrollableArea; | 21 class ScrollableArea; |
22 class ViewportScrollCallback; | 22 class ViewportScrollCallback; |
23 | 23 |
24 // This class manages the the page level aspects of the root scroller. That | 24 // This class manages the the page level aspects of the root scroller. That |
25 // is, given all the iframes on a page and their individual root scrollers, | 25 // is, given all the iframes on a page and their individual root scrollers, |
26 // this class will determine which ultimate Element should be used as the root | 26 // this class will determine which ultimate Element should be used as the root |
27 // scroller and ensures that Element is used to scroll browser controls and | 27 // scroller and ensures that Element is used to scroll browser controls and |
28 // provide overscroll effects. | 28 // provide overscroll effects. |
29 // TODO(bokan): This class is currently OOPIF unaware. crbug.com/642378. | 29 // TODO(bokan): This class is currently OOPIF unaware. crbug.com/642378. |
30 class CORE_EXPORT TopDocumentRootScrollerController | 30 class CORE_EXPORT TopDocumentRootScrollerController |
31 : public GarbageCollected<TopDocumentRootScrollerController> { | 31 : public GarbageCollected<TopDocumentRootScrollerController> { |
32 public: | 32 public: |
33 static TopDocumentRootScrollerController* create(FrameHost&); | 33 static TopDocumentRootScrollerController* create(Page&); |
34 | 34 |
35 DECLARE_TRACE(); | 35 DECLARE_TRACE(); |
36 | 36 |
37 // This class needs to be informed of changes to compositing so that it can | 37 // This class needs to be informed of changes to compositing so that it can |
38 // update the compositor when the effective root scroller changes. | 38 // update the compositor when the effective root scroller changes. |
39 void didUpdateCompositing(); | 39 void didUpdateCompositing(); |
40 | 40 |
41 // PaintLayerScrollableAreas need to notify this class when they're being | 41 // PaintLayerScrollableAreas need to notify this class when they're being |
42 // disposed so that we can remove them as the root scroller. | 42 // disposed so that we can remove them as the root scroller. |
43 void didDisposeScrollableArea(ScrollableArea&); | 43 void didDisposeScrollableArea(ScrollableArea&); |
(...skipping 27 matching lines...) Expand all Loading... |
71 // this isn't necessarily the PLSA belonging to the root scroller Element's | 71 // this isn't necessarily the PLSA belonging to the root scroller Element's |
72 // LayoutBox. If the root scroller is the documentElement then we use the | 72 // LayoutBox. If the root scroller is the documentElement then we use the |
73 // FrameView (or LayoutView if root-layer-scrolls). | 73 // FrameView (or LayoutView if root-layer-scrolls). |
74 ScrollableArea* rootScrollerArea() const; | 74 ScrollableArea* rootScrollerArea() const; |
75 | 75 |
76 // Returns the size we should use for the root scroller, accounting for top | 76 // Returns the size we should use for the root scroller, accounting for top |
77 // controls adjustment and using the root FrameView. | 77 // controls adjustment and using the root FrameView. |
78 IntSize rootScrollerVisibleArea() const; | 78 IntSize rootScrollerVisibleArea() const; |
79 | 79 |
80 private: | 80 private: |
81 TopDocumentRootScrollerController(FrameHost&); | 81 TopDocumentRootScrollerController(Page&); |
82 | 82 |
83 // Calculates the Element that should be the globalRootScroller. On a | 83 // Calculates the Element that should be the globalRootScroller. On a |
84 // simple page, this will simply the root frame's effectiveRootScroller but | 84 // simple page, this will simply the root frame's effectiveRootScroller but |
85 // if the root scroller is set to an iframe, this will then descend into | 85 // if the root scroller is set to an iframe, this will then descend into |
86 // the iframe to find its effective root scroller. | 86 // the iframe to find its effective root scroller. |
87 Element* findGlobalRootScrollerElement(); | 87 Element* findGlobalRootScrollerElement(); |
88 | 88 |
89 // Should be called to ensure the correct element is currently set as the | 89 // Should be called to ensure the correct element is currently set as the |
90 // global root scroller and that all appropriate state changes are made if | 90 // global root scroller and that all appropriate state changes are made if |
91 // it changes. | 91 // it changes. |
92 void recomputeGlobalRootScroller(); | 92 void recomputeGlobalRootScroller(); |
93 | 93 |
94 Document* topDocument() const; | 94 Document* topDocument() const; |
95 | 95 |
96 void setNeedsCompositingInputsUpdateOnGlobalRootScroller(); | 96 void setNeedsCompositingInputsUpdateOnGlobalRootScroller(); |
97 | 97 |
98 // The apply-scroll callback that moves browser controls and produces | 98 // The apply-scroll callback that moves browser controls and produces |
99 // overscroll effects. This class makes sure this callback is set on the | 99 // overscroll effects. This class makes sure this callback is set on the |
100 // appropriate root scroller element. | 100 // appropriate root scroller element. |
101 Member<ViewportScrollCallback> m_viewportApplyScroll; | 101 Member<ViewportScrollCallback> m_viewportApplyScroll; |
102 | 102 |
103 // The page level root scroller. i.e. The actual element for which | 103 // The page level root scroller. i.e. The actual element for which |
104 // scrolling should move browser controls and produce overscroll glow. Once an | 104 // scrolling should move browser controls and produce overscroll glow. Once an |
105 // m_viewportApplyScroll has been created, it will always be set on this | 105 // m_viewportApplyScroll has been created, it will always be set on this |
106 // Element. | 106 // Element. |
107 WeakMember<Element> m_globalRootScroller; | 107 WeakMember<Element> m_globalRootScroller; |
108 | 108 |
109 WeakMember<FrameHost> m_frameHost; | 109 WeakMember<Page> m_page; |
110 }; | 110 }; |
111 | 111 |
112 } // namespace blink | 112 } // namespace blink |
113 | 113 |
114 #endif // RootScrollerController_h | 114 #endif // RootScrollerController_h |
OLD | NEW |