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

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

Issue 1215973002: Oilpan: improve ScrollableArea handling. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: review-induced improvements Created 5 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/frame/PinchViewport.cpp ('k') | Source/core/frame/RootFrameViewport.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
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 ScrollableArea { 24 class CORE_EXPORT RootFrameViewport final : public NoBaseWillBeGarbageCollectedF inalized<RootFrameViewport>, public ScrollableArea {
25 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(RootFrameViewport);
25 public: 26 public:
26 static PassOwnPtr<RootFrameViewport> create(ScrollableArea& visualViewport, ScrollableArea& layoutViewport) 27 static PassOwnPtrWillBeRawPtr<RootFrameViewport> create(ScrollableArea& visu alViewport, ScrollableArea& layoutViewport)
27 { 28 {
28 return adoptPtr(new RootFrameViewport(visualViewport, layoutViewport)); 29 return adoptPtrWillBeNoop(new RootFrameViewport(visualViewport, layoutVi ewport));
29 } 30 }
30 31
32 DECLARE_VIRTUAL_TRACE();
33
31 // ScrollableArea Implementation 34 // ScrollableArea Implementation
32 void setScrollPosition(const DoublePoint&, ScrollType, ScrollBehavior = Scro llBehaviorInstant) override; 35 void setScrollPosition(const DoublePoint&, ScrollType, ScrollBehavior = Scro llBehaviorInstant) override;
33 LayoutRect scrollIntoView( 36 LayoutRect scrollIntoView(
34 const LayoutRect& rectInContent, 37 const LayoutRect& rectInContent,
35 const ScrollAlignment& alignX, 38 const ScrollAlignment& alignX,
36 const ScrollAlignment& alignY) override; 39 const ScrollAlignment& alignY) override;
37 DoubleRect visibleContentRectDouble(IncludeScrollbarsInRect = ExcludeScrollb ars) const override; 40 DoubleRect visibleContentRectDouble(IncludeScrollbarsInRect = ExcludeScrollb ars) const override;
38 IntRect visibleContentRect(IncludeScrollbarsInRect = ExcludeScrollbars) cons t override; 41 IntRect visibleContentRect(IncludeScrollbarsInRect = ExcludeScrollbars) cons t override;
39 bool shouldUseIntegerScrollOffset() const override; 42 bool shouldUseIntegerScrollOffset() const override;
40 bool isActive() const override; 43 bool isActive() const override;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 private: 76 private:
74 RootFrameViewport(ScrollableArea& visualViewport, ScrollableArea& layoutView port); 77 RootFrameViewport(ScrollableArea& visualViewport, ScrollableArea& layoutView port);
75 78
76 DoublePoint scrollOffsetFromScrollAnimators() const; 79 DoublePoint scrollOffsetFromScrollAnimators() const;
77 80
78 // If either of the layout or visual viewports are scrolled explicitly (i.e. not 81 // If either of the layout or visual viewports are scrolled explicitly (i.e. not
79 // through this class), their updated offset will not be reflected in this c lass' 82 // through this class), their updated offset will not be reflected in this c lass'
80 // animator so use this method to pull updated values when necessary. 83 // animator so use this method to pull updated values when necessary.
81 void updateScrollAnimator(); 84 void updateScrollAnimator();
82 85
83 ScrollableArea& visualViewport() const { return m_visualViewport; } 86 ScrollableArea& visualViewport() const { ASSERT(m_visualViewport); return *m _visualViewport; }
84 ScrollableArea& layoutViewport() const { return m_layoutViewport; } 87 ScrollableArea& layoutViewport() const { ASSERT(m_layoutViewport); return *m _layoutViewport; }
85 88
86 ScrollableArea& m_visualViewport; 89 RawPtrWillBeMember<ScrollableArea> m_visualViewport;
87 ScrollableArea& m_layoutViewport; 90 RawPtrWillBeMember<ScrollableArea> m_layoutViewport;
88 }; 91 };
89 92
90 } // namespace blink 93 } // namespace blink
91 94
92 #endif // RootFrameViewport_h 95 #endif // RootFrameViewport_h
OLDNEW
« no previous file with comments | « Source/core/frame/PinchViewport.cpp ('k') | Source/core/frame/RootFrameViewport.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698