Bug 513006 - Some scrollbars disappear if GTK2 theme has scrollbar buttons turned off r=roc
authorMichael Ventnor <mventnor@mozilla.com>
Mon, 16 May 2011 13:28:01 +1000
changeset 69560 6e4fb61ef475a66fb6b2e7d62efe866f13270b12
parent 69559 e985b26f23eb5f52b16de09e71f3ab7ead2c28cd
child 69561 44617683f1a514f30afc826ad4207dc58e8ffc40
child 69641 57371a7e12ab8a59e5cdefad3e5dbfb31183e92b
push id20015
push usermventnor@mozilla.com
push dateMon, 16 May 2011 03:28:45 +0000
treeherdermozilla-central@6e4fb61ef475 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs513006
milestone6.0a1
first release with
nightly linux32
6e4fb61ef475 / 6.0a1 / 20110516030622 / files
nightly linux64
6e4fb61ef475 / 6.0a1 / 20110516030622 / files
nightly mac
6e4fb61ef475 / 6.0a1 / 20110516030622 / files
nightly win32
6e4fb61ef475 / 6.0a1 / 20110516030622 / files
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
Bug 513006 - Some scrollbars disappear if GTK2 theme has scrollbar buttons turned off r=roc
widget/src/gtk2/nsNativeThemeGTK.cpp
--- a/widget/src/gtk2/nsNativeThemeGTK.cpp
+++ b/widget/src/gtk2/nsNativeThemeGTK.cpp
@@ -1032,16 +1032,35 @@ nsNativeThemeGTK::GetMinimumWidgetSize(n
       } else {
         moz_gtk_splitter_get_metrics(GTK_ORIENTATION_VERTICAL, &metrics);
         aResult->width = 0;
         aResult->height = metrics;
       }
       *aIsOverridable = PR_FALSE;
     }
     break;
+    case NS_THEME_SCROLLBAR_TRACK_HORIZONTAL:
+    case NS_THEME_SCROLLBAR_TRACK_VERTICAL:
+    {
+      /* While we enforce a minimum size for the thumb, this is ignored
+       * for the some scrollbars if buttons are hidden (bug 513006) because
+       * the thumb isn't a direct child of the scrollbar, unlike the buttons
+       * or track. So add a minimum size to the track as well to prevent a
+       * 0-width scrollbar. */
+      MozGtkScrollbarMetrics metrics;
+      moz_gtk_get_scrollbar_metrics(&metrics);
+
+      if (aWidgetType == NS_THEME_SCROLLBAR_TRACK_VERTICAL)
+        aResult->width = metrics.slider_width;
+      else
+        aResult->height = metrics.slider_width;
+
+      *aIsOverridable = PR_FALSE;
+    }
+    break;
     case NS_THEME_SCROLLBAR_THUMB_VERTICAL:
     case NS_THEME_SCROLLBAR_THUMB_HORIZONTAL:
       {
         MozGtkScrollbarMetrics metrics;
         moz_gtk_get_scrollbar_metrics(&metrics);
 
         nsRect rect = aFrame->GetParent()->GetRect();
         PRInt32 p2a = aFrame->PresContext()->DeviceContext()->