ff3c231
diff --git a/widget/gtk/gtk3drawing.c b/widget/gtk/gtk3drawing.c
ff3c231
--- a/widget/gtk/gtk3drawing.c
ff3c231
+++ b/widget/gtk/gtk3drawing.c
ff3c231
@@ -2098,18 +2098,23 @@ moz_gtk_progress_chunk_paint(cairo_t *cr
ff3c231
     return MOZ_GTK_SUCCESS;
ff3c231
 }
ff3c231
 
ff3c231
 gint
ff3c231
 moz_gtk_get_tab_thickness(void)
ff3c231
 {
ff3c231
     GtkBorder border;
ff3c231
     GtkStyleContext * style;
ff3c231
+    gboolean has_tab_gap;
ff3c231
 
ff3c231
     ensure_tab_widget();
ff3c231
+    gtk_widget_style_get(gTabWidget, "has-tab-gap", &has_tab_gap, NULL);
ff3c231
+    if (!has_tab_gap)
ff3c231
+      return 0; /* don't use ythickness for tabs without a gap */
ff3c231
+
ff3c231
     style = gtk_widget_get_style_context(gTabWidget);
ff3c231
     gtk_style_context_add_class(style, GTK_STYLE_CLASS_NOTEBOOK);
ff3c231
     gtk_style_context_get_border(style, 0, &border);
ff3c231
 
ff3c231
     if (border.top < 2)
ff3c231
         return 2; /* some themes don't set ythickness correctly */
ff3c231
 
ff3c231
     return border.top;
ff3c231
@@ -2140,172 +2145,196 @@ moz_gtk_tab_paint(cairo_t *cr, GdkRectan
ff3c231
      * When it is selected, we overwrite the adjacent border of the tabpanel
ff3c231
      * touching the tab with a pierced border (called "the gap") to make the
ff3c231
      * tab appear physically attached to the tabpanel; see details below. */
ff3c231
 
ff3c231
     GtkStyleContext* style;
ff3c231
     GdkRectangle tabRect;
ff3c231
     GdkRectangle focusRect;
ff3c231
     GdkRectangle backRect;
ff3c231
+    gboolean has_tab_gap;
ff3c231
     int initial_gap = 0;
ff3c231
 
ff3c231
     ensure_tab_widget();
ff3c231
     gtk_widget_set_direction(gTabWidget, direction);
ff3c231
 
ff3c231
     style = gtk_widget_get_style_context(gTabWidget);    
ff3c231
     gtk_style_context_save(style);
ff3c231
     moz_gtk_tab_prepare_style_context(style, flags);
ff3c231
 
ff3c231
-    tabRect = *rect;
ff3c231
-
ff3c231
-    if (flags & MOZ_GTK_TAB_FIRST) {
ff3c231
-        gtk_widget_style_get (gTabWidget, "initial-gap", &initial_gap, NULL);
ff3c231
-        tabRect.width -= initial_gap;
ff3c231
-
ff3c231
-        if (direction != GTK_TEXT_DIR_RTL) {
ff3c231
-            tabRect.x += initial_gap;
ff3c231
+    gtk_widget_style_get(gTabWidget, "has-tab-gap", &has_tab_gap, NULL);
ff3c231
+    if (has_tab_gap) {
ff3c231
+        tabRect = *rect;
ff3c231
+        if (flags & MOZ_GTK_TAB_FIRST) {
ff3c231
+            gtk_widget_style_get (gTabWidget, "initial-gap", &initial_gap, NULL);
ff3c231
+            tabRect.width -= initial_gap;
ff3c231
+
ff3c231
+            if (direction != GTK_TEXT_DIR_RTL) {
ff3c231
+                tabRect.x += initial_gap;
ff3c231
+            }
ff3c231
         }
ff3c231
-    }
ff3c231
-
ff3c231
-    focusRect = backRect = tabRect;
ff3c231
-
ff3c231
-    if ((flags & MOZ_GTK_TAB_SELECTED) == 0) {
ff3c231
-        /* Only draw the tab */
ff3c231
-        gtk_render_extension(style, cr,
ff3c231
-                             tabRect.x, tabRect.y, tabRect.width, tabRect.height,
ff3c231
-                            (flags & MOZ_GTK_TAB_BOTTOM) ?
ff3c231
-                                GTK_POS_TOP : GTK_POS_BOTTOM );
ff3c231
+
ff3c231
+        focusRect = backRect = tabRect;
ff3c231
+
ff3c231
+        if ((flags & MOZ_GTK_TAB_SELECTED) == 0) {
ff3c231
+            /* Only draw the tab */            
ff3c231
+            gtk_render_extension(style, cr,
ff3c231
+                                 tabRect.x, tabRect.y, tabRect.width, tabRect.height,
ff3c231
+                                (flags & MOZ_GTK_TAB_BOTTOM) ?
ff3c231
+                                    GTK_POS_TOP : GTK_POS_BOTTOM );
ff3c231
+        } else {
ff3c231
+            /* Draw the tab and the gap
ff3c231
+             * We want the gap to be positioned exactly on the tabpanel top
ff3c231
+             * border; since tabbox.css may set a negative margin so that the tab
ff3c231
+             * frame rect already overlaps the tabpanel frame rect, we need to take
ff3c231
+             * that into account when drawing. To that effect, nsNativeThemeGTK
ff3c231
+             * passes us this negative margin (bmargin in the graphic below) in the
ff3c231
+             * lowest bits of |flags|.  We use it to set gap_voffset, the distance
ff3c231
+             * between the top of the gap and the bottom of the tab (resp. the
ff3c231
+             * bottom of the gap and the top of the tab when we draw a bottom tab),
ff3c231
+             * while ensuring that the gap always touches the border of the tab,
ff3c231
+             * i.e. 0 <= gap_voffset <= gap_height, to avoid surprinsing results
ff3c231
+             * with big negative or positive margins.
ff3c231
+             * Here is a graphical explanation in the case of top tabs:
ff3c231
+             *             ___________________________
ff3c231
+             *            /                           \
ff3c231
+             *           |            T A B            |
ff3c231
+             * ----------|. . . . . . . . . . . . . . .|----- top of tabpanel
ff3c231
+             *           :    ^       bmargin          :  ^
ff3c231
+             *           :    | (-negative margin,     :  |
ff3c231
+             *  bottom   :    v  passed in flags)      :  |       gap_height
ff3c231
+             *    of  -> :.............................:  |    (the size of the
ff3c231
+             * the tab   .       part of the gap       .  |  tabpanel top border)
ff3c231
+             *           .      outside of the tab     .  v
ff3c231
+             * ----------------------------------------------
ff3c231
+             *
ff3c231
+             * To draw the gap, we use gtk_paint_box_gap(), see comment in
ff3c231
+             * moz_gtk_tabpanels_paint(). This box_gap is made 3 * gap_height tall,
ff3c231
+             * which should suffice to ensure that the only visible border is the
ff3c231
+             * pierced one.  If the tab is in the middle, we make the box_gap begin
ff3c231
+             * a bit to the left of the tab and end a bit to the right, adjusting
ff3c231
+             * the gap position so it still is under the tab, because we want the
ff3c231
+             * rendering of a gap in the middle of a tabpanel.  This is the role of
ff3c231
+             * the gints gap_{l,r}_offset. On the contrary, if the tab is the
ff3c231
+             * first, we align the start border of the box_gap with the start
ff3c231
+             * border of the tab (left if LTR, right if RTL), by setting the
ff3c231
+             * appropriate offset to 0.*/
ff3c231
+            gint gap_loffset, gap_roffset, gap_voffset, gap_height;
ff3c231
+
ff3c231
+            /* Get height needed by the gap */
ff3c231
+            gap_height = moz_gtk_get_tab_thickness();
ff3c231
+
ff3c231
+            /* Extract gap_voffset from the first bits of flags */
ff3c231
+            gap_voffset = flags & MOZ_GTK_TAB_MARGIN_MASK;
ff3c231
+            if (gap_voffset > gap_height)
ff3c231
+                gap_voffset = gap_height;
ff3c231
+
ff3c231
+            /* Set gap_{l,r}_offset to appropriate values */
ff3c231
+            gap_loffset = gap_roffset = 20; /* should be enough */
ff3c231
+            if (flags & MOZ_GTK_TAB_FIRST) {
ff3c231
+                if (direction == GTK_TEXT_DIR_RTL)
ff3c231
+                    gap_roffset = initial_gap;
ff3c231
+                else
ff3c231
+                    gap_loffset = initial_gap;
ff3c231
+            }
ff3c231
+
ff3c231
+            if (flags & MOZ_GTK_TAB_BOTTOM) {
ff3c231
+                /* Draw the tab on bottom */
ff3c231
+                focusRect.y += gap_voffset;
ff3c231
+                focusRect.height -= gap_voffset;
ff3c231
+
ff3c231
+                gtk_render_extension(style, cr,
ff3c231
+                                     tabRect.x, tabRect.y + gap_voffset, tabRect.width,
ff3c231
+                                     tabRect.height - gap_voffset, GTK_POS_TOP);
ff3c231
+
ff3c231
+                gtk_style_context_remove_region(style, GTK_STYLE_REGION_TAB);
ff3c231
+
ff3c231
+                backRect.y += (gap_voffset - gap_height);
ff3c231
+                backRect.height = gap_height;
ff3c231
+
ff3c231
+                /* Draw the gap; erase with background color before painting in
ff3c231
+                 * case theme does not */
ff3c231
+                gtk_render_background(style, cr, backRect.x, backRect.y,
ff3c231
+                                     backRect.width, backRect.height);
ff3c231
+                cairo_save(cr);
ff3c231
+                cairo_rectangle(cr, backRect.x, backRect.y, backRect.width, backRect.height);
ff3c231
+                cairo_clip(cr);
ff3c231
+
ff3c231
+                gtk_render_frame_gap(style, cr,
ff3c231
+                                     tabRect.x - gap_loffset,
ff3c231
+                                     tabRect.y + gap_voffset - 3 * gap_height,
ff3c231
+                                     tabRect.width + gap_loffset + gap_roffset,
ff3c231
+                                     3 * gap_height, GTK_POS_BOTTOM,
ff3c231
+                                     gap_loffset, gap_loffset + tabRect.width);
ff3c231
+                cairo_restore(cr);
ff3c231
+            } else {
ff3c231
+                /* Draw the tab on top */
ff3c231
+                focusRect.height -= gap_voffset;
ff3c231
+                gtk_render_extension(style, cr,
ff3c231
+                                     tabRect.x, tabRect.y, tabRect.width,
ff3c231
+                                     tabRect.height - gap_voffset, GTK_POS_BOTTOM);
ff3c231
+
ff3c231
+                gtk_style_context_remove_region(style, GTK_STYLE_REGION_TAB);
ff3c231
+
ff3c231
+                backRect.y += (tabRect.height - gap_voffset);
ff3c231
+                backRect.height = gap_height;
ff3c231
+
ff3c231
+                /* Draw the gap; erase with background color before painting in
ff3c231
+                 * case theme does not */
ff3c231
+                gtk_render_background(style, cr, backRect.x, backRect.y,
ff3c231
+                                      backRect.width, backRect.height);
ff3c231
+
ff3c231
+                cairo_save(cr);
ff3c231
+                cairo_rectangle(cr, backRect.x, backRect.y, backRect.width, backRect.height);
ff3c231
+                cairo_clip(cr);
ff3c231
+
ff3c231
+                gtk_render_frame_gap(style, cr,
ff3c231
+                                     tabRect.x - gap_loffset,
ff3c231
+                                     tabRect.y + tabRect.height - gap_voffset,
ff3c231
+                                     tabRect.width + gap_loffset + gap_roffset,
ff3c231
+                                     3 * gap_height, GTK_POS_TOP,
ff3c231
+                                     gap_loffset, gap_loffset + tabRect.width);
ff3c231
+                cairo_restore(cr);
ff3c231
+            }
ff3c231
+
ff3c231
+            if (state->focused) {
ff3c231
+              /* Paint the focus ring */
ff3c231
+              GtkBorder border;
ff3c231
+              gtk_style_context_get_border(style, GetStateFlagsFromGtkWidgetState(state), &border);
ff3c231
+
ff3c231
+              focusRect.x += border.left;
ff3c231
+              focusRect.width -= (border.left + border.right);
ff3c231
+              focusRect.y += border.top;
ff3c231
+              focusRect.height -= (border.top + border.bottom);
ff3c231
+
ff3c231
+              gtk_render_focus(style, cr,
ff3c231
+                              focusRect.x, focusRect.y, focusRect.width, focusRect.height);
ff3c231
+            }
ff3c231
+        }
ff3c231
     } else {
ff3c231
-        /* Draw the tab and the gap
ff3c231
-         * We want the gap to be positioned exactly on the tabpanel top
ff3c231
-         * border; since tabbox.css may set a negative margin so that the tab
ff3c231
-         * frame rect already overlaps the tabpanel frame rect, we need to take
ff3c231
-         * that into account when drawing. To that effect, nsNativeThemeGTK
ff3c231
-         * passes us this negative margin (bmargin in the graphic below) in the
ff3c231
-         * lowest bits of |flags|.  We use it to set gap_voffset, the distance
ff3c231
-         * between the top of the gap and the bottom of the tab (resp. the
ff3c231
-         * bottom of the gap and the top of the tab when we draw a bottom tab),
ff3c231
-         * while ensuring that the gap always touches the border of the tab,
ff3c231
-         * i.e. 0 <= gap_voffset <= gap_height, to avoid surprinsing results
ff3c231
-         * with big negative or positive margins.
ff3c231
-         * Here is a graphical explanation in the case of top tabs:
ff3c231
-         *             ___________________________
ff3c231
-         *            /                           \
ff3c231
-         *           |            T A B            |
ff3c231
-         * ----------|. . . . . . . . . . . . . . .|----- top of tabpanel
ff3c231
-         *           :    ^       bmargin          :  ^
ff3c231
-         *           :    | (-negative margin,     :  |
ff3c231
-         *  bottom   :    v  passed in flags)      :  |       gap_height
ff3c231
-         *    of  -> :.............................:  |    (the size of the
ff3c231
-         * the tab   .       part of the gap       .  |  tabpanel top border)
ff3c231
-         *           .      outside of the tab     .  v
ff3c231
-         * ----------------------------------------------
ff3c231
-         *
ff3c231
-         * To draw the gap, we use gtk_paint_box_gap(), see comment in
ff3c231
-         * moz_gtk_tabpanels_paint(). This box_gap is made 3 * gap_height tall,
ff3c231
-         * which should suffice to ensure that the only visible border is the
ff3c231
-         * pierced one.  If the tab is in the middle, we make the box_gap begin
ff3c231
-         * a bit to the left of the tab and end a bit to the right, adjusting
ff3c231
-         * the gap position so it still is under the tab, because we want the
ff3c231
-         * rendering of a gap in the middle of a tabpanel.  This is the role of
ff3c231
-         * the gints gap_{l,r}_offset. On the contrary, if the tab is the
ff3c231
-         * first, we align the start border of the box_gap with the start
ff3c231
-         * border of the tab (left if LTR, right if RTL), by setting the
ff3c231
-         * appropriate offset to 0.*/
ff3c231
-        gint gap_loffset, gap_roffset, gap_voffset, gap_height;
ff3c231
-
ff3c231
-        /* Get height needed by the gap */
ff3c231
-        gap_height = moz_gtk_get_tab_thickness();
ff3c231
-
ff3c231
-        /* Extract gap_voffset from the first bits of flags */
ff3c231
-        gap_voffset = flags & MOZ_GTK_TAB_MARGIN_MASK;
ff3c231
-        if (gap_voffset > gap_height)
ff3c231
-            gap_voffset = gap_height;
ff3c231
-
ff3c231
-        /* Set gap_{l,r}_offset to appropriate values */
ff3c231
-        gap_loffset = gap_roffset = 20; /* should be enough */
ff3c231
-        if (flags & MOZ_GTK_TAB_FIRST) {
ff3c231
-            if (direction == GTK_TEXT_DIR_RTL)
ff3c231
-                gap_roffset = initial_gap;
ff3c231
-            else
ff3c231
-                gap_loffset = initial_gap;
ff3c231
+        gtk_render_background(style, cr, rect->x, rect->y, rect->width, rect->height);
ff3c231
+        gtk_render_frame(style, cr, rect->x, rect->y,rect->width, rect->height);
ff3c231
+
ff3c231
+        if (state->focused) {
ff3c231
+          /* Paint the focus ring */
ff3c231
+          GtkBorder padding;
ff3c231
+
ff3c231
+          GtkStateFlags state_flags = GetStateFlagsFromGtkWidgetState(state);
ff3c231
+
ff3c231
+          focusRect = *rect;
ff3c231
+          gtk_style_context_get_padding(style, state_flags, &padding);
ff3c231
+
ff3c231
+          focusRect.x += padding.left;
ff3c231
+          focusRect.width -= (padding.left + padding.right);
ff3c231
+          focusRect.y += padding.top;
ff3c231
+          focusRect.height -= (padding.top + padding.bottom);
ff3c231
+
ff3c231
+          gtk_render_focus(style, cr,
ff3c231
+                          focusRect.x, focusRect.y, focusRect.width, focusRect.height);
ff3c231
         }
ff3c231
-
ff3c231
-        if (flags & MOZ_GTK_TAB_BOTTOM) {
ff3c231
-            /* Draw the tab on bottom */
ff3c231
-            focusRect.y += gap_voffset;
ff3c231
-            focusRect.height -= gap_voffset;
ff3c231
-
ff3c231
-            gtk_render_extension(style, cr,
ff3c231
-                                 tabRect.x, tabRect.y + gap_voffset, tabRect.width,
ff3c231
-                                 tabRect.height - gap_voffset, GTK_POS_TOP);
ff3c231
-
ff3c231
-            gtk_style_context_remove_region(style, GTK_STYLE_REGION_TAB);
ff3c231
-
ff3c231
-            backRect.y += (gap_voffset - gap_height);
ff3c231
-            backRect.height = gap_height;
ff3c231
-
ff3c231
-            /* Draw the gap; erase with background color before painting in
ff3c231
-             * case theme does not */
ff3c231
-            gtk_render_background(style, cr, backRect.x, backRect.y,
ff3c231
-                                 backRect.width, backRect.height);
ff3c231
-            cairo_save(cr);
ff3c231
-            cairo_rectangle(cr, backRect.x, backRect.y, backRect.width, backRect.height);
ff3c231
-            cairo_clip(cr);
ff3c231
-
ff3c231
-            gtk_render_frame_gap(style, cr,
ff3c231
-                                 tabRect.x - gap_loffset,
ff3c231
-                                 tabRect.y + gap_voffset - 3 * gap_height,
ff3c231
-                                 tabRect.width + gap_loffset + gap_roffset,
ff3c231
-                                 3 * gap_height, GTK_POS_BOTTOM,
ff3c231
-                                 gap_loffset, gap_loffset + tabRect.width);
ff3c231
-            cairo_restore(cr);
ff3c231
-        } else {
ff3c231
-            /* Draw the tab on top */
ff3c231
-            focusRect.height -= gap_voffset;
ff3c231
-            gtk_render_extension(style, cr,
ff3c231
-                                 tabRect.x, tabRect.y, tabRect.width,
ff3c231
-                                 tabRect.height - gap_voffset, GTK_POS_BOTTOM);
ff3c231
-
ff3c231
-            gtk_style_context_remove_region(style, GTK_STYLE_REGION_TAB);
ff3c231
-
ff3c231
-            backRect.y += (tabRect.height - gap_voffset);
ff3c231
-            backRect.height = gap_height;
ff3c231
-
ff3c231
-            /* Draw the gap; erase with background color before painting in
ff3c231
-             * case theme does not */
ff3c231
-            gtk_render_background(style, cr, backRect.x, backRect.y,
ff3c231
-                                  backRect.width, backRect.height);
ff3c231
-
ff3c231
-            cairo_save(cr);
ff3c231
-            cairo_rectangle(cr, backRect.x, backRect.y, backRect.width, backRect.height);
ff3c231
-            cairo_clip(cr);
ff3c231
-
ff3c231
-            gtk_render_frame_gap(style, cr,
ff3c231
-                                 tabRect.x - gap_loffset,
ff3c231
-                                 tabRect.y + tabRect.height - gap_voffset,
ff3c231
-                                 tabRect.width + gap_loffset + gap_roffset,
ff3c231
-                                 3 * gap_height, GTK_POS_TOP,
ff3c231
-                                 gap_loffset, gap_loffset + tabRect.width);
ff3c231
-            cairo_restore(cr);
ff3c231
-        }
ff3c231
-    }
ff3c231
-
ff3c231
-    if (state->focused) {
ff3c231
-      /* Paint the focus ring */
ff3c231
-      GtkBorder border;
ff3c231
-      gtk_style_context_get_border(style, GetStateFlagsFromGtkWidgetState(state), &border);
ff3c231
-
ff3c231
-      focusRect.x += border.left;
ff3c231
-      focusRect.width -= (border.left + border.right);
ff3c231
-      focusRect.y += border.top;
ff3c231
-      focusRect.height -= (border.top + border.bottom);
ff3c231
-
ff3c231
-      gtk_render_focus(style, cr,
ff3c231
-                      focusRect.x, focusRect.y, focusRect.width, focusRect.height);
ff3c231
     }
ff3c231
 
ff3c231
     gtk_style_context_restore(style);
ff3c231
 
ff3c231
     return MOZ_GTK_SUCCESS;
ff3c231
 }
ff3c231
 
ff3c231
 /* tab area*/
ff3c231
@@ -2963,48 +2992,53 @@ moz_gtk_get_widget_border(GtkThemeWidget
ff3c231
 }
ff3c231
 
ff3c231
 gint
ff3c231
 moz_gtk_get_tab_border(gint* left, gint* top, gint* right, gint* bottom, 
ff3c231
                        GtkTextDirection direction, GtkTabFlags flags)
ff3c231
 {
ff3c231
     GtkStyleContext* style;    
ff3c231
     int tab_curvature;
ff3c231
+    gboolean has_tab_gap;
ff3c231
 
ff3c231
     ensure_tab_widget();
ff3c231
 
ff3c231
     style = gtk_widget_get_style_context(gTabWidget);
ff3c231
     gtk_style_context_save(style);
ff3c231
     moz_gtk_tab_prepare_style_context(style, flags);
ff3c231
 
ff3c231
     // TODO add_style_border() should be replaced
ff3c231
     // with focus-line-width and focus-padding
ff3c231
     // see Bug 877605
ff3c231
     *left = *top = *right = *bottom = 0;
ff3c231
-    moz_gtk_add_style_border(style, left, top, right, bottom);
ff3c231
     moz_gtk_add_style_padding(style, left, top, right, bottom);
ff3c231
 
ff3c231
-    gtk_widget_style_get (gTabWidget, "tab-curvature", &tab_curvature, NULL);
ff3c231
-    *left += tab_curvature;
ff3c231
-    *right += tab_curvature;
ff3c231
-
ff3c231
-    if (flags & MOZ_GTK_TAB_FIRST) {
ff3c231
-      int initial_gap;
ff3c231
-      gtk_widget_style_get (gTabWidget, "initial-gap", &initial_gap, NULL);
ff3c231
-      if (direction == GTK_TEXT_DIR_RTL)
ff3c231
-      	*right += initial_gap;
ff3c231
-      else
ff3c231
-      	*left += initial_gap;
ff3c231
-    }
ff3c231
-
ff3c231
-    // Top tabs have no bottom border, bottom tabs have no top border
ff3c231
-    if (flags & MOZ_GTK_TAB_BOTTOM) {
ff3c231
-      *top = 0;
ff3c231
-    } else {
ff3c231
-      *bottom = 0;
ff3c231
+    gtk_widget_style_get(gTabWidget, "has-tab-gap", &has_tab_gap, NULL);
ff3c231
+    if (has_tab_gap) {
ff3c231
+      moz_gtk_add_style_border(style, left, top, right, bottom);
ff3c231
+
ff3c231
+      gtk_widget_style_get (gTabWidget, "tab-curvature", &tab_curvature, NULL);
ff3c231
+      *left += tab_curvature;
ff3c231
+      *right += tab_curvature;
ff3c231
+
ff3c231
+      if (flags & MOZ_GTK_TAB_FIRST) {
ff3c231
+        int initial_gap;
ff3c231
+        gtk_widget_style_get (gTabWidget, "initial-gap", &initial_gap, NULL);
ff3c231
+        if (direction == GTK_TEXT_DIR_RTL)
ff3c231
+          *right += initial_gap;
ff3c231
+        else
ff3c231
+          *left += initial_gap;
ff3c231
+      }
ff3c231
+
ff3c231
+      // Top tabs have no bottom border, bottom tabs have no top border
ff3c231
+      if (flags & MOZ_GTK_TAB_BOTTOM) {
ff3c231
+        *top = 0;
ff3c231
+      } else {
ff3c231
+        *bottom = 0;
ff3c231
+      }
ff3c231
     }
ff3c231
 
ff3c231
     gtk_style_context_restore(style);
ff3c231
 
ff3c231
     return MOZ_GTK_SUCCESS;
ff3c231
 }
ff3c231
 
ff3c231
 gint
ff3c231
diff --git a/widget/gtk/nsNativeThemeGTK.cpp b/widget/gtk/nsNativeThemeGTK.cpp
ff3c231
--- a/widget/gtk/nsNativeThemeGTK.cpp
ff3c231
+++ b/widget/gtk/nsNativeThemeGTK.cpp
ff3c231
@@ -756,16 +756,18 @@ nsNativeThemeGTK::GetExtraSizeForWidget(
ff3c231
       return true;
ff3c231
     }
ff3c231
   case NS_THEME_TAB :
ff3c231
     {
ff3c231
       if (!IsSelectedTab(aFrame))
ff3c231
         return false;
ff3c231
 
ff3c231
       gint gap_height = moz_gtk_get_tab_thickness();
ff3c231
+      if (!gap_height)
ff3c231
+        return false;
ff3c231
 
ff3c231
       int32_t extra = gap_height - GetTabMarginPixels(aFrame);
ff3c231
       if (extra <= 0)
ff3c231
         return false;
ff3c231
 
ff3c231
       if (IsBottomTab(aFrame)) {
ff3c231
         aExtra->top = extra;
ff3c231
       } else {