diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-15 00:29:36 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-15 00:29:36 +0000 |
commit | 9b3fc53cf3e31fd61e24442fbdcadf8da99f56ed (patch) | |
tree | 255152debf3325e4d52c1df161698a7406b53eeb | |
parent | b1ffd3f3babba213e7709cf8814d3c146522790a (diff) | |
download | chromium_src-9b3fc53cf3e31fd61e24442fbdcadf8da99f56ed.zip chromium_src-9b3fc53cf3e31fd61e24442fbdcadf8da99f56ed.tar.gz chromium_src-9b3fc53cf3e31fd61e24442fbdcadf8da99f56ed.tar.bz2 |
[GTK] Fix rtl tabstrip layout during window resize.
BUG=55619
TEST=see bug
Review URL: http://codereview.chromium.org/3431003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@59467 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/gtk/tabs/tab_strip_gtk.cc | 22 | ||||
-rw-r--r-- | chrome/browser/gtk/tabs/tab_strip_gtk.h | 5 |
2 files changed, 14 insertions, 13 deletions
diff --git a/chrome/browser/gtk/tabs/tab_strip_gtk.cc b/chrome/browser/gtk/tabs/tab_strip_gtk.cc index 0f29263..91cee5d 100644 --- a/chrome/browser/gtk/tabs/tab_strip_gtk.cc +++ b/chrome/browser/gtk/tabs/tab_strip_gtk.cc @@ -1445,7 +1445,7 @@ int TabStripGtk::tab_start_x() const { return 0; } -void TabStripGtk::ResizeLayoutTabs() { +bool TabStripGtk::ResizeLayoutTabs() { resize_layout_factory_.RevokeAll(); // It is critically important that this is unhooked here, otherwise we will @@ -1457,7 +1457,7 @@ void TabStripGtk::ResizeLayoutTabs() { if (mini_tab_count == GetTabCount()) { // Only mini tabs, we know the tab widths won't have changed (all mini-tabs // have the same width), so there is nothing to do. - return; + return false; } TabGtk* first_tab = GetTabAt(mini_tab_count); double unselected, selected; @@ -1466,8 +1466,12 @@ void TabStripGtk::ResizeLayoutTabs() { // We only want to run the animation if we're not already at the desired // size. - if (abs(first_tab->width() - w) > 1) + if (abs(first_tab->width() - w) > 1) { StartResizeLayoutAnimation(); + return true; + } + + return false; } bool TabStripGtk::IsCursorInTabStripZone() const { @@ -1902,15 +1906,11 @@ void TabStripGtk::OnSizeAllocate(GtkWidget* widget, GtkAllocation* allocation) { if (GetTabCount() == 0) return; - // Do a regular layout on the first configure-event so we don't animate - // the first tab. - // TODO(jhawkins): Windows resizes the layout tabs continuously during - // a resize. I need to investigate which signal to watch in order to - // reproduce this behavior. - if (GetTabCount() == 1) + // When there is only one tab, Layout() so we don't animate it. With more + // tabs, do ResizeLayoutTabs(). In RTL(), we will also need to manually + // Layout() when ResizeLayoutTabs() is a no-op. + if ((GetTabCount() == 1) || (!ResizeLayoutTabs() && base::i18n::IsRTL())) Layout(); - else - ResizeLayoutTabs(); } gboolean TabStripGtk::OnDragMotion(GtkWidget* widget, GdkDragContext* context, diff --git a/chrome/browser/gtk/tabs/tab_strip_gtk.h b/chrome/browser/gtk/tabs/tab_strip_gtk.h index e812ba1..bc03bcf 100644 --- a/chrome/browser/gtk/tabs/tab_strip_gtk.h +++ b/chrome/browser/gtk/tabs/tab_strip_gtk.h @@ -307,8 +307,9 @@ class TabStripGtk : public TabStripModelObserver, // Returns the x-coordinate tabs start from. int tab_start_x() const; - // Perform an animated resize-relayout of the TabStrip immediately. - void ResizeLayoutTabs(); + // Perform an animated resize-relayout of the TabStrip immediately. The + // value returned indicates whether a resize actually took place. + bool ResizeLayoutTabs(); // Returns whether or not the cursor is currently in the "tab strip zone" // which is defined as the region above the TabStrip and a bit below it. |