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

Unified Diff: ui/views/controls/scrollbar/cocoa_scroll_bar.mm

Issue 2189583004: [not for review - epic CL] Adding Elastic+Momentum+Layered scrolling to views::ScrollView Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/controls/scrollbar/cocoa_scroll_bar.h ('k') | ui/views/controls/scrollbar/scroll_bar.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « ui/views/controls/scrollbar/cocoa_scroll_bar.h ('k') | ui/views/controls/scrollbar/scroll_bar.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698