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

Side by Side 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: 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 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/scroll_view.h" 5 #include "ui/views/controls/scroll_view.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "ui/events/event.h" 9 #include "ui/events/event.h"
10 #include "ui/gfx/canvas.h" 10 #include "ui/gfx/canvas.h"
11 #include "ui/native_theme/native_theme.h" 11 #include "ui/native_theme/native_theme.h"
12 #include "ui/views/border.h" 12 #include "ui/views/border.h"
13 #include "ui/views/controls/scrollbar/native_scroll_bar.h" 13 #include "ui/views/style/platform_style.h"
14 #include "ui/views/widget/root_view.h" 14 #include "ui/views/widget/root_view.h"
15 15
16 namespace views { 16 namespace views {
17 17
18 const char ScrollView::kViewClassName[] = "ScrollView"; 18 const char ScrollView::kViewClassName[] = "ScrollView";
19 19
20 namespace { 20 namespace {
21 21
22 // Subclass of ScrollView that resets the border when the theme changes. 22 // Subclass of ScrollView that resets the border when the theme changes.
23 class ScrollViewWithBorder : public views::ScrollView { 23 class ScrollViewWithBorder : public views::ScrollView {
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 117
118 private: 118 private:
119 DISALLOW_COPY_AND_ASSIGN(Viewport); 119 DISALLOW_COPY_AND_ASSIGN(Viewport);
120 }; 120 };
121 121
122 ScrollView::ScrollView() 122 ScrollView::ScrollView()
123 : contents_(NULL), 123 : contents_(NULL),
124 contents_viewport_(new Viewport()), 124 contents_viewport_(new Viewport()),
125 header_(NULL), 125 header_(NULL),
126 header_viewport_(new Viewport()), 126 header_viewport_(new Viewport()),
127 horiz_sb_(new NativeScrollBar(true)), 127 horiz_sb_(PlatformStyle::CreateScrollBar(true).release()),
128 vert_sb_(new NativeScrollBar(false)), 128 vert_sb_(PlatformStyle::CreateScrollBar(false).release()),
129 corner_view_(new ScrollCornerView()), 129 corner_view_(new ScrollCornerView()),
130 min_height_(-1), 130 min_height_(-1),
131 max_height_(-1), 131 max_height_(-1),
132 hide_horizontal_scrollbar_(false) { 132 hide_horizontal_scrollbar_(false) {
133 set_notify_enter_exit_on_child(true); 133 set_notify_enter_exit_on_child(true);
134 134
135 AddChildView(contents_viewport_); 135 AddChildView(contents_viewport_);
136 AddChildView(header_viewport_); 136 AddChildView(header_viewport_);
137 137
138 // Don't add the scrollbars as children until we discover we need them 138 // Don't add the scrollbars as children until we discover we need them
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 632
633 VariableRowHeightScrollHelper::RowInfo 633 VariableRowHeightScrollHelper::RowInfo
634 FixedRowHeightScrollHelper::GetRowInfo(int y) { 634 FixedRowHeightScrollHelper::GetRowInfo(int y) {
635 if (y < top_margin_) 635 if (y < top_margin_)
636 return RowInfo(0, top_margin_); 636 return RowInfo(0, top_margin_);
637 return RowInfo((y - top_margin_) / row_height_ * row_height_ + top_margin_, 637 return RowInfo((y - top_margin_) / row_height_ * row_height_ + top_margin_,
638 row_height_); 638 row_height_);
639 } 639 }
640 640
641 } // namespace views 641 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698