Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Unified Diff: ui/views/layout/box_layout.cc

Issue 273223002: views: Make view::Views::GetPreferredSize() const. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More compile fix for ToT Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/layout/box_layout.h ('k') | ui/views/layout/fill_layout.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/layout/box_layout.cc
diff --git a/ui/views/layout/box_layout.cc b/ui/views/layout/box_layout.cc
index ae44a0812a6d46e6f78b8bc3c7af5c3cf9ec9ca5..c33264c5eebb655bfe10df1984dacfe8953c20f2 100644
--- a/ui/views/layout/box_layout.cc
+++ b/ui/views/layout/box_layout.cc
@@ -98,12 +98,12 @@ void BoxLayout::Layout(View* host) {
}
}
-gfx::Size BoxLayout::GetPreferredSize(View* host) {
+gfx::Size BoxLayout::GetPreferredSize(const View* host) const {
// Calculate the child views' preferred width.
int width = 0;
if (orientation_ == kVertical) {
for (int i = 0; i < host->child_count(); ++i) {
- View* child = host->child_at(i);
+ const View* child = host->child_at(i);
if (!child->visible())
continue;
@@ -114,7 +114,7 @@ gfx::Size BoxLayout::GetPreferredSize(View* host) {
return GetPreferredSizeForChildWidth(host, width);
}
-int BoxLayout::GetPreferredHeightForWidth(View* host, int width) {
+int BoxLayout::GetPreferredHeightForWidth(const View* host, int width) const {
int child_width = width - NonChildSize(host).width();
return GetPreferredSizeForChildWidth(host, child_width).height();
}
@@ -141,8 +141,8 @@ void BoxLayout::SetMainAxisPosition(int position, gfx::Rect* child_area) const {
child_area->set_y(position);
}
-gfx::Size BoxLayout::GetPreferredSizeForChildWidth(View* host,
- int child_area_width) {
+gfx::Size BoxLayout::GetPreferredSizeForChildWidth(const View* host,
+ int child_area_width) const {
gfx::Rect child_area_bounds;
if (orientation_ == kHorizontal) {
@@ -151,7 +151,7 @@ gfx::Size BoxLayout::GetPreferredSizeForChildWidth(View* host,
// TODO(estade): fix this if it ever becomes a problem.
int position = 0;
for (int i = 0; i < host->child_count(); ++i) {
- View* child = host->child_at(i);
+ const View* child = host->child_at(i);
if (!child->visible())
continue;
@@ -166,7 +166,7 @@ gfx::Size BoxLayout::GetPreferredSizeForChildWidth(View* host,
} else {
int height = 0;
for (int i = 0; i < host->child_count(); ++i) {
- View* child = host->child_at(i);
+ const View* child = host->child_at(i);
if (!child->visible())
continue;
@@ -186,7 +186,7 @@ gfx::Size BoxLayout::GetPreferredSizeForChildWidth(View* host,
child_area_bounds.height() + non_child_size.height());
}
-gfx::Size BoxLayout::NonChildSize(View* host) {
+gfx::Size BoxLayout::NonChildSize(const View* host) const {
gfx::Insets insets(host->GetInsets());
return gfx::Size(insets.width() + inside_border_insets_.width(),
insets.height() + inside_border_insets_.height());
« no previous file with comments | « ui/views/layout/box_layout.h ('k') | ui/views/layout/fill_layout.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698