summaryrefslogtreecommitdiffstats
path: root/chrome/browser/gtk/tabs/tab_strip_gtk.cc
diff options
context:
space:
mode:
authorjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-27 21:24:21 +0000
committerjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-27 21:24:21 +0000
commit147abd4ccf54e4d1bb1596b8b217cead63c9ba2d (patch)
tree253901eba2b279ccf9e7ce72c8eef655742e39cb /chrome/browser/gtk/tabs/tab_strip_gtk.cc
parent616f9a1ec13b57aa1d6ca18a2b919cdaed41764a (diff)
downloadchromium_src-147abd4ccf54e4d1bb1596b8b217cead63c9ba2d.zip
chromium_src-147abd4ccf54e4d1bb1596b8b217cead63c9ba2d.tar.gz
chromium_src-147abd4ccf54e4d1bb1596b8b217cead63c9ba2d.tar.bz2
gtk: Fix the positioning of the tabstrip drop arrow for RTL locales.
BUG=17695 TEST=Open the browser in a RTL locale. Drag a link from the tab contents into the tabstrip. The drop arrow should be positioned correctly. Review URL: http://codereview.chromium.org/159394 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21711 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk/tabs/tab_strip_gtk.cc')
-rw-r--r--chrome/browser/gtk/tabs/tab_strip_gtk.cc20
1 files changed, 13 insertions, 7 deletions
diff --git a/chrome/browser/gtk/tabs/tab_strip_gtk.cc b/chrome/browser/gtk/tabs/tab_strip_gtk.cc
index 7607cbb..27a1d02 100644
--- a/chrome/browser/gtk/tabs/tab_strip_gtk.cc
+++ b/chrome/browser/gtk/tabs/tab_strip_gtk.cc
@@ -1426,14 +1426,16 @@ gfx::Rect TabStripGtk::GetDropBounds(int drop_index,
int center_x;
if (drop_index < GetTabCount()) {
TabGtk* tab = GetTabAt(drop_index);
+ gfx::Rect bounds = tab->GetNonMirroredBounds(tabstrip_.get());
// TODO(sky): update these for pinned tabs.
if (drop_before)
- center_x = tab->x() - (kTabHOffset / 2);
+ center_x = bounds.x() - (kTabHOffset / 2);
else
- center_x = tab->x() + (tab->width() / 2);
+ center_x = bounds.x() + (bounds.width() / 2);
} else {
TabGtk* last_tab = GetTabAt(drop_index - 1);
- center_x = last_tab->x() + last_tab->width() + (kTabHOffset / 2);
+ gfx::Rect bounds = last_tab->GetNonMirroredBounds(tabstrip_.get());
+ center_x = bounds.x() + bounds.width() + (kTabHOffset / 2);
}
center_x = gtk_util::MirroredXCoordinate(tabstrip_.get(), center_x);
@@ -1455,13 +1457,17 @@ gfx::Rect TabStripGtk::GetDropBounds(int drop_index,
}
void TabStripGtk::UpdateDropIndex(GdkDragContext* context, gint x, gint y) {
- // TODO(jhawkins): Handle RTL layout.
+ // If the UI layout is right-to-left, we need to mirror the mouse
+ // coordinates since we calculate the drop index based on the
+ // original (and therefore non-mirrored) positions of the tabs.
+ x = gtk_util::MirroredXCoordinate(tabstrip_.get(), x);
for (int i = 0; i < GetTabCount(); ++i) {
TabGtk* tab = GetTabAt(i);
- const int tab_max_x = tab->x() + tab->width();
- const int hot_width = tab->width() / 3;
+ gfx::Rect bounds = tab->GetNonMirroredBounds(tabstrip_.get());
+ const int tab_max_x = bounds.x() + bounds.width();
+ const int hot_width = bounds.width() / 3;
if (x < tab_max_x) {
- if (x < tab->x() + hot_width)
+ if (x < bounds.x() + hot_width)
SetDropIndex(i, true);
else if (x >= tab_max_x - hot_width)
SetDropIndex(i + 1, true);