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

Unified Diff: views/controls/single_split_view.cc

Issue 150120: Add layout support for invisible SingleSplitView children. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 6 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/controls/single_split_view.cc
===================================================================
--- views/controls/single_split_view.cc (revision 19710)
+++ views/controls/single_split_view.cc (working copy)
@@ -35,20 +35,30 @@
View* leading = GetChildViewAt(0);
View* trailing = GetChildViewAt(1);
- if (divider_offset_ < 0)
- divider_offset_ = (GetPrimaryAxisSize() - kDividerSize) / 2;
- else
- divider_offset_ = std::min(divider_offset_,
- GetPrimaryAxisSize() - kDividerSize);
- if (is_horizontal_) {
- leading->SetBounds(0, 0, divider_offset_, height());
- trailing->SetBounds(divider_offset_ + kDividerSize, 0,
- width() - divider_offset_ - kDividerSize, height());
+ if (!leading->IsVisible() && !trailing->IsVisible())
+ return;
+
+ if (!trailing->IsVisible()) {
+ leading->SetBounds(0, 0, width(), height());
+ } else if (!leading->IsVisible()) {
+ trailing->SetBounds(0, 0, width(), height());
} else {
- leading->SetBounds(0, 0, width(), divider_offset_);
- trailing->SetBounds(0, divider_offset_ + kDividerSize,
- width(), height() - divider_offset_ - kDividerSize);
+ if (divider_offset_ < 0)
+ divider_offset_ = (GetPrimaryAxisSize() - kDividerSize) / 2;
+ else
+ divider_offset_ = std::min(divider_offset_,
+ GetPrimaryAxisSize() - kDividerSize);
+
+ if (is_horizontal_) {
+ leading->SetBounds(0, 0, divider_offset_, height());
+ trailing->SetBounds(divider_offset_ + kDividerSize, 0,
+ width() - divider_offset_ - kDividerSize, height());
+ } else {
+ leading->SetBounds(0, 0, width(), divider_offset_);
+ trailing->SetBounds(0, divider_offset_ + kDividerSize,
+ width(), height() - divider_offset_ - kDividerSize);
+ }
}
SchedulePaint();
@@ -139,6 +149,9 @@
if (GetChildViewCount() < 2)
return false;
+ if (!GetChildViewAt(0)->IsVisible() || !GetChildViewAt(1)->IsVisible())
+ return false;
+
int divider_relative_offset;
if (is_horizontal_) {
divider_relative_offset =
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698