summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-10 03:04:53 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-10 03:04:53 +0000
commit83a4894678658a364191c4ec370143f5dbe097e6 (patch)
tree00f8887b1be5940418f11737964f26898886cf6e
parent4fc24a6e5fad3b0a2b4d6bc511755bff4225b0ae (diff)
downloadchromium_src-83a4894678658a364191c4ec370143f5dbe097e6.zip
chromium_src-83a4894678658a364191c4ec370143f5dbe097e6.tar.gz
chromium_src-83a4894678658a364191c4ec370143f5dbe097e6.tar.bz2
Makes treeview add a one pixel border around the scrollview.
BUG=109666 TEST=none R=ben@chromium.org Review URL: http://codereview.chromium.org/9114029 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@116995 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--ui/views/controls/scroll_view.cc8
-rw-r--r--ui/views/controls/scrollbar/native_scroll_bar.cc6
-rw-r--r--ui/views/controls/scrollbar/native_scroll_bar_gtk.cc3
-rw-r--r--ui/views/controls/scrollbar/native_scroll_bar_views.cc40
-rw-r--r--ui/views/controls/scrollbar/native_scroll_bar_win.cc3
-rw-r--r--ui/views/controls/tree/tree_view_views.cc5
6 files changed, 49 insertions, 16 deletions
diff --git a/ui/views/controls/scroll_view.cc b/ui/views/controls/scroll_view.cc
index ad6b88b..f49f42e 100644
--- a/ui/views/controls/scroll_view.cc
+++ b/ui/views/controls/scroll_view.cc
@@ -153,9 +153,7 @@ void ScrollView::Layout() {
// this default behavior, the inner view has to calculate the available space,
// used ComputeScrollBarsVisibility() to use the same calculation that is done
// here and sets its bound to fit within.
- gfx::Rect viewport_bounds = GetLocalBounds();
- // Realign it to 0 so it can be used as-is for SetBounds().
- viewport_bounds.set_origin(gfx::Point(0, 0));
+ gfx::Rect viewport_bounds = GetContentsBounds();
// viewport_size is the total client space available.
gfx::Size viewport_size = viewport_bounds.size();
if (viewport_bounds.IsEmpty()) {
@@ -163,8 +161,8 @@ void ScrollView::Layout() {
return;
}
- // Assumes a vertical scrollbar since most the current views are designed for
- // this.
+ // Assumes a vertical scrollbar since most of the current views are designed
+ // for this.
int horiz_sb_height = GetScrollBarHeight();
int vert_sb_width = GetScrollBarWidth();
viewport_bounds.set_width(viewport_bounds.width() - vert_sb_width);
diff --git a/ui/views/controls/scrollbar/native_scroll_bar.cc b/ui/views/controls/scrollbar/native_scroll_bar.cc
index d6a1254..9dcb485 100644
--- a/ui/views/controls/scrollbar/native_scroll_bar.cc
+++ b/ui/views/controls/scrollbar/native_scroll_bar.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -49,8 +49,10 @@ gfx::Size NativeScrollBar::GetPreferredSize() {
}
void NativeScrollBar::Layout() {
- if (native_wrapper_)
+ if (native_wrapper_) {
+ native_wrapper_->GetView()->SetBounds(0, 0, width(), height());
native_wrapper_->GetView()->Layout();
+ }
}
void NativeScrollBar::ViewHierarchyChanged(bool is_add, View *parent,
diff --git a/ui/views/controls/scrollbar/native_scroll_bar_gtk.cc b/ui/views/controls/scrollbar/native_scroll_bar_gtk.cc
index 2e1e191..b6d11e3 100644
--- a/ui/views/controls/scrollbar/native_scroll_bar_gtk.cc
+++ b/ui/views/controls/scrollbar/native_scroll_bar_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -30,7 +30,6 @@ NativeScrollBarGtk::~NativeScrollBarGtk() {
// NativeScrollBarGtk, View overrides:
void NativeScrollBarGtk::Layout() {
- SetBoundsRect(native_scroll_bar_->GetLocalBounds());
NativeControlGtk::Layout();
}
diff --git a/ui/views/controls/scrollbar/native_scroll_bar_views.cc b/ui/views/controls/scrollbar/native_scroll_bar_views.cc
index fba93d09..e82c189 100644
--- a/ui/views/controls/scrollbar/native_scroll_bar_views.cc
+++ b/ui/views/controls/scrollbar/native_scroll_bar_views.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -276,8 +276,6 @@ NativeScrollBarViews::~NativeScrollBarViews() {
// NativeScrollBarViews, View overrides:
void NativeScrollBarViews::Layout() {
- SetBoundsRect(native_scroll_bar_->GetLocalBounds());
-
gfx::Size size = prev_button_->GetPreferredSize();
prev_button_->SetBounds(0, 0, size.width(), size.height());
@@ -399,12 +397,44 @@ NativeScrollBarWrapper* NativeScrollBarWrapper::CreateWrapper(
// static
int NativeScrollBarWrapper::GetHorizontalScrollBarHeight() {
- return 20;
+ const gfx::NativeTheme* native_theme = gfx::NativeTheme::instance();
+
+ gfx::NativeTheme::ExtraParams button_params;
+ button_params.scrollbar_arrow.is_hovering = false;
+ gfx::Size button_size = native_theme->GetPartSize(
+ gfx::NativeTheme::kScrollbarLeftArrow,
+ gfx::NativeTheme::kNormal,
+ button_params);
+
+ gfx::NativeTheme::ExtraParams thumb_params;
+ thumb_params.scrollbar_thumb.is_hovering = false;
+ gfx::Size track_size = native_theme->GetPartSize(
+ gfx::NativeTheme::kScrollbarHorizontalThumb,
+ gfx::NativeTheme::kNormal,
+ thumb_params);
+
+ return std::max(track_size.height(), button_size.height());
}
// static
int NativeScrollBarWrapper::GetVerticalScrollBarWidth() {
- return 20;
+ const gfx::NativeTheme* native_theme = gfx::NativeTheme::instance();
+
+ gfx::NativeTheme::ExtraParams button_params;
+ button_params.scrollbar_arrow.is_hovering = false;
+ gfx::Size button_size = native_theme->GetPartSize(
+ gfx::NativeTheme::kScrollbarUpArrow,
+ gfx::NativeTheme::kNormal,
+ button_params);
+
+ gfx::NativeTheme::ExtraParams thumb_params;
+ thumb_params.scrollbar_thumb.is_hovering = false;
+ gfx::Size track_size = native_theme->GetPartSize(
+ gfx::NativeTheme::kScrollbarVerticalThumb,
+ gfx::NativeTheme::kNormal,
+ thumb_params);
+
+ return std::max(track_size.width(), button_size.width());
}
#endif
diff --git a/ui/views/controls/scrollbar/native_scroll_bar_win.cc b/ui/views/controls/scrollbar/native_scroll_bar_win.cc
index 5a15684..e5afb18 100644
--- a/ui/views/controls/scrollbar/native_scroll_bar_win.cc
+++ b/ui/views/controls/scrollbar/native_scroll_bar_win.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -217,7 +217,6 @@ NativeScrollBarWin::~NativeScrollBarWin() {
// NativeScrollBarWin, View overrides:
void NativeScrollBarWin::Layout() {
- SetBoundsRect(native_scroll_bar_->GetLocalBounds());
NativeControlWin::Layout();
}
diff --git a/ui/views/controls/tree/tree_view_views.cc b/ui/views/controls/tree/tree_view_views.cc
index 4226c96..dbaedd0 100644
--- a/ui/views/controls/tree/tree_view_views.cc
+++ b/ui/views/controls/tree/tree_view_views.cc
@@ -14,8 +14,10 @@
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/canvas_skia.h"
+#include "ui/gfx/native_theme.h"
#include "ui/gfx/skia_util.h"
#include "ui/views/background.h"
+#include "ui/views/border.h"
#include "ui/views/controls/scroll_view.h"
#include "ui/views/controls/textfield/textfield.h"
#include "ui/views/controls/tree/tree_view_controller.h"
@@ -76,6 +78,9 @@ TreeView::~TreeView() {
View* TreeView::CreateParentIfNecessary() {
ScrollView* scroll_view = new ScrollView;
scroll_view->SetContents(this);
+ scroll_view->set_border(Border::CreateSolidBorder(
+ 1, gfx::NativeTheme::instance()->GetSystemColor(
+ gfx::NativeTheme::kColorId_UnfocusedBorderColor)));
return scroll_view;
}