| Index: ui/views/controls/scrollbar/overlay_scroll_bar.cc
|
| diff --git a/ui/views/controls/scrollbar/overlay_scroll_bar.cc b/ui/views/controls/scrollbar/overlay_scroll_bar.cc
|
| index c7e254a6a026ef8a00f9a3b45c988e7e857faa65..25228e45a4d7ff57bc55ba6bf3f84fd2bedca06e 100644
|
| --- a/ui/views/controls/scrollbar/overlay_scroll_bar.cc
|
| +++ b/ui/views/controls/scrollbar/overlay_scroll_bar.cc
|
| @@ -62,10 +62,15 @@ gfx::Size OverlayScrollBarThumb::GetPreferredSize() {
|
| void OverlayScrollBarThumb::OnPaint(gfx::Canvas* canvas) {
|
| gfx::Rect local_bounds(GetLocalBounds());
|
| SkPaint paint;
|
| - int alpha = (GetState() == CustomButton::STATE_HOVERED ||
|
| - GetState() == CustomButton::STATE_PRESSED) ?
|
| - kThumbHoverAlpha : kThumbDefaultAlpha;
|
| - alpha *= animation_opacity_;
|
| + int alpha = kThumbDefaultAlpha * animation_opacity_;
|
| + if (GetState() == CustomButton::STATE_HOVERED) {
|
| + alpha = kThumbHoverAlpha * animation_opacity_;
|
| + } else if(GetState() == CustomButton::STATE_PRESSED) {
|
| + // If we are in pressed state, no need to worry about animation,
|
| + // just display the deeper color.
|
| + alpha = kThumbHoverAlpha;
|
| + }
|
| +
|
| paint.setStyle(SkPaint::kFill_Style);
|
| paint.setColor(SkColorSetARGB(alpha, 0, 0, 0));
|
| canvas->DrawRoundRect(local_bounds, kThumbCornerRadius, paint);
|
| @@ -119,6 +124,22 @@ void OverlayScrollBar::OnMouseExitedScrollView(const ui::MouseEvent& event) {
|
| animation_.Hide();
|
| }
|
|
|
| +void OverlayScrollBar::OnGestureEvent(ui::GestureEvent* event) {
|
| + switch (event->type()) {
|
| + case ui::ET_GESTURE_SCROLL_BEGIN:
|
| + animation_.Show();
|
| + break;
|
| + case ui::ET_GESTURE_SCROLL_END:
|
| + case ui::ET_SCROLL_FLING_START:
|
| + case ui::ET_GESTURE_END:
|
| + animation_.Hide();
|
| + break;
|
| + default:
|
| + break;
|
| + }
|
| + BaseScrollBar::OnGestureEvent(event);
|
| +}
|
| +
|
| gfx::Size OverlayScrollBar::GetPreferredSize() {
|
| return gfx::Size();
|
| }
|
|
|