diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-14 17:03:07 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-14 17:03:07 +0000 |
commit | 0d8ea70525f3c0805b0a474838917d0d1b5cd6a9 (patch) | |
tree | 6cbf491f10dae971bebe975e3fb623fc8a97a33b /chrome/browser | |
parent | 017b3cc2a4ade9e4e69f15bbd4721f149642d8a6 (diff) | |
download | chromium_src-0d8ea70525f3c0805b0a474838917d0d1b5cd6a9.zip chromium_src-0d8ea70525f3c0805b0a474838917d0d1b5cd6a9.tar.gz chromium_src-0d8ea70525f3c0805b0a474838917d0d1b5cd6a9.tar.bz2 |
Replace View::GetBounds(CRect* bounds) const; with gfx::Rect bounds() const.
http://crbug.com/2186
Review URL: http://codereview.chromium.org/7136
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3348 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/autocomplete/autocomplete_popup.cc | 3 | ||||
-rw-r--r-- | chrome/browser/find_in_page_controller.cc | 23 | ||||
-rw-r--r-- | chrome/browser/find_in_page_view.cc | 28 | ||||
-rw-r--r-- | chrome/browser/history_view.cc | 10 | ||||
-rw-r--r-- | chrome/browser/views/about_chrome_view.cc | 30 | ||||
-rw-r--r-- | chrome/browser/views/about_chrome_view.h | 6 | ||||
-rw-r--r-- | chrome/browser/views/constrained_window_impl.cc | 14 | ||||
-rw-r--r-- | chrome/browser/views/first_run_view_base.cc | 5 | ||||
-rw-r--r-- | chrome/browser/views/frame/browser_view2.cc | 29 | ||||
-rw-r--r-- | chrome/browser/views/frame/opaque_non_client_view.cc | 31 | ||||
-rw-r--r-- | chrome/browser/views/old_frames/vista_frame.cc | 5 | ||||
-rw-r--r-- | chrome/browser/views/old_frames/xp_frame.cc | 16 | ||||
-rw-r--r-- | chrome/browser/views/tabs/tab_strip.cc | 4 |
13 files changed, 88 insertions, 116 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_popup.cc b/chrome/browser/autocomplete/autocomplete_popup.cc index 9dcc1b4..c9ca6a1 100644 --- a/chrome/browser/autocomplete/autocomplete_popup.cc +++ b/chrome/browser/autocomplete/autocomplete_popup.cc @@ -169,8 +169,7 @@ void AutocompletePopupView::UpdatePopupAppearance() { // to its parent. // TODO(pkasting): http://b/1345937 All this use of editor accessors should // die once this class is a true ChromeView. - CRect rc; - edit_view_->parent_view()->GetBounds(&rc); + CRect rc = edit_view_->parent_view()->bounds().ToRECT(); // Subtract the top left corner to make the coordinates relative to the // location bar view itself, and convert to screen coordinates. CPoint top_left(-rc.TopLeft()); diff --git a/chrome/browser/find_in_page_controller.cc b/chrome/browser/find_in_page_controller.cc index baa4973..67c819c 100644 --- a/chrome/browser/find_in_page_controller.cc +++ b/chrome/browser/find_in_page_controller.cc @@ -478,19 +478,22 @@ void FindInPageController::GetDialogBounds(gfx::Rect* bounds) { *bounds = gfx::Rect(browser_client_rect); // Find the dimensions of the toolbar and the BookmarkBar. - CRect toolbar_bounds, bookmark_bar_bounds; + gfx::Rect toolbar_bounds, bookmark_bar_bounds; if (toolbar) { if (!g_browser_process->IsUsingNewFrames()) - toolbar->GetBounds(&toolbar_bounds); - else - toolbar->GetLocalBounds(&toolbar_bounds, false); + toolbar_bounds = toolbar->bounds(); + else { + CRect local_bounds; + toolbar->GetLocalBounds(&local_bounds, false); + toolbar_bounds = gfx::Rect(local_bounds); + } // Need to convert toolbar bounds into ViewContainer coords because the // toolbar is the child of another view that isn't the top level view. // This is required to ensure correct positioning relative to the top,left // of the window. CPoint topleft(0, 0); ChromeViews::View::ConvertPointToViewContainer(toolbar, &topleft); - toolbar_bounds.OffsetRect(topleft); + toolbar_bounds.Offset(topleft.x, topleft.y); } // If the bookmarks bar is available, we need to update our @@ -509,7 +512,7 @@ void FindInPageController::GetDialogBounds(gfx::Rect* bounds) { // the bookmarks bar (this works even if the bar is hidden). if (!bookmark_bar->IsNewTabPage() || bookmark_bar->IsAlwaysShown()) { - bookmark_bar->GetBounds(&bookmark_bar_bounds); + bookmark_bar_bounds = bookmark_bar->bounds(); } } else { view_->SetToolbarBlend(true); @@ -522,13 +525,13 @@ void FindInPageController::GetDialogBounds(gfx::Rect* bounds) { // window or a Chrome application so we want to draw at the top of the page // content (right beneath the title bar). int y_pos_offset = 0; - if (!toolbar_bounds.IsRectEmpty()) { + if (!toolbar_bounds.IsEmpty()) { // We have a toolbar (chrome), so overlap it by one pixel. - y_pos_offset = toolbar_bounds.BottomRight().y - 1; + y_pos_offset = toolbar_bounds.bottom() - 1; // If there is a bookmark bar attached to the toolbar we should appear // attached to it instead of the toolbar. - if (!bookmark_bar_bounds.IsRectEmpty()) - y_pos_offset += bookmark_bar_bounds.Height() - 1; + if (!bookmark_bar_bounds.IsEmpty()) + y_pos_offset += bookmark_bar_bounds.height() - 1; } else { // There is no toolbar, so this is probably a constrained window or a Chrome // Application. This means we draw the Find window at the top of the page diff --git a/chrome/browser/find_in_page_view.cc b/chrome/browser/find_in_page_view.cc index c6507f4..ac75944 100644 --- a/chrome/browser/find_in_page_view.cc +++ b/chrome/browser/find_in_page_view.cc @@ -284,28 +284,28 @@ void FindInPageView::Paint(ChromeCanvas* canvas) { // Then we draw the background image for the Find TextField. We start by // calculating the position of background images for the Find text box. - CRect find_text_rect; - CRect back_button_rect; + gfx::Rect find_text_rect; + gfx::Rect back_button_rect; int x = 0; // x coordinate of the curved edge background image. int w = 0; // width of the background image for the text field. if (UILayoutIsRightToLeft()) { - find_text_->GetBounds(&find_text_rect, APPLY_MIRRORING_TRANSFORMATION); - find_previous_button_->GetBounds(&back_button_rect, - APPLY_MIRRORING_TRANSFORMATION); - x = find_text_rect.right; - w = find_text_rect.right - back_button_rect.right; + find_text_rect = find_text_->GetBounds(APPLY_MIRRORING_TRANSFORMATION); + back_button_rect = + find_previous_button_->GetBounds(APPLY_MIRRORING_TRANSFORMATION); + x = find_text_rect.right(); + w = find_text_rect.right() - back_button_rect.right(); } else { - find_text_->GetBounds(&find_text_rect); - find_previous_button_->GetBounds(&back_button_rect); - x = find_text_rect.left - kBackground_left->width(); - w = back_button_rect.left - find_text_rect.left; + find_text_rect = find_text_->bounds(); + back_button_rect = find_previous_button_->bounds(); + x = find_text_rect.x() - kBackground_left->width(); + w = back_button_rect.x() - find_text_rect.x(); } // Draw the image to the left that creates a curved left edge for the box // (drawn on the right for RTL languages). canvas->TileImageInt(*kBackground_left, x, - back_button_rect.top, + back_button_rect.y(), kBackground_left->width(), kBackground_left->height()); @@ -314,8 +314,8 @@ void FindInPageView::Paint(ChromeCanvas* canvas) { int background_height = kBackground->height(); canvas->TileImageInt(*kBackground, UILayoutIsRightToLeft() ? - back_button_rect.right : find_text_rect.left, - back_button_rect.top, + back_button_rect.right() : find_text_rect.x(), + back_button_rect.y(), w, background_height); diff --git a/chrome/browser/history_view.cc b/chrome/browser/history_view.cc index 737eedf..064e215 100644 --- a/chrome/browser/history_view.cc +++ b/chrome/browser/history_view.cc @@ -394,13 +394,10 @@ void HistoryItemRenderer::Paint(ChromeCanvas* canvas) { if (favicon) { // WARNING: if you change these values, update the code that determines // whether we should allow a drag (GetDragRegion). - CRect title_bounds; - title_link_->GetBounds(&title_bounds); // We need to tweak the favicon position if the UI layout is RTL. gfx::Rect favicon_bounds; - favicon_bounds.set_x( - title_bounds.left - kIconPadding - kFavIconSize); + favicon_bounds.set_x(title_link_->x() - kIconPadding - kFavIconSize); favicon_bounds.set_y(kEntryPadding); favicon_bounds.set_width(favicon->width()); favicon_bounds.set_height(favicon->height()); @@ -602,14 +599,11 @@ HistoryItemRenderer::DragRegion HistoryItemRenderer::GetDragRegion(int x, int y) { // Is the location over the favicon? SkBitmap* favicon = model_->GetFavicon(model_index_); - CRect title_bounds; - title_link_->GetBounds(&title_bounds); if (favicon) { // If the UI layout is right-to-left, we must make sure we mirror the // favicon position before doing any hit testing. gfx::Rect favicon_bounds; - favicon_bounds.set_x( - title_bounds.left - kIconPadding - kFavIconSize); + favicon_bounds.set_x(title_link_->x() - kIconPadding - kFavIconSize); favicon_bounds.set_y(kEntryPadding); favicon_bounds.set_width(favicon->width()); favicon_bounds.set_height(favicon->height()); diff --git a/chrome/browser/views/about_chrome_view.cc b/chrome/browser/views/about_chrome_view.cc index d642aa7..2094372 100644 --- a/chrome/browser/views/about_chrome_view.cc +++ b/chrome/browser/views/about_chrome_view.cc @@ -312,8 +312,7 @@ void AboutChromeView::Paint(ChromeCanvas* canvas) { ChromeFont font = ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::BaseFont); - CRect bounds; - main_text_label_->GetBounds(&bounds); + const gfx::Rect label_bounds = main_text_label_->bounds(); ChromeViews::Link* link1 = chromium_url_appears_first_ ? chromium_url_ : open_source_url_; @@ -330,12 +329,13 @@ void AboutChromeView::Paint(ChromeCanvas* canvas) { CSize position; // Draw the first text chunk and position the Chromium url. DrawTextAndPositionUrl(canvas, main_label_chunk1_, link1, - rect1, &position, bounds, font); + rect1, &position, label_bounds, font); // Draw the second text chunk and position the Open Source url. DrawTextAndPositionUrl(canvas, main_label_chunk2_, link2, - rect2, &position, bounds, font); + rect2, &position, label_bounds, font); // Draw the third text chunk. - DrawTextStartingFrom(canvas, main_label_chunk3_, &position, bounds, font); + DrawTextStartingFrom(canvas, main_label_chunk3_, &position, label_bounds, + font); #if defined(GOOGLE_CHROME_BUILD) // Insert a line break and some whitespace. @@ -344,9 +344,11 @@ void AboutChromeView::Paint(ChromeCanvas* canvas) { // And now the Terms of Service and position the TOS url. DrawTextAndPositionUrl(canvas, main_label_chunk4_, terms_of_service_url_, - &terms_of_service_url_rect_, &position, bounds, font); + &terms_of_service_url_rect_, &position, label_bounds, + font); // The last text chunk doesn't have a URL associated with it. - DrawTextStartingFrom(canvas, main_label_chunk5_, &position, bounds, font); + DrawTextStartingFrom(canvas, main_label_chunk5_, &position, label_bounds, + font); #endif // Save the height so we can set the bounds correctly. @@ -358,7 +360,7 @@ void AboutChromeView::DrawTextAndPositionUrl(ChromeCanvas* canvas, ChromeViews::Link* link, gfx::Rect* rect, CSize* position, - const CRect& bounds, + const gfx::Rect& bounds, const ChromeFont& font) { DCHECK(canvas && link && rect && position); // Draw the text chunk. @@ -371,7 +373,7 @@ void AboutChromeView::DrawTextAndPositionUrl(ChromeCanvas* canvas, *rect = gfx::Rect(position->cx, position->cy, sz.cx, sz.cy); // Going from relative to absolute pixel coordinates again. - rect->Offset(bounds.TopLeft().x, bounds.TopLeft().y); + rect->Offset(bounds.x(), bounds.y()); // And leave some space to draw the link in. position->cx += sz.cx; } @@ -379,7 +381,7 @@ void AboutChromeView::DrawTextAndPositionUrl(ChromeCanvas* canvas, void AboutChromeView::DrawTextStartingFrom(ChromeCanvas* canvas, const std::wstring& text, CSize* position, - const CRect& bounds, + const gfx::Rect& bounds, const ChromeFont& font) { // Iterate through line breaking opportunities (which in English would be // spaces and such. This tells us where to wrap. @@ -407,8 +409,8 @@ void AboutChromeView::DrawTextStartingFrom(ChromeCanvas* canvas, // Draw the word on the screen (mirrored if RTL locale). canvas->DrawStringInt(word, font, SK_ColorBLACK, main_text_label_->MirroredXCoordinateInsideView( - position->cx + bounds.TopLeft().x), - position->cy + bounds.TopLeft().y, + position->cx + bounds.x()), + position->cy + bounds.y(), w, h, flags); if (word.size() > 0 && word[word.size() - 1] == L'\x0a') { @@ -425,8 +427,8 @@ void AboutChromeView::DrawTextStartingFrom(ChromeCanvas* canvas, void AboutChromeView::WrapIfWordDoesntFit(int word_width, int font_height, CSize* position, - const CRect& bounds) { - if (position->cx + word_width > bounds.right) { + const gfx::Rect& bounds) { + if (position->cx + word_width > bounds.right()) { position->cx = 0; position->cy += font_height; } diff --git a/chrome/browser/views/about_chrome_view.h b/chrome/browser/views/about_chrome_view.h index 4de351f..1a1b704 100644 --- a/chrome/browser/views/about_chrome_view.h +++ b/chrome/browser/views/about_chrome_view.h @@ -96,7 +96,7 @@ class AboutChromeView : public ChromeViews::View, ChromeViews::Link* link, gfx::Rect* rect, CSize* position, - const CRect& bounds, + const gfx::Rect& bounds, const ChromeFont& font); // A helper function for DrawTextAndPositionUrl, which simply draws the text @@ -105,7 +105,7 @@ class AboutChromeView : public ChromeViews::View, void DrawTextStartingFrom(ChromeCanvas* canvas, const std::wstring& text, CSize* position, - const CRect& bounds, + const gfx::Rect& bounds, const ChromeFont& font); // A simply utility function that calculates whether a word of width @@ -114,7 +114,7 @@ class AboutChromeView : public ChromeViews::View, void WrapIfWordDoesntFit(int word_width, int font_height, CSize* position, - const CRect& bounds); + const gfx::Rect& bounds); Profile* profile_; diff --git a/chrome/browser/views/constrained_window_impl.cc b/chrome/browser/views/constrained_window_impl.cc index 76e3eb1..34ce0d0 100644 --- a/chrome/browser/views/constrained_window_impl.cc +++ b/chrome/browser/views/constrained_window_impl.cc @@ -502,9 +502,6 @@ CPoint ConstrainedWindowNonClientView::GetSystemMenuPoint() const { } int ConstrainedWindowNonClientView::NonClientHitTest(const gfx::Point& point) { - CRect bounds; - CPoint test_point = point.ToPOINT(); - // First see if it's within the grow box area, since that overlaps the client // bounds. int component = container_->client_view()->NonClientHitTest(point); @@ -512,11 +509,11 @@ int ConstrainedWindowNonClientView::NonClientHitTest(const gfx::Point& point) { return component; // Then see if the point is within any of the window controls. - close_button_->GetBounds(&bounds); - if (bounds.PtInRect(test_point)) + gfx::Rect button_bounds = + close_button_->GetBounds(APPLY_MIRRORING_TRANSFORMATION); + if (button_bounds.Contains(point)) return HTCLOSE; - bounds = icon_bounds_.ToRECT(); - if (bounds.PtInRect(test_point)) + if (icon_bounds_.Contains(point)) return HTSYSMENU; component = GetHTComponentForFrame(point, kResizeAreaSize, @@ -525,8 +522,7 @@ int ConstrainedWindowNonClientView::NonClientHitTest(const gfx::Point& point) { window_delegate_->CanResize()); if (component == HTNOWHERE) { // Finally fall back to the caption. - GetBounds(&bounds, APPLY_MIRRORING_TRANSFORMATION); - if (bounds.PtInRect(test_point)) + if (bounds().Contains(point)) component = HTCAPTION; // Otherwise, the point is outside the window's bounds. } diff --git a/chrome/browser/views/first_run_view_base.cc b/chrome/browser/views/first_run_view_base.cc index 81e72fee..51feba4 100644 --- a/chrome/browser/views/first_run_view_base.cc +++ b/chrome/browser/views/first_run_view_base.cc @@ -108,11 +108,10 @@ void FirstRunViewBase::SetupControls() { } void FirstRunViewBase::AdjustDialogWidth(const ChromeViews::View* sub_view) { - CRect bounds; - sub_view->GetBounds(&bounds); + gfx::Rect sub_view_bounds = sub_view->bounds(); preferred_width_ = std::max(preferred_width_, - static_cast<int>(bounds.right) + kPanelHorizMargin); + static_cast<int>(sub_view_bounds.right()) + kPanelHorizMargin); } void FirstRunViewBase::SetMinimumDialogWidth(int width) { diff --git a/chrome/browser/views/frame/browser_view2.cc b/chrome/browser/views/frame/browser_view2.cc index e4a81c1..6ed9661 100644 --- a/chrome/browser/views/frame/browser_view2.cc +++ b/chrome/browser/views/frame/browser_view2.cc @@ -120,16 +120,13 @@ void BrowserView2::WindowMoved() { } gfx::Rect BrowserView2::GetToolbarBounds() const { - CRect bounds; - toolbar_->GetBounds(&bounds); - return gfx::Rect(bounds); + return toolbar_->bounds(); } gfx::Rect BrowserView2::GetClientAreaBounds() const { - CRect bounds; - contents_container_->GetBounds(&bounds); - bounds.OffsetRect(x(), y()); - return gfx::Rect(bounds); + gfx::Rect container_bounds = contents_container_->bounds(); + container_bounds.Offset(x(), y()); + return container_bounds; } int BrowserView2::GetTabStripHeight() const { @@ -742,10 +739,9 @@ int BrowserView2::NonClientHitTest(const gfx::Point& point) { // If the point's y coordinate is below the top of the toolbar and otherwise // within the bounds of this view, the point is considered to be within the // client area. - CRect bounds; - GetBounds(&bounds); - bounds.top += toolbar_->y(); - if (gfx::Rect(bounds).Contains(point.x(), point.y())) + gfx::Rect bv_bounds = bounds(); + bv_bounds.Offset(0, toolbar_->y()); + if (bv_bounds.Contains(point)) return HTCLIENT; // If the point's y coordinate is above the top of the toolbar, but not in @@ -758,9 +754,9 @@ int BrowserView2::NonClientHitTest(const gfx::Point& point) { // window controls not to work. So we return HTNOWHERE so that the caller // will hit-test the window controls before finally falling back to // HTCAPTION. - GetBounds(&bounds); - bounds.bottom = y() + toolbar_->y(); - if (gfx::Rect(bounds).Contains(point.x(), point.y())) + bv_bounds = bounds(); + bv_bounds.set_height(toolbar_->y()); + if (bv_bounds.Contains(point)) return HTNOWHERE; // If the point is somewhere else, delegate to the default implementation. @@ -1060,10 +1056,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. - CRect last_bounds; - (*old_view)->GetBounds(&last_bounds); - new_view->SetBounds(last_bounds.left, last_bounds.top, - last_bounds.Width(), last_bounds.Height()); + new_view->SetBounds((*old_view)->bounds().ToRECT()); new_view->SchedulePaint(); } else if (new_view) { DCHECK(new_height == 0); diff --git a/chrome/browser/views/frame/opaque_non_client_view.cc b/chrome/browser/views/frame/opaque_non_client_view.cc index f3b3afa..5bde0e6 100644 --- a/chrome/browser/views/frame/opaque_non_client_view.cc +++ b/chrome/browser/views/frame/opaque_non_client_view.cc @@ -527,9 +527,6 @@ CPoint OpaqueNonClientView::GetSystemMenuPoint() const { } int OpaqueNonClientView::NonClientHitTest(const gfx::Point& point) { - CRect bounds; - CPoint test_point = point.ToPOINT(); - // First see if it's within the grow box area, since that overlaps the client // bounds. int component = frame_->client_view()->NonClientHitTest(point); @@ -537,21 +534,22 @@ int OpaqueNonClientView::NonClientHitTest(const gfx::Point& point) { return component; // Then see if the point is within any of the window controls. - close_button_->GetBounds(&bounds, APPLY_MIRRORING_TRANSFORMATION); - if (bounds.PtInRect(test_point)) + gfx::Rect button_bounds = + close_button_->GetBounds(APPLY_MIRRORING_TRANSFORMATION); + if (button_bounds.Contains(point)) return HTCLOSE; - restore_button_->GetBounds(&bounds, APPLY_MIRRORING_TRANSFORMATION); - if (bounds.PtInRect(test_point)) + button_bounds = restore_button_->GetBounds(APPLY_MIRRORING_TRANSFORMATION); + if (button_bounds.Contains(point)) return HTMAXBUTTON; - maximize_button_->GetBounds(&bounds, APPLY_MIRRORING_TRANSFORMATION); - if (bounds.PtInRect(test_point)) + button_bounds = maximize_button_->GetBounds(APPLY_MIRRORING_TRANSFORMATION); + if (button_bounds.Contains(point)) return HTMAXBUTTON; - minimize_button_->GetBounds(&bounds, APPLY_MIRRORING_TRANSFORMATION); - if (bounds.PtInRect(test_point)) + button_bounds = minimize_button_->GetBounds(APPLY_MIRRORING_TRANSFORMATION); + if (button_bounds.Contains(point)) return HTMINBUTTON; if (window_icon_) { - window_icon_->GetBounds(&bounds, APPLY_MIRRORING_TRANSFORMATION); - if (bounds.PtInRect(test_point)) + button_bounds = window_icon_->GetBounds(APPLY_MIRRORING_TRANSFORMATION); + if (button_bounds.Contains(point)) return HTSYSMENU; } @@ -563,8 +561,7 @@ int OpaqueNonClientView::NonClientHitTest(const gfx::Point& point) { frame_->window_delegate()->CanResize()); if (component == HTNOWHERE) { // Finally fall back to the caption. - GetBounds(&bounds, APPLY_MIRRORING_TRANSFORMATION); - if (bounds.PtInRect(test_point)) + if (bounds().Contains(point)) component = HTCAPTION; // Otherwise, the point is outside the window's bounds. } @@ -647,9 +644,7 @@ ChromeViews::View* OpaqueNonClientView::GetViewForPoint( for (int i = 0; i < arraysize(views); ++i) { if (!views[i]->IsVisible()) continue; - CRect bounds; - views[i]->GetBounds(&bounds); - if (bounds.PtInRect(point)) + if (views[i]->bounds().Contains(gfx::Point(point))) return views[i]; } return View::GetViewForPoint(point, can_create_floating); diff --git a/chrome/browser/views/old_frames/vista_frame.cc b/chrome/browser/views/old_frames/vista_frame.cc index 592237a..e7cf71d 100644 --- a/chrome/browser/views/old_frames/vista_frame.cc +++ b/chrome/browser/views/old_frames/vista_frame.cc @@ -1479,10 +1479,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. - CRect last_bounds; - (*view)->GetBounds(&last_bounds); - new_view->SetBounds(last_bounds.left, last_bounds.top, - last_bounds.Width(), last_bounds.Height()); + new_view->SetBounds((*view)->bounds().ToRECT()); 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 5672ec2..36f6111 100644 --- a/chrome/browser/views/old_frames/xp_frame.cc +++ b/chrome/browser/views/old_frames/xp_frame.cc @@ -2337,10 +2337,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. - CRect last_bounds; - (*view)->GetBounds(&last_bounds); - new_view->SetBounds(last_bounds.left, last_bounds.top, - last_bounds.Width(), last_bounds.Height()); + new_view->SetBounds((*view)->bounds().ToRECT()); new_view->SchedulePaint(); } else if (new_view) { DCHECK(new_height == 0); @@ -2432,14 +2429,13 @@ void XPFrame::SizeToContents(const gfx::Rect& contents_bounds) { // Then we calculate the size of the window chrome, this is the stuff that // needs to be positioned around the edges of contents_bounds. - CRect bounds; - tab_contents_container_->GetBounds(&bounds); + gfx::Rect bounds = tab_contents_container_->bounds(); CRect cr; GetClientRect(&cr); - int toolbar_height = bounds.top; - int left_edge_width = bounds.left; - int right_edge_width = cr.Width() - bounds.right; - int bottom_edge_height = cr.Height() - bounds.bottom; + int toolbar_height = bounds.y(); + int left_edge_width = bounds.x(); + int right_edge_width = cr.Width() - bounds.right(); + int bottom_edge_height = cr.Height() - bounds.bottom(); // Now resize the window. This will result in Layout() getting called again // and the contents getting sized to the value specified in |contents_bounds| diff --git a/chrome/browser/views/tabs/tab_strip.cc b/chrome/browser/views/tabs/tab_strip.cc index ec1a705..083036b 100644 --- a/chrome/browser/views/tabs/tab_strip.cc +++ b/chrome/browser/views/tabs/tab_strip.cc @@ -543,11 +543,9 @@ bool TabStrip::PointIsWithinWindowCaption(const CPoint& point) { // Check to see if the point is within the non-button parts of the new tab // button. The button has a non-rectangular shape, so if it's not in the // visual portions of the button we treat it as a click to the caption. - CRect bounds; - newtab_button_->GetBounds(&bounds); CPoint point_in_newtab_coords(point); View::ConvertPointToView(this, newtab_button_, &point_in_newtab_coords); - if (bounds.PtInRect(point) && + if (newtab_button_->bounds().Contains(gfx::Point(point)) && !newtab_button_->HitTest(point_in_newtab_coords)) { return true; } |