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

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

Issue 1671313002: MacViews: Overlay Scrollbars with Show/Hide Animations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit Created 4 years, 10 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/base_scroll_bar.h" 5 #include "ui/views/controls/scrollbar/base_scroll_bar.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 if (old_state == CustomButton::STATE_PRESSED && 121 if (old_state == CustomButton::STATE_PRESSED &&
122 new_state == CustomButton::STATE_NORMAL && 122 new_state == CustomButton::STATE_NORMAL &&
123 GetThumbTrackState() == CustomButton::STATE_HOVERED) { 123 GetThumbTrackState() == CustomButton::STATE_HOVERED) {
124 SetThumbTrackState(CustomButton::STATE_NORMAL); 124 SetThumbTrackState(CustomButton::STATE_NORMAL);
125 } 125 }
126 } 126 }
127 127
128 /////////////////////////////////////////////////////////////////////////////// 128 ///////////////////////////////////////////////////////////////////////////////
129 // BaseScrollBar, View implementation: 129 // BaseScrollBar, View implementation:
130 130
131 void BaseScrollBar::Layout() {
132 gfx::Rect thumb_bounds = GetTrackBounds();
tapted 2016/02/16 23:32:57 Yeah - I'm not sure what views/OWNERS will think a
spqchan 2016/02/17 00:05:29 Done.
133 if (IsHorizontal()) {
134 thumb_bounds.set_x(thumb_->x());
135 thumb_bounds.set_width(thumb_->width());
136 } else {
137 thumb_bounds.set_y(thumb_->y());
138 thumb_bounds.set_height(thumb_->height());
139 }
140 thumb_->SetBoundsRect(thumb_bounds);
141 }
142
131 bool BaseScrollBar::OnMousePressed(const ui::MouseEvent& event) { 143 bool BaseScrollBar::OnMousePressed(const ui::MouseEvent& event) {
132 if (event.IsOnlyLeftMouseButton()) 144 if (event.IsOnlyLeftMouseButton())
133 ProcessPressEvent(event); 145 ProcessPressEvent(event);
134 return true; 146 return true;
135 } 147 }
136 148
137 void BaseScrollBar::OnMouseReleased(const ui::MouseEvent& event) { 149 void BaseScrollBar::OnMouseReleased(const ui::MouseEvent& event) {
138 SetState(HitTestPoint(event.location()) ? 150 SetState(HitTestPoint(event.location()) ?
139 CustomButton::STATE_HOVERED : CustomButton::STATE_NORMAL); 151 CustomButton::STATE_HOVERED : CustomButton::STATE_NORMAL);
140 } 152 }
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 thumb_position = thumb_position - (thumb_->GetSize() / 2); 520 thumb_position = thumb_position - (thumb_->GetSize() / 2);
509 return (thumb_position * contents_size_) / GetTrackSize(); 521 return (thumb_position * contents_size_) / GetTrackSize();
510 } 522 }
511 523
512 void BaseScrollBar::SetThumbTrackState(CustomButton::ButtonState state) { 524 void BaseScrollBar::SetThumbTrackState(CustomButton::ButtonState state) {
513 thumb_track_state_ = state; 525 thumb_track_state_ = state;
514 SchedulePaint(); 526 SchedulePaint();
515 } 527 }
516 528
517 } // namespace views 529 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698