Commit ebd57a9c authored by sky@chromium.org's avatar sky@chromium.org

Makes the status bubble less janky on chromeos. Any time the bounds

change we need to adjust based on where the mouse is. Not sure why we
didn't notice this on windows.

BUG=123256
TEST=see bug
R=ben@chromium.org

Review URL: https://chromiumcodereview.appspot.com/10069043

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@132246 0039d316-1c4b-4281-b951-d872f2087c98
parent 8be45847
...@@ -72,7 +72,8 @@ class StatusBubbleViews::StatusView : public views::Label, ...@@ -72,7 +72,8 @@ class StatusBubbleViews::StatusView : public views::Label,
public ui::LinearAnimation, public ui::LinearAnimation,
public ui::AnimationDelegate { public ui::AnimationDelegate {
public: public:
StatusView(StatusBubble* status_bubble, views::Widget* popup, StatusView(StatusBubble* status_bubble,
views::Widget* popup,
ui::ThemeProvider* theme_provider) ui::ThemeProvider* theme_provider)
: ALLOW_THIS_IN_INITIALIZER_LIST(ui::LinearAnimation(kFramerate, this)), : ALLOW_THIS_IN_INITIALIZER_LIST(ui::LinearAnimation(kFramerate, this)),
stage_(BUBBLE_HIDDEN), stage_(BUBBLE_HIDDEN),
...@@ -313,7 +314,6 @@ double StatusBubbleViews::StatusView::GetCurrentOpacity() { ...@@ -313,7 +314,6 @@ double StatusBubbleViews::StatusView::GetCurrentOpacity() {
void StatusBubbleViews::StatusView::SetOpacity(double opacity) { void StatusBubbleViews::StatusView::SetOpacity(double opacity) {
popup_->SetOpacity(static_cast<unsigned char>(opacity * 255)); popup_->SetOpacity(static_cast<unsigned char>(opacity * 255));
SchedulePaint();
} }
void StatusBubbleViews::StatusView::AnimateToState(double state) { void StatusBubbleViews::StatusView::AnimateToState(double state) {
...@@ -544,7 +544,8 @@ void StatusBubbleViews::StatusViewExpander::SetBubbleWidth(int width) { ...@@ -544,7 +544,8 @@ void StatusBubbleViews::StatusViewExpander::SetBubbleWidth(int width) {
const int StatusBubbleViews::kShadowThickness = 1; const int StatusBubbleViews::kShadowThickness = 1;
StatusBubbleViews::StatusBubbleViews(views::View* base_view) StatusBubbleViews::StatusBubbleViews(views::View* base_view)
: offset_(0), : contains_mouse_(false),
offset_(0),
popup_(NULL), popup_(NULL),
opacity_(0), opacity_(0),
base_view_(base_view), base_view_(base_view),
...@@ -604,6 +605,8 @@ void StatusBubbleViews::SetBounds(int x, int y, int w, int h) { ...@@ -604,6 +605,8 @@ void StatusBubbleViews::SetBounds(int x, int y, int w, int h) {
position_.SetPoint(base_view_->GetMirroredXWithWidthInView(x, w), y); position_.SetPoint(base_view_->GetMirroredXWithWidthInView(x, w), y);
size_.SetSize(w, h); size_.SetSize(w, h);
Reposition(); Reposition();
if (popup_.get() && contains_mouse_)
AvoidMouse(last_mouse_moved_location_);
} }
void StatusBubbleViews::SetStatus(const string16& status_text) { void StatusBubbleViews::SetStatus(const string16& status_text) {
...@@ -692,8 +695,10 @@ void StatusBubbleViews::Hide() { ...@@ -692,8 +695,10 @@ void StatusBubbleViews::Hide() {
void StatusBubbleViews::MouseMoved(const gfx::Point& location, void StatusBubbleViews::MouseMoved(const gfx::Point& location,
bool left_content) { bool left_content) {
contains_mouse_ = !left_content;
if (left_content) if (left_content)
return; return;
last_mouse_moved_location_ = location;
if (view_) { if (view_) {
view_->ResetTimer(); view_->ResetTimer();
......
// 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 // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
...@@ -110,6 +110,12 @@ class StatusBubbleViews : public StatusBubble { ...@@ -110,6 +110,12 @@ class StatusBubbleViews : public StatusBubble {
gfx::Point position_; gfx::Point position_;
gfx::Size size_; gfx::Size size_;
// Last location passed to MouseMoved().
gfx::Point last_mouse_moved_location_;
// Whether the view contains the mouse.
bool contains_mouse_;
// How vertically offset the bubble is from its root position_. // How vertically offset the bubble is from its root position_.
int offset_; int offset_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment