summaryrefslogtreecommitdiffstats
path: root/chrome/views
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-14 17:03:07 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-14 17:03:07 +0000
commit0d8ea70525f3c0805b0a474838917d0d1b5cd6a9 (patch)
tree6cbf491f10dae971bebe975e3fb623fc8a97a33b /chrome/views
parent017b3cc2a4ade9e4e69f15bbd4721f149642d8a6 (diff)
downloadchromium_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/views')
-rw-r--r--chrome/views/accessibility/view_accessibility.cc19
-rw-r--r--chrome/views/bitmap_scroll_bar.cc54
-rw-r--r--chrome/views/chrome_menu.cc4
-rw-r--r--chrome/views/client_view.cc6
-rw-r--r--chrome/views/custom_frame_window.cc80
-rw-r--r--chrome/views/grid_layout_unittest.cc2
-rw-r--r--chrome/views/label.cc10
-rw-r--r--chrome/views/text_button.cc27
-rw-r--r--chrome/views/tooltip_manager.cc9
-rw-r--r--chrome/views/view.cc11
-rw-r--r--chrome/views/view.h7
-rw-r--r--chrome/views/view_unittest.cc4
12 files changed, 103 insertions, 130 deletions
diff --git a/chrome/views/accessibility/view_accessibility.cc b/chrome/views/accessibility/view_accessibility.cc
index 2790bb1..259eb5c 100644
--- a/chrome/views/accessibility/view_accessibility.cc
+++ b/chrome/views/accessibility/view_accessibility.cc
@@ -446,7 +446,7 @@ STDMETHODIMP ViewAccessibility::accLocation(LONG* x_left, LONG* y_top,
return E_INVALIDARG;
}
- CRect view_bounds(0, 0, 0, 0);
+ gfx::Rect view_bounds;
// Retrieving the parent View to be used for converting from view-to-screen
// coordinates.
ChromeViews::View* parent = view_->GetParent();
@@ -458,25 +458,26 @@ STDMETHODIMP ViewAccessibility::accLocation(LONG* x_left, LONG* y_top,
if (var_id.lVal == CHILDID_SELF) {
// Retrieve active View's bounds.
- view_->GetBounds(&view_bounds);
+ view_bounds = view_->bounds();
} else {
// Check to see if child is out-of-bounds.
if (!IsValidChild((var_id.lVal - 1), view_)) {
return E_INVALIDARG;
}
// Retrieve child bounds.
- view_->GetChildViewAt(var_id.lVal - 1)->GetBounds(&view_bounds);
+ view_bounds = view_->GetChildViewAt(var_id.lVal - 1)->bounds();
// Parent View is current View.
parent = view_;
}
- if (!view_bounds.IsRectNull()) {
- *width = view_bounds.Width();
- *height = view_bounds.Height();
+ if (!view_bounds.IsEmpty()) {
+ *width = view_bounds.width();
+ *height = view_bounds.height();
- ChromeViews::View::ConvertPointToScreen(parent, &view_bounds.TopLeft());
- *x_left = view_bounds.left;
- *y_top = view_bounds.top;
+ CPoint topleft = view_bounds.origin().ToPOINT();
+ ChromeViews::View::ConvertPointToScreen(parent, &topleft);
+ *x_left = topleft.x;
+ *y_top = topleft.y;
} else {
return E_FAIL;
}
diff --git a/chrome/views/bitmap_scroll_bar.cc b/chrome/views/bitmap_scroll_bar.cc
index 7dcf18e..948846bd 100644
--- a/chrome/views/bitmap_scroll_bar.cc
+++ b/chrome/views/bitmap_scroll_bar.cc
@@ -90,46 +90,40 @@ class BitmapScrollBarThumb : public View {
size = std::max(size,
static_cast<int>(scroll_bar_->IsHorizontal() ?
prefsize.cx : prefsize.cy));
- CRect bounds;
- GetBounds(&bounds);
+ gfx::Rect thumb_bounds = bounds();
if (scroll_bar_->IsHorizontal()) {
- bounds.right = bounds.left + size;
+ thumb_bounds.set_width(size);
} else {
- bounds.bottom = bounds.top + size;
+ thumb_bounds.set_height(size);
}
- SetBounds(bounds);
+ SetBounds(thumb_bounds.ToRECT());
}
// Retrieves the size (width or height) of the thumb.
int GetSize() const {
- CRect bounds;
- GetBounds(&bounds);
if (scroll_bar_->IsHorizontal())
- return bounds.Width();
- return bounds.Height();
+ return width();
+ return height();
}
// Sets the position of the thumb on the x or y axis.
void SetPosition(int position) {
- CRect bounds;
- GetBounds(&bounds);
+ gfx::Rect thumb_bounds = bounds();
gfx::Rect track_bounds = scroll_bar_->GetTrackBounds();
if (scroll_bar_->IsHorizontal()) {
- bounds.MoveToX(track_bounds.x() + position);
+ thumb_bounds.set_x(track_bounds.x() + position);
} else {
- bounds.MoveToY(track_bounds.y() + position);
+ thumb_bounds.set_x(track_bounds.y() + position);
}
- SetBounds(bounds);
+ SetBounds(thumb_bounds.ToRECT());
}
// Gets the position of the thumb on the x or y axis.
int GetPosition() const {
- CRect bounds;
- GetBounds(&bounds);
gfx::Rect track_bounds = scroll_bar_->GetTrackBounds();
if (scroll_bar_->IsHorizontal())
- return bounds.left - track_bounds.x();
- return bounds.top - track_bounds.y();
+ return x() - track_bounds.x();
+ return y() - track_bounds.y();
}
// View overrides:
@@ -380,11 +374,8 @@ void BitmapScrollBar::ScrollByContentsOffset(int contents_offset) {
}
void BitmapScrollBar::TrackClicked() {
- if (last_scroll_amount_ != SCROLL_NONE) {
- CRect thumb_bounds;
- thumb_->GetBounds(&thumb_bounds);
+ if (last_scroll_amount_ != SCROLL_NONE)
ScrollByAmount(last_scroll_amount_);
- }
}
///////////////////////////////////////////////////////////////////////////////
@@ -436,14 +427,12 @@ void BitmapScrollBar::Layout() {
// Preserve the height/width of the thumb (depending on orientation) as set
// by the last call to |Update|, but coerce the width/height to be the
// appropriate value for the bitmaps provided.
- CRect bounds;
- thumb_->GetBounds(&bounds);
if (IsHorizontal()) {
- thumb_->SetBounds(bounds.left, bounds.top, bounds.Width(),
+ thumb_->SetBounds(thumb_->x(), thumb_->y(), thumb_->width(),
thumb_prefsize.cy);
} else {
- thumb_->SetBounds(bounds.left, bounds.top, thumb_prefsize.cx,
- bounds.Height());
+ thumb_->SetBounds(thumb_->x(), thumb_->y(), thumb_prefsize.cx,
+ thumb_->height());
}
// Hide the thumb if the track isn't tall enough to display even a tiny
@@ -465,18 +454,17 @@ void BitmapScrollBar::DidChangeBounds(const CRect& previous,
bool BitmapScrollBar::OnMousePressed(const MouseEvent& event) {
if (event.IsOnlyLeftMouseButton()) {
SetThumbTrackState(BaseButton::BS_PUSHED);
- CRect thumb_bounds;
- thumb_->GetBounds(&thumb_bounds);
+ gfx::Rect thumb_bounds = thumb_->bounds();
if (IsHorizontal()) {
- if (event.x() < thumb_bounds.left) {
+ if (event.x() < thumb_bounds.x()) {
last_scroll_amount_ = SCROLL_PREV_PAGE;
- } else if (event.x() > thumb_bounds.right) {
+ } else if (event.x() > thumb_bounds.right()) {
last_scroll_amount_ = SCROLL_NEXT_PAGE;
}
} else {
- if (event.y() < thumb_bounds.top) {
+ if (event.y() < thumb_bounds.y()) {
last_scroll_amount_ = SCROLL_PREV_PAGE;
- } else if (event.y() > thumb_bounds.bottom) {
+ } else if (event.y() > thumb_bounds.bottom()) {
last_scroll_amount_ = SCROLL_NEXT_PAGE;
}
}
diff --git a/chrome/views/chrome_menu.cc b/chrome/views/chrome_menu.cc
index 537503f..f51e964 100644
--- a/chrome/views/chrome_menu.cc
+++ b/chrome/views/chrome_menu.cc
@@ -1016,9 +1016,7 @@ gfx::Rect SubmenuView::CalculateDropIndicatorBounds(
MenuItemView* item,
MenuDelegate::DropPosition position) {
DCHECK(position != MenuDelegate::DROP_NONE);
- CRect item_bounds_c;
- item->GetBounds(&item_bounds_c);
- gfx::Rect item_bounds(item_bounds_c);
+ gfx::Rect item_bounds = item->bounds();
switch (position) {
case MenuDelegate::DROP_BEFORE:
item_bounds.Offset(0, -kDropIndicatorHeight / 2);
diff --git a/chrome/views/client_view.cc b/chrome/views/client_view.cc
index bf66d90..ba994cd 100644
--- a/chrome/views/client_view.cc
+++ b/chrome/views/client_view.cc
@@ -16,11 +16,7 @@ ClientView::ClientView(Window* window, View* contents_view)
}
int ClientView::NonClientHitTest(const gfx::Point& point) {
- CRect bounds;
- GetBounds(&bounds, APPLY_MIRRORING_TRANSFORMATION);
- if (gfx::Rect(bounds).Contains(point.x(), point.y()))
- return HTCLIENT;
- return HTNOWHERE;
+ return bounds().Contains(point) ? HTCLIENT : HTNOWHERE;
}
///////////////////////////////////////////////////////////////////////////////
diff --git a/chrome/views/custom_frame_window.cc b/chrome/views/custom_frame_window.cc
index 018a188..ebd705f 100644
--- a/chrome/views/custom_frame_window.cc
+++ b/chrome/views/custom_frame_window.cc
@@ -425,9 +425,6 @@ CPoint DefaultNonClientView::GetSystemMenuPoint() const {
// why this function passes APPLY_MIRRORING_TRANSFORMATION as the |settings|
// whenever it calls GetBounds().
int DefaultNonClientView::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);
@@ -435,20 +432,22 @@ int DefaultNonClientView::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;
- system_menu_button_->GetBounds(&bounds, APPLY_MIRRORING_TRANSFORMATION);
- if (bounds.PtInRect(test_point))
+ button_bounds =
+ system_menu_button_->GetBounds(APPLY_MIRRORING_TRANSFORMATION);
+ if (button_bounds.Contains(point))
return HTSYSMENU;
component = GetHTComponentForFrame(
@@ -459,8 +458,7 @@ int DefaultNonClientView::NonClientHitTest(const gfx::Point& point) {
container_->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.
}
@@ -633,32 +631,31 @@ void DefaultNonClientView::PaintClientEdge(ChromeCanvas* canvas) {
resources()->GetPartBitmap(FRAME_CLIENT_EDGE_BOTTOM_LEFT);
SkBitmap* left = resources()->GetPartBitmap(FRAME_CLIENT_EDGE_LEFT);
- CRect client_area_bounds;
- container_->client_view()->GetBounds(&client_area_bounds);
-
- canvas->DrawBitmapInt(*top_left, client_area_bounds.left - top_left->width(),
- client_area_bounds.top - top->height());
- canvas->TileImageInt(*top, client_area_bounds.left,
- client_area_bounds.top - top->height(),
- client_area_bounds.Width(), top->height());
- canvas->DrawBitmapInt(*top_right, client_area_bounds.right,
- client_area_bounds.top - top->height());
- canvas->TileImageInt(*right, client_area_bounds.right,
- client_area_bounds.top - top->height() +
+ gfx::Rect client_area_bounds = container_->client_view()->bounds();
+
+ canvas->DrawBitmapInt(*top_left, client_area_bounds.x() - top_left->width(),
+ client_area_bounds.y() - top->height());
+ canvas->TileImageInt(*top, client_area_bounds.x(),
+ client_area_bounds.y() - top->height(),
+ client_area_bounds.width(), top->height());
+ canvas->DrawBitmapInt(*top_right, client_area_bounds.right(),
+ client_area_bounds.y() - top->height());
+ canvas->TileImageInt(*right, client_area_bounds.right(),
+ client_area_bounds.y() - top->height() +
top_right->height(),
- right->width(), client_area_bounds.Height());
- canvas->DrawBitmapInt(*bottom_right, client_area_bounds.right,
- client_area_bounds.bottom);
- canvas->TileImageInt(*bottom, client_area_bounds.left,
- client_area_bounds.bottom,
- client_area_bounds.Width(), bottom_right->height());
+ right->width(), client_area_bounds.height());
+ canvas->DrawBitmapInt(*bottom_right, client_area_bounds.right(),
+ client_area_bounds.bottom());
+ canvas->TileImageInt(*bottom, client_area_bounds.x(),
+ client_area_bounds.bottom(),
+ client_area_bounds.width(), bottom_right->height());
canvas->DrawBitmapInt(*bottom_left,
- client_area_bounds.left - bottom_left->width(),
- client_area_bounds.bottom);
- canvas->TileImageInt(*left, client_area_bounds.left - left->width(),
- client_area_bounds.top - top->height() +
+ client_area_bounds.x() - bottom_left->width(),
+ client_area_bounds.bottom());
+ canvas->TileImageInt(*left, client_area_bounds.x() - left->width(),
+ client_area_bounds.y() - top->height() +
top_left->height(),
- left->width(), client_area_bounds.Height());
+ left->width(), client_area_bounds.height());
}
void DefaultNonClientView::LayoutWindowControls() {
@@ -780,14 +777,13 @@ void DefaultNonClientView::LayoutTitleBar() {
// Size the title, if visible.
if (d->ShouldShowWindowTitle()) {
- CRect system_menu_bounds;
- system_menu_button_->GetBounds(&system_menu_bounds);
+ gfx::Rect system_menu_bounds = system_menu_button_->bounds();
int spacing = d->ShouldShowWindowIcon() ? kWindowIconTitleSpacing : 0;
int title_right = should_show_minmax_buttons_ ?
minimize_button_->x() : close_button_->x();
- int title_left = system_menu_bounds.right + spacing;
+ int title_left = system_menu_bounds.right() + spacing;
title_bounds_.SetRect(title_left, kTitleTopOffset + top_offset,
- std::max(0, static_cast<int>(title_right - system_menu_bounds.right)),
+ std::max(0, static_cast<int>(title_right - system_menu_bounds.right())),
title_font_.height());
// We draw the custom frame window's title directly rather than using a
diff --git a/chrome/views/grid_layout_unittest.cc b/chrome/views/grid_layout_unittest.cc
index 080cddb..4abfced 100644
--- a/chrome/views/grid_layout_unittest.cc
+++ b/chrome/views/grid_layout_unittest.cc
@@ -89,7 +89,7 @@ class GridLayoutAlignmentTest : public testing::Test {
EXPECT_TRUE(CSize(10, 20) == pref);
host.SetBounds(0, 0, 100, 100);
layout->Layout(&host);
- v1.GetBounds(bounds);
+ *bounds = v1.bounds().ToRECT();
RemoveAll();
}
diff --git a/chrome/views/label.cc b/chrome/views/label.cc
index 31053ac..ec6e5cb 100644
--- a/chrome/views/label.cc
+++ b/chrome/views/label.cc
@@ -346,18 +346,16 @@ void Label::SizeToFit(int max_width) {
std::vector<std::wstring> lines;
SplitString(text_, L'\n', &lines);
- int width = 0;
+ int label_width = 0;
for (std::vector<std::wstring>::const_iterator iter = lines.begin();
iter != lines.end(); ++iter) {
- width = std::max(width, font_.GetStringWidth(*iter));
+ label_width = std::max(label_width, font_.GetStringWidth(*iter));
}
if (max_width > 0)
- width = std::min(width, max_width);
+ label_width = std::min(label_width, max_width);
- CRect out;
- GetBounds(&out);
- SetBounds(out.left, out.top, width, 0);
+ SetBounds(x(), y(), width(), 0);
SizeToPreferredSize();
}
diff --git a/chrome/views/text_button.cc b/chrome/views/text_button.cc
index e4e7225..617860d 100644
--- a/chrome/views/text_button.cc
+++ b/chrome/views/text_button.cc
@@ -81,8 +81,7 @@ void TextButtonBorder::Paint(const View& view, ChromeCanvas* canvas) const {
set = &pushed_set_;
if (set) {
- CRect bounds;
- view.GetBounds(&bounds);
+ gfx::Rect bounds = view.bounds();
// Draw the top left image
canvas->DrawBitmapInt(*set->top_left, 0, 0);
@@ -90,43 +89,43 @@ void TextButtonBorder::Paint(const View& view, ChromeCanvas* canvas) const {
// Tile the top image
canvas->TileImageInt(*set->top,
set->top_left->width(), 0,
- bounds.Width() - set->top_right->width() - set->top_left->width(),
+ bounds.width() - set->top_right->width() - set->top_left->width(),
set->top->height());
// Draw the top right image
canvas->DrawBitmapInt(*set->top_right,
- bounds.Width() - set->top_right->width(), 0);
+ bounds.width() - set->top_right->width(), 0);
// Tile the left image
canvas->TileImageInt(*set->left,
0, set->top_left->height(),
set->top_left->width(),
- bounds.Height() - set->top->height() - set->bottom_left->height());
+ bounds.height() - set->top->height() - set->bottom_left->height());
// Tile the center image
canvas->TileImageInt(*set->center,
set->left->width(), set->top->height(),
- bounds.Width() - set->right->width() - set->left->width(),
- bounds.Height() - set->bottom->height() - set->top->height());
+ bounds.width() - set->right->width() - set->left->width(),
+ bounds.height() - set->bottom->height() - set->top->height());
// Tile the right image
canvas->TileImageInt(*set->right,
- bounds.Width() - set->right->width(), set->top_right->height(),
- bounds.Width(), bounds.Height() - set->bottom_right->height() - set->top_right->height());
+ bounds.width() - set->right->width(), set->top_right->height(),
+ bounds.width(), bounds.height() - set->bottom_right->height() - set->top_right->height());
// Draw the bottom left image
- canvas->DrawBitmapInt(*set->bottom_left, 0, bounds.Height() - set->bottom_left->height());
+ canvas->DrawBitmapInt(*set->bottom_left, 0, bounds.height() - set->bottom_left->height());
// Tile the bottom image
canvas->TileImageInt(*set->bottom,
- set->bottom_left->width(), bounds.Height() - set->bottom->height(),
- bounds.Width() - set->bottom_right->width() - set->bottom_left->width(),
+ set->bottom_left->width(), bounds.height() - set->bottom->height(),
+ bounds.width() - set->bottom_right->width() - set->bottom_left->width(),
set->bottom->height());
// Draw the bottom right image
canvas->DrawBitmapInt(*set->bottom_right,
- bounds.Width() - set->bottom_right->width(),
- bounds.Height() - set->bottom_right->height());
+ bounds.width() - set->bottom_right->width(),
+ bounds.height() - set->bottom_right->height());
} else {
// Do nothing
}
diff --git a/chrome/views/tooltip_manager.cc b/chrome/views/tooltip_manager.cc
index 112d380..a146933 100644
--- a/chrome/views/tooltip_manager.cc
+++ b/chrome/views/tooltip_manager.cc
@@ -379,9 +379,8 @@ void TooltipManager::ShowKeyboardTooltip(View* focused_view) {
HideKeyboardTooltip();
std::wstring tooltip_text;
if (!focused_view->GetTooltipText(0, 0, &tooltip_text))
- return ;
- CRect bounds;
- focused_view->GetBounds(&bounds);
+ return;
+ gfx::Rect focused_bounds = focused_view->bounds();
CPoint screen_point;
focused_view->ConvertPointToScreen(focused_view, &screen_point);
CPoint relative_point_coordinates;
@@ -409,9 +408,9 @@ void TooltipManager::ShowKeyboardTooltip(View* focused_view) {
reinterpret_cast<LPARAM>(&keyboard_toolinfo));
if (!tooltip_height_)
tooltip_height_ = CalcTooltipHeight();
- RECT rect_bounds = {screen_point.x, screen_point.y + bounds.Height(),
+ RECT rect_bounds = {screen_point.x, screen_point.y + focused_bounds.height(),
screen_point.x + tooltip_width,
- screen_point.y + bounds.Height() +
+ screen_point.y + focused_bounds.height() +
line_count * tooltip_height_ };
gfx::Rect monitor_bounds =
win_util::GetMonitorBoundsForRect(gfx::Rect(rect_bounds));
diff --git a/chrome/views/view.cc b/chrome/views/view.cc
index 9f107be..def0ec6 100644
--- a/chrome/views/view.cc
+++ b/chrome/views/view.cc
@@ -114,15 +114,16 @@ View::~View() {
//
/////////////////////////////////////////////////////////////////////////////
-void View::GetBounds(CRect* out, PositionMirroringSettings settings) const {
- *out = bounds_;
+gfx::Rect View::GetBounds(PositionMirroringSettings settings) const {
+ gfx::Rect bounds(bounds_);
// If the parent uses an RTL UI layout and if we are asked to transform the
// bounds to their mirrored position if necessary, then we should shift the
// rectangle appropriately.
- if (settings == APPLY_MIRRORING_TRANSFORMATION) {
- out->MoveToX(MirroredX());
- }
+ if (settings == APPLY_MIRRORING_TRANSFORMATION)
+ bounds.set_x(MirroredX());
+
+ return bounds;
}
// y(), width() and height() are agnostic to the RTL UI layout of the
diff --git a/chrome/views/view.h b/chrome/views/view.h
index 072e84d..6e46336 100644
--- a/chrome/views/view.h
+++ b/chrome/views/view.h
@@ -140,9 +140,8 @@ class View : public AcceleratorTarget {
// This is the function subclasses should use whenever they need to obtain
// the bounds of one of their child views (for example, when implementing
// View::Layout()).
- void GetBounds(CRect *out) const {
- GetBounds(out, IGNORE_MIRRORING_TRANSFORMATION);
- };
+ // TODO(beng): Convert |bounds_| to a gfx::Rect.
+ gfx::Rect bounds() const { return gfx::Rect(bounds_); }
// Return the bounds of the View, relative to the parent. If
// |settings| is IGNORE_MIRRORING_TRANSFORMATION, the function returns the
@@ -155,7 +154,7 @@ class View : public AcceleratorTarget {
// transparent to the View subclasses and therefore you should use the
// version of GetBounds() which does not take a transformation settings
// parameter.
- void GetBounds(CRect *out, PositionMirroringSettings settings) const;
+ gfx::Rect GetBounds(PositionMirroringSettings settings) const;
// Set the bounds in the parent's coordinate system.
void SetBounds(const CRect& bounds);
diff --git a/chrome/views/view_unittest.cc b/chrome/views/view_unittest.cc
index 4894525..94de4d2 100644
--- a/chrome/views/view_unittest.cc
+++ b/chrome/views/view_unittest.cc
@@ -165,9 +165,7 @@ TEST_F(ViewTest, DidChangeBounds) {
EXPECT_EQ(v->previous_bounds_, prev_rect);
EXPECT_EQ(v->new_bounds_, new_rect);
- CRect r;
- v->GetBounds(&r);
- EXPECT_EQ(r, new_rect);
+ EXPECT_EQ(v->bounds(), gfx::Rect(new_rect));
delete v;
}