OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 RootFrameViewport_h | 5 #ifndef RootFrameViewport_h |
6 #define RootFrameViewport_h | 6 #define RootFrameViewport_h |
7 | 7 |
8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
9 #include "platform/scroll/ScrollableArea.h" | 9 #include "platform/scroll/ScrollableArea.h" |
10 | 10 |
11 namespace blink { | 11 namespace blink { |
12 | 12 |
| 13 class CompositedLayerMapping; |
13 class FrameView; | 14 class FrameView; |
14 class LayoutRect; | 15 class LayoutRect; |
| 16 class LocalFrame; |
15 | 17 |
16 // ScrollableArea for the root frame's viewport. This class ties together the | 18 // ScrollableArea for the root frame's viewport. This class ties together the |
17 // concepts of layout and visual viewports, used in pinch-to-zoom. This class | 19 // concepts of layout and visual viewports, used in pinch-to-zoom. This class |
18 // takes two ScrollableAreas, one for the visual viewport and one for the | 20 // takes two ScrollableAreas, one for the visual viewport and one for the |
19 // layout viewport, and delegates and composes the ScrollableArea API as needed | 21 // layout viewport, and delegates and composes the ScrollableArea API as needed |
20 // between them. For most scrolling APIs, this class will split the scroll up | 22 // between them. For most scrolling APIs, this class will split the scroll up |
21 // between the two viewports in accord with the pinch-zoom semantics. For other | 23 // between the two viewports in accord with the pinch-zoom semantics. For other |
22 // APIs that don't make sense on the combined viewport, the call is delegated to | 24 // APIs that don't make sense on the combined viewport, the call is delegated to |
23 // the layout viewport. Thus, we could say this class is a decorator on the | 25 // the layout viewport. Thus, we could say this class is a decorator on the |
24 // FrameView scrollable area that adds pinch-zoom semantics to scrolling. | 26 // FrameView scrollable area that adds pinch-zoom semantics to scrolling. |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 IntSize contentsSize() const override; | 72 IntSize contentsSize() const override; |
71 bool scrollbarsCanBeActive() const override; | 73 bool scrollbarsCanBeActive() const override; |
72 IntRect scrollableAreaBoundingBox() const override; | 74 IntRect scrollableAreaBoundingBox() const override; |
73 bool userInputScrollable(ScrollbarOrientation) const override; | 75 bool userInputScrollable(ScrollbarOrientation) const override; |
74 bool shouldPlaceVerticalScrollbarOnLeft() const override; | 76 bool shouldPlaceVerticalScrollbarOnLeft() const override; |
75 void scrollControlWasSetNeedsPaintInvalidation() override; | 77 void scrollControlWasSetNeedsPaintInvalidation() override; |
76 GraphicsLayer* layerForContainer() const override; | 78 GraphicsLayer* layerForContainer() const override; |
77 GraphicsLayer* layerForScrolling() const override; | 79 GraphicsLayer* layerForScrolling() const override; |
78 GraphicsLayer* layerForHorizontalScrollbar() const override; | 80 GraphicsLayer* layerForHorizontalScrollbar() const override; |
79 GraphicsLayer* layerForVerticalScrollbar() const override; | 81 GraphicsLayer* layerForVerticalScrollbar() const override; |
| 82 GraphicsLayer* layerForScrollCorner() const override; |
80 ScrollResult userScroll(ScrollGranularity, const FloatSize&) override; | 83 ScrollResult userScroll(ScrollGranularity, const FloatSize&) override; |
81 bool scrollAnimatorEnabled() const override; | 84 bool scrollAnimatorEnabled() const override; |
82 HostWindow* getHostWindow() const override; | 85 HostWindow* getHostWindow() const override; |
83 void serviceScrollAnimations(double) override; | 86 void serviceScrollAnimations(double) override; |
84 void updateCompositorScrollAnimations() override; | 87 void updateCompositorScrollAnimations() override; |
85 void cancelProgrammaticScrollAnimation() override; | 88 void cancelProgrammaticScrollAnimation() override; |
86 ScrollBehavior scrollBehaviorStyle() const override; | 89 ScrollBehavior scrollBehaviorStyle() const override; |
87 Widget* getWidget() override; | 90 Widget* getWidget() override; |
88 void clearScrollAnimators() override; | 91 void clearScrollAnimators() override; |
89 LayoutBox* layoutBox() const override; | 92 LayoutBox* layoutBox() const override; |
90 | 93 |
91 private: | 94 private: |
92 RootFrameViewport(ScrollableArea& visualViewport, ScrollableArea& layoutView
port); | 95 RootFrameViewport(ScrollableArea& visualViewport, ScrollableArea& layoutView
port); |
93 | 96 |
94 enum ViewportToScrollFirst { | 97 enum ViewportToScrollFirst { |
95 VisualViewport, | 98 VisualViewport, |
96 LayoutViewport | 99 LayoutViewport |
97 }; | 100 }; |
98 | 101 |
99 DoublePoint scrollOffsetFromScrollAnimators() const; | 102 DoublePoint scrollOffsetFromScrollAnimators() const; |
100 | 103 |
101 void distributeScrollBetweenViewports(const DoublePoint&, ScrollType, Scroll
Behavior, ViewportToScrollFirst); | 104 void distributeScrollBetweenViewports(const DoublePoint&, ScrollType, Scroll
Behavior, ViewportToScrollFirst); |
102 | 105 |
| 106 LocalFrame* mainFrame() const; |
| 107 CompositedLayerMapping* compositedLayerMapping() const; |
| 108 |
103 // If either of the layout or visual viewports are scrolled explicitly (i.e.
not | 109 // If either of the layout or visual viewports are scrolled explicitly (i.e.
not |
104 // through this class), their updated offset will not be reflected in this c
lass' | 110 // through this class), their updated offset will not be reflected in this c
lass' |
105 // animator so use this method to pull updated values when necessary. | 111 // animator so use this method to pull updated values when necessary. |
106 void updateScrollAnimator(); | 112 void updateScrollAnimator(); |
107 | 113 |
108 ScrollableArea& visualViewport() const { ASSERT(m_visualViewport); return *m
_visualViewport; } | 114 ScrollableArea& visualViewport() const { ASSERT(m_visualViewport); return *m
_visualViewport; } |
109 | 115 |
110 Member<ScrollableArea> m_visualViewport; | 116 Member<ScrollableArea> m_visualViewport; |
111 Member<ScrollableArea> m_layoutViewport; | 117 Member<ScrollableArea> m_layoutViewport; |
112 }; | 118 }; |
113 | 119 |
114 DEFINE_TYPE_CASTS(RootFrameViewport, ScrollableArea, scrollableArea, scrollableA
rea->isRootFrameViewport(), scrollableArea.isRootFrameViewport()); | 120 DEFINE_TYPE_CASTS(RootFrameViewport, ScrollableArea, scrollableArea, scrollableA
rea->isRootFrameViewport(), scrollableArea.isRootFrameViewport()); |
115 | 121 |
116 } // namespace blink | 122 } // namespace blink |
117 | 123 |
118 #endif // RootFrameViewport_h | 124 #endif // RootFrameViewport_h |
OLD | NEW |