diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-16 18:17:47 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-16 18:17:47 +0000 |
commit | 80f8b9f5cf620c37e9d1408a114dc90699584d89 (patch) | |
tree | 9e2f5fcacbb18cd86690bc47e0d22ea8f10ac317 /chrome/browser/task_manager.cc | |
parent | f377cebc8bb25bb9f6708adbfda567a95c296642 (diff) | |
download | chromium_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/task_manager.cc')
-rw-r--r-- | chrome/browser/task_manager.cc | 37 |
1 files changed, 12 insertions, 25 deletions
diff --git a/chrome/browser/task_manager.cc b/chrome/browser/task_manager.cc index 0f593b1..e08db35 100644 --- a/chrome/browser/task_manager.cc +++ b/chrome/browser/task_manager.cc @@ -667,7 +667,6 @@ class TaskManagerContents : public ChromeViews::View, void Init(TaskManagerTableModel* table_model); virtual void Layout(); virtual gfx::Size GetPreferredSize(); - virtual void DidChangeBounds(const CRect& previous, const CRect& current); virtual void ViewHierarchyChanged(bool is_add, ChromeViews::View* parent, ChromeViews::View* child); void GetSelection(std::vector<int>* selection); @@ -809,11 +808,6 @@ void TaskManagerContents::UpdateStatsCounters() { } } -void TaskManagerContents::DidChangeBounds(const CRect& previous, - const CRect& current) { - Layout(); -} - void TaskManagerContents::ViewHierarchyChanged(bool is_add, ChromeViews::View* parent, ChromeViews::View* child) { @@ -839,31 +833,24 @@ void TaskManagerContents::ViewHierarchyChanged(bool is_add, void TaskManagerContents::Layout() { // kPanelHorizMargin is too big. const int kTableButtonSpacing = 12; - CRect bounds; - GetLocalBounds(&bounds, true); - int x = bounds.left; - int y = bounds.top; gfx::Size size = kill_button_->GetPreferredSize(); int prefered_width = size.width(); int prefered_height = size.height(); - tab_table_->SetBounds( - x + kPanelHorizMargin, - y + kPanelVertMargin, - bounds.Width() - 2 * kPanelHorizMargin, - bounds.Height() - 2 * kPanelVertMargin - prefered_height); - + tab_table_->SetBounds(x() + kPanelHorizMargin, + y() + kPanelVertMargin, + width() - 2 * kPanelHorizMargin, + height() - 2 * kPanelVertMargin - prefered_height); + // y-coordinate of button top left. - CRect parent_bounds; - GetParent()->GetLocalBounds(&parent_bounds, false); - int y_buttons = parent_bounds.bottom - prefered_height - kButtonVEdgeMargin; + gfx::Rect parent_bounds = GetParent()->GetLocalBounds(false); + int y_buttons = parent_bounds.bottom() - prefered_height - kButtonVEdgeMargin; - kill_button_->SetBounds( - x + bounds.Width() - prefered_width - kPanelHorizMargin, - y_buttons, - prefered_width, - prefered_height); + kill_button_->SetBounds(x() + width() - prefered_width - kPanelHorizMargin, + y_buttons, + prefered_width, + prefered_height); size = about_memory_link_->GetPreferredSize(); int link_prefered_width = size.width(); @@ -872,7 +859,7 @@ void TaskManagerContents::Layout() { // bottom of buttons vertically. int link_y_offset = std::max(0, prefered_height - link_prefered_height) / 2; about_memory_link_->SetBounds( - x + kPanelHorizMargin, + x() + kPanelHorizMargin, y_buttons + prefered_height - link_prefered_height - link_y_offset, link_prefered_width, link_prefered_height); |