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

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

Issue 2555213004: Improving the appearance of overlay scrollbars (Closed)
Patch Set: attempt to fix mac Created 4 years 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 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 thumb_->SetLength(static_cast<int>(ratio * GetTrackSize())); 393 thumb_->SetLength(static_cast<int>(ratio * GetTrackSize()));
394 394
395 int thumb_position = CalculateThumbPosition(contents_scroll_offset); 395 int thumb_position = CalculateThumbPosition(contents_scroll_offset);
396 thumb_->SetPosition(thumb_position); 396 thumb_->SetPosition(thumb_position);
397 } 397 }
398 398
399 int BaseScrollBar::GetPosition() const { 399 int BaseScrollBar::GetPosition() const {
400 return thumb_->GetPosition(); 400 return thumb_->GetPosition();
401 } 401 }
402 402
403 bool BaseScrollBar::OverlapsContent() const {
404 return false;
405 }
406
403 /////////////////////////////////////////////////////////////////////////////// 407 ///////////////////////////////////////////////////////////////////////////////
404 // BaseScrollBar, protected: 408 // BaseScrollBar, protected:
405 409
406 BaseScrollBarThumb* BaseScrollBar::GetThumb() const { 410 BaseScrollBarThumb* BaseScrollBar::GetThumb() const {
407 return thumb_; 411 return thumb_;
408 } 412 }
409 413
410 void BaseScrollBar::ScrollToPosition(int position) { 414 void BaseScrollBar::ScrollToPosition(int position) {
411 controller()->ScrollToPosition(this, position); 415 controller()->ScrollToPosition(this, position);
412 } 416 }
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 int track_size = GetTrackSize(); 484 int track_size = GetTrackSize();
481 if (track_size == thumb_size) 485 if (track_size == thumb_size)
482 return 0; 486 return 0;
483 if (scroll_to_middle) 487 if (scroll_to_middle)
484 thumb_position = thumb_position - (thumb_size / 2); 488 thumb_position = thumb_position - (thumb_size / 2);
485 return (thumb_position * (contents_size_ - viewport_size_)) / 489 return (thumb_position * (contents_size_ - viewport_size_)) /
486 (track_size - thumb_size); 490 (track_size - thumb_size);
487 } 491 }
488 492
489 } // namespace views 493 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698