Index: ui/views/layout/box_layout.cc |
diff --git a/ui/views/layout/box_layout.cc b/ui/views/layout/box_layout.cc |
index 10f82b9aa544e349b18a852a4afe330de9176427..b962bc6471b27719474b39661c8e65aba8da3bf3 100644 |
--- a/ui/views/layout/box_layout.cc |
+++ b/ui/views/layout/box_layout.cc |
@@ -23,6 +23,7 @@ BoxLayout::BoxLayout(BoxLayout::Orientation orientation, |
cross_axis_alignment_(CROSS_AXIS_ALIGNMENT_STRETCH), |
default_flex_(0), |
minimum_cross_axis_size_(0), |
+ collapse_when_hidden_(false), |
host_(NULL) { |
} |
@@ -156,6 +157,9 @@ void BoxLayout::Layout(View* host) { |
gfx::Size BoxLayout::GetPreferredSize(const View* host) const { |
DCHECK_EQ(host_, host); |
+ if (!host->visible() && collapse_when_hidden_) |
+ return gfx::Size(); |
+ |
// Calculate the child views' preferred width. |
int width = 0; |
if (orientation_ == kVertical) { |