diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-28 20:32:40 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-28 20:32:40 +0000 |
commit | 2f13a9a035cfdaf9048cbe085d92def6298b0f25 (patch) | |
tree | 34074e99aa267476ef0f04fef33217d7817ae877 /ui | |
parent | f3e02be0ec0a9b0518f7efd4d19abefcba936ff8 (diff) | |
download | chromium_src-2f13a9a035cfdaf9048cbe085d92def6298b0f25.zip chromium_src-2f13a9a035cfdaf9048cbe085d92def6298b0f25.tar.gz chromium_src-2f13a9a035cfdaf9048cbe085d92def6298b0f25.tar.bz2 |
Two tweaks to avoid invoking ShelfLayoutManager::LayoutShelf unless we
need to. The reason we should only invoke LayoutShelf is that it'll
cancel any animations. Here's the two problematic scenarios I noticed:
. ImageView::SetImage invoked PreferredSizeChanged even if it
didn't. PreferredSizeChanged eventually makes it way to LayoutShelf,
so we should only invoke this if the preferred size actually
changed.
. StatusAreaLayoutManager::SetChildBounds need not do anything if the
size matches.
BUG=120679
TEST=none
R=ben@chromium.org
Review URL: https://chromiumcodereview.appspot.com/9877009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@129480 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r-- | ui/views/controls/image_view.cc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/ui/views/controls/image_view.cc b/ui/views/controls/image_view.cc index 92c1513..64ccf5b 100644 --- a/ui/views/controls/image_view.cc +++ b/ui/views/controls/image_view.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -23,8 +23,10 @@ ImageView::~ImageView() { } void ImageView::SetImage(const SkBitmap& bm) { + gfx::Size pref_size(GetPreferredSize()); image_ = bm; - PreferredSizeChanged(); + if (pref_size != GetPreferredSize()) + PreferredSizeChanged(); SchedulePaint(); } |