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

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

Issue 1422703004: BoxLayout: Added set_collapse_when_hidden(), like views::Label. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@exclusiveaccess-minor-refactor
Patch Set: Created 5 years, 2 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/box_layout_unittest.cc » ('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 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) {
« no previous file with comments | « ui/views/layout/box_layout.h ('k') | ui/views/layout/box_layout_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698