OLD | NEW |
---|---|
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 #include "cc/input/pinch_zoom_scrollbar.h" | 5 #include "cc/input/pinch_zoom_scrollbar.h" |
6 | 6 |
7 #include "cc/input/pinch_zoom_scrollbar_geometry.h" | 7 #include "cc/input/pinch_zoom_scrollbar_geometry.h" |
8 #include "cc/layers/layer.h" | 8 #include "cc/layers/layer.h" |
9 #include "cc/trees/layer_tree_host.h" | 9 #include "cc/trees/layer_tree_host.h" |
10 #include "ui/gfx/size_conversions.h" | |
10 | 11 |
11 namespace cc { | 12 namespace cc { |
12 | 13 |
13 const float PinchZoomScrollbar::kDefaultOpacity = 0.5f; | 14 const float PinchZoomScrollbar::kDefaultOpacity = 0.5f; |
14 const float PinchZoomScrollbar::kFadeDurationInSeconds = 0.5f; | 15 const float PinchZoomScrollbar::kFadeDurationInSeconds = 0.5f; |
15 | 16 |
16 PinchZoomScrollbar::PinchZoomScrollbar( | 17 PinchZoomScrollbar::PinchZoomScrollbar( |
17 WebKit::WebScrollbar::Orientation orientation, LayerTreeHost* owner) | 18 WebKit::WebScrollbar::Orientation orientation, LayerTreeHost* owner) |
18 : orientation_(orientation), | 19 : orientation_(orientation), |
19 owner_(owner) { | 20 owner_(owner) { |
(...skipping 12 matching lines...) Expand all Loading... | |
32 return root_scroll_layer->scroll_offset().x(); | 33 return root_scroll_layer->scroll_offset().x(); |
33 else | 34 else |
34 return root_scroll_layer->scroll_offset().y(); | 35 return root_scroll_layer->scroll_offset().y(); |
35 } | 36 } |
36 | 37 |
37 WebKit::WebPoint PinchZoomScrollbar::location() const { | 38 WebKit::WebPoint PinchZoomScrollbar::location() const { |
38 return WebKit::WebPoint(); | 39 return WebKit::WebPoint(); |
39 } | 40 } |
40 | 41 |
41 WebKit::WebSize PinchZoomScrollbar::size() const { | 42 WebKit::WebSize PinchZoomScrollbar::size() const { |
42 gfx::Size viewport_size = owner_->layout_viewport_size(); | 43 gfx::Size viewport_size = gfx::ToCeiledSize(gfx::ScaleSize( |
danakj
2013/04/09 00:04:35
Is there a nice way to not duplicate this logic wi
| |
44 owner_->device_viewport_size(), 1 / owner_->device_scale_factor())); | |
43 gfx::Size size; | 45 gfx::Size size; |
44 int track_width = PinchZoomScrollbarGeometry::kTrackWidth; | 46 int track_width = PinchZoomScrollbarGeometry::kTrackWidth; |
45 if (orientation_ == WebKit::WebScrollbar::Horizontal) | 47 if (orientation_ == WebKit::WebScrollbar::Horizontal) |
46 size = gfx::Size(viewport_size.width() - track_width, track_width); | 48 size = gfx::Size(viewport_size.width() - track_width, track_width); |
47 else | 49 else |
48 size = gfx::Size(track_width, viewport_size.height() - track_width); | 50 size = gfx::Size(track_width, viewport_size.height() - track_width); |
49 return WebKit::WebSize(size); | 51 return WebKit::WebSize(size); |
50 } | 52 } |
51 | 53 |
52 bool PinchZoomScrollbar::enabled() const { | 54 bool PinchZoomScrollbar::enabled() const { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
108 } | 110 } |
109 bool PinchZoomScrollbar::isCustomScrollbar() const { | 111 bool PinchZoomScrollbar::isCustomScrollbar() const { |
110 return false; | 112 return false; |
111 } | 113 } |
112 | 114 |
113 WebKit::WebScrollbar::Orientation PinchZoomScrollbar::orientation() const { | 115 WebKit::WebScrollbar::Orientation PinchZoomScrollbar::orientation() const { |
114 return orientation_; | 116 return orientation_; |
115 } | 117 } |
116 | 118 |
117 } // namespace cc | 119 } // namespace cc |
OLD | NEW |