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

Unified Diff: ui/views/controls/scroll_view.cc

Issue 1671313002: MacViews: Overlay Scrollbars with Show/Hide Animations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits Created 4 years, 10 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/cocoa/views_scrollbar_bridge.mm ('k') | ui/views/controls/scroll_view_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/scroll_view.cc
diff --git a/ui/views/controls/scroll_view.cc b/ui/views/controls/scroll_view.cc
index 6902a8a346086f5c5bb89afbf9dfb658b1755b76..a3e1e9787a2ae32b3118c2d0ed9837d808f94d25 100644
--- a/ui/views/controls/scroll_view.cc
+++ b/ui/views/controls/scroll_view.cc
@@ -10,7 +10,7 @@
#include "ui/gfx/canvas.h"
#include "ui/native_theme/native_theme.h"
#include "ui/views/border.h"
-#include "ui/views/controls/scrollbar/native_scroll_bar.h"
+#include "ui/views/style/platform_style.h"
#include "ui/views/widget/root_view.h"
namespace views {
@@ -124,8 +124,8 @@ ScrollView::ScrollView()
contents_viewport_(new Viewport()),
header_(NULL),
header_viewport_(new Viewport()),
- horiz_sb_(new NativeScrollBar(true)),
- vert_sb_(new NativeScrollBar(false)),
+ horiz_sb_(PlatformStyle::CreateScrollBar(true).release()),
+ vert_sb_(PlatformStyle::CreateScrollBar(false).release()),
corner_view_(new ScrollCornerView()),
min_height_(-1),
max_height_(-1),
@@ -300,11 +300,15 @@ void ScrollView::Layout() {
should_layout_contents = true;
}
+ int height_offset = horiz_sb_required ?
+ horiz_sb_->GetContentOverlapSize() : 0;
+ int width_offset = vert_sb_required ?
+ vert_sb_->GetContentOverlapSize() : 0;
+
if (horiz_sb_required) {
- int height_offset = horiz_sb_->GetContentOverlapSize();
horiz_sb_->SetBounds(contents_x,
viewport_bounds.bottom() - height_offset,
- viewport_bounds.right() - contents_x,
+ viewport_bounds.right() - contents_x - width_offset,
horiz_sb_height + height_offset);
}
if (vert_sb_required) {
@@ -312,7 +316,7 @@ void ScrollView::Layout() {
vert_sb_->SetBounds(viewport_bounds.right() - width_offset,
contents_y,
vert_sb_width + width_offset,
- viewport_bounds.bottom() - contents_y);
+ viewport_bounds.bottom() - contents_y - height_offset);
}
if (corner_view_required) {
// Show the resize corner.
« no previous file with comments | « ui/views/cocoa/views_scrollbar_bridge.mm ('k') | ui/views/controls/scroll_view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698