| Index: ui/views/controls/scrollbar/cocoa_scroll_bar.mm
|
| diff --git a/ui/views/controls/scrollbar/cocoa_scroll_bar.mm b/ui/views/controls/scrollbar/cocoa_scroll_bar.mm
|
| index 3c6bb9b607f7881827abd4f587ee52ed03ff39c3..a22610664477005b9f41e6307985679bd35ba1cc 100644
|
| --- a/ui/views/controls/scrollbar/cocoa_scroll_bar.mm
|
| +++ b/ui/views/controls/scrollbar/cocoa_scroll_bar.mm
|
| @@ -168,6 +168,7 @@ CocoaScrollBar::CocoaScrollBar(bool horizontal)
|
| base::Bind(&CocoaScrollBar::HideScrollbar, base::Unretained(this)),
|
| false),
|
| thickness_animation_(this),
|
| + last_contents_scroll_offset_(0),
|
| is_expanded_(false),
|
| did_start_dragging_(false) {
|
| bridge_.reset([[ViewsScrollbarBridge alloc] initWithDelegate:this]);
|
| @@ -322,10 +323,24 @@ void CocoaScrollBar::OnMouseExited(const ui::MouseEvent& event) {
|
| }
|
|
|
| //////////////////////////////////////////////////////////////////
|
| -// CocoaScrollBar::BaseScrollBar:
|
| +// CocoaScrollBar::ScrollBar:
|
| +
|
| +void CocoaScrollBar::Update(int viewport_size,
|
| + int content_size,
|
| + int contents_scroll_offset) {
|
| + // TODO(tapted): Pass in overscroll amounts from the Layer and "Squish" the
|
| + // scroller thumb accordingly.
|
| + BaseScrollBar::Update(viewport_size, content_size, contents_scroll_offset);
|
| +
|
| + // Only reveal the scroller when |contents_scroll_offset| changes. Note this
|
| + // is different to GetPosition() which can change due to layout. A layout
|
| + // change can also change the offset; show the scroller in these cases. This
|
| + // is consistent with WebContents (Cocoa will also show a scroller with any
|
| + // mouse-initiated layout, put not programmatic size changes).
|
| + if (contents_scroll_offset == last_contents_scroll_offset_)
|
| + return;
|
|
|
| -void CocoaScrollBar::ScrollToPosition(int position) {
|
| - BaseScrollBar::ScrollToPosition(position);
|
| + last_contents_scroll_offset_ = contents_scroll_offset;
|
|
|
| if (GetCocoaScrollBarThumb()->IsStatePressed())
|
| did_start_dragging_ = true;
|
|
|