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

Side by Side Diff: cc/pinch_zoom_viewport.h

Issue 11550035: Implement pinch-zoom scaling for main-frame scrollbars and pinch-zoom overlay scrollbars. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Refactor for cleaner state/scrollbar split. Created 7 years, 11 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 CC_PINCH_ZOOM_VIEWPORT_H_ 5 #ifndef CC_PINCH_ZOOM_VIEWPORT_H_
6 #define CC_PINCH_ZOOM_VIEWPORT_H_ 6 #define CC_PINCH_ZOOM_VIEWPORT_H_
7 7
8 #include "cc/cc_export.h" 8 #include "cc/cc_export.h"
9 #include "cc/pinch_zoom_scrollbar_layer_impl.h"
9 #include "ui/gfx/rect.h" 10 #include "ui/gfx/rect.h"
10 #include "ui/gfx/transform.h" 11 #include "ui/gfx/transform.h"
11 12
12 namespace cc { 13 namespace cc {
13 14
15 class LayerTreeHostImpl;
16
14 // PinchZoomViewport models the bounds and offset of the viewport that is used 17 // PinchZoomViewport models the bounds and offset of the viewport that is used
15 // during a pinch-zoom operation. It tracks the layout-space dimensions of the 18 // during a pinch-zoom operation. It tracks the layout-space dimensions of the
16 // viewport before any applied scale, and then tracks the layout-space 19 // viewport before any applied scale, and then tracks the layout-space
17 // coordinates of the viewport respecting the pinch settings. 20 // coordinates of the viewport respecting the pinch settings.
18 class CC_EXPORT PinchZoomViewport { 21 class CC_EXPORT PinchZoomViewport {
19 public: 22 public:
20 PinchZoomViewport(); 23 PinchZoomViewport(LayerTreeHostImpl*);
24 ~PinchZoomViewport();
21 25
22 float total_page_scale_factor() const { 26 float total_page_scale_factor() const {
23 return page_scale_factor_ * page_scale_delta_; 27 return page_scale_factor_ * page_scale_delta_;
24 } 28 }
25 29
26 void set_page_scale_factor(float factor) { page_scale_factor_ = factor; } 30 void set_page_scale_factor(float factor) { page_scale_factor_ = factor; }
27 float page_scale_factor() const { return page_scale_factor_; } 31 float page_scale_factor() const { return page_scale_factor_; }
28 32
29 void set_page_scale_delta(float delta); 33 void set_page_scale_delta(float delta);
30 float page_scale_delta() const { return page_scale_delta_; } 34 float page_scale_delta() const { return page_scale_delta_; }
(...skipping 20 matching lines...) Expand all
51 // for pinch-zoom. 55 // for pinch-zoom.
52 gfx::RectF Bounds() const; 56 gfx::RectF Bounds() const;
53 57
54 const gfx::Vector2dF& zoomed_viewport_offset() const { 58 const gfx::Vector2dF& zoomed_viewport_offset() const {
55 return zoomed_viewport_offset_; 59 return zoomed_viewport_offset_;
56 } 60 }
57 61
58 void set_layout_viewport_size(const gfx::SizeF& size) { 62 void set_layout_viewport_size(const gfx::SizeF& size) {
59 layout_viewport_size_ = size; 63 layout_viewport_size_ = size;
60 } 64 }
65 gfx::SizeF layout_viewport_size() {
66 return layout_viewport_size_;
67 }
61 68
62 // Apply the scroll offset in layout space to the offset of the pinch-zoom 69 // Apply the scroll offset in layout space to the offset of the pinch-zoom
63 // viewport. The viewport cannot be scrolled outside of the layout viewport 70 // viewport. The viewport cannot be scrolled outside of the layout viewport
64 // bounds. Returns the component of the scroll that is un-applied due to this 71 // bounds. Returns the component of the scroll that is un-applied due to this
65 // constraint. 72 // constraint.
66 gfx::Vector2dF ApplyScroll(const gfx::Vector2dF); 73 gfx::Vector2dF ApplyScroll(const gfx::Vector2dF);
67 74
68 // The implTransform goes from the origin of the unzoomedDeviceViewport to the 75 // The implTransform goes from the origin of the unzoomedDeviceViewport to the
69 // origin of the zoomedDeviceViewport. 76 // origin of the zoomedDeviceViewport.
70 // 77 //
71 // implTransform = S[pageScale] * Tr[-zoomedDeviceViewportOffset] 78 // implTransform = S[pageScale] * Tr[-zoomedDeviceViewportOffset]
72 gfx::Transform ImplTransform(bool page_scale_pinch_zoom_enabled) const; 79 gfx::Transform ImplTransform(bool page_scale_pinch_zoom_enabled) const;
73 80
81 LayerImpl* root_scroll_layer();
82 LayerImpl* currently_scrolling_layer() const;
83
84 void AddPinchZoomScrollbarsToTree(LayerTreeImpl*);
85
74 private: 86 private:
75 float page_scale_factor_; 87 float page_scale_factor_;
76 float page_scale_delta_; 88 float page_scale_delta_;
77 float sent_page_scale_delta_; 89 float sent_page_scale_delta_;
78 float max_page_scale_factor_; 90 float max_page_scale_factor_;
79 float min_page_scale_factor_; 91 float min_page_scale_factor_;
80 float device_scale_factor_; 92 float device_scale_factor_;
81 93
82 gfx::Vector2dF zoomed_viewport_offset_; 94 gfx::Vector2dF zoomed_viewport_offset_;
83 gfx::SizeF layout_viewport_size_; 95 gfx::SizeF layout_viewport_size_;
96
97 PinchZoomScrollbarState vertical_scrollbar_client_;
98 PinchZoomScrollbarState horizontal_scrollbar_client_;
99 LayerTreeHostImpl* owner_;
84 }; 100 };
85 101
86 } // namespace cc 102 } // namespace cc
87 103
88 #endif // CC_PINCH_ZOOM_VIEWPORT_H_ 104 #endif // CC_PINCH_ZOOM_VIEWPORT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698