| 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 LayoutRect; |   13 class LayoutRect; | 
|   14  |   14  | 
|   15 // ScrollableArea for the root frame's viewport. This class ties together the |   15 // ScrollableArea for the root frame's viewport. This class ties together the | 
|   16 // concepts of layout and visual viewports, used in pinch-to-zoom. This class |   16 // concepts of layout and visual viewports, used in pinch-to-zoom. This class | 
|   17 // takes two ScrollableAreas, one for the visual viewport and one for the |   17 // takes two ScrollableAreas, one for the visual viewport and one for the | 
|   18 // layout viewport, and delegates and composes the ScrollableArea API as needed |   18 // layout viewport, and delegates and composes the ScrollableArea API as needed | 
|   19 // between them. For most scrolling APIs, this class will split the scroll up |   19 // between them. For most scrolling APIs, this class will split the scroll up | 
|   20 // between the two viewports in accord with the pinch-zoom semantics. For other |   20 // between the two viewports in accord with the pinch-zoom semantics. For other | 
|   21 // APIs that don't make sense on the combined viewport, the call is delegated to |   21 // APIs that don't make sense on the combined viewport, the call is delegated to | 
|   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 NoBaseWillBeGarbageCollectedF
     inalized<RootFrameViewport>, public ScrollableArea { |   24 class CORE_EXPORT RootFrameViewport final : public NoBaseWillBeGarbageCollectedF
     inalized<RootFrameViewport>, public ScrollableArea { | 
|   25     USING_FAST_MALLOC_WILL_BE_REMOVED(RootFrameViewport); |   25     USING_FAST_MALLOC_WILL_BE_REMOVED(RootFrameViewport); | 
|   26     WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(RootFrameViewport); |   26     WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(RootFrameViewport); | 
|   27 public: |   27 public: | 
|   28     static PassOwnPtrWillBeRawPtr<RootFrameViewport> create(ScrollableArea& visu
     alViewport, ScrollableArea& layoutViewport, bool invertScrollOrder = false) |   28     static PassOwnPtrWillBeRawPtr<RootFrameViewport> create(ScrollableArea& visu
     alViewport, ScrollableArea& layoutViewport) | 
|   29     { |   29     { | 
|   30         return adoptPtrWillBeNoop(new RootFrameViewport(visualViewport, layoutVi
     ewport, invertScrollOrder)); |   30         return adoptPtrWillBeNoop(new RootFrameViewport(visualViewport, layoutVi
     ewport)); | 
|   31     } |   31     } | 
|   32  |   32  | 
|   33     DECLARE_VIRTUAL_TRACE(); |   33     DECLARE_VIRTUAL_TRACE(); | 
|   34  |   34  | 
|   35     // ScrollableArea Implementation |   35     // ScrollableArea Implementation | 
|   36     void setScrollPosition(const DoublePoint&, ScrollType, ScrollBehavior = Scro
     llBehaviorInstant) override; |   36     void setScrollPosition(const DoublePoint&, ScrollType, ScrollBehavior = Scro
     llBehaviorInstant) override; | 
|   37     LayoutRect scrollIntoView( |   37     LayoutRect scrollIntoView( | 
|   38         const LayoutRect& rectInContent, |   38         const LayoutRect& rectInContent, | 
|   39         const ScrollAlignment& alignX, |   39         const ScrollAlignment& alignX, | 
|   40         const ScrollAlignment& alignY, |   40         const ScrollAlignment& alignY, | 
| (...skipping 25 matching lines...) Expand all  Loading... | 
|   66     ScrollResultOneDimensional userScroll(ScrollDirectionPhysical, ScrollGranula
     rity, float delta = 1) override; |   66     ScrollResultOneDimensional userScroll(ScrollDirectionPhysical, ScrollGranula
     rity, float delta = 1) override; | 
|   67     bool scrollAnimatorEnabled() const override; |   67     bool scrollAnimatorEnabled() const override; | 
|   68     HostWindow* hostWindow() const override; |   68     HostWindow* hostWindow() const override; | 
|   69     void serviceScrollAnimations(double) override; |   69     void serviceScrollAnimations(double) override; | 
|   70     void updateCompositorScrollAnimations() override; |   70     void updateCompositorScrollAnimations() override; | 
|   71     void cancelProgrammaticScrollAnimation() override; |   71     void cancelProgrammaticScrollAnimation() override; | 
|   72     ScrollBehavior scrollBehaviorStyle() const override; |   72     ScrollBehavior scrollBehaviorStyle() const override; | 
|   73     Widget* widget() override; |   73     Widget* widget() override; | 
|   74  |   74  | 
|   75 private: |   75 private: | 
|   76     RootFrameViewport(ScrollableArea& visualViewport, ScrollableArea& layoutView
     port, bool invertScrollOrder); |   76     RootFrameViewport(ScrollableArea& visualViewport, ScrollableArea& layoutView
     port); | 
|   77  |   77  | 
|   78     DoublePoint scrollOffsetFromScrollAnimators() const; |   78     DoublePoint scrollOffsetFromScrollAnimators() const; | 
|   79  |   79  | 
|   80     void distributeScrollBetweenViewports(const DoublePoint&, ScrollType, Scroll
     Behavior); |   80     void distributeScrollBetweenViewports(const DoublePoint&, ScrollType, Scroll
     Behavior); | 
|   81  |   81  | 
|   82     // If either of the layout or visual viewports are scrolled explicitly (i.e.
      not |   82     // If either of the layout or visual viewports are scrolled explicitly (i.e.
      not | 
|   83     // through this class), their updated offset will not be reflected in this c
     lass' |   83     // through this class), their updated offset will not be reflected in this c
     lass' | 
|   84     // animator so use this method to pull updated values when necessary. |   84     // animator so use this method to pull updated values when necessary. | 
|   85     void updateScrollAnimator(); |   85     void updateScrollAnimator(); | 
|   86  |   86  | 
|   87     ScrollableArea& visualViewport() const { ASSERT(m_visualViewport); return *m
     _visualViewport; } |   87     ScrollableArea& visualViewport() const { ASSERT(m_visualViewport); return *m
     _visualViewport; } | 
|   88     ScrollableArea& layoutViewport() const { ASSERT(m_layoutViewport); return *m
     _layoutViewport; } |   88     ScrollableArea& layoutViewport() const { ASSERT(m_layoutViewport); return *m
     _layoutViewport; } | 
|   89  |   89  | 
|   90     RawPtrWillBeMember<ScrollableArea> m_visualViewport; |   90     RawPtrWillBeMember<ScrollableArea> m_visualViewport; | 
|   91     RawPtrWillBeMember<ScrollableArea> m_layoutViewport; |   91     RawPtrWillBeMember<ScrollableArea> m_layoutViewport; | 
|   92  |  | 
|   93     // Experimental flag. If the experiment is enabled, scroll the visual viewpo
     rt first, |  | 
|   94     // the bubble scrolls to the layout viewport. |  | 
|   95     bool m_invertScrollOrder; |  | 
|   96 }; |   92 }; | 
|   97  |   93  | 
|   98 } // namespace blink |   94 } // namespace blink | 
|   99  |   95  | 
|  100 #endif // RootFrameViewport_h |   96 #endif // RootFrameViewport_h | 
| OLD | NEW |