| Index: ui/views/controls/scrollbar/base_scroll_bar.cc
|
| diff --git a/ui/views/controls/scrollbar/base_scroll_bar.cc b/ui/views/controls/scrollbar/base_scroll_bar.cc
|
| index 82d852944b656dadf77f632a2663201039b3eb64..2da1f80db5b6d240f2d0b316c1fe773471810161 100644
|
| --- a/ui/views/controls/scrollbar/base_scroll_bar.cc
|
| +++ b/ui/views/controls/scrollbar/base_scroll_bar.cc
|
| @@ -38,7 +38,6 @@ BaseScrollBar::BaseScrollBar(bool horizontal, BaseScrollBarThumb* thumb)
|
| contents_size_(0),
|
| contents_scroll_offset_(0),
|
| viewport_size_(0),
|
| - thumb_track_state_(CustomButton::STATE_NORMAL),
|
| last_scroll_amount_(SCROLL_NONE),
|
| repeater_(base::Bind(&BaseScrollBar::TrackClicked,
|
| base::Unretained(this))),
|
| @@ -112,15 +111,6 @@ bool BaseScrollBar::ScrollByContentsOffset(int contents_offset) {
|
| return true;
|
| }
|
|
|
| -void BaseScrollBar::OnThumbStateChanged(CustomButton::ButtonState old_state,
|
| - CustomButton::ButtonState new_state) {
|
| - if (old_state == CustomButton::STATE_PRESSED &&
|
| - new_state == CustomButton::STATE_NORMAL &&
|
| - GetThumbTrackState() == CustomButton::STATE_HOVERED) {
|
| - SetThumbTrackState(CustomButton::STATE_NORMAL);
|
| - }
|
| -}
|
| -
|
| ///////////////////////////////////////////////////////////////////////////////
|
| // BaseScrollBar, View implementation:
|
|
|
| @@ -131,21 +121,11 @@ bool BaseScrollBar::OnMousePressed(const ui::MouseEvent& event) {
|
| }
|
|
|
| void BaseScrollBar::OnMouseReleased(const ui::MouseEvent& event) {
|
| - SetState(HitTestPoint(event.location()) ?
|
| - CustomButton::STATE_HOVERED : CustomButton::STATE_NORMAL);
|
| + repeater_.Stop();
|
| }
|
|
|
| void BaseScrollBar::OnMouseCaptureLost() {
|
| - SetState(CustomButton::STATE_NORMAL);
|
| -}
|
| -
|
| -void BaseScrollBar::OnMouseEntered(const ui::MouseEvent& event) {
|
| - SetThumbTrackState(CustomButton::STATE_HOVERED);
|
| -}
|
| -
|
| -void BaseScrollBar::OnMouseExited(const ui::MouseEvent& event) {
|
| - if (GetThumbTrackState() == CustomButton::STATE_HOVERED)
|
| - SetState(CustomButton::STATE_NORMAL);
|
| + repeater_.Stop();
|
| }
|
|
|
| bool BaseScrollBar::OnKeyPressed(const ui::KeyEvent& event) {
|
| @@ -216,7 +196,7 @@ void BaseScrollBar::OnGestureEvent(ui::GestureEvent* event) {
|
| return;
|
| }
|
|
|
| - SetState(CustomButton::STATE_NORMAL);
|
| + repeater_.Stop();
|
|
|
| if (event->type() == ui::ET_GESTURE_TAP) {
|
| // TAP_DOWN would have already scrolled some amount. So scrolling again on
|
| @@ -407,8 +387,7 @@ void BaseScrollBar::Update(int viewport_size,
|
| // content size multiplied by the height of the thumb track.
|
| double ratio =
|
| std::min(1.0, static_cast<double>(viewport_size) / contents_size_);
|
| - int thumb_size = static_cast<int>(ratio * GetTrackSize());
|
| - thumb_->SetSize(thumb_size);
|
| + thumb_->SetLength(static_cast<int>(ratio * GetTrackSize()));
|
|
|
| int thumb_position = CalculateThumbPosition(contents_scroll_offset);
|
| thumb_->SetPosition(thumb_position);
|
| @@ -425,10 +404,6 @@ BaseScrollBarThumb* BaseScrollBar::GetThumb() const {
|
| return thumb_;
|
| }
|
|
|
| -CustomButton::ButtonState BaseScrollBar::GetThumbTrackState() const {
|
| - return thumb_track_state_;
|
| -}
|
| -
|
| void BaseScrollBar::ScrollToPosition(int position) {
|
| controller()->ScrollToPosition(this, position);
|
| }
|
| @@ -445,7 +420,6 @@ int BaseScrollBar::GetThumbSizeForTest() {
|
| }
|
|
|
| void BaseScrollBar::ProcessPressEvent(const ui::LocatedEvent& event) {
|
| - SetThumbTrackState(CustomButton::STATE_PRESSED);
|
| gfx::Rect thumb_bounds = thumb_->bounds();
|
| if (IsHorizontal()) {
|
| if (GetMirroredXInView(event.x()) < thumb_bounds.x()) {
|
| @@ -464,11 +438,6 @@ void BaseScrollBar::ProcessPressEvent(const ui::LocatedEvent& event) {
|
| repeater_.Start();
|
| }
|
|
|
| -void BaseScrollBar::SetState(CustomButton::ButtonState state) {
|
| - SetThumbTrackState(state);
|
| - repeater_.Stop();
|
| -}
|
| -
|
| void BaseScrollBar::TrackClicked() {
|
| if (last_scroll_amount_ != SCROLL_NONE)
|
| ScrollByAmount(last_scroll_amount_);
|
| @@ -507,9 +476,4 @@ int BaseScrollBar::CalculateContentsOffset(int thumb_position,
|
| (track_size - thumb_size);
|
| }
|
|
|
| -void BaseScrollBar::SetThumbTrackState(CustomButton::ButtonState state) {
|
| - thumb_track_state_ = state;
|
| - SchedulePaint();
|
| -}
|
| -
|
| } // namespace views
|
|
|