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

Side by Side Diff: cc/pinch_zoom_scrollbar.cc

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: Fix impl-side painting issues. Created 7 years, 10 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "cc/pinch_zoom_scrollbar.h"
6
7 #include "cc/layer.h"
8 #include "cc/layer_tree_host.h"
9
10 namespace cc {
11
12 PinchZoomScrollbar::PinchZoomScrollbar(
13 WebKit::WebScrollbar::Orientation orientation, LayerTreeHost* owner)
14 : orientation_(orientation),
15 owner_(owner) {
16 DCHECK(owner_);
17 }
18
19
20 bool PinchZoomScrollbar::isOverlay() const { return true; }
21
22 int PinchZoomScrollbar::value() const {
23 Layer* rootScrollLayer = owner_->rootScrollLayer();
24 if (!rootScrollLayer)
25 return 0;
26
27 if (orientation_ == WebKit::WebScrollbar::Horizontal)
28 return rootScrollLayer->scrollOffset().x();
29 else
30 return rootScrollLayer->scrollOffset().y();
31 }
32
33 WebKit::WebPoint PinchZoomScrollbar::location() const {
34 return WebKit::WebPoint();
35 }
36
37 WebKit::WebSize PinchZoomScrollbar::size() const {
38 gfx::Size viewportSize = owner_->layoutViewportSize();
39 gfx::Size size;
40 if (orientation_ == WebKit::WebScrollbar::Horizontal)
41 size = gfx::Size(viewportSize.width() - kTrackWidth, kTrackWidth);
42 else
43 size = gfx::Size(kTrackWidth, viewportSize.height() - kTrackWidth);
44 return WebKit::WebSize(size);
45 }
46
47 bool PinchZoomScrollbar::enabled() const {
48 return true;
49 }
50
51 int PinchZoomScrollbar::maximum() const {
52 gfx::Size size = owner_->layoutViewportSize();
53 Layer* rootScrollLayer = owner_->rootScrollLayer();
54 if (!rootScrollLayer)
55 return 0;
56
57 if (orientation_ == WebKit::WebScrollbar::Horizontal)
58 return rootScrollLayer->contentBounds().width() - size.width();
59 else
60 return rootScrollLayer->contentBounds().height() - size.height();
61 }
62
63 int PinchZoomScrollbar::totalSize() const {
64 Layer* rootScrollLayer = owner_->rootScrollLayer();
65 gfx::Size size;
66 if (rootScrollLayer)
67 size = rootScrollLayer->contentBounds();
68 else
69 size = owner_->layoutViewportSize();
70
71 if (orientation_ == WebKit::WebScrollbar::Horizontal)
72 return size.width();
73 else
74 return size.height();
75 }
76
77 bool PinchZoomScrollbar::isScrollViewScrollbar() const {
78 return false;
79 }
80
81 bool PinchZoomScrollbar::isScrollableAreaActive() const {
82 return true;
83 }
84
85 WebKit::WebScrollbar::ScrollbarControlSize PinchZoomScrollbar::controlSize() con st {
86 return WebKit::WebScrollbar::SmallScrollbar;
87 }
88
89 WebKit::WebScrollbar::ScrollbarPart PinchZoomScrollbar::pressedPart() const {
90 return WebKit::WebScrollbar::NoPart;
91 }
92
93 WebKit::WebScrollbar::ScrollbarPart PinchZoomScrollbar::hoveredPart() const {
94 return WebKit::WebScrollbar::NoPart;
95 }
96
97 WebKit::WebScrollbar::ScrollbarOverlayStyle PinchZoomScrollbar::scrollbarOverlay Style() const {
98 return WebKit::WebScrollbar::ScrollbarOverlayStyleDefault;
99 }
100 bool PinchZoomScrollbar::isCustomScrollbar() const {
101 return false;
102 }
103
104 WebKit::WebScrollbar::Orientation PinchZoomScrollbar::orientation() const {
105 return orientation_;
106 }
107
108 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698