diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-31 16:24:27 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-31 16:24:27 +0000 |
commit | 4d3525221871b55f2e4de075a7d6034cdc0d056a (patch) | |
tree | de6597a9c61f7412b67944df8642e4b525814f08 /views | |
parent | b7302558b5727f2efe618b1b97fa7f1b2942b30e (diff) | |
download | chromium_src-4d3525221871b55f2e4de075a7d6034cdc0d056a.zip chromium_src-4d3525221871b55f2e4de075a7d6034cdc0d056a.tar.gz chromium_src-4d3525221871b55f2e4de075a7d6034cdc0d056a.tar.bz2 |
views: Make View::GetVisibleBounds() a const method.
Note: This was a TODO for beng.
BUG=72040
TEST=None
R=ben@chromium.org
Review URL: http://codereview.chromium.org/7083013
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@87312 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r-- | views/view.cc | 9 | ||||
-rw-r--r-- | views/view.h | 3 |
2 files changed, 5 insertions, 7 deletions
diff --git a/views/view.cc b/views/view.cc index 8fa73c0..fd4749d 100644 --- a/views/view.cc +++ b/views/view.cc @@ -291,22 +291,21 @@ gfx::Insets View::GetInsets() const { return insets; } -gfx::Rect View::GetVisibleBounds() { +gfx::Rect View::GetVisibleBounds() const { if (!IsVisibleInRootView()) return gfx::Rect(); gfx::Rect vis_bounds(0, 0, width(), height()); gfx::Rect ancestor_bounds; - View* view = this; + const View* view = this; int root_x = 0; int root_y = 0; while (view != NULL && !vis_bounds.IsEmpty()) { root_x += view->GetMirroredX(); root_y += view->y(); vis_bounds.Offset(view->GetMirroredX(), view->y()); - View* ancestor = view->parent(); + const View* ancestor = view->parent(); if (ancestor != NULL) { - ancestor_bounds.SetRect(0, 0, ancestor->width(), - ancestor->height()); + ancestor_bounds.SetRect(0, 0, ancestor->width(), ancestor->height()); vis_bounds = vis_bounds.Intersect(ancestor_bounds); } else if (!view->GetWidget()) { // If the view has no Widget, we're not visible. Return an empty rect. diff --git a/views/view.h b/views/view.h index 4f6f0e3..2a145ab 100644 --- a/views/view.h +++ b/views/view.h @@ -278,8 +278,7 @@ class View : public AcceleratorTarget { // function takes into account the mirroring setting for each View and // therefore it will return the mirrored version of the visible bounds if // need be. - // TODO(beng): const. - gfx::Rect GetVisibleBounds(); + gfx::Rect GetVisibleBounds() const; // Return the bounds of the View in screen coordinate system. gfx::Rect GetScreenBounds() const; |