summaryrefslogtreecommitdiffstats
path: root/chrome/browser/gtk/download_item_gtk.cc
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-22 20:24:06 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-22 20:24:06 +0000
commit36345874fb0086e5fc509caf01e84d26fd982afd (patch)
tree7c4157f2d150004038f17477bc6bab18e5ef0f21 /chrome/browser/gtk/download_item_gtk.cc
parent5ec89fa2cffd6582b311b1861e4fbd8af71bc5ae (diff)
downloadchromium_src-36345874fb0086e5fc509caf01e84d26fd982afd.zip
chromium_src-36345874fb0086e5fc509caf01e84d26fd982afd.tar.gz
chromium_src-36345874fb0086e5fc509caf01e84d26fd982afd.tar.bz2
Avoid DCHECK in nine box during download shelf animation.
That DCHECK might be a little overzealous, but is probably useful for most situations, so I'm leaving it. TBR=tony Review URL: http://codereview.chromium.org/92036 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14237 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk/download_item_gtk.cc')
-rw-r--r--chrome/browser/gtk/download_item_gtk.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/chrome/browser/gtk/download_item_gtk.cc b/chrome/browser/gtk/download_item_gtk.cc
index 38260e8..5e49ff0 100644
--- a/chrome/browser/gtk/download_item_gtk.cc
+++ b/chrome/browser/gtk/download_item_gtk.cc
@@ -27,6 +27,11 @@ const int kMenuButtonWidth = 16;
// it will be elided.
const int kTextWidth = 140;
+// The minimum width we will ever draw the download item. Used as a lower bound
+// during animation. This number comes from the width of the images used to
+// make the download item.
+const int kMinDownloadItemWidth = 13;
+
const char* kLabelColorMarkup = "<span color='#%s'>%s</span>";
const char* kFilenameColor = "576C95"; // 87, 108, 149
const char* kStatusColor = "7B8DAE"; // 123, 141, 174
@@ -228,8 +233,8 @@ void DownloadItemGtk::AnimationProgressed(const Animation* animation) {
// now the only contents of body_ is text, so to make its size request the
// same as the width of the text. See above TODO for explanation of the
// extra 50.
- int showing_width = (kTextWidth + 50) *
- new_item_animation_->GetCurrentValue();
+ int showing_width = std::max(kMinDownloadItemWidth,
+ (kTextWidth + 50) * new_item_animation_->GetCurrentValue());
gtk_widget_set_size_request(body_, showing_width, -1);
}