mozilla-gtk3_20.patch
branchfirefox47
changeset 919 6838f0c032f8
parent 909 c6717354928b
child 926 6ab8b16f232c
--- a/mozilla-gtk3_20.patch	Tue Jun 14 21:23:19 2016 +0200
+++ b/mozilla-gtk3_20.patch	Tue Jun 14 22:13:50 2016 +0200
@@ -1,7 +1,7 @@
-diff -up firefox-46.0/widget/gtk/gtk3drawing.c.gtk3-20 firefox-46.0/widget/gtk/gtk3drawing.c
---- firefox-46.0/widget/gtk/gtk3drawing.c.gtk3-20	2016-04-22 02:37:27.000000000 +0200
-+++ firefox-46.0/widget/gtk/gtk3drawing.c	2016-04-25 14:56:19.006992927 +0200
-@@ -17,32 +17,79 @@
+diff -up firefox-46.0.1/widget/gtk/gtk3drawing.c.gtk3-20 firefox-46.0.1/widget/gtk/gtk3drawing.c
+--- firefox-46.0.1/widget/gtk/gtk3drawing.c.gtk3-20	2016-05-03 07:31:12.000000000 +0200
++++ firefox-46.0.1/widget/gtk/gtk3drawing.c	2016-05-20 15:05:08.750151522 +0200
+@@ -17,34 +17,86 @@
  
  #include <math.h>
  
@@ -22,6 +22,11 @@
 +
 +        struct {
 +            GtkStyleContext*  style;
++            GtkStyleContext*  styleBackground;
++        } tooltip;
++
++        struct {
++            GtkStyleContext*  style;
 +            GtkStyleContext*  styleContents;
 +            GtkStyleContext*  styleTrough;
 +            GtkStyleContext*  styleSlider;
@@ -88,9 +93,12 @@
 -static GtkWidget* gProgressWidget;
 +static MozGtkWidget gProgressBar;
  static GtkWidget* gTabWidget;
- static GtkWidget* gTooltipWidget;
+-static GtkWidget* gTooltipWidget;
++static MozGtkWidget gTooltip;
  static GtkWidget* gMenuBarWidget;
-@@ -78,6 +125,37 @@ static gboolean is_initialized;
+ static GtkWidget* gMenuBarItemWidget;
+ static GtkWidget* gMenuPopupWidget;
+@@ -78,6 +130,37 @@ static gboolean is_initialized;
  #define GTK_STATE_FLAG_CHECKED (1 << 11)
  #endif
  
@@ -128,7 +136,7 @@
  static GtkStateFlags
  GetStateFlagsFromGtkWidgetState(GtkWidgetState* state)
  {
-@@ -97,6 +175,41 @@ GetStateFlagsFromGtkWidgetState(GtkWidge
+@@ -97,6 +180,41 @@ GetStateFlagsFromGtkWidgetState(GtkWidge
      return stateFlags;
  }
  
@@ -170,7 +178,7 @@
  /* Because we have such an unconventional way of drawing widgets, signal to the GTK theme engine
     that they are drawing for Mozilla instead of a conventional GTK app so they can do any specific
     things they may want to do. */
-@@ -141,9 +254,16 @@ setup_widget_prototype(GtkWidget* widget
+@@ -141,9 +259,16 @@ setup_widget_prototype(GtkWidget* widget
  static gint
  ensure_button_widget()
  {
@@ -190,7 +198,7 @@
      }
      return MOZ_GTK_SUCCESS;
  }
-@@ -195,9 +315,21 @@ ensure_button_arrow_widget()
+@@ -195,9 +320,21 @@ ensure_button_arrow_widget()
  static gint
  ensure_checkbox_widget()
  {
@@ -215,7 +223,7 @@
      }
      return MOZ_GTK_SUCCESS;
  }
-@@ -205,9 +337,21 @@ ensure_checkbox_widget()
+@@ -205,9 +342,21 @@ ensure_checkbox_widget()
  static gint
  ensure_radiobutton_widget()
  {
@@ -240,7 +248,7 @@
      }
      return MOZ_GTK_SUCCESS;
  }
-@@ -215,25 +359,62 @@ ensure_radiobutton_widget()
+@@ -215,25 +364,62 @@ ensure_radiobutton_widget()
  static gint
  ensure_scrollbar_widget()
  {
@@ -316,7 +324,7 @@
  }
  
  static gint
-@@ -253,9 +434,19 @@ ensure_scale_widget()
+@@ -253,9 +439,19 @@ ensure_scale_widget()
  static gint
  ensure_entry_widget()
  {
@@ -339,7 +347,7 @@
      }
      return MOZ_GTK_SUCCESS;
  }
-@@ -387,9 +578,9 @@ moz_gtk_get_combo_box_entry_inner_widget
+@@ -387,9 +583,9 @@ moz_gtk_get_combo_box_entry_inner_widget
          g_object_add_weak_pointer(G_OBJECT(widget),
                                    (gpointer) &gComboBoxEntryButtonWidget);
      } else if (GTK_IS_ENTRY(widget)) {
@@ -351,7 +359,7 @@
      } else
          return;
      gtk_widget_realize(widget);
-@@ -411,7 +602,7 @@ ensure_combo_box_entry_widgets()
+@@ -411,7 +607,7 @@ ensure_combo_box_entry_widgets()
  {
      GtkWidget* buttonChild;
  
@@ -360,7 +368,7 @@
              gComboBoxEntryButtonWidget &&
              gComboBoxEntryArrowWidget)
          return MOZ_GTK_SUCCESS;
-@@ -427,9 +618,9 @@ ensure_combo_box_entry_widgets()
+@@ -427,9 +623,9 @@ ensure_combo_box_entry_widgets()
                           moz_gtk_get_combo_box_entry_inner_widgets,
                           NULL);
  
@@ -372,7 +380,32 @@
      }
  
      if (gComboBoxEntryButtonWidget) {
-@@ -530,9 +721,21 @@ ensure_tab_widget()
+@@ -507,12 +703,18 @@ ensure_toolbar_separator_widget()
+ static gint
+ ensure_tooltip_widget()
+ {
+-    if (!gTooltipWidget) {
+-        gTooltipWidget = gtk_window_new(GTK_WINDOW_POPUP);
+-        GtkStyleContext* style = gtk_widget_get_style_context(gTooltipWidget);
+-        gtk_style_context_add_class(style, GTK_STYLE_CLASS_TOOLTIP);
+-        gtk_widget_realize(gTooltipWidget);
+-        moz_gtk_set_widget_name(gTooltipWidget);
++    if (!gTooltip.widget) {
++        GtkCssNode path[] = { 
++            { GTK_TYPE_TOOLTIP, "tooltip", NULL, NULL},
++            { GTK_TYPE_TOOLTIP, "tooltip", "background", NULL},
++        };
++
++        gTooltip.widget = gtk_window_new(GTK_WINDOW_POPUP);
++        gtk_widget_realize(gTooltip.widget);
++        moz_gtk_set_widget_name(gTooltip.widget);
++
++        gTooltip.tooltip.style = moz_gtk_style_create(&path[0], NULL);
++        gTooltip.tooltip.styleBackground = moz_gtk_style_create(&path[1], NULL);
+     }
+     return MOZ_GTK_SUCCESS;
+ }
+@@ -530,9 +732,21 @@ ensure_tab_widget()
  static gint
  ensure_progress_widget()
  {
@@ -397,7 +430,7 @@
      }
      return MOZ_GTK_SUCCESS;
  }
-@@ -638,6 +841,11 @@ static gint
+@@ -638,6 +852,11 @@ static gint
  ensure_check_menu_item_widget()
  {
      if (!gCheckMenuItemWidget) {
@@ -409,7 +442,7 @@
          ensure_menu_popup_widget();
          gCheckMenuItemWidget = gtk_check_menu_item_new_with_label("M");
          gtk_menu_shell_append(GTK_MENU_SHELL(gMenuPopupWidget),
-@@ -752,7 +960,7 @@ moz_gtk_checkbox_get_metrics(gint* indic
+@@ -752,7 +971,7 @@ moz_gtk_checkbox_get_metrics(gint* indic
  {
      ensure_checkbox_widget();
  
@@ -418,7 +451,7 @@
                            "indicator_size", indicator_size,
                            "indicator_spacing", indicator_spacing,
                            NULL);
-@@ -765,7 +973,7 @@ moz_gtk_radio_get_metrics(gint* indicato
+@@ -765,7 +984,7 @@ moz_gtk_radio_get_metrics(gint* indicato
  {
      ensure_radiobutton_widget();
  
@@ -427,24 +460,25 @@
                            "indicator_size", indicator_size,
                            "indicator_spacing", indicator_spacing,
                            NULL);
-@@ -778,13 +986,12 @@ moz_gtk_get_focus_outline_size(gint* foc
+@@ -778,13 +997,13 @@ moz_gtk_get_focus_outline_size(gint* foc
  {
      GtkBorder border;
      GtkBorder padding;
 -    GtkStyleContext *style;
-+    GtkStyleContext* style = gEntry.entry.style;
++    GtkStyleContext* style;
  
      ensure_entry_widget();
 -    style = gtk_widget_get_style_context(gEntryWidget);
  
 -    gtk_style_context_get_border(style, 0, &border);
 -    gtk_style_context_get_padding(style, 0, &padding);
++    style = gEntry.entry.style;
 +    gtk_style_context_get_border(style, gtk_style_context_get_state(style), &border);
 +    gtk_style_context_get_padding(style, gtk_style_context_get_state(style), &padding);
      *focus_h_width = border.left + padding.left;
      *focus_v_width = border.top + padding.top;
      return MOZ_GTK_SUCCESS;
-@@ -821,7 +1028,7 @@ moz_gtk_button_get_default_overflow(gint
+@@ -821,7 +1040,7 @@ moz_gtk_button_get_default_overflow(gint
      GtkBorder* default_outside_border;
  
      ensure_button_widget();
@@ -453,7 +487,7 @@
                           "default-outside-border", &default_outside_border,
                           NULL);
  
-@@ -844,7 +1051,7 @@ moz_gtk_button_get_default_border(gint*
+@@ -844,7 +1063,7 @@ moz_gtk_button_get_default_border(gint*
      GtkBorder* default_border;
  
      ensure_button_widget();
@@ -462,7 +496,7 @@
                           "default-border", &default_border,
                           NULL);
  
-@@ -935,7 +1142,7 @@ moz_gtk_button_paint(cairo_t *cr, GdkRec
+@@ -935,7 +1154,7 @@ moz_gtk_button_paint(cairo_t *cr, GdkRec
  
      if (state->focused) {
          GtkBorder border;
@@ -471,7 +505,7 @@
          x += border.left;
          y += border.top;
          width -= (border.left + border.right);
-@@ -956,15 +1163,14 @@ moz_gtk_toggle_paint(cairo_t *cr, GdkRec
+@@ -956,15 +1175,14 @@ moz_gtk_toggle_paint(cairo_t *cr, GdkRec
      gint indicator_size, indicator_spacing;
      gint x, y, width, height;
      gint focus_x, focus_y, focus_width, focus_height;
@@ -490,7 +524,7 @@
      }
  
      // XXX we should assert rect->height >= indicator_size too
-@@ -983,11 +1189,9 @@ moz_gtk_toggle_paint(cairo_t *cr, GdkRec
+@@ -983,11 +1201,9 @@ moz_gtk_toggle_paint(cairo_t *cr, GdkRec
      focus_width = width + 2 * indicator_spacing;
      focus_height = height + 2 * indicator_spacing;
    
@@ -505,7 +539,7 @@
  
      if (selected)
          state_flags |= checkbox_check_state;
-@@ -995,13 +1199,15 @@ moz_gtk_toggle_paint(cairo_t *cr, GdkRec
+@@ -995,13 +1211,15 @@ moz_gtk_toggle_paint(cairo_t *cr, GdkRec
      if (inconsistent)
          state_flags |= GTK_STATE_FLAG_INCONSISTENT;
  
@@ -525,7 +559,7 @@
                              focus_width, focus_height);
          }
      }
-@@ -1010,15 +1216,14 @@ moz_gtk_toggle_paint(cairo_t *cr, GdkRec
+@@ -1010,15 +1228,14 @@ moz_gtk_toggle_paint(cairo_t *cr, GdkRec
          * 'indeterminate' type on checkboxes. In GTK, the shadow type
          * must also be changed for the state to be drawn.
          */        
@@ -545,7 +579,7 @@
  
      return MOZ_GTK_SUCCESS;
  }
-@@ -1035,8 +1240,8 @@ calculate_button_inner_rect(GtkWidget* b
+@@ -1035,8 +1252,8 @@ calculate_button_inner_rect(GtkWidget* b
      style = gtk_widget_get_style_context(button);
  
      /* This mirrors gtkbutton's child positioning */
@@ -556,7 +590,7 @@
  
      inner_rect->x = rect->x + border.left + padding.left;
      inner_rect->y = rect->y + padding.top + border.top;
-@@ -1099,9 +1304,9 @@ moz_gtk_scrollbar_button_paint(cairo_t *
+@@ -1099,9 +1316,9 @@ moz_gtk_scrollbar_button_paint(cairo_t *
      ensure_scrollbar_widget();
  
      if (flags & MOZ_GTK_STEPPER_VERTICAL)
@@ -568,7 +602,7 @@
  
      gtk_widget_set_direction(scrollbar, direction);
  
-@@ -1181,25 +1386,22 @@ moz_gtk_scrollbar_trough_paint(GtkThemeW
+@@ -1181,25 +1398,22 @@ moz_gtk_scrollbar_trough_paint(GtkThemeW
                                 GtkTextDirection direction)
  {
      GtkStyleContext* style;
@@ -602,7 +636,7 @@
  
      gtk_render_background(style, cr, rect->x, rect->y, rect->width, rect->height);
      gtk_render_frame(style, cr, rect->x, rect->y, rect->width, rect->height);
-@@ -1208,7 +1410,6 @@ moz_gtk_scrollbar_trough_paint(GtkThemeW
+@@ -1208,7 +1422,6 @@ moz_gtk_scrollbar_trough_paint(GtkThemeW
          gtk_render_focus(style, cr,
                           rect->x, rect->y, rect->width, rect->height);
      }
@@ -610,7 +644,7 @@
      return MOZ_GTK_SUCCESS;
  }
  
-@@ -1220,24 +1421,20 @@ moz_gtk_scrollbar_thumb_paint(GtkThemeWi
+@@ -1220,24 +1433,20 @@ moz_gtk_scrollbar_thumb_paint(GtkThemeWi
  {
      GtkStateFlags state_flags = GetStateFlagsFromGtkWidgetState(state);
      GtkStyleContext* style;
@@ -643,7 +677,7 @@
      gtk_style_context_get_margin (style, state_flags, &margin);
  
      gtk_render_slider(style, cr,
-@@ -1248,8 +1445,6 @@ moz_gtk_scrollbar_thumb_paint(GtkThemeWi
+@@ -1248,8 +1457,6 @@ moz_gtk_scrollbar_thumb_paint(GtkThemeWi
                       (widget == MOZ_GTK_SCROLLBAR_THUMB_HORIZONTAL) ?
                       GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL);
  
@@ -652,7 +686,7 @@
      return MOZ_GTK_SUCCESS;
  }
  
-@@ -1260,8 +1455,8 @@ moz_gtk_spin_paint(cairo_t *cr, GdkRecta
+@@ -1260,8 +1467,8 @@ moz_gtk_spin_paint(cairo_t *cr, GdkRecta
      GtkStyleContext* style;
  
      ensure_spin_widget();
@@ -663,7 +697,7 @@
      gtk_style_context_save(style);
      gtk_style_context_add_class(style, GTK_STYLE_CLASS_SPINBUTTON);
      gtk_render_background(style, cr, rect->x, rect->y, rect->width, rect->height);
-@@ -1280,11 +1475,10 @@ moz_gtk_spin_updown_paint(cairo_t *cr, G
+@@ -1280,11 +1487,10 @@ moz_gtk_spin_updown_paint(cairo_t *cr, G
      GtkStyleContext* style;
  
      ensure_spin_widget();
@@ -677,7 +711,7 @@
  
      gtk_render_background(style, cr, rect->x, rect->y, rect->width, rect->height);
      gtk_render_frame(style, cr, rect->x, rect->y, rect->width, rect->height);
-@@ -1450,15 +1644,13 @@ moz_gtk_vpaned_paint(cairo_t *cr, GdkRec
+@@ -1450,15 +1656,13 @@ moz_gtk_vpaned_paint(cairo_t *cr, GdkRec
  static gint
  moz_gtk_entry_paint(cairo_t *cr, GdkRectangle* rect,
                      GtkWidgetState* state,
@@ -696,7 +730,7 @@
  
      if (draw_focus_outline_only) {
          // Inflate the given 'rect' with the focus outline size.
-@@ -1478,10 +1670,9 @@ moz_gtk_entry_paint(cairo_t *cr, GdkRect
+@@ -1478,10 +1682,9 @@ moz_gtk_entry_paint(cairo_t *cr, GdkRect
       * textarea window uses gtk_paint_flat_box when exposed */
  
      /* This gets us a lovely greyish disabledish look */
@@ -708,7 +742,7 @@
    
      /* Now paint the shadow and focus border.
       * We do like in gtk_entry_draw_frame, we first draw the shadow, a tad
-@@ -1531,7 +1722,7 @@ moz_gtk_treeview_paint(cairo_t *cr, GdkR
+@@ -1531,7 +1734,7 @@ moz_gtk_treeview_paint(cairo_t *cr, GdkR
      style = gtk_widget_get_style_context(gScrolledWindowWidget);
      gtk_style_context_save(style);
      gtk_style_context_add_class(style, GTK_STYLE_CLASS_FRAME);    
@@ -717,7 +751,7 @@
      xthickness = border.left;
      ythickness = border.top;    
  
-@@ -1702,7 +1893,7 @@ moz_gtk_combo_box_paint(cairo_t *cr, Gdk
+@@ -1702,7 +1905,7 @@ moz_gtk_combo_box_paint(cairo_t *cr, Gdk
          if (direction == GTK_TEXT_DIR_LTR) {
              GtkBorder padding;
              GtkStateFlags state_flags = GetStateFlagsFromGtkWidgetState(state);
@@ -726,7 +760,7 @@
              arrow_rect.x -= padding.left;
          }
          else
-@@ -1804,29 +1995,27 @@ moz_gtk_container_paint(cairo_t *cr, Gdk
+@@ -1804,29 +2007,27 @@ moz_gtk_container_paint(cairo_t *cr, Gdk
                          gboolean isradio, GtkTextDirection direction)
  {
      GtkStateFlags state_flags = GetStateFlagsFromGtkWidgetState(state);
@@ -764,7 +798,7 @@
    
      return MOZ_GTK_SUCCESS;
  }
-@@ -1836,32 +2025,26 @@ moz_gtk_toggle_label_paint(cairo_t *cr,
+@@ -1836,32 +2037,26 @@ moz_gtk_toggle_label_paint(cairo_t *cr,
                             GtkWidgetState* state, 
                             gboolean isradio, GtkTextDirection direction)
  {
@@ -782,15 +816,15 @@
      } else {
          ensure_checkbox_widget();
 -        widget = gCheckboxWidget;
-+        widget = &gCheckbox;
-     }
+-    }
 -    style = gtk_widget_get_style_context(widget);
 -    gtk_style_context_save(style);
 -    if (isradio) {
 -      gtk_style_context_add_class(style, GTK_STYLE_CLASS_RADIO);
 -    } else {
 -      gtk_style_context_add_class(style, GTK_STYLE_CLASS_CHECK);
--    }
++        widget = &gCheckbox;
+     }
 -    gtk_widget_set_direction(widget, direction);
 +    gtk_style_context_save(widget->check.styleLabel);
 +    gtk_widget_set_direction(widget->widget, direction);
@@ -806,7 +840,7 @@
  
      return MOZ_GTK_SUCCESS;
  }
-@@ -1922,7 +2105,7 @@ moz_gtk_toolbar_separator_paint(cairo_t
+@@ -1922,7 +2117,7 @@ moz_gtk_toolbar_separator_paint(cairo_t
                            rect->height * (end_fraction - start_fraction));
      } else {
          GtkBorder padding;
@@ -815,7 +849,19 @@
      
          paint_width = padding.left;
          if (paint_width > rect->width)
-@@ -2006,18 +2189,13 @@ static gint
+@@ -1945,9 +2140,9 @@ moz_gtk_tooltip_paint(cairo_t *cr, GdkRe
+     GtkStyleContext* style;
+ 
+     ensure_tooltip_widget();
+-    gtk_widget_set_direction(gTooltipWidget, direction);
++    gtk_widget_set_direction(gTooltip.widget, direction);
+ 
+-    style = gtk_widget_get_style_context(gTooltipWidget);
++    style = gTooltip.tooltip.styleBackground;
+     gtk_render_background(style, cr, rect->x, rect->y, rect->width, rect->height);
+     gtk_render_frame(style, cr, rect->x, rect->y, rect->width, rect->height);
+     return MOZ_GTK_SUCCESS;
+@@ -2006,18 +2201,13 @@ static gint
  moz_gtk_progressbar_paint(cairo_t *cr, GdkRectangle* rect,
                            GtkTextDirection direction)
  {
@@ -839,7 +885,7 @@
  
      return MOZ_GTK_SUCCESS;
  }
-@@ -2027,15 +2205,8 @@ moz_gtk_progress_chunk_paint(cairo_t *cr
+@@ -2027,15 +2217,8 @@ moz_gtk_progress_chunk_paint(cairo_t *cr
                               GtkTextDirection direction,
                               GtkThemeWidgetType widget)
  {
@@ -856,7 +902,7 @@
  
      if (widget == MOZ_GTK_PROGRESS_CHUNK_INDETERMINATE ||
          widget == MOZ_GTK_PROGRESS_CHUNK_VERTICAL_INDETERMINATE) {
-@@ -2074,12 +2245,14 @@ moz_gtk_progress_chunk_paint(cairo_t *cr
+@@ -2074,12 +2257,14 @@ moz_gtk_progress_chunk_paint(cairo_t *cr
      // gtk_render_activity was used to render progress chunks on GTK versions
      // before 3.13.7, see bug 1173907.
      if (!gtk_check_version(3, 13, 7)) {
@@ -875,7 +921,7 @@
  
      return MOZ_GTK_SUCCESS;
  }
-@@ -2096,7 +2269,7 @@ moz_gtk_get_tab_thickness(void)
+@@ -2096,7 +2281,7 @@ moz_gtk_get_tab_thickness(void)
  
      style = gtk_widget_get_style_context(gTabWidget);
      gtk_style_context_add_class(style, GTK_STYLE_CLASS_NOTEBOOK);
@@ -884,7 +930,7 @@
  
      if (border.top < 2)
          return 2; /* some themes don't set ythickness correctly */
-@@ -2292,7 +2465,7 @@ moz_gtk_tab_paint(cairo_t *cr, GdkRectan
+@@ -2292,7 +2477,7 @@ moz_gtk_tab_paint(cairo_t *cr, GdkRectan
        gtk_style_context_save(style);
        moz_gtk_tab_prepare_style_context(style, flags);
  
@@ -893,7 +939,7 @@
  
        focusRect.x += padding.left;
        focusRect.width -= (padding.left + padding.right);
-@@ -2408,7 +2581,7 @@ moz_gtk_tab_scroll_arrow_paint(cairo_t *
+@@ -2408,7 +2593,7 @@ moz_gtk_tab_scroll_arrow_paint(cairo_t *
  }
  
  static gint
@@ -902,7 +948,7 @@
                         GtkTextDirection direction)
  {
      GtkStyleContext* style;
-@@ -2468,7 +2641,7 @@ moz_gtk_menu_separator_paint(cairo_t *cr
+@@ -2468,7 +2653,7 @@ moz_gtk_menu_separator_paint(cairo_t *cr
      border_width = gtk_container_get_border_width(GTK_CONTAINER(gMenuSeparatorWidget));
  
      style = gtk_widget_get_style_context(gMenuSeparatorWidget);
@@ -911,7 +957,7 @@
  
      x = rect->x + border_width;
      y = rect->y + border_width;
-@@ -2521,7 +2694,8 @@ moz_gtk_menu_item_paint(cairo_t *cr, Gdk
+@@ -2521,7 +2706,8 @@ moz_gtk_menu_item_paint(cairo_t *cr, Gdk
              item_widget = gMenuItemWidget;
          }
          style = gtk_widget_get_style_context(item_widget);
@@ -921,7 +967,7 @@
  
          if (flags & MOZ_TOPLEVEL_MENU_ITEM) {
              gtk_style_context_add_class(style, GTK_STYLE_CLASS_MENUBAR);
-@@ -2540,7 +2714,7 @@ moz_gtk_menu_item_paint(cairo_t *cr, Gdk
+@@ -2540,7 +2726,7 @@ moz_gtk_menu_item_paint(cairo_t *cr, Gdk
  
          gtk_render_background(style, cr, x, y, w, h);
          gtk_render_frame(style, cr, x, y, w, h);
@@ -930,7 +976,7 @@
      }
  
      return MOZ_GTK_SUCCESS;
-@@ -2556,7 +2730,10 @@ moz_gtk_menu_arrow_paint(cairo_t *cr, Gd
+@@ -2556,7 +2742,10 @@ moz_gtk_menu_arrow_paint(cairo_t *cr, Gd
  
      ensure_menu_item_widget();
      gtk_widget_set_direction(gMenuItemWidget, direction);
@@ -942,7 +988,7 @@
      style = gtk_widget_get_style_context(gMenuItemWidget);
      gtk_style_context_save(style);
      gtk_style_context_add_class(style, GTK_STYLE_CLASS_MENUITEM);
-@@ -2606,7 +2783,7 @@ moz_gtk_check_menu_item_paint(cairo_t *c
+@@ -2606,7 +2795,7 @@ moz_gtk_check_menu_item_paint(cairo_t *c
      }
      
      gtk_style_context_set_state(style, state_flags);
@@ -951,7 +997,7 @@
  
      offset = gtk_container_get_border_width(GTK_CONTAINER(gCheckMenuItemWidget)) +
                                              padding.left + 2;
-@@ -2658,7 +2835,7 @@ moz_gtk_add_style_border(GtkStyleContext
+@@ -2658,7 +2847,7 @@ moz_gtk_add_style_border(GtkStyleContext
  {
      GtkBorder border;
  
@@ -960,7 +1006,7 @@
  
      *left += border.left;
      *right += border.right;
-@@ -2667,12 +2844,22 @@ moz_gtk_add_style_border(GtkStyleContext
+@@ -2667,12 +2856,22 @@ moz_gtk_add_style_border(GtkStyleContext
  }
  
  static void
@@ -984,7 +1030,7 @@
  
      *left += padding.left;
      *right += padding.right;
-@@ -2680,6 +2867,16 @@ moz_gtk_add_style_padding(GtkStyleContex
+@@ -2680,6 +2879,16 @@ moz_gtk_add_style_padding(GtkStyleContex
      *bottom += padding.bottom;
  }
  
@@ -1001,7 +1047,7 @@
  gint
  moz_gtk_get_widget_border(GtkThemeWidgetType widget, gint* left, gint* top,
                            gint* right, gint* bottom, GtkTextDirection direction,
-@@ -2694,36 +2891,27 @@ moz_gtk_get_widget_border(GtkThemeWidget
+@@ -2694,37 +2903,35 @@ moz_gtk_get_widget_border(GtkThemeWidget
      case MOZ_GTK_TOOLBAR_BUTTON:
          {
              ensure_button_widget();
@@ -1039,13 +1085,21 @@
              *left = *top = *right = *bottom = -1;
 -            moz_gtk_add_style_padding(style, left, top, right, bottom);
 -            moz_gtk_add_style_border(style, left, top, right, bottom);
-+
+ 
 +            moz_gtk_add_style_padding(gEntry.entry.style, left, top, right, bottom);
 +            moz_gtk_add_style_border(gEntry.entry.style, left, top, right, bottom);
- 
++
++            return MOZ_GTK_SUCCESS;
++        }
++    case MOZ_GTK_TOOLTIP:
++        {
++            ensure_tooltip_widget();
++            moz_gtk_add_style_padding(gTooltip.tooltip.styleBackground, left, top, right, bottom);
++            moz_gtk_add_style_border(gTooltip.tooltip.styleBackground, left, top, right, bottom);
              return MOZ_GTK_SUCCESS;
          }
-@@ -2759,7 +2947,7 @@ moz_gtk_get_widget_border(GtkThemeWidget
+     case MOZ_GTK_TREEVIEW:
+@@ -2759,7 +2966,7 @@ moz_gtk_get_widget_border(GtkThemeWidget
          break;
      case MOZ_GTK_DROPDOWN_ENTRY:
          ensure_combo_box_entry_widgets();
@@ -1054,7 +1108,7 @@
          break;
      case MOZ_GTK_DROPDOWN_ARROW:
          ensure_combo_box_entry_widgets();
-@@ -2795,7 +2983,7 @@ moz_gtk_get_widget_border(GtkThemeWidget
+@@ -2795,7 +3002,7 @@ moz_gtk_get_widget_border(GtkThemeWidget
  
                  if (!wide_separators) {
                      style = gtk_widget_get_style_context(gComboBoxSeparatorWidget);
@@ -1063,7 +1117,7 @@
                      separator_width = border.left;
                  }
              }
-@@ -2814,14 +3002,17 @@ moz_gtk_get_widget_border(GtkThemeWidget
+@@ -2814,14 +3021,17 @@ moz_gtk_get_widget_border(GtkThemeWidget
          w = gTabWidget;
          break;
      case MOZ_GTK_PROGRESSBAR:
@@ -1085,7 +1139,7 @@
          break;
      case MOZ_GTK_SCALE_HORIZONTAL:
          ensure_scale_widget();
-@@ -2840,12 +3031,13 @@ moz_gtk_get_widget_border(GtkThemeWidget
+@@ -2840,12 +3050,13 @@ moz_gtk_get_widget_border(GtkThemeWidget
          {
              if (widget == MOZ_GTK_CHECKBUTTON_CONTAINER) {
                  ensure_checkbox_widget();
@@ -1102,7 +1156,15 @@
  
              *left = *top = *right = *bottom = gtk_container_get_border_width(GTK_CONTAINER(w));
              moz_gtk_add_style_border(style,
-@@ -2978,6 +3170,32 @@ moz_gtk_get_combo_box_entry_button_size(
+@@ -2904,7 +3115,6 @@ moz_gtk_get_widget_border(GtkThemeWidget
+     case MOZ_GTK_MENUSEPARATOR:
+     /* These widgets have no borders.*/
+     case MOZ_GTK_SPINBUTTON:
+-    case MOZ_GTK_TOOLTIP:
+     case MOZ_GTK_WINDOW:
+     case MOZ_GTK_RESIZER:
+     case MOZ_GTK_MENUARROW:
+@@ -2978,6 +3188,32 @@ moz_gtk_get_combo_box_entry_button_size(
  }
  
  gint
@@ -1135,7 +1197,7 @@
  moz_gtk_get_tab_scroll_arrow_size(gint* width, gint* height)
  {
      gint arrow_size;
-@@ -3030,7 +3248,7 @@ moz_gtk_get_toolbar_separator_width(gint
+@@ -3030,7 +3266,7 @@ moz_gtk_get_toolbar_separator_width(gint
                           "separator-width", &separator_width,
                           NULL);
      /* Just in case... */
@@ -1144,7 +1206,7 @@
      *size = MAX(*size, (wide_separators ? separator_width : border.left));
      return MOZ_GTK_SUCCESS;
  }
-@@ -3072,7 +3290,7 @@ moz_gtk_get_menu_separator_height(gint *
+@@ -3072,7 +3308,7 @@ moz_gtk_get_menu_separator_height(gint *
      border_width = gtk_container_get_border_width(GTK_CONTAINER(gMenuSeparatorWidget));
  
      style = gtk_widget_get_style_context(gMenuSeparatorWidget);
@@ -1153,7 +1215,7 @@
  
      gtk_style_context_save(style);
      gtk_style_context_add_class(style, GTK_STYLE_CLASS_SEPARATOR);
-@@ -3130,15 +3348,21 @@ moz_gtk_get_scrollbar_metrics(MozGtkScro
+@@ -3130,15 +3366,21 @@ moz_gtk_get_scrollbar_metrics(MozGtkScro
  {
      ensure_scrollbar_widget();
  
@@ -1178,7 +1240,7 @@
  
      return MOZ_GTK_SUCCESS;
  }
-@@ -3163,7 +3387,7 @@ moz_gtk_images_in_buttons()
+@@ -3163,7 +3405,7 @@ moz_gtk_images_in_buttons()
      GtkSettings* settings;
  
      ensure_button_widget();
@@ -1187,7 +1249,7 @@
  
      g_object_get(settings, "gtk-button-images", &result, NULL);
      return result;
-@@ -3191,7 +3415,7 @@ moz_gtk_widget_paint(GtkThemeWidgetType
+@@ -3191,7 +3433,7 @@ moz_gtk_widget_paint(GtkThemeWidgetType
          }
          ensure_button_widget();
          return moz_gtk_button_paint(cr, rect, state,
@@ -1196,7 +1258,7 @@
                                      direction);
          break;
      case MOZ_GTK_CHECKBUTTON:
-@@ -3241,7 +3465,7 @@ moz_gtk_widget_paint(GtkThemeWidgetType
+@@ -3241,7 +3483,7 @@ moz_gtk_widget_paint(GtkThemeWidgetType
      case MOZ_GTK_SPINBUTTON_ENTRY:
          ensure_spin_widget();
          return moz_gtk_entry_paint(cr, rect, state,
@@ -1205,7 +1267,7 @@
          break;
      case MOZ_GTK_GRIPPER:
          return moz_gtk_gripper_paint(cr, rect, state,
-@@ -3268,7 +3492,7 @@ moz_gtk_widget_paint(GtkThemeWidgetType
+@@ -3268,7 +3510,7 @@ moz_gtk_widget_paint(GtkThemeWidgetType
      case MOZ_GTK_ENTRY:
          ensure_entry_widget();
          return moz_gtk_entry_paint(cr, rect, state,
@@ -1214,7 +1276,7 @@
          break;
      case MOZ_GTK_DROPDOWN:
          return moz_gtk_combo_box_paint(cr, rect, state, direction);
-@@ -3280,7 +3504,7 @@ moz_gtk_widget_paint(GtkThemeWidgetType
+@@ -3280,7 +3522,7 @@ moz_gtk_widget_paint(GtkThemeWidgetType
      case MOZ_GTK_DROPDOWN_ENTRY:
          ensure_combo_box_entry_widgets();
          return moz_gtk_entry_paint(cr, rect, state,
@@ -1223,7 +1285,7 @@
          break;
      case MOZ_GTK_CHECKBUTTON_CONTAINER:
      case MOZ_GTK_RADIOBUTTON_CONTAINER:
-@@ -3332,7 +3556,7 @@ moz_gtk_widget_paint(GtkThemeWidgetType
+@@ -3332,7 +3574,7 @@ moz_gtk_widget_paint(GtkThemeWidgetType
                                                (GtkArrowType) flags, direction);
          break;
      case MOZ_GTK_MENUBAR:
@@ -1232,7 +1294,7 @@
          break;
      case MOZ_GTK_MENUPOPUP:
          return moz_gtk_menu_popup_paint(cr, rect, direction);
-@@ -3383,7 +3607,7 @@ GtkWidget* moz_gtk_get_scrollbar_widget(
+@@ -3383,7 +3625,7 @@ GtkWidget* moz_gtk_get_scrollbar_widget(
  {
      MOZ_ASSERT(is_initialized, "Forgot to call moz_gtk_init()");
      ensure_scrollbar_widget();
@@ -1241,7 +1303,7 @@
  }
  
  gboolean moz_gtk_has_scrollbar_buttons(void)
-@@ -3391,7 +3615,7 @@ gboolean moz_gtk_has_scrollbar_buttons(v
+@@ -3391,7 +3633,7 @@ gboolean moz_gtk_has_scrollbar_buttons(v
      gboolean backward, forward, secondary_backward, secondary_forward;
      MOZ_ASSERT(is_initialized, "Forgot to call moz_gtk_init()");
      ensure_scrollbar_widget();
@@ -1250,7 +1312,18 @@
                            "has-backward-stepper", &backward,
                            "has-forward-stepper", &forward,
                            "has-secondary-backward-stepper", &secondary_backward,
-@@ -3415,17 +3639,19 @@ moz_gtk_shutdown()
+@@ -3403,8 +3645,8 @@ gboolean moz_gtk_has_scrollbar_buttons(v
+ gint
+ moz_gtk_shutdown()
+ {
+-    if (gTooltipWidget)
+-        gtk_widget_destroy(gTooltipWidget);
++    moz_gtk_widget_free(&gTooltip);
++
+     /* This will destroy all of our widgets */
+     if (gProtoWindow)
+         gtk_widget_destroy(gProtoWindow);
+@@ -3415,17 +3657,19 @@ moz_gtk_shutdown()
  
      gProtoWindow = NULL;
      gProtoLayout = NULL;
@@ -1277,7 +1350,7 @@
      gComboBoxWidget = NULL;
      gComboBoxButtonWidget = NULL;
      gComboBoxSeparatorWidget = NULL;
-@@ -3433,12 +3659,12 @@ moz_gtk_shutdown()
+@@ -3433,14 +3677,13 @@ moz_gtk_shutdown()
      gComboBoxEntryWidget = NULL;
      gComboBoxEntryButtonWidget = NULL;
      gComboBoxEntryArrowWidget = NULL;
@@ -1290,11 +1363,13 @@
 -    gProgressWidget = NULL;
 +    moz_gtk_widget_free(&gProgressBar);
      gTabWidget = NULL;
-     gTooltipWidget = NULL;
+-    gTooltipWidget = NULL;
      gMenuBarWidget = NULL;
-diff -up firefox-46.0/widget/gtk/gtkdrawing.h.gtk3-20 firefox-46.0/widget/gtk/gtkdrawing.h
---- firefox-46.0/widget/gtk/gtkdrawing.h.gtk3-20	2016-04-22 02:37:27.000000000 +0200
-+++ firefox-46.0/widget/gtk/gtkdrawing.h	2016-04-25 14:42:42.000000000 +0200
+     gMenuBarItemWidget = NULL;
+     gMenuPopupWidget = NULL;
+diff -up firefox-46.0.1/widget/gtk/gtkdrawing.h.gtk3-20 firefox-46.0.1/widget/gtk/gtkdrawing.h
+--- firefox-46.0.1/widget/gtk/gtkdrawing.h.gtk3-20	2016-05-03 07:31:12.000000000 +0200
++++ firefox-46.0.1/widget/gtk/gtkdrawing.h	2016-05-19 15:20:11.656519199 +0200
 @@ -67,6 +67,13 @@ typedef enum {
    MOZ_GTK_TAB_SELECTED        = 1 << 10
  } GtkTabFlags;
@@ -1332,9 +1407,9 @@
  #ifdef __cplusplus
  }
  #endif /* __cplusplus */
-diff -up firefox-46.0/widget/gtk/mozgtk/mozgtk.c.gtk3-20 firefox-46.0/widget/gtk/mozgtk/mozgtk.c
---- firefox-46.0/widget/gtk/mozgtk/mozgtk.c.gtk3-20	2016-04-22 02:37:27.000000000 +0200
-+++ firefox-46.0/widget/gtk/mozgtk/mozgtk.c	2016-04-25 14:46:15.299592716 +0200
+diff -up firefox-46.0.1/widget/gtk/mozgtk/mozgtk.c.gtk3-20 firefox-46.0.1/widget/gtk/mozgtk/mozgtk.c
+--- firefox-46.0.1/widget/gtk/mozgtk/mozgtk.c.gtk3-20	2016-05-03 07:31:12.000000000 +0200
++++ firefox-46.0.1/widget/gtk/mozgtk/mozgtk.c	2016-05-20 10:40:19.442320669 +0200
 @@ -504,6 +504,11 @@ STUB(gtk_window_set_type_hint)
  STUB(gtk_window_set_wmclass)
  STUB(gtk_window_unfullscreen)
@@ -1347,7 +1422,7 @@
  #endif
  
  #ifdef GTK3_SYMBOLS
-@@ -581,6 +586,13 @@ STUB(gtk_color_chooser_get_type)
+@@ -581,6 +586,14 @@ STUB(gtk_color_chooser_get_type)
  STUB(gtk_color_chooser_set_rgba)
  STUB(gtk_color_chooser_get_rgba)
  STUB(gtk_color_chooser_set_use_alpha)
@@ -1358,12 +1433,13 @@
 +STUB(gtk_widget_path_iter_get_state)
 +STUB(gtk_style_context_set_parent)
 +STUB(gtk_widget_path_unref)
++STUB(gtk_tooltip_get_type)
  #endif
  
  #ifdef GTK2_SYMBOLS
-diff -up firefox-46.0/widget/gtk/nsLookAndFeel.cpp.gtk3-20 firefox-46.0/widget/gtk/nsLookAndFeel.cpp
---- firefox-46.0/widget/gtk/nsLookAndFeel.cpp.gtk3-20	2016-04-22 02:37:27.000000000 +0200
-+++ firefox-46.0/widget/gtk/nsLookAndFeel.cpp	2016-04-25 14:18:25.000000000 +0200
+diff -up firefox-46.0.1/widget/gtk/nsLookAndFeel.cpp.gtk3-20 firefox-46.0.1/widget/gtk/nsLookAndFeel.cpp
+--- firefox-46.0.1/widget/gtk/nsLookAndFeel.cpp.gtk3-20	2016-05-03 07:31:12.000000000 +0200
++++ firefox-46.0.1/widget/gtk/nsLookAndFeel.cpp	2016-05-20 13:53:54.085049707 +0200
 @@ -353,14 +353,18 @@ nsLookAndFeel::NativeGetColor(ColorID aI
      case eColorID_activeborder:
          // active window border
@@ -1419,7 +1495,7 @@
          aColor = GDK_RGBA_TO_NS_RGBA(gdk_color);
          break;
      case eColorID__moz_buttonhovertext:
-@@ -1110,7 +1121,7 @@ nsLookAndFeel::Init()
+@@ -1110,27 +1126,29 @@ nsLookAndFeel::Init()
      style = create_context(path);
      gtk_style_context_add_class(style, GTK_STYLE_CLASS_SCROLLBAR);
      gtk_style_context_add_class(style, GTK_STYLE_CLASS_TROUGH);
@@ -1428,9 +1504,9 @@
      sMozScrollbar = GDK_RGBA_TO_NS_RGBA(color);
      g_object_unref(style);
  
-@@ -1118,18 +1129,18 @@ nsLookAndFeel::Init()
+     // Window colors
      style = create_context(path);
-     gtk_style_context_save(style);
+-    gtk_style_context_save(style);
      gtk_style_context_add_class(style, GTK_STYLE_CLASS_BACKGROUND);
 -    gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL, &color);
 +    gtk_style_context_get_background_color(style, gtk_style_context_get_state(style), &color);
@@ -1438,20 +1514,27 @@
 -    gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color);
 +    gtk_style_context_get_color(style, gtk_style_context_get_state(style), &color);
      sMozWindowText = GDK_RGBA_TO_NS_RGBA(color);
-     gtk_style_context_restore(style);
+-    gtk_style_context_restore(style);
++    g_object_unref(style);
  
      // tooltip foreground and background
-     gtk_style_context_add_class(style, GTK_STYLE_CLASS_TOOLTIP);
+-    gtk_style_context_add_class(style, GTK_STYLE_CLASS_TOOLTIP);
++    GtkCssNode tooltipPath[] = { 
++         { GTK_TYPE_TOOLTIP, "tooltip", NULL, NULL},
++    };
++    style = moz_gtk_style_create(tooltipPath, NULL);
++    gtk_style_context_get_color(style, gtk_style_context_get_state(style), &color);
++    sInfoText = GDK_RGBA_TO_NS_RGBA(color);
      gtk_style_context_add_class(style, GTK_STYLE_CLASS_BACKGROUND);
 -    gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL, &color);
 +    gtk_style_context_get_background_color(style, gtk_style_context_get_state(style), &color);
      sInfoBackground = GDK_RGBA_TO_NS_RGBA(color);
 -    gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color);
-+    gtk_style_context_get_color(style, gtk_style_context_get_state(style), &color);
-     sInfoText = GDK_RGBA_TO_NS_RGBA(color);
+-    sInfoText = GDK_RGBA_TO_NS_RGBA(color);
      g_object_unref(style);
  
-@@ -1144,20 +1155,26 @@ nsLookAndFeel::Init()
+     // menu foreground & menu background
+@@ -1144,20 +1162,26 @@ nsLookAndFeel::Init()
      gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
  
      style = gtk_widget_get_style_context(accel_label);
@@ -1483,7 +1566,7 @@
  
      g_object_unref(menu);
  #endif
-@@ -1266,44 +1283,54 @@ nsLookAndFeel::Init()
+@@ -1266,44 +1290,54 @@ nsLookAndFeel::Init()
              GDK_COLOR_TO_NS_RGB(style->dark[GTK_STATE_NORMAL]);
      }
  #else
@@ -1555,7 +1638,7 @@
  
      // GTK's guide to fancy odd row background colors:
      // 1) Check if a theme explicitly defines an odd row color
-@@ -1316,7 +1343,7 @@ nsLookAndFeel::Init()
+@@ -1316,7 +1350,7 @@ nsLookAndFeel::Init()
      // Get odd row background color
      gtk_style_context_save(style);
      gtk_style_context_add_region(style, GTK_STYLE_REGION_ROW, GTK_REGION_ODD);
@@ -1564,7 +1647,7 @@
      sOddCellBackground = GDK_RGBA_TO_NS_RGBA(color);
      gtk_style_context_restore(style);
  
-@@ -1334,9 +1361,11 @@ nsLookAndFeel::Init()
+@@ -1334,9 +1368,11 @@ nsLookAndFeel::Init()
      gtk_container_add(GTK_CONTAINER(parent), infoBar);
      gtk_container_add(GTK_CONTAINER(infoBarContent), infoBarLabel);
      style = gtk_widget_get_style_context(infoBarLabel);
@@ -1577,9 +1660,9 @@
  #endif
      // Some themes have a unified menu bar, and support window dragging on it
      gboolean supports_menubar_drag = FALSE;
-diff -up firefox-46.0/widget/gtk/nsNativeThemeGTK.cpp.gtk3-20 firefox-46.0/widget/gtk/nsNativeThemeGTK.cpp
---- firefox-46.0/widget/gtk/nsNativeThemeGTK.cpp.gtk3-20	2016-04-25 14:46:15.300592722 +0200
-+++ firefox-46.0/widget/gtk/nsNativeThemeGTK.cpp	2016-04-25 14:40:42.000000000 +0200
+diff -up firefox-46.0.1/widget/gtk/nsNativeThemeGTK.cpp.gtk3-20 firefox-46.0.1/widget/gtk/nsNativeThemeGTK.cpp
+--- firefox-46.0.1/widget/gtk/nsNativeThemeGTK.cpp.gtk3-20	2016-05-03 07:31:12.000000000 +0200
++++ firefox-46.0.1/widget/gtk/nsNativeThemeGTK.cpp	2016-05-19 15:20:11.658519202 +0200
 @@ -1567,9 +1567,6 @@ nsNativeThemeGTK::GetMinimumWidgetSize(n
    case NS_THEME_RADIO_CONTAINER:
    case NS_THEME_CHECKBOX_LABEL:
@@ -1612,4 +1695,3 @@
    case NS_THEME_TOOLBAR_SEPARATOR:
      {
        gint separator_width;
-