| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "ui/views/controls/scrollbar/kennedy_scroll_bar.h" | 5 #include "ui/views/controls/scrollbar/kennedy_scroll_bar.h" |
| 6 | 6 |
| 7 #include "third_party/skia/include/core/SkColor.h" | 7 #include "third_party/skia/include/core/SkColor.h" |
| 8 #include "third_party/skia/include/core/SkXfermode.h" | 8 #include "third_party/skia/include/core/SkXfermode.h" |
| 9 #include "ui/gfx/canvas.h" | 9 #include "ui/gfx/canvas.h" |
| 10 #include "ui/views/background.h" | 10 #include "ui/views/background.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 : BaseScrollBar(horizontal, new KennedyScrollBarThumb(this)) { | 61 : BaseScrollBar(horizontal, new KennedyScrollBarThumb(this)) { |
| 62 set_notify_enter_exit_on_child(true); | 62 set_notify_enter_exit_on_child(true); |
| 63 } | 63 } |
| 64 | 64 |
| 65 KennedyScrollBar::~KennedyScrollBar() { | 65 KennedyScrollBar::~KennedyScrollBar() { |
| 66 } | 66 } |
| 67 | 67 |
| 68 gfx::Rect KennedyScrollBar::GetTrackBounds() const { | 68 gfx::Rect KennedyScrollBar::GetTrackBounds() const { |
| 69 gfx::Rect local_bounds(GetLocalBounds()); | 69 gfx::Rect local_bounds(GetLocalBounds()); |
| 70 gfx::Size track_size = local_bounds.size(); | 70 gfx::Size track_size = local_bounds.size(); |
| 71 track_size.ClampToMin(GetThumb()->size()); | 71 track_size.ClampToLowerBound(GetThumb()->size()); |
| 72 local_bounds.set_size(track_size); | 72 local_bounds.set_size(track_size); |
| 73 return local_bounds; | 73 return local_bounds; |
| 74 } | 74 } |
| 75 | 75 |
| 76 int KennedyScrollBar::GetLayoutSize() const { | 76 int KennedyScrollBar::GetLayoutSize() const { |
| 77 return kScrollbarWidth; | 77 return kScrollbarWidth; |
| 78 } | 78 } |
| 79 | 79 |
| 80 gfx::Size KennedyScrollBar::GetPreferredSize() { | 80 gfx::Size KennedyScrollBar::GetPreferredSize() { |
| 81 return GetTrackBounds().size(); | 81 return GetTrackBounds().size(); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 98 CustomButton::ButtonState state = GetThumbTrackState(); | 98 CustomButton::ButtonState state = GetThumbTrackState(); |
| 99 if ((state == CustomButton::STATE_HOVERED) || | 99 if ((state == CustomButton::STATE_HOVERED) || |
| 100 (state == CustomButton::STATE_PRESSED)) { | 100 (state == CustomButton::STATE_PRESSED)) { |
| 101 gfx::Rect local_bounds(GetLocalBounds()); | 101 gfx::Rect local_bounds(GetLocalBounds()); |
| 102 canvas->FillRect(local_bounds, kTrackHoverColor); | 102 canvas->FillRect(local_bounds, kTrackHoverColor); |
| 103 canvas->DrawRect(local_bounds, kBorderColor); | 103 canvas->DrawRect(local_bounds, kBorderColor); |
| 104 } | 104 } |
| 105 } | 105 } |
| 106 | 106 |
| 107 } // namespace views | 107 } // namespace views |
| OLD | NEW |