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 | |
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')
65 files changed, 118 insertions, 294 deletions
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc index e4b4bf6..716e3e1 100644 --- a/chrome/browser/automation/automation_provider.cc +++ b/chrome/browser/automation/automation_provider.cc @@ -1136,8 +1136,7 @@ void AutomationProvider::WindowGetViewBounds(const IPC::Message& message, int view_id, bool screen_coordinates) { bool succeeded = false; - CRect bounds; - bounds.SetRect(0, 0, 0, 0); + gfx::Rect bounds; void* iter = NULL; if (window_tracker_->ContainsHandle(handle)) { @@ -1153,14 +1152,14 @@ void AutomationProvider::WindowGetViewBounds(const IPC::Message& message, ChromeViews::View::ConvertPointToScreen(view, &point); else ChromeViews::View::ConvertPointToView(view, root_view, &point); - view->GetLocalBounds(&bounds, false); - bounds.MoveToXY(point.x(), point.y()); + bounds = view->GetLocalBounds(false); + bounds.set_origin(point); } } } - Send(new AutomationMsg_WindowViewBoundsResponse( - message.routing_id(), succeeded, gfx::Rect(bounds))); + Send(new AutomationMsg_WindowViewBoundsResponse(message.routing_id(), + succeeded, bounds)); } // This task enqueues a mouse event on the event loop, so that the view diff --git a/chrome/browser/debugger/debugger_view.cc b/chrome/browser/debugger/debugger_view.cc index f6cac90..704be14 100644 --- a/chrome/browser/debugger/debugger_view.cc +++ b/chrome/browser/debugger/debugger_view.cc @@ -46,10 +46,6 @@ void DebuggerView::Layout() { web_container_->SetBounds(0, 0, width(), height()); } -void DebuggerView::DidChangeBounds(const CRect& previous, - const CRect& current) { - Layout(); -} void DebuggerView::ViewHierarchyChanged(bool is_add, ChromeViews::View* parent, @@ -63,8 +59,7 @@ void DebuggerView::ViewHierarchyChanged(bool is_add, void DebuggerView::Paint(ChromeCanvas* canvas) { #ifndef NDEBUG SkPaint paint; - canvas->FillRectInt(SK_ColorCYAN, bounds_.left, bounds_.top, - bounds_.Width(), bounds_.Height()); + canvas->FillRectInt(SK_ColorCYAN, x(), y(), width(), height()); #endif } diff --git a/chrome/browser/debugger/debugger_view.h b/chrome/browser/debugger/debugger_view.h index ecb9e7a..72544b4 100644 --- a/chrome/browser/debugger/debugger_view.h +++ b/chrome/browser/debugger/debugger_view.h @@ -50,7 +50,6 @@ class DebuggerView : public ChromeViews::View, virtual gfx::Size GetPreferredSize(); virtual void Layout(); virtual void Paint(ChromeCanvas* canvas); - virtual void DidChangeBounds(const CRect& previous, const CRect& current); virtual void ViewHierarchyChanged(bool is_add, ChromeViews::View* parent, ChromeViews::View* child); diff --git a/chrome/browser/drag_utils.cc b/chrome/browser/drag_utils.cc index 5eb1c27..8ba82af 100644 --- a/chrome/browser/drag_utils.cc +++ b/chrome/browser/drag_utils.cc @@ -150,7 +150,7 @@ void SetURLAndDragImage(const GURL& url, button.SetIcon(icon); } gfx::Size prefsize = button.GetPreferredSize(); - button.SetBounds(gfx::Point(), prefsize); + button.SetBounds(0, 0, prefsize.width(), prefsize.height()); // Render the image. ChromeCanvas canvas(prefsize.width(), prefsize.height(), false); diff --git a/chrome/browser/find_in_page_controller.cc b/chrome/browser/find_in_page_controller.cc index 0646ced..0f05267 100644 --- a/chrome/browser/find_in_page_controller.cc +++ b/chrome/browser/find_in_page_controller.cc @@ -480,12 +480,10 @@ void FindInPageController::GetDialogBounds(gfx::Rect* bounds) { // Find the dimensions of the toolbar and the BookmarkBar. gfx::Rect toolbar_bounds, bookmark_bar_bounds; if (toolbar) { - if (!g_browser_process->IsUsingNewFrames()) + if (!g_browser_process->IsUsingNewFrames()) { toolbar_bounds = toolbar->bounds(); - else { - CRect local_bounds; - toolbar->GetLocalBounds(&local_bounds, false); - toolbar_bounds = gfx::Rect(local_bounds); + } else { + toolbar_bounds = toolbar->GetLocalBounds(false); } // Need to convert toolbar bounds into Container coords because the toolbar // is the child of another view that isn't the top level view. This is diff --git a/chrome/browser/find_in_page_view.cc b/chrome/browser/find_in_page_view.cc index da14afe..2c3aa19 100644 --- a/chrome/browser/find_in_page_view.cc +++ b/chrome/browser/find_in_page_view.cc @@ -244,8 +244,7 @@ void FindInPageView::Paint(ChromeCanvas* canvas) { SkPaint paint; // Get the local bounds so that we now how much to stretch the background. - CRect lb; - GetLocalBounds(&lb, true); + gfx::Rect lb = GetLocalBounds(true); // First, we draw the background image for the whole dialog (3 images: left, // middle and right). Note, that the window region has been set by the @@ -270,13 +269,13 @@ void FindInPageView::Paint(ChromeCanvas* canvas) { canvas->TileImageInt(*bg_middle, bg_left->width(), 0, - lb.Width() - + lb.width() - bg_left->width() - bg_right->width(), bg_middle->height()); canvas->TileImageInt(*bg_right, - lb.right - bg_right->width(), + lb.right() - bg_right->width(), 0, bg_right->width(), bg_right->height()); @@ -322,12 +321,12 @@ void FindInPageView::Paint(ChromeCanvas* canvas) { // While animating we draw the curved edges at the point where the // controller told us the top of the window is: |animation_offset_|. canvas->TileImageInt(*bg_left, - lb.TopLeft().x, + lb.x(), animation_offset_, bg_left->width(), kAnimatingEdgeHeight); canvas->TileImageInt(*bg_right, - lb.BottomRight().x - bg_right->width(), + lb.right() - bg_right->width(), animation_offset_, bg_right->width(), kAnimatingEdgeHeight); @@ -399,11 +398,6 @@ void FindInPageView::Layout() { find_previous_button_->height()); } -void FindInPageView::DidChangeBounds(const CRect& old_bounds, - const CRect& new_bounds) { - Layout(); -} - void FindInPageView::ViewHierarchyChanged(bool is_add, View *parent, View *child) { diff --git a/chrome/browser/find_in_page_view.h b/chrome/browser/find_in_page_view.h index 834568e..4f09ae0 100644 --- a/chrome/browser/find_in_page_view.h +++ b/chrome/browser/find_in_page_view.h @@ -68,8 +68,6 @@ class FindInPageView : public ChromeViews::View, // Overridden from ChromeViews::View: virtual void Paint(ChromeCanvas* canvas); virtual void Layout(); - virtual void DidChangeBounds(const CRect& old_bounds, - const CRect& new_bounds); virtual gfx::Size GetPreferredSize(); virtual void ViewHierarchyChanged(bool is_add, View* parent, View* child); diff --git a/chrome/browser/history_view.cc b/chrome/browser/history_view.cc index ef439eb..7ff4225 100644 --- a/chrome/browser/history_view.cc +++ b/chrome/browser/history_view.cc @@ -840,7 +840,8 @@ bool HistoryView::IsVisible() { return vc && vc->IsVisible(); } -void HistoryView::DidChangeBounds(const CRect& previous, const CRect& current) { +void HistoryView::DidChangeBounds(const gfx::Rect& previous, + const gfx::Rect& current) { SchedulePaint(); } @@ -851,14 +852,13 @@ void HistoryView::Layout() { if (!parent) return; - CRect bounds; - parent->GetLocalBounds(&bounds, true); + gfx::Rect bounds = parent->GetLocalBounds(true); // If not visible, have zero size so we don't compute anything. int width = 0; int height = 0; if (IsVisible()) { - width = bounds.Width(); + width = bounds.width(); height = std::max(GetLastEntryMaxY(), kEntryPadding + kNoResultTextHeight); } diff --git a/chrome/browser/history_view.h b/chrome/browser/history_view.h index b5c0725..8f5998c 100644 --- a/chrome/browser/history_view.h +++ b/chrome/browser/history_view.h @@ -33,7 +33,8 @@ class HistoryView : public ChromeViews::View, bool IsVisible(); // Overridden for layout purposes. - virtual void DidChangeBounds(const CRect& previous, const CRect& current); + virtual void DidChangeBounds(const gfx::Rect& previous, + const gfx::Rect& current); virtual void Layout(); virtual bool GetFloatingViewIDForPoint(int x, int y, int* id); 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); diff --git a/chrome/browser/views/about_chrome_view.cc b/chrome/browser/views/about_chrome_view.cc index e5a8262..d5627e5 100644 --- a/chrome/browser/views/about_chrome_view.cc +++ b/chrome/browser/views/about_chrome_view.cc @@ -266,12 +266,11 @@ void AboutChromeView::Layout() { // Get the y-coordinate of our parent so we can position the text left of the // buttons at the bottom. - CRect parent_bounds; - GetParent()->GetLocalBounds(&parent_bounds, false); + gfx::Rect parent_bounds = GetParent()->GetLocalBounds(false); sz = throbber_->GetPreferredSize(); int throbber_topleft_x = kPanelHorizMargin; - int throbber_topleft_y = parent_bounds.bottom - sz.height() - + int throbber_topleft_y = parent_bounds.bottom() - sz.height() - kButtonVEdgeMargin - 3; throbber_->SetBounds(throbber_topleft_x, throbber_topleft_y, sz.width(), sz.height()); @@ -300,7 +299,7 @@ void AboutChromeView::Layout() { update_label_.SetHorizontalAlignment(ChromeViews::Label::ALIGN_LEFT); update_label_.SetBounds(update_label_x, throbber_topleft_y + 1, - parent_bounds.Width() - update_label_x, + parent_bounds.width() - update_label_x, sz.height()); } diff --git a/chrome/browser/views/bookmark_bar_view.cc b/chrome/browser/views/bookmark_bar_view.cc index ca3267b..f3118b5 100644 --- a/chrome/browser/views/bookmark_bar_view.cc +++ b/chrome/browser/views/bookmark_bar_view.cc @@ -847,8 +847,8 @@ void BookmarkBarView::Layout() { x += other_bookmarked_pref.width() + kButtonPadding; } -void BookmarkBarView::DidChangeBounds(const CRect& previous, - const CRect& current) { +void BookmarkBarView::DidChangeBounds(const gfx::Rect& previous, + const gfx::Rect& current) { Layout(); } diff --git a/chrome/browser/views/bookmark_bar_view.h b/chrome/browser/views/bookmark_bar_view.h index ae20fae..ee978e3 100644 --- a/chrome/browser/views/bookmark_bar_view.h +++ b/chrome/browser/views/bookmark_bar_view.h @@ -88,7 +88,8 @@ class BookmarkBarView : public ChromeViews::View, // View methods: virtual gfx::Size GetPreferredSize(); virtual void Layout(); - virtual void DidChangeBounds(const CRect& previous, const CRect& current); + virtual void DidChangeBounds(const gfx::Rect& previous, + const gfx::Rect& current); virtual void ViewHierarchyChanged(bool is_add, View* parent, View* child); virtual void Paint(ChromeCanvas* canvas); virtual void PaintChildren(ChromeCanvas* canvas); diff --git a/chrome/browser/views/bookmark_bubble_view.cc b/chrome/browser/views/bookmark_bubble_view.cc index f6021ef..7e0d0fc 100644 --- a/chrome/browser/views/bookmark_bubble_view.cc +++ b/chrome/browser/views/bookmark_bubble_view.cc @@ -130,8 +130,8 @@ BookmarkBubbleView::~BookmarkBubbleView() { SetNodeTitleFromTextField(); } -void BookmarkBubbleView::DidChangeBounds(const CRect& previous, - const CRect& current) { +void BookmarkBubbleView::DidChangeBounds(const gfx::Rect& previous, + const gfx::Rect& current) { Layout(); } diff --git a/chrome/browser/views/bookmark_bubble_view.h b/chrome/browser/views/bookmark_bubble_view.h index 2b3fc9f..89594a1 100644 --- a/chrome/browser/views/bookmark_bubble_view.h +++ b/chrome/browser/views/bookmark_bubble_view.h @@ -43,7 +43,8 @@ class BookmarkBubbleView : public ChromeViews::View, virtual ~BookmarkBubbleView(); // Overriden to force a layout. - virtual void DidChangeBounds(const CRect& previous, const CRect& current); + virtual void DidChangeBounds(const gfx::Rect& previous, + const gfx::Rect& current); // Invoked after the bubble has been shown. virtual void BubbleShown(); diff --git a/chrome/browser/views/bookmark_editor_view.cc b/chrome/browser/views/bookmark_editor_view.cc index b93e8a6..2c8a3cc 100644 --- a/chrome/browser/views/bookmark_editor_view.cc +++ b/chrome/browser/views/bookmark_editor_view.cc @@ -108,10 +108,9 @@ void BookmarkEditorView::Layout() { // Manually lay out the New Folder button in the same row as the OK/Cancel // buttons... - CRect parent_bounds; - GetParent()->GetLocalBounds(&parent_bounds, false); + gfx::Rect parent_bounds = GetParent()->GetLocalBounds(false); gfx::Size prefsize = new_group_button_.GetPreferredSize(); - int button_y = parent_bounds.bottom - prefsize.height() - kButtonVEdgeMargin; + int button_y = parent_bounds.bottom() - prefsize.height() - kButtonVEdgeMargin; new_group_button_.SetBounds(kPanelHorizMargin, button_y, prefsize.width(), prefsize.height()); } @@ -122,11 +121,6 @@ gfx::Size BookmarkEditorView::GetPreferredSize() { IDS_EDITBOOKMARK_DIALOG_HEIGHT_LINES)); } -void BookmarkEditorView::DidChangeBounds(const CRect& previous, - const CRect& current) { - Layout(); -} - void BookmarkEditorView::ViewHierarchyChanged(bool is_add, ChromeViews::View* parent, ChromeViews::View* child) { diff --git a/chrome/browser/views/bookmark_editor_view.h b/chrome/browser/views/bookmark_editor_view.h index 7c432d2..51f3769 100644 --- a/chrome/browser/views/bookmark_editor_view.h +++ b/chrome/browser/views/bookmark_editor_view.h @@ -72,7 +72,6 @@ class BookmarkEditorView : public ChromeViews::View, // View methods. 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); diff --git a/chrome/browser/views/clear_browsing_data.cc b/chrome/browser/views/clear_browsing_data.cc index 0bf697d..30c331f 100644 --- a/chrome/browser/views/clear_browsing_data.cc +++ b/chrome/browser/views/clear_browsing_data.cc @@ -176,12 +176,11 @@ void ClearBrowsingDataView::Layout() { // Get the y-coordinate of our parent so we can position the throbber and // status message at the bottom of the panel. - CRect parent_bounds; - GetParent()->GetLocalBounds(&parent_bounds, false); + gfx::Rect parent_bounds = GetParent()->GetLocalBounds(false); sz = throbber_->GetPreferredSize(); int throbber_topleft_x = kPanelHorizMargin; - int throbber_topleft_y = parent_bounds.bottom - sz.height() - + int throbber_topleft_y = parent_bounds.bottom() - sz.height() - kButtonVEdgeMargin - 3; throbber_->SetBounds(throbber_topleft_x, throbber_topleft_y, sz.width(), sz.height()); diff --git a/chrome/browser/views/constrained_window_impl.cc b/chrome/browser/views/constrained_window_impl.cc index 11f635a..9cbd04f 100644 --- a/chrome/browser/views/constrained_window_impl.cc +++ b/chrome/browser/views/constrained_window_impl.cc @@ -613,7 +613,7 @@ void ConstrainedWindowNonClientView::Layout() { location_bar_height); location_bar_->Layout(); } - container_->client_view()->SetBounds(client_bounds_.ToRECT()); + container_->client_view()->SetBounds(client_bounds_); } gfx::Size ConstrainedWindowNonClientView::GetPreferredSize() { diff --git a/chrome/browser/views/delay_view.cc b/chrome/browser/views/delay_view.cc index 76c8322..a841580 100644 --- a/chrome/browser/views/delay_view.cc +++ b/chrome/browser/views/delay_view.cc @@ -50,14 +50,13 @@ void DelayView::Layout() { if (!GetParent()) return; - CSize available; - GetParent()->GetSize(&available); + gfx::Size available = GetParent()->size(); if (cancel_button_) { gfx::Size button_size = cancel_button_->GetPreferredSize(); - cancel_button_->SetBounds(available.cx - kWindowMargin - + cancel_button_->SetBounds(available.width() - kWindowMargin - button_size.width(), - available.cy - kWindowMargin - + available.height() - kWindowMargin - button_size.height(), button_size.width(), button_size.height()); } @@ -73,8 +72,8 @@ void DelayView::Layout() { label_size.width(), std::max(throbber_size.height(), label_size.height())); - main_rect.set_x((available.cx / 2) - (main_rect.width() / 2)); - main_rect.set_y((available.cy / 2) - (main_rect.height() / 2)); + main_rect.set_x((available.width() / 2) - (main_rect.width() / 2)); + main_rect.set_y((available.height() / 2) - (main_rect.height() / 2)); label_->SetBounds(main_rect.x() + throbber_size.width() + kThrobberLabelSpace, diff --git a/chrome/browser/views/download_item_view.cc b/chrome/browser/views/download_item_view.cc index 66f4c55..ec88049 100644 --- a/chrome/browser/views/download_item_view.cc +++ b/chrome/browser/views/download_item_view.cc @@ -311,11 +311,6 @@ void DownloadItemView::Layout() { } } -void DownloadItemView::DidChangeBounds(const CRect& previous, - const CRect& current) { - Layout(); -} - void DownloadItemView::ButtonPressed(ChromeViews::NativeButton* sender) { if (sender == discard_button_) { if (download_->state() == DownloadItem::IN_PROGRESS) @@ -790,6 +785,6 @@ void DownloadItemView::SizeLabelToMinWidth() { if (min_width == -1) size = dangerous_download_label_->GetPreferredSize(); - dangerous_download_label_->SetBounds(gfx::Point(), size); + dangerous_download_label_->SetBounds(0, 0, size.width(), size.height()); dangerous_download_label_sized_ = true; }
\ No newline at end of file diff --git a/chrome/browser/views/download_item_view.h b/chrome/browser/views/download_item_view.h index e67697e..0fefcea 100644 --- a/chrome/browser/views/download_item_view.h +++ b/chrome/browser/views/download_item_view.h @@ -69,7 +69,6 @@ class DownloadItemView : public ChromeViews::NativeButton::Listener, virtual void OnMouseReleased(const ChromeViews::MouseEvent& event, bool canceled); virtual bool OnMouseDragged(const ChromeViews::MouseEvent& event); - virtual void DidChangeBounds(const CRect& previous, const CRect& current); // NativeButton::Listener implementation. virtual void ButtonPressed(ChromeViews::NativeButton* sender); diff --git a/chrome/browser/views/download_shelf_view.cc b/chrome/browser/views/download_shelf_view.cc index a966dcc..ed6b074 100644 --- a/chrome/browser/views/download_shelf_view.cc +++ b/chrome/browser/views/download_shelf_view.cc @@ -177,11 +177,6 @@ gfx::Size DownloadShelfView::GetPreferredSize() { return prefsize; } -void DownloadShelfView::DidChangeBounds(const CRect& previous, - const CRect& current) { - Layout(); -} - void DownloadShelfView::AnimationProgressed(const Animation *animation) { if (animation == new_item_animation_.get()) { Layout(); diff --git a/chrome/browser/views/download_shelf_view.h b/chrome/browser/views/download_shelf_view.h index 0ac607d..35e5b2c 100644 --- a/chrome/browser/views/download_shelf_view.h +++ b/chrome/browser/views/download_shelf_view.h @@ -44,8 +44,6 @@ class DownloadShelfView : public ChromeViews::View, // PaintBackground, PaintBorder and PaintSeparators. virtual void Paint(ChromeCanvas* canvas); - void DidChangeBounds(const CRect& previous, const CRect& current); - // AnimationDelegate implementations virtual void AnimationProgressed(const Animation* animation); virtual void AnimationEnded(const Animation* animation); diff --git a/chrome/browser/views/download_tab_view.cc b/chrome/browser/views/download_tab_view.cc index 61f5164..fb65c1f 100644 --- a/chrome/browser/views/download_tab_view.cc +++ b/chrome/browser/views/download_tab_view.cc @@ -670,11 +670,6 @@ void DownloadItemTabView::PaintBackground(ChromeCanvas* canvas) { } } -void DownloadItemTabView::DidChangeBounds(const CRect& previous, - const CRect& current) { - Layout(); -} - bool DownloadItemTabView::OnMousePressed(const ChromeViews::MouseEvent& event) { gfx::Point point(event.location()); @@ -819,13 +814,7 @@ void DownloadTabView::UpdateDownloadProgress() { SchedulePaint(); } -void DownloadTabView::DidChangeBounds(const CRect& previous, - const CRect& current) { - Layout(); -} - void DownloadTabView::Layout() { - CRect r; DetachAllFloatingViews(); // Dangerous downloads items use NativeButtons, so they need to be attached // as NativeControls are not supported yet in floating views. @@ -844,7 +833,6 @@ void DownloadTabView::Layout() { } View* v = GetParent(); if (v) { - v->GetLocalBounds(&r, true); int h = static_cast<int>(downloads_.size()) * (download_util::kBigProgressIconSize + kSpacer) + kSpacer; SetBounds(x(), y(), v->width(), h); diff --git a/chrome/browser/views/download_tab_view.h b/chrome/browser/views/download_tab_view.h index 8c59089..6152908 100644 --- a/chrome/browser/views/download_tab_view.h +++ b/chrome/browser/views/download_tab_view.h @@ -36,7 +36,6 @@ class DownloadItemTabView : public ChromeViews::View, virtual void Paint(ChromeCanvas* canvas); void PaintBackground(ChromeCanvas* canvas); virtual gfx::Size GetPreferredSize(); - virtual void DidChangeBounds(const CRect& previous, const CRect& current); virtual bool OnMousePressed(const ChromeViews::MouseEvent& event); virtual bool OnMouseDragged(const ChromeViews::MouseEvent& event); @@ -111,7 +110,6 @@ class DownloadTabView : public ChromeViews::View, DownloadManager* model() const { return model_; } // View overrides - virtual void DidChangeBounds(const CRect& previous, const CRect& current); virtual void Layout(); virtual void Paint(ChromeCanvas* canvas); virtual bool GetFloatingViewIDForPoint(int x, int y, int* id); diff --git a/chrome/browser/views/first_run_bubble.cc b/chrome/browser/views/first_run_bubble.cc index 4dc3812b..1032a07 100644 --- a/chrome/browser/views/first_run_bubble.cc +++ b/chrome/browser/views/first_run_bubble.cc @@ -95,11 +95,6 @@ class FirstRunBubbleView : public ChromeViews::View, AddChildView(change_button_); } - // Overridden from ChromeViews::View. - virtual void DidChangeBounds(const CRect& previous, const CRect& current) { - Layout(); - } - // Overridden from NativeButton::Listener. virtual void ButtonPressed(ChromeViews::NativeButton* sender) { bubble_window_->Close(); diff --git a/chrome/browser/views/frame/aero_glass_non_client_view.cc b/chrome/browser/views/frame/aero_glass_non_client_view.cc index 5155634..65b9f9d 100644 --- a/chrome/browser/views/frame/aero_glass_non_client_view.cc +++ b/chrome/browser/views/frame/aero_glass_non_client_view.cc @@ -250,11 +250,6 @@ gfx::Size AeroGlassNonClientView::GetPreferredSize() { return prefsize; } -void AeroGlassNonClientView::DidChangeBounds(const CRect& previous, - const CRect& current) { - Layout(); -} - void AeroGlassNonClientView::ViewHierarchyChanged(bool is_add, ChromeViews::View* parent, ChromeViews::View* child) { @@ -413,9 +408,8 @@ void AeroGlassNonClientView::LayoutDistributorLogo() { } void AeroGlassNonClientView::LayoutClientView() { - gfx::Rect client_bounds( - CalculateClientAreaBounds(width(), height())); - frame_->client_view()->SetBounds(client_bounds.ToRECT()); + gfx::Rect client_bounds = CalculateClientAreaBounds(width(), height()); + frame_->client_view()->SetBounds(client_bounds); } // static diff --git a/chrome/browser/views/frame/aero_glass_non_client_view.h b/chrome/browser/views/frame/aero_glass_non_client_view.h index 2412a63..2814918 100644 --- a/chrome/browser/views/frame/aero_glass_non_client_view.h +++ b/chrome/browser/views/frame/aero_glass_non_client_view.h @@ -34,7 +34,6 @@ class AeroGlassNonClientView : public ChromeViews::NonClientView { virtual void Paint(ChromeCanvas* canvas); 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); diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc index 5a8b495..7e8303d 100644 --- a/chrome/browser/views/frame/browser_view.cc +++ b/chrome/browser/views/frame/browser_view.cc @@ -220,11 +220,6 @@ void BrowserView::Layout() { toolbar_->SetBounds(0, 0, width(), height()); } -void BrowserView::DidChangeBounds(const CRect& previous, - const CRect& current) { - Layout(); -} - void BrowserView::ViewHierarchyChanged(bool is_add, ChromeViews::View* parent, ChromeViews::View* child) { diff --git a/chrome/browser/views/frame/browser_view.h b/chrome/browser/views/frame/browser_view.h index 5d48fc7..704d6a7 100644 --- a/chrome/browser/views/frame/browser_view.h +++ b/chrome/browser/views/frame/browser_view.h @@ -79,7 +79,6 @@ class BrowserView : public BrowserWindow, // Overridden from ChromeViews::View: virtual void Layout(); - virtual void DidChangeBounds(const CRect& previous, const CRect& current); virtual void ViewHierarchyChanged(bool is_add, ChromeViews::View* parent, ChromeViews::View* child); diff --git a/chrome/browser/views/frame/browser_view2.cc b/chrome/browser/views/frame/browser_view2.cc index f3f8800..c1e3588 100644 --- a/chrome/browser/views/frame/browser_view2.cc +++ b/chrome/browser/views/frame/browser_view2.cc @@ -782,11 +782,6 @@ void BrowserView2::Layout() { SchedulePaint(); } -void BrowserView2::DidChangeBounds(const CRect& previous, - const CRect& current) { - Layout(); -} - void BrowserView2::ViewHierarchyChanged(bool is_add, ChromeViews::View* parent, ChromeViews::View* child) { @@ -1046,7 +1041,7 @@ bool BrowserView2::UpdateChildViewAndLayout(ChromeViews::View* new_view, } else if (new_view && *old_view) { // The view changed, but the new view wants the same size, give it the // bounds of the last view and have it repaint. - new_view->SetBounds((*old_view)->bounds().ToRECT()); + new_view->SetBounds((*old_view)->bounds()); new_view->SchedulePaint(); } else if (new_view) { DCHECK(new_height == 0); diff --git a/chrome/browser/views/frame/browser_view2.h b/chrome/browser/views/frame/browser_view2.h index 6f1329d..dbe4f5d 100644 --- a/chrome/browser/views/frame/browser_view2.h +++ b/chrome/browser/views/frame/browser_view2.h @@ -221,7 +221,6 @@ class BrowserView2 : public BrowserWindow, protected: // Overridden from ChromeViews::View: virtual void Layout(); - virtual void DidChangeBounds(const CRect& previous, const CRect& current); virtual void ViewHierarchyChanged(bool is_add, ChromeViews::View* parent, ChromeViews::View* child); diff --git a/chrome/browser/views/frame/opaque_non_client_view.cc b/chrome/browser/views/frame/opaque_non_client_view.cc index 72b2215..ac29c56 100644 --- a/chrome/browser/views/frame/opaque_non_client_view.cc +++ b/chrome/browser/views/frame/opaque_non_client_view.cc @@ -651,11 +651,6 @@ ChromeViews::View* OpaqueNonClientView::GetViewForPoint( return View::GetViewForPoint(point, can_create_floating); } -void OpaqueNonClientView::DidChangeBounds(const CRect& previous, - const CRect& current) { - Layout(); -} - void OpaqueNonClientView::ViewHierarchyChanged(bool is_add, ChromeViews::View* parent, ChromeViews::View* child) { @@ -1007,13 +1002,12 @@ void OpaqueNonClientView::LayoutTitleBar() { // Do this last, after the icon has been moved. if (window_icon_) - window_icon_->SetBounds(icon_bounds_.ToRECT()); + window_icon_->SetBounds(icon_bounds_); } void OpaqueNonClientView::LayoutClientView() { - gfx::Rect client_bounds( - CalculateClientAreaBounds(width(), height())); - frame_->client_view()->SetBounds(client_bounds.ToRECT()); + gfx::Rect client_bounds = CalculateClientAreaBounds(width(), height()); + frame_->client_view()->SetBounds(client_bounds); } // static diff --git a/chrome/browser/views/frame/opaque_non_client_view.h b/chrome/browser/views/frame/opaque_non_client_view.h index 5b9bc54..830ba76 100644 --- a/chrome/browser/views/frame/opaque_non_client_view.h +++ b/chrome/browser/views/frame/opaque_non_client_view.h @@ -59,7 +59,6 @@ class OpaqueNonClientView : public ChromeViews::NonClientView, virtual gfx::Size GetPreferredSize(); virtual ChromeViews::View* GetViewForPoint(const gfx::Point& point, bool can_create_floating); - virtual void DidChangeBounds(const CRect& previous, const CRect& current); virtual void ViewHierarchyChanged(bool is_add, ChromeViews::View* parent, ChromeViews::View* child); diff --git a/chrome/browser/views/hung_renderer_view.cc b/chrome/browser/views/hung_renderer_view.cc index bd0c289..895c4dd 100644 --- a/chrome/browser/views/hung_renderer_view.cc +++ b/chrome/browser/views/hung_renderer_view.cc @@ -161,10 +161,6 @@ class HungRendererWarningView : public ChromeViews::View, public: ButtonContainer() {} virtual ~ButtonContainer() {} - - virtual void DidChangeBounds(const CRect& previous, const CRect& current) { - Layout(); - } private: DISALLOW_EVIL_CONSTRUCTORS(ButtonContainer); }; diff --git a/chrome/browser/views/info_bar_item_view.cc b/chrome/browser/views/info_bar_item_view.cc index b7c0d3b..71b5c4e 100644 --- a/chrome/browser/views/info_bar_item_view.cc +++ b/chrome/browser/views/info_bar_item_view.cc @@ -132,8 +132,8 @@ void InfoBarItemView::Layout() { } } -void InfoBarItemView::DidChangeBounds(const CRect& previous, - const CRect& current) { +void InfoBarItemView::DidChangeBounds(const gfx::Rect& previous, + const gfx::Rect& current) { if (GetParent() != NULL) Layout(); } diff --git a/chrome/browser/views/info_bar_item_view.h b/chrome/browser/views/info_bar_item_view.h index c5b99ab..4e38e7c 100644 --- a/chrome/browser/views/info_bar_item_view.h +++ b/chrome/browser/views/info_bar_item_view.h @@ -48,7 +48,8 @@ class InfoBarItemView : public ChromeViews::View, // Lays out all child views of the info bar from trailing to leading. virtual void Layout(); - virtual void DidChangeBounds(const CRect& previous, const CRect& current); + virtual void DidChangeBounds(const gfx::Rect& previous, + const gfx::Rect& current); // Starts the close animation, which will end in the bar closing itself. void BeginClose(); diff --git a/chrome/browser/views/info_bar_view.cc b/chrome/browser/views/info_bar_view.cc index a5955a2..3d69eaa 100644 --- a/chrome/browser/views/info_bar_view.cc +++ b/chrome/browser/views/info_bar_view.cc @@ -93,11 +93,6 @@ void InfoBarView::Paint(ChromeCanvas* canvas) { PaintSeparators(canvas); } -void InfoBarView::DidChangeBounds(const CRect& previous, - const CRect& current) { - Layout(); -} - void InfoBarView::ChildAnimationProgressed() { if (web_contents_) web_contents_->ToolbarSizeChanged(true); diff --git a/chrome/browser/views/info_bar_view.h b/chrome/browser/views/info_bar_view.h index 52a91c5..6091867 100644 --- a/chrome/browser/views/info_bar_view.h +++ b/chrome/browser/views/info_bar_view.h @@ -42,8 +42,6 @@ class InfoBarView : public ChromeViews::View, // PaintBackground, PaintBorder and PaintSeparators. virtual void Paint(ChromeCanvas* canvas); - virtual void DidChangeBounds(const CRect& previous, const CRect& current); - WebContents* web_contents() { return web_contents_; } protected: diff --git a/chrome/browser/views/info_bubble.h b/chrome/browser/views/info_bubble.h index bb8933b..1c49a8d 100644 --- a/chrome/browser/views/info_bubble.h +++ b/chrome/browser/views/info_bubble.h @@ -112,10 +112,6 @@ class InfoBubble : public ChromeViews::ContainerWin, // Positions the content relative to the border. virtual void Layout(); - virtual void DidChangeBounds(const CRect& previous, const CRect& current) { - Layout(); - } - // Return the mask for the content view. HRGN GetMask(const CSize& size); diff --git a/chrome/browser/views/keyword_editor_view.cc b/chrome/browser/views/keyword_editor_view.cc index a49801a..043a9c6 100644 --- a/chrome/browser/views/keyword_editor_view.cc +++ b/chrome/browser/views/keyword_editor_view.cc @@ -421,11 +421,6 @@ void KeywordEditorView::ModifyTemplateURL(const TemplateURL* template_url, UserMetrics::RecordAction(L"KeywordEditor_ModifiedKeyword", profile_); } -void KeywordEditorView::DidChangeBounds(const CRect& previous, - const CRect& current) { - Layout(); -} - gfx::Size KeywordEditorView::GetPreferredSize() { return gfx::Size(ChromeViews::Window::GetLocalizedContentsSize( IDS_SEARCHENGINES_DIALOG_WIDTH_CHARS, diff --git a/chrome/browser/views/keyword_editor_view.h b/chrome/browser/views/keyword_editor_view.h index 41773ad..2d5b809 100644 --- a/chrome/browser/views/keyword_editor_view.h +++ b/chrome/browser/views/keyword_editor_view.h @@ -146,7 +146,6 @@ class KeywordEditorView : public ChromeViews::View, const std::wstring& url); // Overriden to invoke Layout. - virtual void DidChangeBounds(const CRect& previous, const CRect& current); virtual gfx::Size GetPreferredSize(); // DialogDelegate methods: diff --git a/chrome/browser/views/location_bar_view.cc b/chrome/browser/views/location_bar_view.cc index 51081bd..bd9774c 100644 --- a/chrome/browser/views/location_bar_view.cc +++ b/chrome/browser/views/location_bar_view.cc @@ -213,11 +213,6 @@ gfx::Size LocationBarView::GetPreferredSize() { security_image_view_.GetPreferredSize().width())); } -void LocationBarView::DidChangeBounds(const CRect& previous, - const CRect& current) { - Layout(); -} - void LocationBarView::Layout() { DoLayout(true); } @@ -646,12 +641,6 @@ gfx::Size LocationBarView::SelectedKeywordView::GetMinimumSize() { return partial_label_.GetMinimumSize(); } -void LocationBarView::SelectedKeywordView::DidChangeBounds( - const CRect& previous, - const CRect& current) { - Layout(); -} - void LocationBarView::SelectedKeywordView::Layout() { gfx::Size pref = GetPreferredSize(); bool at_pref = (width() == pref.width()); @@ -804,11 +793,6 @@ void LocationBarView::KeywordHintView::Layout() { } } -void LocationBarView::KeywordHintView::DidChangeBounds(const CRect& previous, - const CRect& current) { - Layout(); -} - // We don't translate accelerators for ALT + numpad digit, they are used for // entering special characters. bool LocationBarView::ShouldLookupAccelerators(const ChromeViews::KeyEvent& e) { diff --git a/chrome/browser/views/location_bar_view.h b/chrome/browser/views/location_bar_view.h index cec73af..2c138f5 100644 --- a/chrome/browser/views/location_bar_view.h +++ b/chrome/browser/views/location_bar_view.h @@ -70,7 +70,6 @@ class LocationBarView : public ChromeViews::View, virtual gfx::Size GetPreferredSize(); // Layout and Painting functions - virtual void DidChangeBounds(const CRect& previous, const CRect& current); virtual void Layout(); virtual void Paint(ChromeCanvas* canvas); @@ -155,7 +154,6 @@ class LocationBarView : public ChromeViews::View, virtual gfx::Size GetPreferredSize(); virtual gfx::Size GetMinimumSize(); - virtual void DidChangeBounds(const CRect& previous, const CRect& current); virtual void Layout(); // The current keyword, or an empty string if no keyword is displayed. @@ -212,8 +210,7 @@ class LocationBarView : public ChromeViews::View, // The minimum size is just big enough to show the tab. virtual gfx::Size GetMinimumSize(); virtual void Layout(); - void DidChangeBounds(const CRect& previous, const CRect& current); - + void set_profile(Profile* profile) { profile_ = profile; } private: diff --git a/chrome/browser/views/old_frames/vista_frame.cc b/chrome/browser/views/old_frames/vista_frame.cc index fe1f0b4..d381731 100644 --- a/chrome/browser/views/old_frames/vista_frame.cc +++ b/chrome/browser/views/old_frames/vista_frame.cc @@ -1471,7 +1471,7 @@ bool VistaFrame::UpdateChildViewAndLayout(ChromeViews::View* new_view, } else if (new_view && *view) { // The view changed, but the new view wants the same size, give it the // bounds of the last view and have it repaint. - new_view->SetBounds((*view)->bounds().ToRECT()); + new_view->SetBounds((*view)->bounds()); new_view->SchedulePaint(); } else if (new_view) { DCHECK(new_height == 0); diff --git a/chrome/browser/views/old_frames/xp_frame.cc b/chrome/browser/views/old_frames/xp_frame.cc index 24f614d..4fddbe8 100644 --- a/chrome/browser/views/old_frames/xp_frame.cc +++ b/chrome/browser/views/old_frames/xp_frame.cc @@ -2328,7 +2328,7 @@ bool XPFrame::UpdateChildViewAndLayout(ChromeViews::View* new_view, } else if (new_view && *view) { // The view changed, but the new view wants the same size, give it the // bounds of the last view and have it repaint. - new_view->SetBounds((*view)->bounds().ToRECT()); + new_view->SetBounds((*view)->bounds()); new_view->SchedulePaint(); } else if (new_view) { DCHECK(new_height == 0); 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); diff --git a/chrome/browser/views/page_info_window.cc b/chrome/browser/views/page_info_window.cc index 79e697a..3a45c3f 100644 --- a/chrome/browser/views/page_info_window.cc +++ b/chrome/browser/views/page_info_window.cc @@ -450,9 +450,9 @@ class PageInfoContentView : public ChromeViews::View { if (cert_viewer_button_) { gfx::Size ps = cert_viewer_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; cert_viewer_button_->SetBounds(kPanelHorizMargin, y_buttons, ps.width(), ps.height()); } diff --git a/chrome/browser/views/password_manager_view.cc b/chrome/browser/views/password_manager_view.cc index e39d67b..13965eb 100644 --- a/chrome/browser/views/password_manager_view.cc +++ b/chrome/browser/views/password_manager_view.cc @@ -293,10 +293,10 @@ void PasswordManagerView::Layout() { // Manually lay out the Remove All button in the same row as // the close button. - CRect parent_bounds; - GetParent()->GetLocalBounds(&parent_bounds, false); + gfx::Rect parent_bounds = GetParent()->GetLocalBounds(false); gfx::Size prefsize = remove_all_button_.GetPreferredSize(); - int button_y = parent_bounds.bottom - prefsize.height() - kButtonVEdgeMargin; + int button_y = + parent_bounds.bottom() - prefsize.height() - kButtonVEdgeMargin; remove_all_button_.SetBounds(kPanelHorizMargin, button_y, prefsize.width(), prefsize.height()); } diff --git a/chrome/browser/views/sad_tab_view.cc b/chrome/browser/views/sad_tab_view.cc index dbcfbfe..7b34bcb 100644 --- a/chrome/browser/views/sad_tab_view.cc +++ b/chrome/browser/views/sad_tab_view.cc @@ -88,10 +88,6 @@ void SadTabView::Layout() { message_bounds_.SetRect(message_x, message_y, message_width, message_height); } -void SadTabView::DidChangeBounds(const CRect&, const CRect&) { - Layout(); -} - // static void SadTabView::InitClass() { static bool initialized = false; diff --git a/chrome/browser/views/sad_tab_view.h b/chrome/browser/views/sad_tab_view.h index 2486224..4f27199 100644 --- a/chrome/browser/views/sad_tab_view.h +++ b/chrome/browser/views/sad_tab_view.h @@ -31,7 +31,6 @@ class SadTabView : public ChromeViews::View { // Overridden from ChromeViews::View: virtual void Paint(ChromeCanvas* canvas); virtual void Layout(); - virtual void DidChangeBounds(const CRect&, const CRect&); private: static void InitClass(); diff --git a/chrome/browser/views/shelf_item_dialog.cc b/chrome/browser/views/shelf_item_dialog.cc index 306922f..7e1db6b 100644 --- a/chrome/browser/views/shelf_item_dialog.cc +++ b/chrome/browser/views/shelf_item_dialog.cc @@ -480,11 +480,6 @@ bool ShelfItemDialog::AcceleratorPressed( return true; } -void ShelfItemDialog::DidChangeBounds(const CRect& previous, - const CRect& current) { - Layout(); -} - void ShelfItemDialog::OnSelectionChanged() { int selection = url_table_->FirstSelectedRow(); if (selection >= 0 && selection < url_table_model_->RowCount()) { diff --git a/chrome/browser/views/shelf_item_dialog.h b/chrome/browser/views/shelf_item_dialog.h index 744e6f6..6c0c587 100644 --- a/chrome/browser/views/shelf_item_dialog.h +++ b/chrome/browser/views/shelf_item_dialog.h @@ -73,7 +73,6 @@ class ShelfItemDialog : public ChromeViews::View, UINT flags) {} // Overridden from View. - virtual void DidChangeBounds(const CRect& previous, const CRect& current); virtual gfx::Size GetPreferredSize(); virtual bool AcceleratorPressed(const ChromeViews::Accelerator& accelerator); diff --git a/chrome/browser/views/tabs/dragged_tab_controller.cc b/chrome/browser/views/tabs/dragged_tab_controller.cc index b174dc8..cdbcd98 100644 --- a/chrome/browser/views/tabs/dragged_tab_controller.cc +++ b/chrome/browser/views/tabs/dragged_tab_controller.cc @@ -727,10 +727,9 @@ gfx::Rect DraggedTabController::GetViewScreenBounds( ChromeViews::View* view) const { gfx::Point view_topleft; ChromeViews::View::ConvertPointToScreen(view, &view_topleft); - CRect view_screen_bounds; - view->GetLocalBounds(&view_screen_bounds, true); - view_screen_bounds.OffsetRect(view_topleft.ToPOINT()); - return gfx::Rect(view_screen_bounds); + gfx::Rect view_screen_bounds = view->GetLocalBounds(true); + view_screen_bounds.Offset(view_topleft.x(), view_topleft.y()); + return view_screen_bounds; } int DraggedTabController::NormalizeIndexToAttachedTabStrip(int index) const { diff --git a/chrome/browser/views/tabs/dragged_tab_view.cc b/chrome/browser/views/tabs/dragged_tab_view.cc index 2c326ba..ecbcadc 100644 --- a/chrome/browser/views/tabs/dragged_tab_view.cc +++ b/chrome/browser/views/tabs/dragged_tab_view.cc @@ -150,13 +150,14 @@ void DraggedTabView::Paint(ChromeCanvas* canvas) { void DraggedTabView::Layout() { if (attached_) { - renderer_->SetBounds(gfx::Point(), GetPreferredSize()); + gfx::Size prefsize = GetPreferredSize(); + renderer_->SetBounds(0, 0, prefsize.width(), prefsize.height()); } else { int left = 0; if (UILayoutIsRightToLeft()) left = GetPreferredSize().width() - attached_tab_size_.width(); - renderer_->SetBounds(CRect(left, 0, left + attached_tab_size_.width(), - attached_tab_size_.height())); + renderer_->SetBounds(left, 0, left + attached_tab_size_.width(), + attached_tab_size_.height()); } } diff --git a/chrome/browser/views/tabs/tab_renderer.cc b/chrome/browser/views/tabs/tab_renderer.cc index 876c57e..99548a0 100644 --- a/chrome/browser/views/tabs/tab_renderer.cc +++ b/chrome/browser/views/tabs/tab_renderer.cc @@ -439,15 +439,10 @@ void TabRenderer::Paint(ChromeCanvas* canvas) { } void TabRenderer::Layout() { - CRect lb; - GetLocalBounds(&lb, false); - if (lb.IsRectEmpty()) + gfx::Rect lb = GetLocalBounds(false); + if (lb.IsEmpty()) return; - - lb.left += kLeftPadding; - lb.top += kTopPadding; - lb.bottom -= kBottomPadding; - lb.right -= kRightPadding; + lb.Inset(kLeftPadding, kTopPadding, kRightPadding, kBottomPadding); // First of all, figure out who is tallest. int content_height = GetContentHeight(); @@ -456,17 +451,17 @@ void TabRenderer::Layout() { showing_icon_ = ShouldShowIcon(); if (showing_icon_) { int favicon_top = kTopPadding + (content_height - kFaviconSize) / 2; - favicon_bounds_.SetRect(lb.left, favicon_top, kFaviconSize, kFaviconSize); + favicon_bounds_.SetRect(lb.x(), favicon_top, kFaviconSize, kFaviconSize); } else { - favicon_bounds_.SetRect(lb.left, lb.top, 0, 0); + favicon_bounds_.SetRect(lb.x(), lb.y(), 0, 0); } // Size the download icon. showing_download_icon_ = data_.show_download_icon; if (showing_download_icon_) { - int icon_top = kTopPadding + (content_height - download_icon_height) / 2; - download_icon_bounds_.SetRect(lb.Width() - download_icon_width, icon_top, - download_icon_width, download_icon_height); + int icon_top = kTopPadding + (content_height - download_icon_height) / 2; + download_icon_bounds_.SetRect(lb.width() - download_icon_width, icon_top, + download_icon_width, download_icon_height); } // Size the Close button. @@ -476,7 +471,7 @@ void TabRenderer::Layout() { kTopPadding + kCloseButtonVertFuzz + (content_height - close_button_height) / 2; // If the ratio of the close button size to tab width exceeds the maximum. - close_button_->SetBounds(lb.Width() + kCloseButtonHorzFuzz, + close_button_->SetBounds(lb.width() + kCloseButtonHorzFuzz, close_button_top, close_button_width, close_button_height); close_button_->SetVisible(true); @@ -502,7 +497,7 @@ void TabRenderer::Layout() { title_width = std::max(close_button_->x() - kTitleCloseButtonSpacing - title_left, 0); } else { - title_width = std::max(lb.Width() - title_left, 0); + title_width = std::max(lb.width() - title_left, 0); } if (data_.show_download_icon) title_width = std::max(title_width - download_icon_width, 0); @@ -521,12 +516,6 @@ void TabRenderer::Layout() { download_icon_bounds_.set_x(MirroredLeftPointForRect(download_icon_bounds_)); } -void TabRenderer::DidChangeBounds(const CRect& previous, - const CRect& current) { - Layout(); -} - - void TabRenderer::OnMouseEntered(const ChromeViews::MouseEvent& e) { hover_animation_->SetTweenType(SlideAnimation::EASE_OUT); hover_animation_->Show(); diff --git a/chrome/browser/views/tabs/tab_renderer.h b/chrome/browser/views/tabs/tab_renderer.h index 1c0a9f5..a956b1b 100644 --- a/chrome/browser/views/tabs/tab_renderer.h +++ b/chrome/browser/views/tabs/tab_renderer.h @@ -74,7 +74,6 @@ class TabRenderer : public ChromeViews::View, // Overridden from ChromeViews::View: virtual void Paint(ChromeCanvas* canvas); virtual void Layout(); - virtual void DidChangeBounds(const CRect& previous, const CRect& current); virtual void OnMouseEntered(const ChromeViews::MouseEvent& event); virtual void OnMouseExited(const ChromeViews::MouseEvent& event); diff --git a/chrome/browser/views/tabs/tab_strip.cc b/chrome/browser/views/tabs/tab_strip.cc index c4e1371..f487074 100644 --- a/chrome/browser/views/tabs/tab_strip.cc +++ b/chrome/browser/views/tabs/tab_strip.cc @@ -633,10 +633,6 @@ void TabStrip::PaintChildren(ChromeCanvas* canvas) { newtab_button_->ProcessPaint(canvas); } -void TabStrip::DidChangeBounds(const CRect& prev, const CRect& curr) { - Layout(); -} - // Overridden to support automation. See automation_proxy_uitest.cc. ChromeViews::View* TabStrip::GetViewByID(int view_id) const { if (GetTabCount() > 0) { @@ -1235,17 +1231,16 @@ void TabStrip::ResizeLayoutTabs() { } bool TabStrip::IsCursorInTabStripZone() { - CRect bounds; - GetLocalBounds(&bounds, true); - gfx::Point tabstrip_topleft(bounds.TopLeft()); + gfx::Rect bounds = GetLocalBounds(true); + gfx::Point tabstrip_topleft(bounds.origin()); View::ConvertPointToScreen(this, &tabstrip_topleft); - bounds.MoveToXY(tabstrip_topleft.ToPOINT()); - bounds.bottom += kTabStripAnimationVSlop; + bounds.set_origin(tabstrip_topleft); + bounds.set_height(bounds.height() + kTabStripAnimationVSlop); CPoint cursor_point; GetCursorPos(&cursor_point); - return !!bounds.PtInRect(cursor_point); + return bounds.Contains(cursor_point.x, cursor_point.y); } void TabStrip::AddMessageLoopObserver() { diff --git a/chrome/browser/views/tabs/tab_strip.h b/chrome/browser/views/tabs/tab_strip.h index b00268db..3f464a8 100644 --- a/chrome/browser/views/tabs/tab_strip.h +++ b/chrome/browser/views/tabs/tab_strip.h @@ -98,7 +98,6 @@ class TabStrip : public ChromeViews::View, // ChromeViews::View overrides: virtual void PaintChildren(ChromeCanvas* canvas); - virtual void DidChangeBounds(const CRect& previous, const CRect& current); virtual ChromeViews::View* GetViewByID(int id) const; virtual void Layout(); virtual gfx::Size GetPreferredSize(); diff --git a/chrome/browser/views/toolbar_view.cc b/chrome/browser/views/toolbar_view.cc index 45d4354..0554b06 100644 --- a/chrome/browser/views/toolbar_view.cc +++ b/chrome/browser/views/toolbar_view.cc @@ -342,11 +342,6 @@ void BrowserToolbarView::Layout() { } } -void BrowserToolbarView::DidChangeBounds(const CRect& previous, - const CRect& current) { - Layout(); -} - void BrowserToolbarView::DidGainFocus() { // Find first accessible child (-1 for start search at parent). int first_acc_child = GetNextAccessibleViewIndex(-1, false); diff --git a/chrome/browser/views/toolbar_view.h b/chrome/browser/views/toolbar_view.h index aa4040f..104dcfae 100644 --- a/chrome/browser/views/toolbar_view.h +++ b/chrome/browser/views/toolbar_view.h @@ -47,7 +47,6 @@ class BrowserToolbarView : public ChromeViews::View, // ChromeViews::View virtual void Layout(); - virtual void DidChangeBounds(const CRect& previous, const CRect& current); virtual void DidGainFocus(); virtual void WillLoseFocus(); virtual bool OnKeyPressed(const ChromeViews::KeyEvent& e); diff --git a/chrome/browser/web_contents_view_win.cc b/chrome/browser/web_contents_view_win.cc index 4891b6f..44eb993 100644 --- a/chrome/browser/web_contents_view_win.cc +++ b/chrome/browser/web_contents_view_win.cc @@ -262,7 +262,7 @@ void WebContentsViewWin::OnPaint(HDC junk_dc) { web_contents_->sad_tab_.reset(new SadTabView); CRect cr; GetClientRect(&cr); - web_contents_->sad_tab_->SetBounds(cr); + web_contents_->sad_tab_->SetBounds(gfx::Rect(cr)); ChromeCanvasPaint canvas(GetHWND(), true); web_contents_->sad_tab_->ProcessPaint(&canvas); return; |