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

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

Issue 1158673006: Replace various ScrollableArea scroll methods with setScrollPosition (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 5 years, 6 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 11 matching lines...) Expand all
22 // the layout viewport. Thus, we could say this class is a decorator on the 22 // the layout viewport. Thus, we could say this class is a decorator on the
23 // FrameView scrollable area that adds pinch-zoom semantics to scrolling. 23 // FrameView scrollable area that adds pinch-zoom semantics to scrolling.
24 class CORE_EXPORT RootFrameViewport final : public ScrollableArea { 24 class CORE_EXPORT RootFrameViewport final : public ScrollableArea {
25 public: 25 public:
26 static PassOwnPtr<RootFrameViewport> create(ScrollableArea& visualViewport, ScrollableArea& layoutViewport) 26 static PassOwnPtr<RootFrameViewport> create(ScrollableArea& visualViewport, ScrollableArea& layoutViewport)
27 { 27 {
28 return adoptPtr(new RootFrameViewport(visualViewport, layoutViewport)); 28 return adoptPtr(new RootFrameViewport(visualViewport, layoutViewport));
29 } 29 }
30 30
31 // ScrollableArea Implementation 31 // ScrollableArea Implementation
32 void setScrollPosition(const DoublePoint&, ScrollBehavior = ScrollBehaviorIn stant) override; 32 void setScrollPosition(const DoublePoint&, ScrollType, ScrollBehavior = Scro llBehaviorInstant) override;
33 LayoutRect scrollIntoView( 33 LayoutRect scrollIntoView(
34 const LayoutRect& rectInContent, 34 const LayoutRect& rectInContent,
35 const ScrollAlignment& alignX, 35 const ScrollAlignment& alignX,
36 const ScrollAlignment& alignY) override; 36 const ScrollAlignment& alignY) override;
37 DoubleRect visibleContentRectDouble(IncludeScrollbarsInRect = ExcludeScrollb ars) const override; 37 DoubleRect visibleContentRectDouble(IncludeScrollbarsInRect = ExcludeScrollb ars) const override;
38 IntRect visibleContentRect(IncludeScrollbarsInRect = ExcludeScrollbars) cons t override; 38 IntRect visibleContentRect(IncludeScrollbarsInRect = ExcludeScrollbars) cons t override;
39 bool shouldUseIntegerScrollOffset() const override; 39 bool shouldUseIntegerScrollOffset() const override;
40 bool isActive() const override; 40 bool isActive() const override;
41 int scrollSize(ScrollbarOrientation) const override; 41 int scrollSize(ScrollbarOrientation) const override;
42 bool isScrollCornerVisible() const override; 42 bool isScrollCornerVisible() const override;
43 IntRect scrollCornerRect() const override; 43 IntRect scrollCornerRect() const override;
44 void setScrollOffset(const IntPoint&) override; 44 void setScrollOffset(const IntPoint&, ScrollType) override;
45 void setScrollOffset(const DoublePoint&) override; 45 void setScrollOffset(const DoublePoint&, ScrollType) override;
46 IntPoint scrollPosition() const override; 46 IntPoint scrollPosition() const override;
47 DoublePoint scrollPositionDouble() const override; 47 DoublePoint scrollPositionDouble() const override;
48 IntPoint minimumScrollPosition() const override; 48 IntPoint minimumScrollPosition() const override;
49 IntPoint maximumScrollPosition() const override; 49 IntPoint maximumScrollPosition() const override;
50 DoublePoint maximumScrollPositionDouble() const override; 50 DoublePoint maximumScrollPositionDouble() const override;
51 IntSize contentsSize() const override; 51 IntSize contentsSize() const override;
52 bool scrollbarsCanBeActive() const override; 52 bool scrollbarsCanBeActive() const override;
53 IntRect scrollableAreaBoundingBox() const override; 53 IntRect scrollableAreaBoundingBox() const override;
54 bool userInputScrollable(ScrollbarOrientation) const override; 54 bool userInputScrollable(ScrollbarOrientation) const override;
55 bool shouldPlaceVerticalScrollbarOnLeft() const override; 55 bool shouldPlaceVerticalScrollbarOnLeft() const override;
56 void invalidateScrollbarRect(Scrollbar*, const IntRect&) override; 56 void invalidateScrollbarRect(Scrollbar*, const IntRect&) override;
57 void invalidateScrollCornerRect(const IntRect&) override; 57 void invalidateScrollCornerRect(const IntRect&) override;
58 GraphicsLayer* layerForContainer() const override; 58 GraphicsLayer* layerForContainer() const override;
59 GraphicsLayer* layerForScrolling() const override; 59 GraphicsLayer* layerForScrolling() const override;
60 GraphicsLayer* layerForHorizontalScrollbar() const override; 60 GraphicsLayer* layerForHorizontalScrollbar() const override;
61 GraphicsLayer* layerForVerticalScrollbar() const override; 61 GraphicsLayer* layerForVerticalScrollbar() const override;
62 bool userScroll(ScrollDirectionPhysical, ScrollGranularity, float delta = 1) override; 62 bool userScroll(ScrollDirectionPhysical, ScrollGranularity, float delta = 1) override;
63 bool scrollAnimatorEnabled() const override; 63 bool scrollAnimatorEnabled() const override;
64 HostWindow* hostWindow() const override; 64 HostWindow* hostWindow() const override;
65 void serviceScrollAnimations(double) override; 65 void serviceScrollAnimations(double) override;
66 // TODO(bokan): This method should be removed. It should be replaced by 66 // TODO(bokan): This method should be removed. It should be replaced by
67 // making EventHandler::handleWheelEvent unpack the WheelEvent and make a 67 // making EventHandler::handleWheelEvent unpack the WheelEvent and make a
68 // call to this class' scroll method. 68 // call to this class' scroll method.
69 ScrollResult handleWheel(const PlatformWheelEvent&) override; 69 ScrollResult handleWheel(const PlatformWheelEvent&) override;
70 70
71 protected:
72 virtual ScrollBehavior scrollBehaviorStyle() const override;
skobes 2015/06/04 23:35:47 This should be public, to match its visibility in
bokan 2015/06/05 15:15:23 Done.
bokan 2015/06/05 15:17:25 Should mention: also did this in DPLSA and made DP
73
71 private: 74 private:
72 RootFrameViewport(ScrollableArea& visualViewport, ScrollableArea& layoutView port); 75 RootFrameViewport(ScrollableArea& visualViewport, ScrollableArea& layoutView port);
73 76
74 DoublePoint scrollOffsetFromScrollAnimators() const; 77 DoublePoint scrollOffsetFromScrollAnimators() const;
75 78
76 // If either of the layout or visual viewports are scrolled explicitly (i.e. not 79 // If either of the layout or visual viewports are scrolled explicitly (i.e. not
77 // through this class), their updated offset will not be reflected in this c lass' 80 // through this class), their updated offset will not be reflected in this c lass'
78 // animator so use this method to pull updated values when necessary. 81 // animator so use this method to pull updated values when necessary.
79 void updateScrollAnimator(); 82 void updateScrollAnimator();
80 83
81 ScrollableArea& visualViewport() const { return m_visualViewport; } 84 ScrollableArea& visualViewport() const { return m_visualViewport; }
82 ScrollableArea& layoutViewport() const { return m_layoutViewport; } 85 ScrollableArea& layoutViewport() const { return m_layoutViewport; }
83 86
84 ScrollableArea& m_visualViewport; 87 ScrollableArea& m_visualViewport;
85 ScrollableArea& m_layoutViewport; 88 ScrollableArea& m_layoutViewport;
86 }; 89 };
87 90
88 } // namespace blink 91 } // namespace blink
89 92
90 #endif // RootFrameViewport_h 93 #endif // RootFrameViewport_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698