summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-06 16:36:41 +0000
committermirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-06 16:36:41 +0000
commitb3db1e412fac9c9ae91e718b17da6f55a05a766c (patch)
treea5b7f7ac65d74470782b98b2799998c283c6024f
parentc80703e78d29efa140ec68078e901c1f523ac0fc (diff)
downloadchromium_src-b3db1e412fac9c9ae91e718b17da6f55a05a766c.zip
chromium_src-b3db1e412fac9c9ae91e718b17da6f55a05a766c.tar.gz
chromium_src-b3db1e412fac9c9ae91e718b17da6f55a05a766c.tar.bz2
Make status bubble behave properly in RTL languages.
BUG=49913 TEST= In RTL language, cause many status bubbles to appear. Hover over some to cause expansion. Bubble behaves correctly. Review URL: http://codereview.chromium.org/3085018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@55234 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/views/status_bubble_views.cc27
1 files changed, 14 insertions, 13 deletions
diff --git a/chrome/browser/views/status_bubble_views.cc b/chrome/browser/views/status_bubble_views.cc
index 8bc3333..cf53efc 100644
--- a/chrome/browser/views/status_bubble_views.cc
+++ b/chrome/browser/views/status_bubble_views.cc
@@ -571,11 +571,22 @@ void StatusBubbleViews::Init() {
}
void StatusBubbleViews::Reposition() {
+ int xpos;
+ // If the UI layout is RTL, we need to mirror the position of the bubble
+ // relative to the parent. Don't hold onto the mirrored position, or
+ // the bubble will flip back and forth from left to right.
+ if (base::i18n::IsRTL()) {
+ gfx::Rect frame_bounds;
+ frame_->GetBounds(&frame_bounds, false);
+ xpos = frame_bounds.width() - position_.x() - size_.width();
+ } else {
+ xpos = position_.x();
+ }
+
if (popup_.get()) {
gfx::Point top_left;
views::View::ConvertPointToScreen(frame_->GetRootView(), &top_left);
-
- popup_->SetBounds(gfx::Rect(top_left.x() + position_.x(),
+ popup_->SetBounds(gfx::Rect(top_left.x() + xpos,
top_left.y() + position_.y(),
size_.width(), size_.height()));
}
@@ -587,17 +598,7 @@ gfx::Size StatusBubbleViews::GetPreferredSize() {
}
void StatusBubbleViews::SetBounds(int x, int y, int w, int h) {
- // If the UI layout is RTL, we need to mirror the position of the bubble
- // relative to the parent.
- if (base::i18n::IsRTL()) {
- gfx::Rect frame_bounds;
- frame_->GetBounds(&frame_bounds, false);
- int mirrored_x = frame_bounds.width() - x - w;
- position_.SetPoint(mirrored_x, y);
- } else {
- position_.SetPoint(x, y);
- }
-
+ position_.SetPoint(x, y);
size_.SetSize(w, h);
Reposition();
}