| 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 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 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 ScrollResultOneDimensional userScroll(ScrollDirectionPhysical, ScrollGranula
rity, float delta = 1) override; | 62 ScrollResultOneDimensional userScroll(ScrollDirectionPhysical, ScrollGranula
rity, 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 void updateCompositorScrollAnimations() override; | 66 void updateCompositorScrollAnimations() override; |
| 67 virtual ScrollBehavior scrollBehaviorStyle() const override; |
| 67 // TODO(bokan): This method should be removed. It should be replaced by | 68 // TODO(bokan): This method should be removed. It should be replaced by |
| 68 // making EventHandler::handleWheelEvent unpack the WheelEvent and make a | 69 // making EventHandler::handleWheelEvent unpack the WheelEvent and make a |
| 69 // call to this class' scroll method. | 70 // call to this class' scroll method. |
| 70 ScrollResult handleWheel(const PlatformWheelEvent&) override; | 71 ScrollResult handleWheel(const PlatformWheelEvent&) override; |
| 71 | 72 |
| 72 private: | 73 private: |
| 73 RootFrameViewport(ScrollableArea& visualViewport, ScrollableArea& layoutView
port); | 74 RootFrameViewport(ScrollableArea& visualViewport, ScrollableArea& layoutView
port); |
| 74 | 75 |
| 75 DoublePoint scrollOffsetFromScrollAnimators() const; | 76 DoublePoint scrollOffsetFromScrollAnimators() const; |
| 76 | 77 |
| 77 // If either of the layout or visual viewports are scrolled explicitly (i.e.
not | 78 // If either of the layout or visual viewports are scrolled explicitly (i.e.
not |
| 78 // through this class), their updated offset will not be reflected in this c
lass' | 79 // through this class), their updated offset will not be reflected in this c
lass' |
| 79 // animator so use this method to pull updated values when necessary. | 80 // animator so use this method to pull updated values when necessary. |
| 80 void updateScrollAnimator(); | 81 void updateScrollAnimator(); |
| 81 | 82 |
| 82 ScrollableArea& visualViewport() const { return m_visualViewport; } | 83 ScrollableArea& visualViewport() const { return m_visualViewport; } |
| 83 ScrollableArea& layoutViewport() const { return m_layoutViewport; } | 84 ScrollableArea& layoutViewport() const { return m_layoutViewport; } |
| 84 | 85 |
| 85 ScrollableArea& m_visualViewport; | 86 ScrollableArea& m_visualViewport; |
| 86 ScrollableArea& m_layoutViewport; | 87 ScrollableArea& m_layoutViewport; |
| 87 }; | 88 }; |
| 88 | 89 |
| 89 } // namespace blink | 90 } // namespace blink |
| 90 | 91 |
| 91 #endif // RootFrameViewport_h | 92 #endif // RootFrameViewport_h |
| OLD | NEW |