summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorjohnnyg@chromium.org <johnnyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-09 17:40:57 +0000
committerjohnnyg@chromium.org <johnnyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-09 17:40:57 +0000
commit25de9c108cb35a2cc5eb1209b65fc38060097bea (patch)
tree4f600cedfca6930530bc8a392108f6d2dd544ccb /chrome/browser
parent638d45d84246e0a0f301c1b7aaa618a45431c0d1 (diff)
downloadchromium_src-25de9c108cb35a2cc5eb1209b65fc38060097bea.zip
chromium_src-25de9c108cb35a2cc5eb1209b65fc38060097bea.tar.gz
chromium_src-25de9c108cb35a2cc5eb1209b65fc38060097bea.tar.bz2
fix the notification continuous-resize problem by preventing scrollbars from being used until the maximum size is reached.
BUG=48494 TEST=create notifications of various sizes, watch for jitter Review URL: http://codereview.chromium.org/2941003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51978 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/notifications/balloon.h8
-rw-r--r--chrome/browser/notifications/balloon_collection.cc8
-rw-r--r--chrome/browser/notifications/balloon_host.cc3
3 files changed, 18 insertions, 1 deletions
diff --git a/chrome/browser/notifications/balloon.h b/chrome/browser/notifications/balloon.h
index a60d9a9..87440c9 100644
--- a/chrome/browser/notifications/balloon.h
+++ b/chrome/browser/notifications/balloon.h
@@ -63,6 +63,11 @@ class Balloon {
const gfx::Size& content_size() const { return content_size_; }
void set_content_size(const gfx::Size& size) { content_size_ = size; }
+ const gfx::Size& min_scrollbar_size() const { return min_scrollbar_size_; }
+ void set_min_scrollbar_size(const gfx::Size& size) {
+ min_scrollbar_size_ = size;
+ }
+
// Request a new content size for this balloon. This will get passed
// to the balloon collection for checking against available space and
// min/max restrictions.
@@ -110,6 +115,9 @@ class Balloon {
gfx::Point position_;
gfx::Size content_size_;
+ // Smallest size for this balloon where scrollbars will be shown.
+ gfx::Size min_scrollbar_size_;
+
DISALLOW_COPY_AND_ASSIGN(Balloon);
};
diff --git a/chrome/browser/notifications/balloon_collection.cc b/chrome/browser/notifications/balloon_collection.cc
index 7a8302d..09bfb56d 100644
--- a/chrome/browser/notifications/balloon_collection.cc
+++ b/chrome/browser/notifications/balloon_collection.cc
@@ -7,6 +7,7 @@
#include "base/logging.h"
#include "base/stl_util-inl.h"
#include "chrome/browser/notifications/balloon.h"
+#include "chrome/browser/notifications/balloon_host.h"
#include "chrome/browser/notifications/notification.h"
#include "chrome/browser/window_sizer.h"
#include "gfx/rect.h"
@@ -41,9 +42,14 @@ BalloonCollectionImpl::~BalloonCollectionImpl() {
void BalloonCollectionImpl::Add(const Notification& notification,
Profile* profile) {
Balloon* new_balloon = MakeBalloon(notification, profile);
-
+ // The +1 on width is necessary because width is fixed on notifications,
+ // so since we always have the max size, we would always hit the scrollbar
+ // condition. We are only interested in comparing height to maximum.
+ new_balloon->set_min_scrollbar_size(gfx::Size(1 + layout_.max_balloon_width(),
+ layout_.max_balloon_height()));
new_balloon->SetPosition(layout_.OffScreenLocation(), false);
new_balloon->Show();
+
balloons_.push_back(new_balloon);
PositionBalloons(false);
diff --git a/chrome/browser/notifications/balloon_host.cc b/chrome/browser/notifications/balloon_host.cc
index f3190d5..e962f5a 100644
--- a/chrome/browser/notifications/balloon_host.cc
+++ b/chrome/browser/notifications/balloon_host.cc
@@ -58,6 +58,9 @@ void BalloonHost::Close(RenderViewHost* render_view_host) {
}
void BalloonHost::RenderViewCreated(RenderViewHost* render_view_host) {
+ render_view_host->Send(new ViewMsg_DisableScrollbarsForSmallWindows(
+ render_view_host->routing_id(), balloon_->min_scrollbar_size()));
+ render_view_host->WasResized();
render_view_host->EnablePreferredSizeChangedMode(
kPreferredSizeWidth | kPreferredSizeHeightThisIsSlow);
}