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 /base | |
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 'base')
-rw-r--r-- | base/gfx/rect.cc | 7 | ||||
-rw-r--r-- | base/gfx/rect.h | 3 |
2 files changed, 10 insertions, 0 deletions
diff --git a/base/gfx/rect.cc b/base/gfx/rect.cc index 0f9708c..fa81023 100644 --- a/base/gfx/rect.cc +++ b/base/gfx/rect.cc @@ -115,6 +115,13 @@ void Rect::Inset(int horizontal, int vertical) { set_height(std::max(height() - (vertical * 2), 0)); } +void Rect::Inset(int left, int top, int right, int bottom) { + set_width(std::max(width() - left - right, 0)); + set_height(std::max(height() - top - bottom, 0)); + set_x(left); + set_y(top); +} + void Rect::Offset(int horizontal, int vertical) { set_x(x() + horizontal); set_y(y() + vertical); diff --git a/base/gfx/rect.h b/base/gfx/rect.h index a7a3d9c..ac730bd 100644 --- a/base/gfx/rect.h +++ b/base/gfx/rect.h @@ -74,6 +74,9 @@ class Rect { // Shrink the rectangle by a horizontal and vertical distance on all sides. void Inset(int horizontal, int vertical); + // Shrink the rectangle by the specified amount on each side. + void Inset(int left, int top, int right, int bottom); + // Move the rectangle by a horizontal and vertical distance. void Offset(int horizontal, int vertical); |