summaryrefslogtreecommitdiffstats
path: root/chrome/browser/notifications/balloon.cc
diff options
context:
space:
mode:
authorlevin@chromium.org <levin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-30 03:43:09 +0000
committerlevin@chromium.org <levin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-30 03:43:09 +0000
commit4e212c3b271b13d22156945997443d00feed6e02 (patch)
tree9c01a0617ba2ce94c9cdfec66b502dc3ad307293 /chrome/browser/notifications/balloon.cc
parente7aa405e7d97e67fc96006d0cc5919c801a5834e (diff)
downloadchromium_src-4e212c3b271b13d22156945997443d00feed6e02.zip
chromium_src-4e212c3b271b13d22156945997443d00feed6e02.tar.gz
chromium_src-4e212c3b271b13d22156945997443d00feed6e02.tar.bz2
For OSX, make it so that notifications only start resizing after the first paint is done.
Also, only allow them to grow. A later fix will remove this ifdef replacing it with code that works across platforms. BUG=56693 TEST=Ran many tests manually. Automated test in progress (before closing the bug). Review URL: http://codereview.chromium.org/5361006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@67673 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/notifications/balloon.cc')
-rw-r--r--chrome/browser/notifications/balloon.cc16
1 files changed, 15 insertions, 1 deletions
diff --git a/chrome/browser/notifications/balloon.cc b/chrome/browser/notifications/balloon.cc
index 96f3fca..86bf50a 100644
--- a/chrome/browser/notifications/balloon.cc
+++ b/chrome/browser/notifications/balloon.cc
@@ -9,6 +9,7 @@
#include "chrome/browser/notifications/notification.h"
#include "chrome/browser/renderer_host/site_instance.h"
#include "gfx/rect.h"
+#include "gfx/size.h"
Balloon::Balloon(const Notification& notification, Profile* profile,
BalloonCollection* collection)
@@ -27,7 +28,20 @@ void Balloon::SetPosition(const gfx::Point& upper_left, bool reposition) {
}
void Balloon::SetContentPreferredSize(const gfx::Size& size) {
- collection_->ResizeBalloon(this, size);
+ gfx::Size new_size(size);
+#if defined(OS_MACOSX)
+ // TODO(levin): Make all of the code that went in with this change to be
+ // cross-platform. See http://crbug.com/64720
+ // Only allow the size of notifications to grow. This stops the balloon
+ // from jumping between sizes due to dynamic content. For example, the
+ // balloon's contents may adjust due to changes in
+ // document.body.clientHeight.
+ new_size.set_height(std::max(new_size.height(), content_size_.height()));
+
+ if (content_size_ == new_size)
+ return;
+#endif
+ collection_->ResizeBalloon(this, new_size);
}
void Balloon::set_view(BalloonView* balloon_view) {