summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-16 16:47:32 +0000
committerpfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-16 16:47:32 +0000
commitd0c07ee9cdb1101244e3b5b4e5322e46cb735163 (patch)
tree2a096ecd4358d7263b6798a25869c80561fe96b1
parent3c540b02313d07c4d0ef92a837fc6d2ccb401f45 (diff)
downloadchromium_src-d0c07ee9cdb1101244e3b5b4e5322e46cb735163.zip
chromium_src-d0c07ee9cdb1101244e3b5b4e5322e46cb735163.tar.gz
chromium_src-d0c07ee9cdb1101244e3b5b4e5322e46cb735163.tar.bz2
SingleSplitView: survive minimize / restore when resize changes leading bounds.
BUG=16855 Review URL: http://codereview.chromium.org/155629 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20872 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--views/controls/single_split_view.cc26
1 files changed, 18 insertions, 8 deletions
diff --git a/views/controls/single_split_view.cc b/views/controls/single_split_view.cc
index 7915171..30ecc34 100644
--- a/views/controls/single_split_view.cc
+++ b/views/controls/single_split_view.cc
@@ -35,13 +35,20 @@ SingleSplitView::SingleSplitView(View* leading,
void SingleSplitView::DidChangeBounds(const gfx::Rect& previous,
const gfx::Rect& current) {
if (resize_leading_on_bounds_change_) {
- if (is_horizontal_)
- divider_offset_ += current.width() - previous.width();
- else
- divider_offset_ += current.height() - previous.height();
-
- if (divider_offset_ < 0)
- divider_offset_ = kDividerSize;
+ // We do not update divider_offset_ on minimize (to zero) and on restore
+ // (to largest value). As a result we get back to the original value upon
+ // window restore.
+ bool is_minimize_or_restore =
+ previous.height() == 0 || current.height() == 0;
+ if (!is_minimize_or_restore) {
+ if (is_horizontal_)
+ divider_offset_ += current.width() - previous.width();
+ else
+ divider_offset_ += current.height() - previous.height();
+
+ if (divider_offset_ < 0)
+ divider_offset_ = kDividerSize;
+ }
}
View::DidChangeBounds(previous, current);
}
@@ -56,7 +63,10 @@ void SingleSplitView::Layout() {
if (!leading->IsVisible() && !trailing->IsVisible())
return;
- if (!trailing->IsVisible()) {
+ if (width() == 0 || height() == 0) {
+ // We are most likely minimized - do not touch divider offset.
+ return;
+ } else if (!trailing->IsVisible()) {
leading->SetBounds(0, 0, width(), height());
} else if (!leading->IsVisible()) {
trailing->SetBounds(0, 0, width(), height());