Chromium Code Reviews| OLD | NEW |
|---|---|
| (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/input/inner_viewport_scrollbar.h" | |
| 6 | |
| 7 #include "cc/layers/layer.h" | |
| 8 #include "third_party/skia/include/core/SkCanvas.h" | |
| 9 | |
| 10 namespace cc { | |
| 11 | |
| 12 InnerViewportScrollbar::InnerViewportScrollbar( | |
| 13 scoped_refptr<Layer> scroll_layer, | |
| 14 scoped_refptr<Layer> clip_layer, | |
| 15 ScrollbarOrientation orientation, | |
| 16 size_t thickness) | |
| 17 : scroll_layer_(scroll_layer), | |
| 18 clip_layer_(clip_layer), | |
| 19 orientation_(orientation), | |
| 20 thickness_(thickness) {} | |
| 21 | |
| 22 InnerViewportScrollbar::~InnerViewportScrollbar() {} | |
| 23 | |
| 24 ScrollbarOrientation InnerViewportScrollbar::Orientation() const { | |
| 25 return orientation_; | |
| 26 } | |
| 27 | |
| 28 gfx::Point InnerViewportScrollbar::Location() const { | |
| 29 return gfx::Point(); | |
| 30 } | |
| 31 | |
| 32 bool InnerViewportScrollbar::IsOverlay() const { | |
| 33 return true; | |
| 34 } | |
| 35 | |
| 36 bool InnerViewportScrollbar::HasThumb() const { | |
| 37 return true; | |
| 38 } | |
| 39 | |
| 40 int InnerViewportScrollbar::ThumbThickness() const { | |
| 41 return thickness_; | |
| 42 } | |
| 43 | |
| 44 int InnerViewportScrollbar::ThumbLength() const { | |
| 45 gfx::Rect track_rect = TrackRect(); | |
|
jamesr
2013/07/03 21:12:14
this is dead code
| |
| 46 if (orientation_ == HORIZONTAL) { | |
| 47 float ratio = static_cast<float>(track_rect.width()) / | |
| 48 clip_layer_->bounds().width(); | |
| 49 return track_rect.width() - ratio * scroll_layer_->max_scroll_offset().x(); | |
|
enne (OOO)
2013/06/19 23:38:28
(1) I think this math is not quite right. Can you
trchen
2013/06/20 01:16:08
Your relative layer space approach should work wit
wjmaclean
2013/06/21 18:20:53
We still need something that will work without a b
wjmaclean
2013/06/21 18:20:53
Yes, I'll add a unit test.
trchen
2013/06/24 21:38:04
I think we can do without dummy values. Most of th
| |
| 50 } else { | |
| 51 float ratio = static_cast<float>(track_rect.height()) / | |
| 52 clip_layer_->bounds().height(); | |
| 53 return track_rect.height() - ratio * scroll_layer_->max_scroll_offset().y(); | |
| 54 } | |
| 55 } | |
| 56 | |
| 57 gfx::Rect InnerViewportScrollbar::TrackRect() const { | |
| 58 if (orientation_ == HORIZONTAL) | |
|
enne (OOO)
2013/06/19 23:38:28
style nit: {}
wjmaclean
2013/06/21 18:20:53
Done.
jamesr
2013/07/03 21:12:14
I'm pretty sure this is completely dead code.
| |
| 59 return gfx::Rect( | |
| 60 0, 0, clip_layer_->bounds().width() - thickness_, thickness_); | |
| 61 else | |
| 62 return gfx::Rect( | |
| 63 0, 0, thickness_, clip_layer_->bounds().height() - thickness_); | |
| 64 } | |
| 65 | |
| 66 void InnerViewportScrollbar::PaintPart(SkCanvas* canvas, | |
| 67 ScrollbarPart part, | |
| 68 gfx::Rect content_rect) {} | |
| 69 | |
| 70 } // namespace cc | |
| OLD | NEW |