Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6905)

Unified Diff: chrome/browser/ui/views/tabs/tab_strip.cc

Issue 10808051: Unmirrors new tab button theme background in Rtl mode (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/tabs/tab_strip.cc
diff --git a/chrome/browser/ui/views/tabs/tab_strip.cc b/chrome/browser/ui/views/tabs/tab_strip.cc
index 1bdccf84ddb350dfa1cb8f52e3c77e78915d7fb1..f22868a5f8f73514d6247928208a14e63fdde1af 100644
--- a/chrome/browser/ui/views/tabs/tab_strip.cc
+++ b/chrome/browser/ui/views/tabs/tab_strip.cc
@@ -420,8 +420,19 @@ gfx::ImageSkia NewTabButton::GetBackgroundImage(
GetThemeProvider()->GetImageSkiaNamed(background_id);
int offset_y = GetThemeProvider()->HasCustomImage(background_id) ?
0 : background_offset_.y();
- canvas.TileImageInt(*background, GetMirroredX() + background_offset_.x(),
- newtab_button_v_offset() + offset_y, 0, 0, width, height);
+
+ // The new tab background is mirrored in RTL mode, but the theme background
+ // should never be mirrored. Mirror it here to compensate.
+ float x_scale = 1.0f;
+ int x = GetMirroredX() + background_offset_.x();
+ if (base::i18n::IsRTL()) {
+ x_scale = -1.0f;
+ // Offset by |width| such that the same region is painted as if there was no
+ // flip.
+ x += width;
+ }
+ canvas.TileImageInt(*background, x, newtab_button_v_offset() + offset_y,
+ x_scale, 1.0f, 0, 0, width, height);
if (alpha != 255) {
SkPaint paint;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698