diff options
author | pkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-11 07:06:06 +0000 |
---|---|---|
committer | pkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-11 07:06:06 +0000 |
commit | dc118492dc8949d4d5f8d9b099d3b12b05ccd62e (patch) | |
tree | 45a6e604ef204a34e22b2934dc35b0e324bae0e9 | |
parent | 55b64fac78c99e1672f88e08b11a97e40eedf4c5 (diff) | |
download | chromium_src-dc118492dc8949d4d5f8d9b099d3b12b05ccd62e.zip chromium_src-dc118492dc8949d4d5f8d9b099d3b12b05ccd62e.tar.gz chromium_src-dc118492dc8949d4d5f8d9b099d3b12b05ccd62e.tar.bz2 |
Prevent starting a crossfade animation of the frame images as a result of a theme change. Doing a crossfade animation is bad because we do not cache the image we are crossfading from.
BUG=247251
TEST=Manual, see bug
TBR=jamescook (Because this CL is a subset of https://codereview.chromium.org/16525002/)
Review URL: https://chromiumcodereview.appspot.com/16431006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@205444 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | ash/wm/frame_painter.cc | 17 | ||||
-rw-r--r-- | ash/wm/frame_painter.h | 3 | ||||
-rw-r--r-- | chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.cc | 5 | ||||
-rw-r--r-- | chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.h | 1 |
4 files changed, 25 insertions, 1 deletions
diff --git a/ash/wm/frame_painter.cc b/ash/wm/frame_painter.cc index 5aeb714..bcb5352 100644 --- a/ash/wm/frame_painter.cc +++ b/ash/wm/frame_painter.cc @@ -681,6 +681,21 @@ void FramePainter::SchedulePaintForTitle(views::NonClientFrameView* view, GetTitleBounds(view, title_font)); } +void FramePainter::OnThemeChanged() { + // We do not cache the images for |previous_theme_frame_id_| and + // |previous_theme_frame_overlay_id_|. Changing the theme changes the images + // returned from ui::ThemeProvider for |previous_theme_frame_id_| + // and |previous_theme_frame_overlay_id_|. Reset the image ids to prevent + // starting a crossfade animation with these images. + previous_theme_frame_id_ = 0; + previous_theme_frame_overlay_id_ = 0; + + if (crossfade_animation_.get() && crossfade_animation_->is_animating()) { + crossfade_animation_.reset(); + frame_->non_client_view()->SchedulePaintInRect(header_frame_bounds_); + } +} + /////////////////////////////////////////////////////////////////////////////// // aura::WindowObserver overrides: @@ -782,7 +797,7 @@ void FramePainter::OnWindowRemovingFromRootWindow(aura::Window* window) { // ui::AnimationDelegate overrides: void FramePainter::AnimationProgressed(const ui::Animation* animation) { - frame_->SchedulePaintInRect(gfx::Rect(header_frame_bounds_)); + frame_->non_client_view()->SchedulePaintInRect(header_frame_bounds_); } /////////////////////////////////////////////////////////////////////////////// diff --git a/ash/wm/frame_painter.h b/ash/wm/frame_painter.h index e288166..2bb7af3 100644 --- a/ash/wm/frame_painter.h +++ b/ash/wm/frame_painter.h @@ -130,6 +130,9 @@ class ASH_EXPORT FramePainter : public aura::WindowObserver, void SchedulePaintForTitle(views::NonClientFrameView* view, const gfx::Font& title_font); + // Called when the browser theme changes. + void OnThemeChanged(); + // aura::WindowObserver overrides: virtual void OnWindowPropertyChanged(aura::Window* window, const void* key, diff --git a/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.cc b/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.cc index 85ab29c..28b2be3 100644 --- a/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.cc +++ b/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.cc @@ -301,6 +301,11 @@ gfx::Size BrowserNonClientFrameViewAsh::GetMinimumSize() { return frame_painter_->GetMinimumSize(this); } +void BrowserNonClientFrameViewAsh::OnThemeChanged() { + BrowserNonClientFrameView::OnThemeChanged(); + frame_painter_->OnThemeChanged(); +} + /////////////////////////////////////////////////////////////////////////////// // views::ButtonListener overrides: diff --git a/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.h b/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.h index eea274d..85d4d0a 100644 --- a/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.h +++ b/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.h @@ -57,6 +57,7 @@ class BrowserNonClientFrameViewAsh virtual bool HitTestRect(const gfx::Rect& rect) const OVERRIDE; virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; virtual gfx::Size GetMinimumSize() OVERRIDE; + virtual void OnThemeChanged() OVERRIDE; // views::ButtonListener overrides: virtual void ButtonPressed(views::Button* sender, |