diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-11 04:35:18 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-11 04:35:18 +0000 |
commit | 8d950abd884b4e0cefe31382bb7ff721a6b21fd5 (patch) | |
tree | 1b4451f156b1b5eecb4a7a17db3226e9e555ddfb | |
parent | 94211019031659c00a397cfbcf4fba25fb267860 (diff) | |
download | chromium_src-8d950abd884b4e0cefe31382bb7ff721a6b21fd5.zip chromium_src-8d950abd884b4e0cefe31382bb7ff721a6b21fd5.tar.gz chromium_src-8d950abd884b4e0cefe31382bb7ff721a6b21fd5.tar.bz2 |
Fix the distributor logo placement on the glass frame.
The window's control bounds can change independently of window sizing messages (WM_SIZE), and so we need to make sure that we always call Layout on the frame view and the client view, even if the bounds of the window don't change so that we are more likely to update the layout of the distributor logo.
http://crbug.com/8511
Review URL: http://codereview.chromium.org/42061
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11424 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/views/client_view.cc | 17 | ||||
-rw-r--r-- | chrome/views/client_view.h | 4 | ||||
-rw-r--r-- | chrome/views/non_client_view.cc | 19 | ||||
-rw-r--r-- | chrome/views/non_client_view.h | 3 |
4 files changed, 37 insertions, 6 deletions
diff --git a/chrome/views/client_view.cc b/chrome/views/client_view.cc index 4f4bae3..0d4cb3e 100644 --- a/chrome/views/client_view.cc +++ b/chrome/views/client_view.cc @@ -36,6 +36,13 @@ gfx::Size ClientView::GetPreferredSize() { return gfx::Size(); } +void ClientView::Layout() { + // |contents_view_| is allowed to be NULL up until the point where this view + // is attached to a Container. + if (contents_view_) + contents_view_->SetBounds(0, 0, width(), height()); +} + void ClientView::ViewHierarchyChanged(bool is_add, View* parent, View* child) { if (is_add && child == this) { DCHECK(GetWidget()); @@ -44,11 +51,11 @@ void ClientView::ViewHierarchyChanged(bool is_add, View* parent, View* child) { } } -void ClientView::Layout() { - // |contents_view_| is allowed to be NULL up until the point where this view - // is attached to a Container. - if (contents_view_) - contents_view_->SetBounds(0, 0, width(), height()); +void ClientView::DidChangeBounds(const gfx::Rect& previous, + const gfx::Rect& current) { + // Overridden to do nothing. The NonClientView manually calls Layout on the + // ClientView when it is itself laid out, see comment in + // NonClientView::Layout. } } // namespace views diff --git a/chrome/views/client_view.h b/chrome/views/client_view.h index d573039..b9b60e3 100644 --- a/chrome/views/client_view.h +++ b/chrome/views/client_view.h @@ -55,11 +55,13 @@ class ClientView : public View { // Overridden from View: virtual gfx::Size GetPreferredSize(); + virtual void Layout(); protected: // Overridden from View: virtual void ViewHierarchyChanged(bool is_add, View* parent, View* child); - virtual void Layout(); + virtual void DidChangeBounds(const gfx::Rect& previous, + const gfx::Rect& current); // Accessors for private data members. Window* window() const { return window_; } diff --git a/chrome/views/non_client_view.cc b/chrome/views/non_client_view.cc index 79448af..18e90b7 100644 --- a/chrome/views/non_client_view.cc +++ b/chrome/views/non_client_view.cc @@ -151,8 +151,21 @@ void NonClientView::Layout() { // ClientView... frame_view_->SetBounds(0, 0, width(), height()); + // We need to manually call Layout here because layout for the frame view can + // change independently of the bounds changing - e.g. after the initial + // display of the window the metrics of the native window controls can change, + // which does not change the bounds of the window but requires a re-layout to + // trigger a repaint. We override DidChangeBounds for the NonClientFrameView + // to do nothing so that SetBounds above doesn't cause Layout to be called + // twice. + frame_view_->Layout(); + // Then layout the ClientView, using those bounds. client_view_->SetBounds(frame_view_->GetBoundsForClientView()); + + // We need to manually call Layout on the ClientView as well for the same + // reason as above. + client_view_->Layout(); } void NonClientView::ViewHierarchyChanged(bool is_add, View* parent, @@ -196,6 +209,12 @@ bool NonClientFrameView::HitTest(const gfx::Point& l) const { return !GetWidget()->AsWindow()->client_view()->bounds().Contains(l); } +void NonClientFrameView::DidChangeBounds(const gfx::Rect& previous, + const gfx::Rect& current) { + // Overridden to do nothing. The NonClientView manually calls Layout on the + // FrameView when it is itself laid out, see comment in NonClientView::Layout. +} + //////////////////////////////////////////////////////////////////////////////// // NonClientFrameView, protected: diff --git a/chrome/views/non_client_view.h b/chrome/views/non_client_view.h index a6366e8..abb2e6ed 100644 --- a/chrome/views/non_client_view.h +++ b/chrome/views/non_client_view.h @@ -59,6 +59,9 @@ class NonClientFrameView : public View { virtual bool HitTest(const gfx::Point& l) const; protected: + virtual void DidChangeBounds(const gfx::Rect& previous, + const gfx::Rect& current); + NonClientFrameView() : paint_as_active_(false) {} |