summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views/frame
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/views/frame')
-rw-r--r--chrome/browser/views/frame/browser_view2.cc29
-rw-r--r--chrome/browser/views/frame/opaque_non_client_view.cc31
2 files changed, 24 insertions, 36 deletions
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);