diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-14 22:40:34 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-14 22:40:34 +0000 |
commit | 5a068bd029b1d28374f0cf26cbb74bc1ef33bd0c (patch) | |
tree | 4ac3c9fae806384f0c5c1b8cc4bfd1efae7aa50a /chrome | |
parent | d66cdc5623b9e6815c1048c02b6ca99664ec1bf7 (diff) | |
download | chromium_src-5a068bd029b1d28374f0cf26cbb74bc1ef33bd0c.zip chromium_src-5a068bd029b1d28374f0cf26cbb74bc1ef33bd0c.tar.gz chromium_src-5a068bd029b1d28374f0cf26cbb74bc1ef33bd0c.tar.bz2 |
Fix broken size restoration for bookmark manager. Initializing a rect incorrectly, and clobbering the maximized state during initial sizing.
http://crbug.com/4437
Review URL: http://codereview.chromium.org/10758
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5512 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/views/window.cc | 13 | ||||
-rw-r--r-- | chrome/views/window.h | 4 | ||||
-rw-r--r-- | chrome/views/window_delegate.cc | 2 |
3 files changed, 16 insertions, 3 deletions
diff --git a/chrome/views/window.cc b/chrome/views/window.cc index fb7d945..e5726c8 100644 --- a/chrome/views/window.cc +++ b/chrome/views/window.cc @@ -87,7 +87,7 @@ gfx::Size Window::CalculateMaximumSize() const { void Window::Show() { int show_state = GetShowState(); bool maximized = false; - if (window_delegate_->GetSavedMaximizedState(&maximized) && maximized) + if (saved_maximized_state_) show_state = SW_SHOWMAXIMIZED; Show(show_state); } @@ -232,7 +232,8 @@ Window::Window(WindowDelegate* window_delegate) restored_enabled_(false), is_always_on_top_(false), window_closed_(false), - disable_inactive_rendering_(false) { + disable_inactive_rendering_(false), + saved_maximized_state_(0) { InitClass(); DCHECK(window_delegate_); window_delegate_->window_.reset(this); @@ -468,6 +469,14 @@ void Window::SetInitialFocus() { } void Window::SetInitialBounds(const gfx::Rect& create_bounds) { + // First we obtain the window's saved show-style and store it. We need to do + // this here, rather than in Show() because by the time Show() is called, + // the window's size will have been reset (below) and the saved maximized + // state will have been lost. Sadly there's no way to tell on Windows when + // a window is restored from maximized state, so we can't more accurately + // track maximized state independently of sizing information. + window_delegate_->GetSavedMaximizedState(&saved_maximized_state_); + // Restore the window's placement from the controller. gfx::Rect saved_bounds(create_bounds.ToRECT()); if (window_delegate_->GetSavedWindowBounds(&saved_bounds)) { diff --git a/chrome/views/window.h b/chrome/views/window.h index ad8f020..9758f9f 100644 --- a/chrome/views/window.h +++ b/chrome/views/window.h @@ -249,6 +249,10 @@ class Window : public ContainerWin { // or not it actually is. bool disable_inactive_rendering_; + // The saved maximized state for this window. See note in SetInitialBounds + // that explains why we save this. + bool saved_maximized_state_; + DISALLOW_EVIL_CONSTRUCTORS(Window); }; diff --git a/chrome/views/window_delegate.cc b/chrome/views/window_delegate.cc index 7ce676e..381ea14 100644 --- a/chrome/views/window_delegate.cc +++ b/chrome/views/window_delegate.cc @@ -57,7 +57,7 @@ bool WindowDelegate::GetSavedWindowBounds(gfx::Rect* bounds) const { !dictionary->GetInteger(L"bottom", &bottom)) return false; - bounds->SetRect(left, top, right, bottom); + bounds->SetRect(left, top, right - left, bottom - top); return true; } |