Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: third_party/WebKit/Source/core/frame/RootFrameViewport.h

Issue 2387883002: Use float for scroll offset. (Closed)
Patch Set: Fix README.md Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
(...skipping 29 matching lines...) Expand all
40 40
41 // Convert from the root content document's coordinate space, into the 41 // Convert from the root content document's coordinate space, into the
42 // coordinate space of the layout viewport's content. In the normal case, 42 // coordinate space of the layout viewport's content. In the normal case,
43 // this will be a no-op since the root FrameView is the layout viewport and 43 // this will be a no-op since the root FrameView is the layout viewport and
44 // so the root content is the layout viewport's content but if the page 44 // so the root content is the layout viewport's content but if the page
45 // sets a custom root scroller via document.rootScroller, another element 45 // sets a custom root scroller via document.rootScroller, another element
46 // may be the layout viewport. 46 // may be the layout viewport.
47 LayoutRect rootContentsToLayoutViewportContents(FrameView& rootFrameView, 47 LayoutRect rootContentsToLayoutViewportContents(FrameView& rootFrameView,
48 const LayoutRect&) const; 48 const LayoutRect&) const;
49 49
50 void restoreToAnchor(const DoublePoint&); 50 void restoreToAnchor(const ScrollOffset&);
51 51
52 // Callback whenever the visual viewport changes scroll position or scale. 52 // Callback whenever the visual viewport changes scroll position or scale.
53 void didUpdateVisualViewport(); 53 void didUpdateVisualViewport();
54 54
55 // ScrollableArea Implementation 55 // ScrollableArea Implementation
56 bool isRootFrameViewport() const override { return true; } 56 bool isRootFrameViewport() const override { return true; }
57 void setScrollPosition(const DoublePoint&, 57 void setScrollOffset(const ScrollOffset&,
58 ScrollType, 58 ScrollType,
59 ScrollBehavior = ScrollBehaviorInstant) override; 59 ScrollBehavior = ScrollBehaviorInstant) override;
60 LayoutRect scrollIntoView(const LayoutRect& rectInContent, 60 LayoutRect scrollIntoView(const LayoutRect& rectInContent,
61 const ScrollAlignment& alignX, 61 const ScrollAlignment& alignX,
62 const ScrollAlignment& alignY, 62 const ScrollAlignment& alignY,
63 ScrollType = ProgrammaticScroll) override; 63 ScrollType = ProgrammaticScroll) override;
64 DoubleRect visibleContentRectDouble(
65 IncludeScrollbarsInRect = ExcludeScrollbars) const override;
66 IntRect visibleContentRect( 64 IntRect visibleContentRect(
67 IncludeScrollbarsInRect = ExcludeScrollbars) const override; 65 IncludeScrollbarsInRect = ExcludeScrollbars) const override;
68 bool shouldUseIntegerScrollOffset() const override; 66 bool shouldUseIntegerScrollOffset() const override;
69 LayoutRect visualRectForScrollbarParts() const override { 67 LayoutRect visualRectForScrollbarParts() const override {
70 ASSERT_NOT_REACHED(); 68 ASSERT_NOT_REACHED();
71 return LayoutRect(); 69 return LayoutRect();
72 } 70 }
73 bool isActive() const override; 71 bool isActive() const override;
74 int scrollSize(ScrollbarOrientation) const override; 72 int scrollSize(ScrollbarOrientation) const override;
75 bool isScrollCornerVisible() const override; 73 bool isScrollCornerVisible() const override;
76 IntRect scrollCornerRect() const override; 74 IntRect scrollCornerRect() const override;
77 void setScrollOffset(const DoublePoint&, ScrollType) override; 75 void updateScrollOffset(const ScrollOffset&, ScrollType) override;
78 IntPoint scrollPosition() const override; 76 IntSize scrollOffsetInt() const override;
79 DoublePoint scrollPositionDouble() const override; 77 ScrollOffset scrollOffset() const override;
80 IntPoint minimumScrollPosition() const override; 78 IntSize minimumScrollOffsetInt() const override;
81 IntPoint maximumScrollPosition() const override; 79 IntSize maximumScrollOffsetInt() const override;
82 DoublePoint maximumScrollPositionDouble() const override; 80 ScrollOffset maximumScrollOffset() const override;
83 IntSize contentsSize() const override; 81 IntSize contentsSize() const override;
84 bool scrollbarsCanBeActive() const override; 82 bool scrollbarsCanBeActive() const override;
85 IntRect scrollableAreaBoundingBox() const override; 83 IntRect scrollableAreaBoundingBox() const override;
86 bool userInputScrollable(ScrollbarOrientation) const override; 84 bool userInputScrollable(ScrollbarOrientation) const override;
87 bool shouldPlaceVerticalScrollbarOnLeft() const override; 85 bool shouldPlaceVerticalScrollbarOnLeft() const override;
88 void scrollControlWasSetNeedsPaintInvalidation() override; 86 void scrollControlWasSetNeedsPaintInvalidation() override;
89 GraphicsLayer* layerForContainer() const override; 87 GraphicsLayer* layerForContainer() const override;
90 GraphicsLayer* layerForScrolling() const override; 88 GraphicsLayer* layerForScrolling() const override;
91 GraphicsLayer* layerForHorizontalScrollbar() const override; 89 GraphicsLayer* layerForHorizontalScrollbar() const override;
92 GraphicsLayer* layerForVerticalScrollbar() const override; 90 GraphicsLayer* layerForVerticalScrollbar() const override;
93 GraphicsLayer* layerForScrollCorner() const override; 91 GraphicsLayer* layerForScrollCorner() const override;
94 ScrollResult userScroll(ScrollGranularity, const FloatSize&) override; 92 ScrollResult userScroll(ScrollGranularity, const FloatSize&) override;
95 bool scrollAnimatorEnabled() const override; 93 bool scrollAnimatorEnabled() const override;
96 HostWindow* getHostWindow() const override; 94 HostWindow* getHostWindow() const override;
97 void serviceScrollAnimations(double) override; 95 void serviceScrollAnimations(double) override;
98 void updateCompositorScrollAnimations() override; 96 void updateCompositorScrollAnimations() override;
99 void cancelProgrammaticScrollAnimation() override; 97 void cancelProgrammaticScrollAnimation() override;
100 ScrollBehavior scrollBehaviorStyle() const override; 98 ScrollBehavior scrollBehaviorStyle() const override;
101 Widget* getWidget() override; 99 Widget* getWidget() override;
102 void clearScrollAnimators() override; 100 void clearScrollAnimators() override;
103 LayoutBox* layoutBox() const override; 101 LayoutBox* layoutBox() const override;
104 102
105 private: 103 private:
106 RootFrameViewport(ScrollableArea& visualViewport, 104 RootFrameViewport(ScrollableArea& visualViewport,
107 ScrollableArea& layoutViewport); 105 ScrollableArea& layoutViewport);
108 106
109 enum ViewportToScrollFirst { VisualViewport, LayoutViewport }; 107 enum ViewportToScrollFirst { VisualViewport, LayoutViewport };
110 108
111 DoublePoint scrollOffsetFromScrollAnimators() const; 109 ScrollOffset scrollOffsetFromScrollAnimators() const;
112 110
113 void distributeScrollBetweenViewports(const DoublePoint&, 111 void distributeScrollBetweenViewports(const ScrollOffset&,
114 ScrollType, 112 ScrollType,
115 ScrollBehavior, 113 ScrollBehavior,
116 ViewportToScrollFirst); 114 ViewportToScrollFirst);
117 115
118 // If either of the layout or visual viewports are scrolled explicitly (i.e. 116 // If either of the layout or visual viewports are scrolled explicitly (i.e.
119 // not through this class), their updated offset will not be reflected in this 117 // not through this class), their updated offset will not be reflected in this
120 // class' animator so use this method to pull updated values when necessary. 118 // class' animator so use this method to pull updated values when necessary.
121 void updateScrollAnimator(); 119 void updateScrollAnimator();
122 120
123 ScrollableArea& visualViewport() const { 121 ScrollableArea& visualViewport() const {
124 ASSERT(m_visualViewport); 122 ASSERT(m_visualViewport);
125 return *m_visualViewport; 123 return *m_visualViewport;
126 } 124 }
127 125
128 Member<ScrollableArea> m_visualViewport; 126 Member<ScrollableArea> m_visualViewport;
129 Member<ScrollableArea> m_layoutViewport; 127 Member<ScrollableArea> m_layoutViewport;
130 }; 128 };
131 129
132 DEFINE_TYPE_CASTS(RootFrameViewport, 130 DEFINE_TYPE_CASTS(RootFrameViewport,
133 ScrollableArea, 131 ScrollableArea,
134 scrollableArea, 132 scrollableArea,
135 scrollableArea->isRootFrameViewport(), 133 scrollableArea->isRootFrameViewport(),
136 scrollableArea.isRootFrameViewport()); 134 scrollableArea.isRootFrameViewport());
137 135
138 } // namespace blink 136 } // namespace blink
139 137
140 #endif // RootFrameViewport_h 138 #endif // RootFrameViewport_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/LocalFrame.cpp ('k') | third_party/WebKit/Source/core/frame/RootFrameViewport.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698