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

Side by Side Diff: ui/views/controls/scroll_view.cc

Issue 259073004: Revert of retry r266042: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « ui/views/controls/label_unittest.cc ('k') | ui/views/controls/styled_label_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ui/events/event.h" 8 #include "ui/events/event.h"
9 #include "ui/native_theme/native_theme.h" 9 #include "ui/native_theme/native_theme.h"
10 #include "ui/views/border.h" 10 #include "ui/views/border.h"
11 #include "ui/views/controls/scrollbar/native_scroll_bar.h" 11 #include "ui/views/controls/scrollbar/native_scroll_bar.h"
12 #include "ui/views/widget/root_view.h" 12 #include "ui/views/widget/root_view.h"
13 13
14 namespace views { 14 namespace views {
15 15
16 const char ScrollView::kViewClassName[] = "ScrollView"; 16 const char ScrollView::kViewClassName[] = "ScrollView";
17 17
18 namespace { 18 namespace {
19 19
20 // Subclass of ScrollView that resets the border when the theme changes. 20 // Subclass of ScrollView that resets the border when the theme changes.
21 class ScrollViewWithBorder : public views::ScrollView { 21 class ScrollViewWithBorder : public views::ScrollView {
22 public: 22 public:
23 ScrollViewWithBorder() {} 23 ScrollViewWithBorder() {
24 SetThemeSpecificState();
25 }
24 26
25 // View overrides; 27 // View overrides;
26 virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) OVERRIDE { 28 virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) OVERRIDE {
27 SetBorder(Border::CreateSolidBorder( 29 SetThemeSpecificState();
28 1,
29 theme->GetSystemColor(ui::NativeTheme::kColorId_UnfocusedBorderColor)));
30 } 30 }
31 31
32 private: 32 private:
33 void SetThemeSpecificState() {
34 SetBorder(Border::CreateSolidBorder(
35 1,
36 GetNativeTheme()->GetSystemColor(
37 ui::NativeTheme::kColorId_UnfocusedBorderColor)));
38 }
39
33 DISALLOW_COPY_AND_ASSIGN(ScrollViewWithBorder); 40 DISALLOW_COPY_AND_ASSIGN(ScrollViewWithBorder);
34 }; 41 };
35 42
36 // Returns the position for the view so that it isn't scrolled off the visible 43 // Returns the position for the view so that it isn't scrolled off the visible
37 // region. 44 // region.
38 int CheckScrollBounds(int viewport_size, int content_size, int current_pos) { 45 int CheckScrollBounds(int viewport_size, int content_size, int current_pos) {
39 int max = std::max(content_size - viewport_size, 0); 46 int max = std::max(content_size - viewport_size, 0);
40 if (current_pos < 0) 47 if (current_pos < 0)
41 return 0; 48 return 0;
42 if (current_pos > max) 49 if (current_pos > max)
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 628
622 VariableRowHeightScrollHelper::RowInfo 629 VariableRowHeightScrollHelper::RowInfo
623 FixedRowHeightScrollHelper::GetRowInfo(int y) { 630 FixedRowHeightScrollHelper::GetRowInfo(int y) {
624 if (y < top_margin_) 631 if (y < top_margin_)
625 return RowInfo(0, top_margin_); 632 return RowInfo(0, top_margin_);
626 return RowInfo((y - top_margin_) / row_height_ * row_height_ + top_margin_, 633 return RowInfo((y - top_margin_) / row_height_ * row_height_ + top_margin_,
627 row_height_); 634 row_height_);
628 } 635 }
629 636
630 } // namespace views 637 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/label_unittest.cc ('k') | ui/views/controls/styled_label_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698