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

Side by Side Diff: ui/views/controls/scrollbar/kennedy_scroll_bar.cc

Issue 14367021: Rename ClampToMin and ClampToMax (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 6 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
« no previous file with comments | « ui/views/controls/button/label_button.cc ('k') | ui/views/controls/tabbed_pane/tabbed_pane.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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.SetToMax(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
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
OLDNEW
« no previous file with comments | « ui/views/controls/button/label_button.cc ('k') | ui/views/controls/tabbed_pane/tabbed_pane.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698