| 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 GarbageCollectedFinalized<Roo
tFrameViewport>, public ScrollableArea { |
| 25 USING_FAST_MALLOC_WILL_BE_REMOVED(RootFrameViewport); | 25 USING_GARBAGE_COLLECTED_MIXIN(RootFrameViewport); |
| 26 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(RootFrameViewport); | |
| 27 public: | 26 public: |
| 28 static PassOwnPtrWillBeRawPtr<RootFrameViewport> create(ScrollableArea& visu
alViewport, ScrollableArea& layoutViewport) | 27 static RawPtr<RootFrameViewport> create(ScrollableArea& visualViewport, Scro
llableArea& layoutViewport) |
| 29 { | 28 { |
| 30 return adoptPtrWillBeNoop(new RootFrameViewport(visualViewport, layoutVi
ewport)); | 29 return new RootFrameViewport(visualViewport, layoutViewport); |
| 31 } | 30 } |
| 32 | 31 |
| 33 DECLARE_VIRTUAL_TRACE(); | 32 DECLARE_VIRTUAL_TRACE(); |
| 34 | 33 |
| 35 // ScrollableArea Implementation | 34 // ScrollableArea Implementation |
| 36 void setScrollPosition(const DoublePoint&, ScrollType, ScrollBehavior = Scro
llBehaviorInstant) override; | 35 void setScrollPosition(const DoublePoint&, ScrollType, ScrollBehavior = Scro
llBehaviorInstant) override; |
| 37 LayoutRect scrollIntoView( | 36 LayoutRect scrollIntoView( |
| 38 const LayoutRect& rectInContent, | 37 const LayoutRect& rectInContent, |
| 39 const ScrollAlignment& alignX, | 38 const ScrollAlignment& alignX, |
| 40 const ScrollAlignment& alignY, | 39 const ScrollAlignment& alignY, |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 void distributeScrollBetweenViewports(const DoublePoint&, ScrollType, Scroll
Behavior); | 80 void distributeScrollBetweenViewports(const DoublePoint&, ScrollType, Scroll
Behavior); |
| 82 | 81 |
| 83 // 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 |
| 84 // 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' |
| 85 // animator so use this method to pull updated values when necessary. | 84 // animator so use this method to pull updated values when necessary. |
| 86 void updateScrollAnimator(); | 85 void updateScrollAnimator(); |
| 87 | 86 |
| 88 ScrollableArea& visualViewport() const { ASSERT(m_visualViewport); return *m
_visualViewport; } | 87 ScrollableArea& visualViewport() const { ASSERT(m_visualViewport); return *m
_visualViewport; } |
| 89 ScrollableArea& layoutViewport() const { ASSERT(m_layoutViewport); return *m
_layoutViewport; } | 88 ScrollableArea& layoutViewport() const { ASSERT(m_layoutViewport); return *m
_layoutViewport; } |
| 90 | 89 |
| 91 RawPtrWillBeMember<ScrollableArea> m_visualViewport; | 90 Member<ScrollableArea> m_visualViewport; |
| 92 RawPtrWillBeMember<ScrollableArea> m_layoutViewport; | 91 Member<ScrollableArea> m_layoutViewport; |
| 93 }; | 92 }; |
| 94 | 93 |
| 95 } // namespace blink | 94 } // namespace blink |
| 96 | 95 |
| 97 #endif // RootFrameViewport_h | 96 #endif // RootFrameViewport_h |
| OLD | NEW |