diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-07 20:26:26 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-07 20:26:26 +0000 |
commit | 3434490377c91e68fbbda4ff2bb48c7c8a75aca7 (patch) | |
tree | dadf968e2fe471bc834f255583262115ef5a3478 | |
parent | 74940712d4d453bdad9d76b386733aa3906c0b54 (diff) | |
download | chromium_src-3434490377c91e68fbbda4ff2bb48c7c8a75aca7.zip chromium_src-3434490377c91e68fbbda4ff2bb48c7c8a75aca7.tar.gz chromium_src-3434490377c91e68fbbda4ff2bb48c7c8a75aca7.tar.bz2 |
Fixes two bugs in wrench menu when shown rtl:
. borders of buttons were drawn incorrectly.
. I was repainting the correct bounds, resulting in mouse hover
effects not showing up correctly.
BUG=48012
TEST=see bug
Review URL: http://codereview.chromium.org/2845040
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51774 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/views/wrench_menu.cc | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/chrome/browser/views/wrench_menu.cc b/chrome/browser/views/wrench_menu.cc index 457d6e9..d772122 100644 --- a/chrome/browser/views/wrench_menu.cc +++ b/chrome/browser/views/wrench_menu.cc @@ -125,7 +125,7 @@ class MenuButtonBackground : public views::Background { CustomButton::BS_NORMAL : static_cast<CustomButton*>(view)->state(); int w = view->width(); int h = view->height(); - switch (type_) { + switch (TypeAdjustedForRTL()) { case LEFT_BUTTON: canvas->FillRectInt(background_color(state), 1, 1, w, h - 2); canvas->FillRectInt(border_color(state), 2, 0, w, 1); @@ -192,6 +192,18 @@ class MenuButtonBackground : public views::Background { } } + ButtonType TypeAdjustedForRTL() const { + if (!base::i18n::IsRTL()) + return type_; + + switch (type_) { + case LEFT_BUTTON: return RIGHT_BUTTON; + case RIGHT_BUTTON: return LEFT_BUTTON; + default: break; + } + return type_; + } + const ButtonType type_; // See description above setter for details. @@ -214,8 +226,10 @@ class ScheduleAllView : public views::View { if (!IsVisible()) return; - if (GetParent()) - GetParent()->SchedulePaint(bounds(), urgent); + if (GetParent()) { + GetParent()->SchedulePaint(GetBounds(APPLY_MIRRORING_TRANSFORMATION), + urgent); + } } private: |