summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views/options
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-16 18:17:47 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-16 18:17:47 +0000
commit80f8b9f5cf620c37e9d1408a114dc90699584d89 (patch)
tree9e2f5fcacbb18cd86690bc47e0d22ea8f10ac317 /chrome/browser/views/options
parentf377cebc8bb25bb9f6708adbfda567a95c296642 (diff)
downloadchromium_src-80f8b9f5cf620c37e9d1408a114dc90699584d89.zip
chromium_src-80f8b9f5cf620c37e9d1408a114dc90699584d89.tar.gz
chromium_src-80f8b9f5cf620c37e9d1408a114dc90699584d89.tar.bz2
Make View::SetBounds take a const gfx::Rect& instead of a const CRect&
Make View::DidChangeBounds call Layout by default, eliminating this function from most places. http://crbug.com/2186 Review URL: http://codereview.chromium.org/7429 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3471 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/options')
-rw-r--r--chrome/browser/views/options/advanced_contents_view.cc30
-rw-r--r--chrome/browser/views/options/cookies_view.cc5
-rw-r--r--chrome/browser/views/options/options_group_view.h14
3 files changed, 21 insertions, 28 deletions
diff --git a/chrome/browser/views/options/advanced_contents_view.cc b/chrome/browser/views/options/advanced_contents_view.cc
index a6fbec6..b8a759c 100644
--- a/chrome/browser/views/options/advanced_contents_view.cc
+++ b/chrome/browser/views/options/advanced_contents_view.cc
@@ -61,9 +61,8 @@ class ListBackground : public ChromeViews::Background {
virtual void Paint(ChromeCanvas* canvas, ChromeViews::View* view) const {
HDC dc = canvas->beginPlatformPaint();
- CRect lb;
- view->GetLocalBounds(&lb, true);
- gfx::NativeTheme::instance()->PaintListBackground(dc, true, &lb);
+ RECT native_lb = view->GetLocalBounds(true).ToRECT();
+ gfx::NativeTheme::instance()->PaintListBackground(dc, true, &native_lb);
canvas->endPlatformPaint();
}
@@ -82,7 +81,8 @@ class AdvancedSection : public OptionsPageView {
AdvancedSection(Profile* profile, const std::wstring& title);
virtual ~AdvancedSection() {}
- virtual void DidChangeBounds(const CRect& previous, const CRect& current);
+ virtual void DidChangeBounds(const gfx::Rect& previous,
+ const gfx::Rect& current);
protected:
// Convenience helpers to add different kinds of ColumnSets for specific
@@ -151,8 +151,8 @@ AdvancedSection::AdvancedSection(Profile* profile,
title_label_->SetColor(title_color);
}
-void AdvancedSection::DidChangeBounds(const CRect& previous,
- const CRect& current) {
+void AdvancedSection::DidChangeBounds(const gfx::Rect& previous,
+ const gfx::Rect& current) {
Layout();
contents_->Layout();
}
@@ -1077,7 +1077,9 @@ class AdvancedContentsView : public OptionsPageView {
// ChromeViews::View overrides:
virtual int GetLineScrollIncrement(ChromeViews::ScrollView* scroll_view,
bool is_horizontal, bool is_positive);
- void Layout();
+ virtual void Layout();
+ virtual void DidChangeBounds(const gfx::Rect& previous,
+ const gfx::Rect& current);
protected:
// OptionsPageView implementation:
@@ -1125,11 +1127,18 @@ void AdvancedContentsView::Layout() {
const int height = GetHeightForWidth(width);
SetBounds(0, 0, width, height);
} else {
- SetBounds(gfx::Point(), GetPreferredSize());
+ gfx::Size prefsize = GetPreferredSize();
+ SetBounds(0, 0, prefsize.width(), prefsize.height());
}
View::Layout();
}
+void AdvancedContentsView::DidChangeBounds(const gfx::Rect& previous,
+ const gfx::Rect& current) {
+ // Override to do nothing. Calling Layout() interferes with our scrolling.
+}
+
+
////////////////////////////////////////////////////////////////////////////////
// AdvancedContentsView, OptionsPageView implementation:
@@ -1185,12 +1194,11 @@ AdvancedScrollViewContainer::~AdvancedScrollViewContainer() {
// AdvancedScrollViewContainer, ChromeViews::View overrides:
void AdvancedScrollViewContainer::Layout() {
- CRect lb;
- GetLocalBounds(&lb, false);
+ gfx::Rect lb = GetLocalBounds(false);
gfx::Size border = gfx::NativeTheme::instance()->GetThemeBorderSize(
gfx::NativeTheme::LIST);
- lb.DeflateRect(border.ToSIZE());
+ lb.Inset(border.width(), border.height());
scroll_view_->SetBounds(lb);
scroll_view_->Layout();
}
diff --git a/chrome/browser/views/options/cookies_view.cc b/chrome/browser/views/options/cookies_view.cc
index cf0d5ee..41a8968 100644
--- a/chrome/browser/views/options/cookies_view.cc
+++ b/chrome/browser/views/options/cookies_view.cc
@@ -642,9 +642,8 @@ ChromeViews::View* CookiesView::GetContentsView() {
void CookiesView::Layout() {
// Lay out the Remove/Remove All buttons in the parent view.
gfx::Size ps = remove_button_->GetPreferredSize();
- CRect parent_bounds;
- GetParent()->GetLocalBounds(&parent_bounds, false);
- int y_buttons = parent_bounds.bottom - ps.height() - kButtonVEdgeMargin;
+ gfx::Rect parent_bounds = GetParent()->GetLocalBounds(false);
+ int y_buttons = parent_bounds.bottom() - ps.height() - kButtonVEdgeMargin;
remove_button_->SetBounds(kPanelHorizMargin, y_buttons, ps.width(),
ps.height());
diff --git a/chrome/browser/views/options/options_group_view.h b/chrome/browser/views/options/options_group_view.h
index d40239d..e1d98d1 100644
--- a/chrome/browser/views/options/options_group_view.h
+++ b/chrome/browser/views/options/options_group_view.h
@@ -32,20 +32,6 @@ class OptionsGroupView : public ChromeViews::View {
// Retrieves the width of the ContentsView. Used to help size wrapping items.
int GetContentsWidth() const;
- class ContentsView : public ChromeViews::View {
- public:
- virtual ~ContentsView() {}
-
- // ChromeViews::View overrides:
- virtual void DidChangeBounds(const CRect& prev_bounds,
- const CRect& next_bounds) {
- Layout();
- }
-
- private:
- DISALLOW_EVIL_CONSTRUCTORS(ContentsView);
- };
-
protected:
// ChromeViews::View overrides:
virtual void Paint(ChromeCanvas* canvas);