diff options
author | skuhne@google.com <skuhne@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-01 15:12:23 +0000 |
---|---|---|
committer | skuhne@google.com <skuhne@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-01 15:12:23 +0000 |
commit | e213ff9273ed18faad994a20e6e90932af55a5b5 (patch) | |
tree | 3c22f3ee545af5ef00340086761664a29a852145 /ui | |
parent | 3989e174735ebeac9f8290a040b2605780eed34f (diff) | |
download | chromium_src-e213ff9273ed18faad994a20e6e90932af55a5b5.zip chromium_src-e213ff9273ed18faad994a20e6e90932af55a5b5.tar.gz chromium_src-e213ff9273ed18faad994a20e6e90932af55a5b5.tar.bz2 |
Handle titlebar text updates properly
Previously the area of the text was not invalidated prior to the title drawing. As such all kind of results were possible.
BUG=152597, 151827
TEST=visual
Review URL: https://codereview.chromium.org/10993087
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@159494 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r-- | ui/views/bubble/bubble_frame_view.h | 1 | ||||
-rw-r--r-- | ui/views/widget/widget.cc | 9 | ||||
-rw-r--r-- | ui/views/window/custom_frame_view.cc | 4 | ||||
-rw-r--r-- | ui/views/window/custom_frame_view.h | 1 | ||||
-rw-r--r-- | ui/views/window/native_frame_view.cc | 4 | ||||
-rw-r--r-- | ui/views/window/native_frame_view.h | 1 | ||||
-rw-r--r-- | ui/views/window/non_client_view.cc | 4 | ||||
-rw-r--r-- | ui/views/window/non_client_view.h | 5 |
8 files changed, 25 insertions, 4 deletions
diff --git a/ui/views/bubble/bubble_frame_view.h b/ui/views/bubble/bubble_frame_view.h index b82fe8e..1349920 100644 --- a/ui/views/bubble/bubble_frame_view.h +++ b/ui/views/bubble/bubble_frame_view.h @@ -32,6 +32,7 @@ class VIEWS_EXPORT BubbleFrameView : public NonClientFrameView { gfx::Path* window_mask) OVERRIDE {} virtual void ResetWindowControls() OVERRIDE {} virtual void UpdateWindowIcon() OVERRIDE {} + virtual void UpdateWindowTitle() OVERRIDE {} // View overrides: virtual gfx::Size GetPreferredSize() OVERRIDE; diff --git a/ui/views/widget/widget.cc b/ui/views/widget/widget.cc index bcee501..14aade8 100644 --- a/ui/views/widget/widget.cc +++ b/ui/views/widget/widget.cc @@ -736,10 +736,6 @@ void Widget::UpdateWindowTitle() { if (!non_client_view_) return; - // If the non-client view is rendering its own title, it'll need to relayout - // now. - non_client_view_->Layout(); - // Update the native frame's text. We do this regardless of whether or not // the native frame is being used, since this also updates the taskbar, etc. string16 window_title; @@ -750,6 +746,11 @@ void Widget::UpdateWindowTitle() { } base::i18n::AdjustStringForLocaleDirection(&window_title); native_widget_->SetWindowTitle(window_title); + non_client_view_->UpdateWindowTitle(); + + // If the non-client view is rendering its own title, it'll need to relayout + // now and to get a paint update later on. + non_client_view_->Layout(); } void Widget::UpdateWindowIcon() { diff --git a/ui/views/window/custom_frame_view.cc b/ui/views/window/custom_frame_view.cc index e94fcd4..a74b5d2 100644 --- a/ui/views/window/custom_frame_view.cc +++ b/ui/views/window/custom_frame_view.cc @@ -211,6 +211,10 @@ void CustomFrameView::UpdateWindowIcon() { window_icon_->SchedulePaint(); } +void CustomFrameView::UpdateWindowTitle() { + SchedulePaintInRect(title_bounds_); +} + /////////////////////////////////////////////////////////////////////////////// // CustomFrameView, View overrides: diff --git a/ui/views/window/custom_frame_view.h b/ui/views/window/custom_frame_view.h index 8e7d60b..17b364e 100644 --- a/ui/views/window/custom_frame_view.h +++ b/ui/views/window/custom_frame_view.h @@ -46,6 +46,7 @@ class CustomFrameView : public NonClientFrameView, gfx::Path* window_mask) OVERRIDE; virtual void ResetWindowControls() OVERRIDE; virtual void UpdateWindowIcon() OVERRIDE; + virtual void UpdateWindowTitle() OVERRIDE; // Overridden from View: virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; diff --git a/ui/views/window/native_frame_view.cc b/ui/views/window/native_frame_view.cc index 86b6687..0a28110 100644 --- a/ui/views/window/native_frame_view.cc +++ b/ui/views/window/native_frame_view.cc @@ -58,6 +58,10 @@ void NativeFrameView::UpdateWindowIcon() { // Nothing to do. } +void NativeFrameView::UpdateWindowTitle() { + // Nothing to do. +} + gfx::Size NativeFrameView::GetPreferredSize() { return frame_->client_view()->GetPreferredSize(); } diff --git a/ui/views/window/native_frame_view.h b/ui/views/window/native_frame_view.h index 304867c..204443e 100644 --- a/ui/views/window/native_frame_view.h +++ b/ui/views/window/native_frame_view.h @@ -25,6 +25,7 @@ class VIEWS_EXPORT NativeFrameView : public NonClientFrameView { gfx::Path* window_mask) OVERRIDE; virtual void ResetWindowControls() OVERRIDE; virtual void UpdateWindowIcon() OVERRIDE; + virtual void UpdateWindowTitle() OVERRIDE; // View overrides: diff --git a/ui/views/window/non_client_view.cc b/ui/views/window/non_client_view.cc index 357c1db..d6ee959 100644 --- a/ui/views/window/non_client_view.cc +++ b/ui/views/window/non_client_view.cc @@ -96,6 +96,10 @@ void NonClientView::UpdateWindowIcon() { frame_view_->UpdateWindowIcon(); } +void NonClientView::UpdateWindowTitle() { + frame_view_->UpdateWindowTitle(); +} + void NonClientView::LayoutFrameView() { // First layout the NonClientFrameView, which determines the size of the // ClientView... diff --git a/ui/views/window/non_client_view.h b/ui/views/window/non_client_view.h index 3b6fd0b..9658657 100644 --- a/ui/views/window/non_client_view.h +++ b/ui/views/window/non_client_view.h @@ -65,6 +65,7 @@ class VIEWS_EXPORT NonClientFrameView : public View { gfx::Path* window_mask) = 0; virtual void ResetWindowControls() = 0; virtual void UpdateWindowIcon() = 0; + virtual void UpdateWindowTitle() = 0; // Overridden from View: virtual bool HitTestRect(const gfx::Rect& rect) const OVERRIDE; @@ -184,6 +185,10 @@ class VIEWS_EXPORT NonClientView : public View { // Tells the NonClientView to invalidate the NonClientFrameView's window icon. void UpdateWindowIcon(); + // Tells the NonClientView to invalidate the NonClientFrameView's window + // title. + void UpdateWindowTitle(); + // Get/Set client_view property. ClientView* client_view() const { return client_view_; } void set_client_view(ClientView* client_view) { |