| 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 return owner_->PinchZoomScrollbarSize(orientation_); |
| 43 gfx::Size size; | |
| 44 int track_width = PinchZoomScrollbarGeometry::kTrackWidth; | |
| 45 if (orientation_ == WebKit::WebScrollbar::Horizontal) | |
| 46 size = gfx::Size(viewport_size.width() - track_width, track_width); | |
| 47 else | |
| 48 size = gfx::Size(track_width, viewport_size.height() - track_width); | |
| 49 return WebKit::WebSize(size); | |
| 50 } | 44 } |
| 51 | 45 |
| 52 bool PinchZoomScrollbar::enabled() const { | 46 bool PinchZoomScrollbar::enabled() const { |
| 53 return true; | 47 return true; |
| 54 } | 48 } |
| 55 | 49 |
| 56 int PinchZoomScrollbar::maximum() const { | 50 int PinchZoomScrollbar::maximum() const { |
| 57 const Layer* root_scroll_layer = owner_->RootScrollLayer(); | 51 const Layer* root_scroll_layer = owner_->RootScrollLayer(); |
| 58 if (!root_scroll_layer) | 52 if (!root_scroll_layer) |
| 59 return 0; | 53 return 0; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 } | 102 } |
| 109 bool PinchZoomScrollbar::isCustomScrollbar() const { | 103 bool PinchZoomScrollbar::isCustomScrollbar() const { |
| 110 return false; | 104 return false; |
| 111 } | 105 } |
| 112 | 106 |
| 113 WebKit::WebScrollbar::Orientation PinchZoomScrollbar::orientation() const { | 107 WebKit::WebScrollbar::Orientation PinchZoomScrollbar::orientation() const { |
| 114 return orientation_; | 108 return orientation_; |
| 115 } | 109 } |
| 116 | 110 |
| 117 } // namespace cc | 111 } // namespace cc |
| OLD | NEW |