diff options
author | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-23 20:29:07 +0000 |
---|---|---|
committer | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-23 20:29:07 +0000 |
commit | 6c940e699a1bf82046416bed61040a8568b42197 (patch) | |
tree | 552d1245076b8b0286a7e97343c28b6a11306d61 /chrome/browser/gtk/custom_button.cc | |
parent | adfb98c43223a2f40da7d6ee76a9dae3f8c57070 (diff) | |
download | chromium_src-6c940e699a1bf82046416bed61040a8568b42197.zip chromium_src-6c940e699a1bf82046416bed61040a8568b42197.tar.gz chromium_src-6c940e699a1bf82046416bed61040a8568b42197.tar.bz2 |
Handle RTL layout in the gtk tabstrip.
BUG=none
TEST=Open the browser with --lang=he and make sure the tabs are ordered starting from the right. Also, the UI elements in the tabs should be reversed as well.
Review URL: http://codereview.chromium.org/147020
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19051 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk/custom_button.cc')
-rw-r--r-- | chrome/browser/gtk/custom_button.cc | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/chrome/browser/gtk/custom_button.cc b/chrome/browser/gtk/custom_button.cc index 8f9a211..bed3128 100644 --- a/chrome/browser/gtk/custom_button.cc +++ b/chrome/browser/gtk/custom_button.cc @@ -4,6 +4,7 @@ #include "chrome/browser/gtk/custom_button.h" +#include "app/l10n_util.h" #include "app/resource_bundle.h" #include "base/basictypes.h" @@ -40,12 +41,17 @@ gboolean CustomDrawButtonBase::OnExpose(GtkWidget* widget, GdkEventExpose* e) { if (!pixbuf) return FALSE; - gdk_draw_pixbuf(widget->window, - widget->style->fg_gc[GTK_WIDGET_STATE(widget)], - pixbuf, - 0, 0, - widget->allocation.x, widget->allocation.y, -1, -1, - GDK_RGB_DITHER_NONE, 0, 0); + cairo_t* cairo_context = gdk_cairo_create(GDK_DRAWABLE(widget->window)); + cairo_translate(cairo_context, widget->allocation.x, widget->allocation.y); + + if (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) { + cairo_translate(cairo_context, widget->allocation.width, 0.0f); + cairo_scale(cairo_context, -1.0f, 1.0f); + } + + gdk_cairo_set_source_pixbuf(cairo_context, pixbuf, 0, 0); + cairo_paint(cairo_context); + cairo_destroy(cairo_context); return TRUE; } |