mozilla-gtk3_20.patch
branchfirefox47
changeset 919 6838f0c032f8
parent 909 c6717354928b
child 926 6ab8b16f232c
equal deleted inserted replaced
918:0f93e8da34b6 919:6838f0c032f8
     1 diff -up firefox-46.0/widget/gtk/gtk3drawing.c.gtk3-20 firefox-46.0/widget/gtk/gtk3drawing.c
     1 diff -up firefox-46.0.1/widget/gtk/gtk3drawing.c.gtk3-20 firefox-46.0.1/widget/gtk/gtk3drawing.c
     2 --- firefox-46.0/widget/gtk/gtk3drawing.c.gtk3-20	2016-04-22 02:37:27.000000000 +0200
     2 --- firefox-46.0.1/widget/gtk/gtk3drawing.c.gtk3-20	2016-05-03 07:31:12.000000000 +0200
     3 +++ firefox-46.0/widget/gtk/gtk3drawing.c	2016-04-25 14:56:19.006992927 +0200
     3 +++ firefox-46.0.1/widget/gtk/gtk3drawing.c	2016-05-20 15:05:08.750151522 +0200
     4 @@ -17,32 +17,79 @@
     4 @@ -17,34 +17,86 @@
     5  
     5  
     6  #include <math.h>
     6  #include <math.h>
     7  
     7  
     8 +#define MOZ_WIDGET_STYLES 4
     8 +#define MOZ_WIDGET_STYLES 4
     9 +
     9 +
    17 +        } entry;
    17 +        } entry;
    18 +
    18 +
    19 +        struct {
    19 +        struct {
    20 +            GtkStyleContext*  style;
    20 +            GtkStyleContext*  style;
    21 +        } button;
    21 +        } button;
       
    22 +
       
    23 +        struct {
       
    24 +            GtkStyleContext*  style;
       
    25 +            GtkStyleContext*  styleBackground;
       
    26 +        } tooltip;
    22 +
    27 +
    23 +        struct {
    28 +        struct {
    24 +            GtkStyleContext*  style;
    29 +            GtkStyleContext*  style;
    25 +            GtkStyleContext*  styleContents;
    30 +            GtkStyleContext*  styleContents;
    26 +            GtkStyleContext*  styleTrough;
    31 +            GtkStyleContext*  styleTrough;
    86  static GtkWidget* gFrameWidget;
    91  static GtkWidget* gFrameWidget;
    87  static GtkWidget* gStatusbarWidget;
    92  static GtkWidget* gStatusbarWidget;
    88 -static GtkWidget* gProgressWidget;
    93 -static GtkWidget* gProgressWidget;
    89 +static MozGtkWidget gProgressBar;
    94 +static MozGtkWidget gProgressBar;
    90  static GtkWidget* gTabWidget;
    95  static GtkWidget* gTabWidget;
    91  static GtkWidget* gTooltipWidget;
    96 -static GtkWidget* gTooltipWidget;
       
    97 +static MozGtkWidget gTooltip;
    92  static GtkWidget* gMenuBarWidget;
    98  static GtkWidget* gMenuBarWidget;
    93 @@ -78,6 +125,37 @@ static gboolean is_initialized;
    99  static GtkWidget* gMenuBarItemWidget;
       
   100  static GtkWidget* gMenuPopupWidget;
       
   101 @@ -78,6 +130,37 @@ static gboolean is_initialized;
    94  #define GTK_STATE_FLAG_CHECKED (1 << 11)
   102  #define GTK_STATE_FLAG_CHECKED (1 << 11)
    95  #endif
   103  #endif
    96  
   104  
    97 +void moz_gtk_widget_free(MozGtkWidget *aMozWidget)
   105 +void moz_gtk_widget_free(MozGtkWidget *aMozWidget)
    98 +{
   106 +{
   126 +                          GtkBorder *padding);
   134 +                          GtkBorder *padding);
   127 +
   135 +
   128  static GtkStateFlags
   136  static GtkStateFlags
   129  GetStateFlagsFromGtkWidgetState(GtkWidgetState* state)
   137  GetStateFlagsFromGtkWidgetState(GtkWidgetState* state)
   130  {
   138  {
   131 @@ -97,6 +175,41 @@ GetStateFlagsFromGtkWidgetState(GtkWidge
   139 @@ -97,6 +180,41 @@ GetStateFlagsFromGtkWidgetState(GtkWidge
   132      return stateFlags;
   140      return stateFlags;
   133  }
   141  }
   134  
   142  
   135 +GtkStyleContext *
   143 +GtkStyleContext *
   136 +moz_gtk_style_create(GtkCssNode *node, GtkStyleContext *parent)
   144 +moz_gtk_style_create(GtkCssNode *node, GtkStyleContext *parent)
   168 +}
   176 +}
   169 +
   177 +
   170  /* Because we have such an unconventional way of drawing widgets, signal to the GTK theme engine
   178  /* Because we have such an unconventional way of drawing widgets, signal to the GTK theme engine
   171     that they are drawing for Mozilla instead of a conventional GTK app so they can do any specific
   179     that they are drawing for Mozilla instead of a conventional GTK app so they can do any specific
   172     things they may want to do. */
   180     things they may want to do. */
   173 @@ -141,9 +254,16 @@ setup_widget_prototype(GtkWidget* widget
   181 @@ -141,9 +259,16 @@ setup_widget_prototype(GtkWidget* widget
   174  static gint
   182  static gint
   175  ensure_button_widget()
   183  ensure_button_widget()
   176  {
   184  {
   177 -    if (!gButtonWidget) {
   185 -    if (!gButtonWidget) {
   178 -        gButtonWidget = gtk_button_new_with_label("M");
   186 -        gButtonWidget = gtk_button_new_with_label("M");
   188 +
   196 +
   189 +        gButton.button.style = moz_gtk_style_create(&path[0], NULL);
   197 +        gButton.button.style = moz_gtk_style_create(&path[0], NULL);
   190      }
   198      }
   191      return MOZ_GTK_SUCCESS;
   199      return MOZ_GTK_SUCCESS;
   192  }
   200  }
   193 @@ -195,9 +315,21 @@ ensure_button_arrow_widget()
   201 @@ -195,9 +320,21 @@ ensure_button_arrow_widget()
   194  static gint
   202  static gint
   195  ensure_checkbox_widget()
   203  ensure_checkbox_widget()
   196  {
   204  {
   197 -    if (!gCheckboxWidget) {
   205 -    if (!gCheckboxWidget) {
   198 -        gCheckboxWidget = gtk_check_button_new_with_label("M");
   206 -        gCheckboxWidget = gtk_check_button_new_with_label("M");
   213 +        gCheckbox.check.styleLabel = moz_gtk_style_create(&path[2],
   221 +        gCheckbox.check.styleLabel = moz_gtk_style_create(&path[2],
   214 +                                       gCheckbox.check.style);
   222 +                                       gCheckbox.check.style);
   215      }
   223      }
   216      return MOZ_GTK_SUCCESS;
   224      return MOZ_GTK_SUCCESS;
   217  }
   225  }
   218 @@ -205,9 +337,21 @@ ensure_checkbox_widget()
   226 @@ -205,9 +342,21 @@ ensure_checkbox_widget()
   219  static gint
   227  static gint
   220  ensure_radiobutton_widget()
   228  ensure_radiobutton_widget()
   221  {
   229  {
   222 -    if (!gRadiobuttonWidget) {
   230 -    if (!gRadiobuttonWidget) {
   223 -        gRadiobuttonWidget = gtk_radio_button_new_with_label(NULL, "M");
   231 -        gRadiobuttonWidget = gtk_radio_button_new_with_label(NULL, "M");
   238 +        gRadiobutton.check.styleLabel = moz_gtk_style_create(&path[2],
   246 +        gRadiobutton.check.styleLabel = moz_gtk_style_create(&path[2],
   239 +                                          gRadiobutton.check.style);
   247 +                                          gRadiobutton.check.style);
   240      }
   248      }
   241      return MOZ_GTK_SUCCESS;
   249      return MOZ_GTK_SUCCESS;
   242  }
   250  }
   243 @@ -215,25 +359,62 @@ ensure_radiobutton_widget()
   251 @@ -215,25 +364,62 @@ ensure_radiobutton_widget()
   244  static gint
   252  static gint
   245  ensure_scrollbar_widget()
   253  ensure_scrollbar_widget()
   246  {
   254  {
   247 -    if (!gVertScrollbarWidget) {
   255 -    if (!gVertScrollbarWidget) {
   248 -        gVertScrollbarWidget = gtk_scrollbar_new(GTK_ORIENTATION_VERTICAL, NULL);
   256 -        gVertScrollbarWidget = gtk_scrollbar_new(GTK_ORIENTATION_VERTICAL, NULL);
   314 +    }
   322 +    }
   315 +    return MOZ_GTK_SUCCESS;
   323 +    return MOZ_GTK_SUCCESS;
   316  }
   324  }
   317  
   325  
   318  static gint
   326  static gint
   319 @@ -253,9 +434,19 @@ ensure_scale_widget()
   327 @@ -253,9 +439,19 @@ ensure_scale_widget()
   320  static gint
   328  static gint
   321  ensure_entry_widget()
   329  ensure_entry_widget()
   322  {
   330  {
   323 -    if (!gEntryWidget) {
   331 -    if (!gEntryWidget) {
   324 -        gEntryWidget = gtk_entry_new();
   332 -        gEntryWidget = gtk_entry_new();
   337 +        gEntry.entry.styleSelection = moz_gtk_style_create(&path[1], 
   345 +        gEntry.entry.styleSelection = moz_gtk_style_create(&path[1], 
   338 +                                                           gEntry.entry.style);
   346 +                                                           gEntry.entry.style);
   339      }
   347      }
   340      return MOZ_GTK_SUCCESS;
   348      return MOZ_GTK_SUCCESS;
   341  }
   349  }
   342 @@ -387,9 +578,9 @@ moz_gtk_get_combo_box_entry_inner_widget
   350 @@ -387,9 +583,9 @@ moz_gtk_get_combo_box_entry_inner_widget
   343          g_object_add_weak_pointer(G_OBJECT(widget),
   351          g_object_add_weak_pointer(G_OBJECT(widget),
   344                                    (gpointer) &gComboBoxEntryButtonWidget);
   352                                    (gpointer) &gComboBoxEntryButtonWidget);
   345      } else if (GTK_IS_ENTRY(widget)) {
   353      } else if (GTK_IS_ENTRY(widget)) {
   346 -        gComboBoxEntryTextareaWidget = widget;
   354 -        gComboBoxEntryTextareaWidget = widget;
   347 +        gComboBoxEntryTextarea.widget = widget;
   355 +        gComboBoxEntryTextarea.widget = widget;
   349 -                                  (gpointer) &gComboBoxEntryTextareaWidget);
   357 -                                  (gpointer) &gComboBoxEntryTextareaWidget);
   350 +                                  (gpointer) &gComboBoxEntryTextarea.widget);
   358 +                                  (gpointer) &gComboBoxEntryTextarea.widget);
   351      } else
   359      } else
   352          return;
   360          return;
   353      gtk_widget_realize(widget);
   361      gtk_widget_realize(widget);
   354 @@ -411,7 +602,7 @@ ensure_combo_box_entry_widgets()
   362 @@ -411,7 +607,7 @@ ensure_combo_box_entry_widgets()
   355  {
   363  {
   356      GtkWidget* buttonChild;
   364      GtkWidget* buttonChild;
   357  
   365  
   358 -    if (gComboBoxEntryTextareaWidget &&
   366 -    if (gComboBoxEntryTextareaWidget &&
   359 +    if (gComboBoxEntryTextarea.widget &&
   367 +    if (gComboBoxEntryTextarea.widget &&
   360              gComboBoxEntryButtonWidget &&
   368              gComboBoxEntryButtonWidget &&
   361              gComboBoxEntryArrowWidget)
   369              gComboBoxEntryArrowWidget)
   362          return MOZ_GTK_SUCCESS;
   370          return MOZ_GTK_SUCCESS;
   363 @@ -427,9 +618,9 @@ ensure_combo_box_entry_widgets()
   371 @@ -427,9 +623,9 @@ ensure_combo_box_entry_widgets()
   364                           moz_gtk_get_combo_box_entry_inner_widgets,
   372                           moz_gtk_get_combo_box_entry_inner_widgets,
   365                           NULL);
   373                           NULL);
   366  
   374  
   367 -    if (!gComboBoxEntryTextareaWidget) {
   375 -    if (!gComboBoxEntryTextareaWidget) {
   368 +    if (!gComboBoxEntryTextarea.widget) {
   376 +    if (!gComboBoxEntryTextarea.widget) {
   370 -        gComboBoxEntryTextareaWidget = gEntryWidget;
   378 -        gComboBoxEntryTextareaWidget = gEntryWidget;
   371 +        gComboBoxEntryTextarea.widget = gEntry.widget;
   379 +        gComboBoxEntryTextarea.widget = gEntry.widget;
   372      }
   380      }
   373  
   381  
   374      if (gComboBoxEntryButtonWidget) {
   382      if (gComboBoxEntryButtonWidget) {
   375 @@ -530,9 +721,21 @@ ensure_tab_widget()
   383 @@ -507,12 +703,18 @@ ensure_toolbar_separator_widget()
       
   384  static gint
       
   385  ensure_tooltip_widget()
       
   386  {
       
   387 -    if (!gTooltipWidget) {
       
   388 -        gTooltipWidget = gtk_window_new(GTK_WINDOW_POPUP);
       
   389 -        GtkStyleContext* style = gtk_widget_get_style_context(gTooltipWidget);
       
   390 -        gtk_style_context_add_class(style, GTK_STYLE_CLASS_TOOLTIP);
       
   391 -        gtk_widget_realize(gTooltipWidget);
       
   392 -        moz_gtk_set_widget_name(gTooltipWidget);
       
   393 +    if (!gTooltip.widget) {
       
   394 +        GtkCssNode path[] = { 
       
   395 +            { GTK_TYPE_TOOLTIP, "tooltip", NULL, NULL},
       
   396 +            { GTK_TYPE_TOOLTIP, "tooltip", "background", NULL},
       
   397 +        };
       
   398 +
       
   399 +        gTooltip.widget = gtk_window_new(GTK_WINDOW_POPUP);
       
   400 +        gtk_widget_realize(gTooltip.widget);
       
   401 +        moz_gtk_set_widget_name(gTooltip.widget);
       
   402 +
       
   403 +        gTooltip.tooltip.style = moz_gtk_style_create(&path[0], NULL);
       
   404 +        gTooltip.tooltip.styleBackground = moz_gtk_style_create(&path[1], NULL);
       
   405      }
       
   406      return MOZ_GTK_SUCCESS;
       
   407  }
       
   408 @@ -530,9 +732,21 @@ ensure_tab_widget()
   376  static gint
   409  static gint
   377  ensure_progress_widget()
   410  ensure_progress_widget()
   378  {
   411  {
   379 -    if (!gProgressWidget) {
   412 -    if (!gProgressWidget) {
   380 -        gProgressWidget = gtk_progress_bar_new();
   413 -        gProgressWidget = gtk_progress_bar_new();
   395 +        gProgressBar.progress.styleProgress = moz_gtk_style_create(&path[2],
   428 +        gProgressBar.progress.styleProgress = moz_gtk_style_create(&path[2],
   396 +                                                gProgressBar.progress.styleTrough);
   429 +                                                gProgressBar.progress.styleTrough);
   397      }
   430      }
   398      return MOZ_GTK_SUCCESS;
   431      return MOZ_GTK_SUCCESS;
   399  }
   432  }
   400 @@ -638,6 +841,11 @@ static gint
   433 @@ -638,6 +852,11 @@ static gint
   401  ensure_check_menu_item_widget()
   434  ensure_check_menu_item_widget()
   402  {
   435  {
   403      if (!gCheckMenuItemWidget) {
   436      if (!gCheckMenuItemWidget) {
   404 +        GtkCssNode path[] = {
   437 +        GtkCssNode path[] = {
   405 +           { GTK_TYPE_CHECK_MENU_ITEM, "menuitem", NULL, NULL },
   438 +           { GTK_TYPE_CHECK_MENU_ITEM, "menuitem", NULL, NULL },
   407 +        };
   440 +        };
   408 +
   441 +
   409          ensure_menu_popup_widget();
   442          ensure_menu_popup_widget();
   410          gCheckMenuItemWidget = gtk_check_menu_item_new_with_label("M");
   443          gCheckMenuItemWidget = gtk_check_menu_item_new_with_label("M");
   411          gtk_menu_shell_append(GTK_MENU_SHELL(gMenuPopupWidget),
   444          gtk_menu_shell_append(GTK_MENU_SHELL(gMenuPopupWidget),
   412 @@ -752,7 +960,7 @@ moz_gtk_checkbox_get_metrics(gint* indic
   445 @@ -752,7 +971,7 @@ moz_gtk_checkbox_get_metrics(gint* indic
   413  {
   446  {
   414      ensure_checkbox_widget();
   447      ensure_checkbox_widget();
   415  
   448  
   416 -    gtk_widget_style_get (gCheckboxWidget,
   449 -    gtk_widget_style_get (gCheckboxWidget,
   417 +    gtk_widget_style_get (gCheckbox.widget,
   450 +    gtk_widget_style_get (gCheckbox.widget,
   418                            "indicator_size", indicator_size,
   451                            "indicator_size", indicator_size,
   419                            "indicator_spacing", indicator_spacing,
   452                            "indicator_spacing", indicator_spacing,
   420                            NULL);
   453                            NULL);
   421 @@ -765,7 +973,7 @@ moz_gtk_radio_get_metrics(gint* indicato
   454 @@ -765,7 +984,7 @@ moz_gtk_radio_get_metrics(gint* indicato
   422  {
   455  {
   423      ensure_radiobutton_widget();
   456      ensure_radiobutton_widget();
   424  
   457  
   425 -    gtk_widget_style_get (gRadiobuttonWidget,
   458 -    gtk_widget_style_get (gRadiobuttonWidget,
   426 +    gtk_widget_style_get (gRadiobutton.widget,
   459 +    gtk_widget_style_get (gRadiobutton.widget,
   427                            "indicator_size", indicator_size,
   460                            "indicator_size", indicator_size,
   428                            "indicator_spacing", indicator_spacing,
   461                            "indicator_spacing", indicator_spacing,
   429                            NULL);
   462                            NULL);
   430 @@ -778,13 +986,12 @@ moz_gtk_get_focus_outline_size(gint* foc
   463 @@ -778,13 +997,13 @@ moz_gtk_get_focus_outline_size(gint* foc
   431  {
   464  {
   432      GtkBorder border;
   465      GtkBorder border;
   433      GtkBorder padding;
   466      GtkBorder padding;
   434 -    GtkStyleContext *style;
   467 -    GtkStyleContext *style;
   435 +    GtkStyleContext* style = gEntry.entry.style;
   468 +    GtkStyleContext* style;
   436  
   469  
   437      ensure_entry_widget();
   470      ensure_entry_widget();
   438 -    style = gtk_widget_get_style_context(gEntryWidget);
   471 -    style = gtk_widget_get_style_context(gEntryWidget);
   439  
   472  
   440 -    gtk_style_context_get_border(style, 0, &border);
   473 -    gtk_style_context_get_border(style, 0, &border);
   441 -    gtk_style_context_get_padding(style, 0, &padding);
   474 -    gtk_style_context_get_padding(style, 0, &padding);
       
   475 +    style = gEntry.entry.style;
   442 +    gtk_style_context_get_border(style, gtk_style_context_get_state(style), &border);
   476 +    gtk_style_context_get_border(style, gtk_style_context_get_state(style), &border);
   443 +    gtk_style_context_get_padding(style, gtk_style_context_get_state(style), &padding);
   477 +    gtk_style_context_get_padding(style, gtk_style_context_get_state(style), &padding);
   444      *focus_h_width = border.left + padding.left;
   478      *focus_h_width = border.left + padding.left;
   445      *focus_v_width = border.top + padding.top;
   479      *focus_v_width = border.top + padding.top;
   446      return MOZ_GTK_SUCCESS;
   480      return MOZ_GTK_SUCCESS;
   447 @@ -821,7 +1028,7 @@ moz_gtk_button_get_default_overflow(gint
   481 @@ -821,7 +1040,7 @@ moz_gtk_button_get_default_overflow(gint
   448      GtkBorder* default_outside_border;
   482      GtkBorder* default_outside_border;
   449  
   483  
   450      ensure_button_widget();
   484      ensure_button_widget();
   451 -    gtk_widget_style_get(gButtonWidget,
   485 -    gtk_widget_style_get(gButtonWidget,
   452 +    gtk_widget_style_get(gButton.widget,
   486 +    gtk_widget_style_get(gButton.widget,
   453                           "default-outside-border", &default_outside_border,
   487                           "default-outside-border", &default_outside_border,
   454                           NULL);
   488                           NULL);
   455  
   489  
   456 @@ -844,7 +1051,7 @@ moz_gtk_button_get_default_border(gint*
   490 @@ -844,7 +1063,7 @@ moz_gtk_button_get_default_border(gint*
   457      GtkBorder* default_border;
   491      GtkBorder* default_border;
   458  
   492  
   459      ensure_button_widget();
   493      ensure_button_widget();
   460 -    gtk_widget_style_get(gButtonWidget,
   494 -    gtk_widget_style_get(gButtonWidget,
   461 +    gtk_widget_style_get(gButton.widget,
   495 +    gtk_widget_style_get(gButton.widget,
   462                           "default-border", &default_border,
   496                           "default-border", &default_border,
   463                           NULL);
   497                           NULL);
   464  
   498  
   465 @@ -935,7 +1142,7 @@ moz_gtk_button_paint(cairo_t *cr, GdkRec
   499 @@ -935,7 +1154,7 @@ moz_gtk_button_paint(cairo_t *cr, GdkRec
   466  
   500  
   467      if (state->focused) {
   501      if (state->focused) {
   468          GtkBorder border;
   502          GtkBorder border;
   469 -        gtk_style_context_get_border(style, state_flags, &border);
   503 -        gtk_style_context_get_border(style, state_flags, &border);
   470 +        moz_gtk_get_style_border(style, state_flags, &border);
   504 +        moz_gtk_get_style_border(style, state_flags, &border);
   471          x += border.left;
   505          x += border.left;
   472          y += border.top;
   506          y += border.top;
   473          width -= (border.left + border.right);
   507          width -= (border.left + border.right);
   474 @@ -956,15 +1163,14 @@ moz_gtk_toggle_paint(cairo_t *cr, GdkRec
   508 @@ -956,15 +1175,14 @@ moz_gtk_toggle_paint(cairo_t *cr, GdkRec
   475      gint indicator_size, indicator_spacing;
   509      gint indicator_size, indicator_spacing;
   476      gint x, y, width, height;
   510      gint x, y, width, height;
   477      gint focus_x, focus_y, focus_width, focus_height;
   511      gint focus_x, focus_y, focus_width, focus_height;
   478 -    GtkWidget *w;
   512 -    GtkWidget *w;
   479 -    GtkStyleContext *style;
   513 -    GtkStyleContext *style;
   488 -        w = gCheckboxWidget;
   522 -        w = gCheckboxWidget;
   489 +        w = &gCheckbox;
   523 +        w = &gCheckbox;
   490      }
   524      }
   491  
   525  
   492      // XXX we should assert rect->height >= indicator_size too
   526      // XXX we should assert rect->height >= indicator_size too
   493 @@ -983,11 +1189,9 @@ moz_gtk_toggle_paint(cairo_t *cr, GdkRec
   527 @@ -983,11 +1201,9 @@ moz_gtk_toggle_paint(cairo_t *cr, GdkRec
   494      focus_width = width + 2 * indicator_spacing;
   528      focus_width = width + 2 * indicator_spacing;
   495      focus_height = height + 2 * indicator_spacing;
   529      focus_height = height + 2 * indicator_spacing;
   496    
   530    
   497 -    style = gtk_widget_get_style_context(w);
   531 -    style = gtk_widget_get_style_context(w);
   498 -
   532 -
   503 +    gtk_widget_set_direction(w->widget, direction);
   537 +    gtk_widget_set_direction(w->widget, direction);
   504 +    gtk_style_context_save(w->check.styleCheck);
   538 +    gtk_style_context_save(w->check.styleCheck);
   505  
   539  
   506      if (selected)
   540      if (selected)
   507          state_flags |= checkbox_check_state;
   541          state_flags |= checkbox_check_state;
   508 @@ -995,13 +1199,15 @@ moz_gtk_toggle_paint(cairo_t *cr, GdkRec
   542 @@ -995,13 +1211,15 @@ moz_gtk_toggle_paint(cairo_t *cr, GdkRec
   509      if (inconsistent)
   543      if (inconsistent)
   510          state_flags |= GTK_STATE_FLAG_INCONSISTENT;
   544          state_flags |= GTK_STATE_FLAG_INCONSISTENT;
   511  
   545  
   512 -    gtk_style_context_set_state(style, state_flags);
   546 -    gtk_style_context_set_state(style, state_flags);
   513 +    gtk_style_context_set_state(w->check.styleCheck, state_flags);
   547 +    gtk_style_context_set_state(w->check.styleCheck, state_flags);
   523 -            gtk_render_focus(style, cr, focus_x, focus_y,
   557 -            gtk_render_focus(style, cr, focus_x, focus_y,
   524 +            gtk_render_focus(w->check.styleCheck, cr, focus_x, focus_y,
   558 +            gtk_render_focus(w->check.styleCheck, cr, focus_x, focus_y,
   525                              focus_width, focus_height);
   559                              focus_width, focus_height);
   526          }
   560          }
   527      }
   561      }
   528 @@ -1010,15 +1216,14 @@ moz_gtk_toggle_paint(cairo_t *cr, GdkRec
   562 @@ -1010,15 +1228,14 @@ moz_gtk_toggle_paint(cairo_t *cr, GdkRec
   529          * 'indeterminate' type on checkboxes. In GTK, the shadow type
   563          * 'indeterminate' type on checkboxes. In GTK, the shadow type
   530          * must also be changed for the state to be drawn.
   564          * must also be changed for the state to be drawn.
   531          */        
   565          */        
   532 -        gtk_style_context_add_class(style, GTK_STYLE_CLASS_CHECK);
   566 -        gtk_style_context_add_class(style, GTK_STYLE_CLASS_CHECK);
   533 -        gtk_toggle_button_set_inconsistent(GTK_TOGGLE_BUTTON(gCheckboxWidget), inconsistent);
   567 -        gtk_toggle_button_set_inconsistent(GTK_TOGGLE_BUTTON(gCheckboxWidget), inconsistent);
   543 -    gtk_style_context_restore(style);
   577 -    gtk_style_context_restore(style);
   544 +    gtk_style_context_restore(w->check.styleCheck);
   578 +    gtk_style_context_restore(w->check.styleCheck);
   545  
   579  
   546      return MOZ_GTK_SUCCESS;
   580      return MOZ_GTK_SUCCESS;
   547  }
   581  }
   548 @@ -1035,8 +1240,8 @@ calculate_button_inner_rect(GtkWidget* b
   582 @@ -1035,8 +1252,8 @@ calculate_button_inner_rect(GtkWidget* b
   549      style = gtk_widget_get_style_context(button);
   583      style = gtk_widget_get_style_context(button);
   550  
   584  
   551      /* This mirrors gtkbutton's child positioning */
   585      /* This mirrors gtkbutton's child positioning */
   552 -    gtk_style_context_get_border(style, 0, &border);
   586 -    gtk_style_context_get_border(style, 0, &border);
   553 -    gtk_style_context_get_padding(style, 0, &padding);
   587 -    gtk_style_context_get_padding(style, 0, &padding);
   554 +    gtk_style_context_get_border(style, gtk_style_context_get_state(style), &border);
   588 +    gtk_style_context_get_border(style, gtk_style_context_get_state(style), &border);
   555 +    gtk_style_context_get_padding(style, gtk_style_context_get_state(style), &padding);
   589 +    gtk_style_context_get_padding(style, gtk_style_context_get_state(style), &padding);
   556  
   590  
   557      inner_rect->x = rect->x + border.left + padding.left;
   591      inner_rect->x = rect->x + border.left + padding.left;
   558      inner_rect->y = rect->y + padding.top + border.top;
   592      inner_rect->y = rect->y + padding.top + border.top;
   559 @@ -1099,9 +1304,9 @@ moz_gtk_scrollbar_button_paint(cairo_t *
   593 @@ -1099,9 +1316,9 @@ moz_gtk_scrollbar_button_paint(cairo_t *
   560      ensure_scrollbar_widget();
   594      ensure_scrollbar_widget();
   561  
   595  
   562      if (flags & MOZ_GTK_STEPPER_VERTICAL)
   596      if (flags & MOZ_GTK_STEPPER_VERTICAL)
   563 -        scrollbar = gVertScrollbarWidget;
   597 -        scrollbar = gVertScrollbarWidget;
   564 +        scrollbar = gVertScrollbar.widget;
   598 +        scrollbar = gVertScrollbar.widget;
   566 -        scrollbar = gHorizScrollbarWidget;
   600 -        scrollbar = gHorizScrollbarWidget;
   567 +        scrollbar = gHorizScrollbar.widget;
   601 +        scrollbar = gHorizScrollbar.widget;
   568  
   602  
   569      gtk_widget_set_direction(scrollbar, direction);
   603      gtk_widget_set_direction(scrollbar, direction);
   570  
   604  
   571 @@ -1181,25 +1386,22 @@ moz_gtk_scrollbar_trough_paint(GtkThemeW
   605 @@ -1181,25 +1398,22 @@ moz_gtk_scrollbar_trough_paint(GtkThemeW
   572                                 GtkTextDirection direction)
   606                                 GtkTextDirection direction)
   573  {
   607  {
   574      GtkStyleContext* style;
   608      GtkStyleContext* style;
   575 -    GtkScrollbar *scrollbar;
   609 -    GtkScrollbar *scrollbar;
   576  
   610  
   600 +        style = gVertScrollbar.scroll.style;
   634 +        style = gVertScrollbar.scroll.style;
   601 +    }
   635 +    }
   602  
   636  
   603      gtk_render_background(style, cr, rect->x, rect->y, rect->width, rect->height);
   637      gtk_render_background(style, cr, rect->x, rect->y, rect->width, rect->height);
   604      gtk_render_frame(style, cr, rect->x, rect->y, rect->width, rect->height);
   638      gtk_render_frame(style, cr, rect->x, rect->y, rect->width, rect->height);
   605 @@ -1208,7 +1410,6 @@ moz_gtk_scrollbar_trough_paint(GtkThemeW
   639 @@ -1208,7 +1422,6 @@ moz_gtk_scrollbar_trough_paint(GtkThemeW
   606          gtk_render_focus(style, cr,
   640          gtk_render_focus(style, cr,
   607                           rect->x, rect->y, rect->width, rect->height);
   641                           rect->x, rect->y, rect->width, rect->height);
   608      }
   642      }
   609 -    gtk_style_context_restore(style);
   643 -    gtk_style_context_restore(style);
   610      return MOZ_GTK_SUCCESS;
   644      return MOZ_GTK_SUCCESS;
   611  }
   645  }
   612  
   646  
   613 @@ -1220,24 +1421,20 @@ moz_gtk_scrollbar_thumb_paint(GtkThemeWi
   647 @@ -1220,24 +1433,20 @@ moz_gtk_scrollbar_thumb_paint(GtkThemeWi
   614  {
   648  {
   615      GtkStateFlags state_flags = GetStateFlagsFromGtkWidgetState(state);
   649      GtkStateFlags state_flags = GetStateFlagsFromGtkWidgetState(state);
   616      GtkStyleContext* style;
   650      GtkStyleContext* style;
   617 -    GtkScrollbar *scrollbar;
   651 -    GtkScrollbar *scrollbar;
   618      GtkBorder margin;
   652      GtkBorder margin;
   641      gtk_style_context_set_state(style, state_flags);
   675      gtk_style_context_set_state(style, state_flags);
   642 -
   676 -
   643      gtk_style_context_get_margin (style, state_flags, &margin);
   677      gtk_style_context_get_margin (style, state_flags, &margin);
   644  
   678  
   645      gtk_render_slider(style, cr,
   679      gtk_render_slider(style, cr,
   646 @@ -1248,8 +1445,6 @@ moz_gtk_scrollbar_thumb_paint(GtkThemeWi
   680 @@ -1248,8 +1457,6 @@ moz_gtk_scrollbar_thumb_paint(GtkThemeWi
   647                       (widget == MOZ_GTK_SCROLLBAR_THUMB_HORIZONTAL) ?
   681                       (widget == MOZ_GTK_SCROLLBAR_THUMB_HORIZONTAL) ?
   648                       GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL);
   682                       GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL);
   649  
   683  
   650 -    gtk_style_context_restore(style);
   684 -    gtk_style_context_restore(style);
   651 -
   685 -
   652      return MOZ_GTK_SUCCESS;
   686      return MOZ_GTK_SUCCESS;
   653  }
   687  }
   654  
   688  
   655 @@ -1260,8 +1455,8 @@ moz_gtk_spin_paint(cairo_t *cr, GdkRecta
   689 @@ -1260,8 +1467,8 @@ moz_gtk_spin_paint(cairo_t *cr, GdkRecta
   656      GtkStyleContext* style;
   690      GtkStyleContext* style;
   657  
   691  
   658      ensure_spin_widget();
   692      ensure_spin_widget();
   659 -    gtk_widget_set_direction(gSpinWidget, direction);
   693 -    gtk_widget_set_direction(gSpinWidget, direction);
   660 -    style = gtk_widget_get_style_context(gSpinWidget);
   694 -    style = gtk_widget_get_style_context(gSpinWidget);
   661 +    gtk_widget_set_direction(gSpin.widget, direction);
   695 +    gtk_widget_set_direction(gSpin.widget, direction);
   662 +    style = gSpin.spin.style;
   696 +    style = gSpin.spin.style;
   663      gtk_style_context_save(style);
   697      gtk_style_context_save(style);
   664      gtk_style_context_add_class(style, GTK_STYLE_CLASS_SPINBUTTON);
   698      gtk_style_context_add_class(style, GTK_STYLE_CLASS_SPINBUTTON);
   665      gtk_render_background(style, cr, rect->x, rect->y, rect->width, rect->height);
   699      gtk_render_background(style, cr, rect->x, rect->y, rect->width, rect->height);
   666 @@ -1280,11 +1475,10 @@ moz_gtk_spin_updown_paint(cairo_t *cr, G
   700 @@ -1280,11 +1487,10 @@ moz_gtk_spin_updown_paint(cairo_t *cr, G
   667      GtkStyleContext* style;
   701      GtkStyleContext* style;
   668  
   702  
   669      ensure_spin_widget();
   703      ensure_spin_widget();
   670 -    style = gtk_widget_get_style_context(gSpinWidget);
   704 -    style = gtk_widget_get_style_context(gSpinWidget);
   671 +    style = gSpin.spin.style;
   705 +    style = gSpin.spin.style;
   675 -    gtk_widget_set_direction(gSpinWidget, direction);
   709 -    gtk_widget_set_direction(gSpinWidget, direction);
   676 +    gtk_widget_set_direction(gSpin.widget, direction);
   710 +    gtk_widget_set_direction(gSpin.widget, direction);
   677  
   711  
   678      gtk_render_background(style, cr, rect->x, rect->y, rect->width, rect->height);
   712      gtk_render_background(style, cr, rect->x, rect->y, rect->width, rect->height);
   679      gtk_render_frame(style, cr, rect->x, rect->y, rect->width, rect->height);
   713      gtk_render_frame(style, cr, rect->x, rect->y, rect->width, rect->height);
   680 @@ -1450,15 +1644,13 @@ moz_gtk_vpaned_paint(cairo_t *cr, GdkRec
   714 @@ -1450,15 +1656,13 @@ moz_gtk_vpaned_paint(cairo_t *cr, GdkRec
   681  static gint
   715  static gint
   682  moz_gtk_entry_paint(cairo_t *cr, GdkRectangle* rect,
   716  moz_gtk_entry_paint(cairo_t *cr, GdkRectangle* rect,
   683                      GtkWidgetState* state,
   717                      GtkWidgetState* state,
   684 -                    GtkWidget* widget, GtkTextDirection direction)
   718 -                    GtkWidget* widget, GtkTextDirection direction)
   685 +                    MozGtkWidget* w, GtkTextDirection direction)
   719 +                    MozGtkWidget* w, GtkTextDirection direction)
   694 -    style = gtk_widget_get_style_context(widget);
   728 -    style = gtk_widget_get_style_context(widget);
   695 +    gtk_widget_set_direction(w->widget, direction);
   729 +    gtk_widget_set_direction(w->widget, direction);
   696  
   730  
   697      if (draw_focus_outline_only) {
   731      if (draw_focus_outline_only) {
   698          // Inflate the given 'rect' with the focus outline size.
   732          // Inflate the given 'rect' with the focus outline size.
   699 @@ -1478,10 +1670,9 @@ moz_gtk_entry_paint(cairo_t *cr, GdkRect
   733 @@ -1478,10 +1682,9 @@ moz_gtk_entry_paint(cairo_t *cr, GdkRect
   700       * textarea window uses gtk_paint_flat_box when exposed */
   734       * textarea window uses gtk_paint_flat_box when exposed */
   701  
   735  
   702      /* This gets us a lovely greyish disabledish look */
   736      /* This gets us a lovely greyish disabledish look */
   703 -    gtk_widget_set_sensitive(widget, !state->disabled);
   737 -    gtk_widget_set_sensitive(widget, !state->disabled);
   704 +    gtk_widget_set_sensitive(w->widget, !state->disabled);
   738 +    gtk_widget_set_sensitive(w->widget, !state->disabled);
   706      gtk_style_context_save(style);
   740      gtk_style_context_save(style);
   707 -    gtk_style_context_add_class(style, GTK_STYLE_CLASS_ENTRY);
   741 -    gtk_style_context_add_class(style, GTK_STYLE_CLASS_ENTRY);
   708    
   742    
   709      /* Now paint the shadow and focus border.
   743      /* Now paint the shadow and focus border.
   710       * We do like in gtk_entry_draw_frame, we first draw the shadow, a tad
   744       * We do like in gtk_entry_draw_frame, we first draw the shadow, a tad
   711 @@ -1531,7 +1722,7 @@ moz_gtk_treeview_paint(cairo_t *cr, GdkR
   745 @@ -1531,7 +1734,7 @@ moz_gtk_treeview_paint(cairo_t *cr, GdkR
   712      style = gtk_widget_get_style_context(gScrolledWindowWidget);
   746      style = gtk_widget_get_style_context(gScrolledWindowWidget);
   713      gtk_style_context_save(style);
   747      gtk_style_context_save(style);
   714      gtk_style_context_add_class(style, GTK_STYLE_CLASS_FRAME);    
   748      gtk_style_context_add_class(style, GTK_STYLE_CLASS_FRAME);    
   715 -    gtk_style_context_get_border(style, state_flags, &border);
   749 -    gtk_style_context_get_border(style, state_flags, &border);
   716 +    moz_gtk_get_style_border(style, state_flags, &border);
   750 +    moz_gtk_get_style_border(style, state_flags, &border);
   717      xthickness = border.left;
   751      xthickness = border.left;
   718      ythickness = border.top;    
   752      ythickness = border.top;    
   719  
   753  
   720 @@ -1702,7 +1893,7 @@ moz_gtk_combo_box_paint(cairo_t *cr, Gdk
   754 @@ -1702,7 +1905,7 @@ moz_gtk_combo_box_paint(cairo_t *cr, Gdk
   721          if (direction == GTK_TEXT_DIR_LTR) {
   755          if (direction == GTK_TEXT_DIR_LTR) {
   722              GtkBorder padding;
   756              GtkBorder padding;
   723              GtkStateFlags state_flags = GetStateFlagsFromGtkWidgetState(state);
   757              GtkStateFlags state_flags = GetStateFlagsFromGtkWidgetState(state);
   724 -            gtk_style_context_get_padding(style, state_flags, &padding);
   758 -            gtk_style_context_get_padding(style, state_flags, &padding);
   725 +            moz_gtk_get_style_padding(style, state_flags, &padding);
   759 +            moz_gtk_get_style_padding(style, state_flags, &padding);
   726              arrow_rect.x -= padding.left;
   760              arrow_rect.x -= padding.left;
   727          }
   761          }
   728          else
   762          else
   729 @@ -1804,29 +1995,27 @@ moz_gtk_container_paint(cairo_t *cr, Gdk
   763 @@ -1804,29 +2007,27 @@ moz_gtk_container_paint(cairo_t *cr, Gdk
   730                          gboolean isradio, GtkTextDirection direction)
   764                          gboolean isradio, GtkTextDirection direction)
   731  {
   765  {
   732      GtkStateFlags state_flags = GetStateFlagsFromGtkWidgetState(state);
   766      GtkStateFlags state_flags = GetStateFlagsFromGtkWidgetState(state);
   733 -    GtkStyleContext* style;
   767 -    GtkStyleContext* style;
   734 -    GtkWidget *widget;
   768 -    GtkWidget *widget;
   762 -    gtk_style_context_restore(style);
   796 -    gtk_style_context_restore(style);
   763 +    gtk_style_context_restore(widget->check.style);
   797 +    gtk_style_context_restore(widget->check.style);
   764    
   798    
   765      return MOZ_GTK_SUCCESS;
   799      return MOZ_GTK_SUCCESS;
   766  }
   800  }
   767 @@ -1836,32 +2025,26 @@ moz_gtk_toggle_label_paint(cairo_t *cr,
   801 @@ -1836,32 +2037,26 @@ moz_gtk_toggle_label_paint(cairo_t *cr,
   768                             GtkWidgetState* state, 
   802                             GtkWidgetState* state, 
   769                             gboolean isradio, GtkTextDirection direction)
   803                             gboolean isradio, GtkTextDirection direction)
   770  {
   804  {
   771 -    GtkStyleContext *style;
   805 -    GtkStyleContext *style;
   772 -    GtkWidget *widget;
   806 -    GtkWidget *widget;
   780 -        widget = gRadiobuttonWidget;
   814 -        widget = gRadiobuttonWidget;
   781 +        widget = &gRadiobutton;
   815 +        widget = &gRadiobutton;
   782      } else {
   816      } else {
   783          ensure_checkbox_widget();
   817          ensure_checkbox_widget();
   784 -        widget = gCheckboxWidget;
   818 -        widget = gCheckboxWidget;
   785 +        widget = &gCheckbox;
   819 -    }
   786      }
       
   787 -    style = gtk_widget_get_style_context(widget);
   820 -    style = gtk_widget_get_style_context(widget);
   788 -    gtk_style_context_save(style);
   821 -    gtk_style_context_save(style);
   789 -    if (isradio) {
   822 -    if (isradio) {
   790 -      gtk_style_context_add_class(style, GTK_STYLE_CLASS_RADIO);
   823 -      gtk_style_context_add_class(style, GTK_STYLE_CLASS_RADIO);
   791 -    } else {
   824 -    } else {
   792 -      gtk_style_context_add_class(style, GTK_STYLE_CLASS_CHECK);
   825 -      gtk_style_context_add_class(style, GTK_STYLE_CLASS_CHECK);
   793 -    }
   826 +        widget = &gCheckbox;
       
   827      }
   794 -    gtk_widget_set_direction(widget, direction);
   828 -    gtk_widget_set_direction(widget, direction);
   795 +    gtk_style_context_save(widget->check.styleLabel);
   829 +    gtk_style_context_save(widget->check.styleLabel);
   796 +    gtk_widget_set_direction(widget->widget, direction);
   830 +    gtk_widget_set_direction(widget->widget, direction);
   797  
   831  
   798 -    gtk_style_context_set_state(style, GetStateFlagsFromGtkWidgetState(state));
   832 -    gtk_style_context_set_state(style, GetStateFlagsFromGtkWidgetState(state));
   804 -    gtk_style_context_restore(style);
   838 -    gtk_style_context_restore(style);
   805 +    gtk_style_context_restore(widget->check.styleLabel);
   839 +    gtk_style_context_restore(widget->check.styleLabel);
   806  
   840  
   807      return MOZ_GTK_SUCCESS;
   841      return MOZ_GTK_SUCCESS;
   808  }
   842  }
   809 @@ -1922,7 +2105,7 @@ moz_gtk_toolbar_separator_paint(cairo_t
   843 @@ -1922,7 +2117,7 @@ moz_gtk_toolbar_separator_paint(cairo_t
   810                            rect->height * (end_fraction - start_fraction));
   844                            rect->height * (end_fraction - start_fraction));
   811      } else {
   845      } else {
   812          GtkBorder padding;
   846          GtkBorder padding;
   813 -        gtk_style_context_get_padding(style, 0, &padding);
   847 -        gtk_style_context_get_padding(style, 0, &padding);
   814 +        gtk_style_context_get_padding(style, gtk_style_context_get_state(style), &padding);
   848 +        gtk_style_context_get_padding(style, gtk_style_context_get_state(style), &padding);
   815      
   849      
   816          paint_width = padding.left;
   850          paint_width = padding.left;
   817          if (paint_width > rect->width)
   851          if (paint_width > rect->width)
   818 @@ -2006,18 +2189,13 @@ static gint
   852 @@ -1945,9 +2140,9 @@ moz_gtk_tooltip_paint(cairo_t *cr, GdkRe
       
   853      GtkStyleContext* style;
       
   854  
       
   855      ensure_tooltip_widget();
       
   856 -    gtk_widget_set_direction(gTooltipWidget, direction);
       
   857 +    gtk_widget_set_direction(gTooltip.widget, direction);
       
   858  
       
   859 -    style = gtk_widget_get_style_context(gTooltipWidget);
       
   860 +    style = gTooltip.tooltip.styleBackground;
       
   861      gtk_render_background(style, cr, rect->x, rect->y, rect->width, rect->height);
       
   862      gtk_render_frame(style, cr, rect->x, rect->y, rect->width, rect->height);
       
   863      return MOZ_GTK_SUCCESS;
       
   864 @@ -2006,18 +2201,13 @@ static gint
   819  moz_gtk_progressbar_paint(cairo_t *cr, GdkRectangle* rect,
   865  moz_gtk_progressbar_paint(cairo_t *cr, GdkRectangle* rect,
   820                            GtkTextDirection direction)
   866                            GtkTextDirection direction)
   821  {
   867  {
   822 -    GtkStyleContext* style;
   868 -    GtkStyleContext* style;
   823 -
   869 -
   837 +    gtk_render_frame(gProgressBar.progress.styleTrough, cr,
   883 +    gtk_render_frame(gProgressBar.progress.styleTrough, cr,
   838 +                     rect->x, rect->y, rect->width, rect->height);
   884 +                     rect->x, rect->y, rect->width, rect->height);
   839  
   885  
   840      return MOZ_GTK_SUCCESS;
   886      return MOZ_GTK_SUCCESS;
   841  }
   887  }
   842 @@ -2027,15 +2205,8 @@ moz_gtk_progress_chunk_paint(cairo_t *cr
   888 @@ -2027,15 +2217,8 @@ moz_gtk_progress_chunk_paint(cairo_t *cr
   843                               GtkTextDirection direction,
   889                               GtkTextDirection direction,
   844                               GtkThemeWidgetType widget)
   890                               GtkThemeWidgetType widget)
   845  {
   891  {
   846 -    GtkStyleContext* style;
   892 -    GtkStyleContext* style;
   847 -
   893 -
   854 -    gtk_style_context_add_class(style, GTK_STYLE_CLASS_PROGRESSBAR);
   900 -    gtk_style_context_add_class(style, GTK_STYLE_CLASS_PROGRESSBAR);
   855 +    gtk_widget_set_direction(gProgressBar.widget, direction);
   901 +    gtk_widget_set_direction(gProgressBar.widget, direction);
   856  
   902  
   857      if (widget == MOZ_GTK_PROGRESS_CHUNK_INDETERMINATE ||
   903      if (widget == MOZ_GTK_PROGRESS_CHUNK_INDETERMINATE ||
   858          widget == MOZ_GTK_PROGRESS_CHUNK_VERTICAL_INDETERMINATE) {
   904          widget == MOZ_GTK_PROGRESS_CHUNK_VERTICAL_INDETERMINATE) {
   859 @@ -2074,12 +2245,14 @@ moz_gtk_progress_chunk_paint(cairo_t *cr
   905 @@ -2074,12 +2257,14 @@ moz_gtk_progress_chunk_paint(cairo_t *cr
   860      // gtk_render_activity was used to render progress chunks on GTK versions
   906      // gtk_render_activity was used to render progress chunks on GTK versions
   861      // before 3.13.7, see bug 1173907.
   907      // before 3.13.7, see bug 1173907.
   862      if (!gtk_check_version(3, 13, 7)) {
   908      if (!gtk_check_version(3, 13, 7)) {
   863 -      gtk_render_background(style, cr, rect->x, rect->y, rect->width, rect->height);
   909 -      gtk_render_background(style, cr, rect->x, rect->y, rect->width, rect->height);
   864 -      gtk_render_frame(style, cr, rect->x, rect->y, rect->width, rect->height);
   910 -      gtk_render_frame(style, cr, rect->x, rect->y, rect->width, rect->height);
   873      }
   919      }
   874 -    gtk_style_context_restore(style);
   920 -    gtk_style_context_restore(style);
   875  
   921  
   876      return MOZ_GTK_SUCCESS;
   922      return MOZ_GTK_SUCCESS;
   877  }
   923  }
   878 @@ -2096,7 +2269,7 @@ moz_gtk_get_tab_thickness(void)
   924 @@ -2096,7 +2281,7 @@ moz_gtk_get_tab_thickness(void)
   879  
   925  
   880      style = gtk_widget_get_style_context(gTabWidget);
   926      style = gtk_widget_get_style_context(gTabWidget);
   881      gtk_style_context_add_class(style, GTK_STYLE_CLASS_NOTEBOOK);
   927      gtk_style_context_add_class(style, GTK_STYLE_CLASS_NOTEBOOK);
   882 -    gtk_style_context_get_border(style, 0, &border);
   928 -    gtk_style_context_get_border(style, 0, &border);
   883 +    gtk_style_context_get_border(style, gtk_style_context_get_state(style), &border);
   929 +    gtk_style_context_get_border(style, gtk_style_context_get_state(style), &border);
   884  
   930  
   885      if (border.top < 2)
   931      if (border.top < 2)
   886          return 2; /* some themes don't set ythickness correctly */
   932          return 2; /* some themes don't set ythickness correctly */
   887 @@ -2292,7 +2465,7 @@ moz_gtk_tab_paint(cairo_t *cr, GdkRectan
   933 @@ -2292,7 +2477,7 @@ moz_gtk_tab_paint(cairo_t *cr, GdkRectan
   888        gtk_style_context_save(style);
   934        gtk_style_context_save(style);
   889        moz_gtk_tab_prepare_style_context(style, flags);
   935        moz_gtk_tab_prepare_style_context(style, flags);
   890  
   936  
   891 -      gtk_style_context_get_padding(style, GetStateFlagsFromGtkWidgetState(state), &padding);
   937 -      gtk_style_context_get_padding(style, GetStateFlagsFromGtkWidgetState(state), &padding);
   892 +      moz_gtk_get_style_padding(style, GetStateFlagsFromGtkWidgetState(state), &padding);
   938 +      moz_gtk_get_style_padding(style, GetStateFlagsFromGtkWidgetState(state), &padding);
   893  
   939  
   894        focusRect.x += padding.left;
   940        focusRect.x += padding.left;
   895        focusRect.width -= (padding.left + padding.right);
   941        focusRect.width -= (padding.left + padding.right);
   896 @@ -2408,7 +2581,7 @@ moz_gtk_tab_scroll_arrow_paint(cairo_t *
   942 @@ -2408,7 +2593,7 @@ moz_gtk_tab_scroll_arrow_paint(cairo_t *
   897  }
   943  }
   898  
   944  
   899  static gint
   945  static gint
   900 -moz_gtk_menu_bar_paint(cairo_t *cr, GdkRectangle* rect,
   946 -moz_gtk_menu_bar_paint(cairo_t *cr, GdkRectangle* rect,
   901 +moz_gtk_menu_bar_paint(cairo_t *cr, GdkRectangle* rect, GtkWidgetState* state,
   947 +moz_gtk_menu_bar_paint(cairo_t *cr, GdkRectangle* rect, GtkWidgetState* state,
   902                         GtkTextDirection direction)
   948                         GtkTextDirection direction)
   903  {
   949  {
   904      GtkStyleContext* style;
   950      GtkStyleContext* style;
   905 @@ -2468,7 +2641,7 @@ moz_gtk_menu_separator_paint(cairo_t *cr
   951 @@ -2468,7 +2653,7 @@ moz_gtk_menu_separator_paint(cairo_t *cr
   906      border_width = gtk_container_get_border_width(GTK_CONTAINER(gMenuSeparatorWidget));
   952      border_width = gtk_container_get_border_width(GTK_CONTAINER(gMenuSeparatorWidget));
   907  
   953  
   908      style = gtk_widget_get_style_context(gMenuSeparatorWidget);
   954      style = gtk_widget_get_style_context(gMenuSeparatorWidget);
   909 -    gtk_style_context_get_padding(style, 0, &padding);
   955 -    gtk_style_context_get_padding(style, 0, &padding);
   910 +    gtk_style_context_get_padding(style, gtk_style_context_get_state(style), &padding);
   956 +    gtk_style_context_get_padding(style, gtk_style_context_get_state(style), &padding);
   911  
   957  
   912      x = rect->x + border_width;
   958      x = rect->x + border_width;
   913      y = rect->y + border_width;
   959      y = rect->y + border_width;
   914 @@ -2521,7 +2694,8 @@ moz_gtk_menu_item_paint(cairo_t *cr, Gdk
   960 @@ -2521,7 +2706,8 @@ moz_gtk_menu_item_paint(cairo_t *cr, Gdk
   915              item_widget = gMenuItemWidget;
   961              item_widget = gMenuItemWidget;
   916          }
   962          }
   917          style = gtk_widget_get_style_context(item_widget);
   963          style = gtk_widget_get_style_context(item_widget);
   918 -        gtk_style_context_save(style);
   964 -        gtk_style_context_save(style);
   919 +// TODO - FIX!
   965 +// TODO - FIX!
   920 +//        gtk_style_context_save(style);
   966 +//        gtk_style_context_save(style);
   921  
   967  
   922          if (flags & MOZ_TOPLEVEL_MENU_ITEM) {
   968          if (flags & MOZ_TOPLEVEL_MENU_ITEM) {
   923              gtk_style_context_add_class(style, GTK_STYLE_CLASS_MENUBAR);
   969              gtk_style_context_add_class(style, GTK_STYLE_CLASS_MENUBAR);
   924 @@ -2540,7 +2714,7 @@ moz_gtk_menu_item_paint(cairo_t *cr, Gdk
   970 @@ -2540,7 +2726,7 @@ moz_gtk_menu_item_paint(cairo_t *cr, Gdk
   925  
   971  
   926          gtk_render_background(style, cr, x, y, w, h);
   972          gtk_render_background(style, cr, x, y, w, h);
   927          gtk_render_frame(style, cr, x, y, w, h);
   973          gtk_render_frame(style, cr, x, y, w, h);
   928 -        gtk_style_context_restore(style);
   974 -        gtk_style_context_restore(style);
   929 +//        gtk_style_context_restore(style);
   975 +//        gtk_style_context_restore(style);
   930      }
   976      }
   931  
   977  
   932      return MOZ_GTK_SUCCESS;
   978      return MOZ_GTK_SUCCESS;
   933 @@ -2556,7 +2730,10 @@ moz_gtk_menu_arrow_paint(cairo_t *cr, Gd
   979 @@ -2556,7 +2742,10 @@ moz_gtk_menu_arrow_paint(cairo_t *cr, Gd
   934  
   980  
   935      ensure_menu_item_widget();
   981      ensure_menu_item_widget();
   936      gtk_widget_set_direction(gMenuItemWidget, direction);
   982      gtk_widget_set_direction(gMenuItemWidget, direction);
   937 -
   983 -
   938 +/*
   984 +/*
   940 +                                                     GTK_STATE_FLAG_DIR_RTL;
   986 +                                                     GTK_STATE_FLAG_DIR_RTL;
   941 +*/
   987 +*/
   942      style = gtk_widget_get_style_context(gMenuItemWidget);
   988      style = gtk_widget_get_style_context(gMenuItemWidget);
   943      gtk_style_context_save(style);
   989      gtk_style_context_save(style);
   944      gtk_style_context_add_class(style, GTK_STYLE_CLASS_MENUITEM);
   990      gtk_style_context_add_class(style, GTK_STYLE_CLASS_MENUITEM);
   945 @@ -2606,7 +2783,7 @@ moz_gtk_check_menu_item_paint(cairo_t *c
   991 @@ -2606,7 +2795,7 @@ moz_gtk_check_menu_item_paint(cairo_t *c
   946      }
   992      }
   947      
   993      
   948      gtk_style_context_set_state(style, state_flags);
   994      gtk_style_context_set_state(style, state_flags);
   949 -    gtk_style_context_get_padding(style, state_flags, &padding);
   995 -    gtk_style_context_get_padding(style, state_flags, &padding);
   950 +    moz_gtk_get_style_padding(style, state_flags, &padding);
   996 +    moz_gtk_get_style_padding(style, state_flags, &padding);
   951  
   997  
   952      offset = gtk_container_get_border_width(GTK_CONTAINER(gCheckMenuItemWidget)) +
   998      offset = gtk_container_get_border_width(GTK_CONTAINER(gCheckMenuItemWidget)) +
   953                                              padding.left + 2;
   999                                              padding.left + 2;
   954 @@ -2658,7 +2835,7 @@ moz_gtk_add_style_border(GtkStyleContext
  1000 @@ -2658,7 +2847,7 @@ moz_gtk_add_style_border(GtkStyleContext
   955  {
  1001  {
   956      GtkBorder border;
  1002      GtkBorder border;
   957  
  1003  
   958 -    gtk_style_context_get_border(style, 0, &border);
  1004 -    gtk_style_context_get_border(style, 0, &border);
   959 +    gtk_style_context_get_border(style, gtk_style_context_get_state(style), &border);
  1005 +    gtk_style_context_get_border(style, gtk_style_context_get_state(style), &border);
   960  
  1006  
   961      *left += border.left;
  1007      *left += border.left;
   962      *right += border.right;
  1008      *right += border.right;
   963 @@ -2667,12 +2844,22 @@ moz_gtk_add_style_border(GtkStyleContext
  1009 @@ -2667,12 +2856,22 @@ moz_gtk_add_style_border(GtkStyleContext
   964  }
  1010  }
   965  
  1011  
   966  static void
  1012  static void
   967 +moz_gtk_get_style_border(GtkStyleContext* style, GtkStateFlags state_flags,
  1013 +moz_gtk_get_style_border(GtkStyleContext* style, GtkStateFlags state_flags,
   968 +                         GtkBorder *border)
  1014 +                         GtkBorder *border)
   982 -    gtk_style_context_get_padding(style, 0, &padding);
  1028 -    gtk_style_context_get_padding(style, 0, &padding);
   983 +    gtk_style_context_get_padding(style, gtk_style_context_get_state(style), &padding);
  1029 +    gtk_style_context_get_padding(style, gtk_style_context_get_state(style), &padding);
   984  
  1030  
   985      *left += padding.left;
  1031      *left += padding.left;
   986      *right += padding.right;
  1032      *right += padding.right;
   987 @@ -2680,6 +2867,16 @@ moz_gtk_add_style_padding(GtkStyleContex
  1033 @@ -2680,6 +2879,16 @@ moz_gtk_add_style_padding(GtkStyleContex
   988      *bottom += padding.bottom;
  1034      *bottom += padding.bottom;
   989  }
  1035  }
   990  
  1036  
   991 +static void
  1037 +static void
   992 +moz_gtk_get_style_padding(GtkStyleContext* style, GtkStateFlags state_flags,
  1038 +moz_gtk_get_style_padding(GtkStyleContext* style, GtkStateFlags state_flags,
   999 +}
  1045 +}
  1000 +
  1046 +
  1001  gint
  1047  gint
  1002  moz_gtk_get_widget_border(GtkThemeWidgetType widget, gint* left, gint* top,
  1048  moz_gtk_get_widget_border(GtkThemeWidgetType widget, gint* left, gint* top,
  1003                            gint* right, gint* bottom, GtkTextDirection direction,
  1049                            gint* right, gint* bottom, GtkTextDirection direction,
  1004 @@ -2694,36 +2891,27 @@ moz_gtk_get_widget_border(GtkThemeWidget
  1050 @@ -2694,37 +2903,35 @@ moz_gtk_get_widget_border(GtkThemeWidget
  1005      case MOZ_GTK_TOOLBAR_BUTTON:
  1051      case MOZ_GTK_TOOLBAR_BUTTON:
  1006          {
  1052          {
  1007              ensure_button_widget();
  1053              ensure_button_widget();
  1008 -            style = gtk_widget_get_style_context(gButtonWidget);
  1054 -            style = gtk_widget_get_style_context(gButtonWidget);
  1009 -
  1055 -
  1037              // XXX: Subtract 1 pixel from the padding to account for the default
  1083              // XXX: Subtract 1 pixel from the padding to account for the default
  1038              // padding in forms.css. See bug 1187385.
  1084              // padding in forms.css. See bug 1187385.
  1039              *left = *top = *right = *bottom = -1;
  1085              *left = *top = *right = *bottom = -1;
  1040 -            moz_gtk_add_style_padding(style, left, top, right, bottom);
  1086 -            moz_gtk_add_style_padding(style, left, top, right, bottom);
  1041 -            moz_gtk_add_style_border(style, left, top, right, bottom);
  1087 -            moz_gtk_add_style_border(style, left, top, right, bottom);
  1042 +
  1088  
  1043 +            moz_gtk_add_style_padding(gEntry.entry.style, left, top, right, bottom);
  1089 +            moz_gtk_add_style_padding(gEntry.entry.style, left, top, right, bottom);
  1044 +            moz_gtk_add_style_border(gEntry.entry.style, left, top, right, bottom);
  1090 +            moz_gtk_add_style_border(gEntry.entry.style, left, top, right, bottom);
  1045  
  1091 +
       
  1092 +            return MOZ_GTK_SUCCESS;
       
  1093 +        }
       
  1094 +    case MOZ_GTK_TOOLTIP:
       
  1095 +        {
       
  1096 +            ensure_tooltip_widget();
       
  1097 +            moz_gtk_add_style_padding(gTooltip.tooltip.styleBackground, left, top, right, bottom);
       
  1098 +            moz_gtk_add_style_border(gTooltip.tooltip.styleBackground, left, top, right, bottom);
  1046              return MOZ_GTK_SUCCESS;
  1099              return MOZ_GTK_SUCCESS;
  1047          }
  1100          }
  1048 @@ -2759,7 +2947,7 @@ moz_gtk_get_widget_border(GtkThemeWidget
  1101      case MOZ_GTK_TREEVIEW:
       
  1102 @@ -2759,7 +2966,7 @@ moz_gtk_get_widget_border(GtkThemeWidget
  1049          break;
  1103          break;
  1050      case MOZ_GTK_DROPDOWN_ENTRY:
  1104      case MOZ_GTK_DROPDOWN_ENTRY:
  1051          ensure_combo_box_entry_widgets();
  1105          ensure_combo_box_entry_widgets();
  1052 -        w = gComboBoxEntryTextareaWidget;
  1106 -        w = gComboBoxEntryTextareaWidget;
  1053 +        w = gComboBoxEntryTextarea.widget;
  1107 +        w = gComboBoxEntryTextarea.widget;
  1054          break;
  1108          break;
  1055      case MOZ_GTK_DROPDOWN_ARROW:
  1109      case MOZ_GTK_DROPDOWN_ARROW:
  1056          ensure_combo_box_entry_widgets();
  1110          ensure_combo_box_entry_widgets();
  1057 @@ -2795,7 +2983,7 @@ moz_gtk_get_widget_border(GtkThemeWidget
  1111 @@ -2795,7 +3002,7 @@ moz_gtk_get_widget_border(GtkThemeWidget
  1058  
  1112  
  1059                  if (!wide_separators) {
  1113                  if (!wide_separators) {
  1060                      style = gtk_widget_get_style_context(gComboBoxSeparatorWidget);
  1114                      style = gtk_widget_get_style_context(gComboBoxSeparatorWidget);
  1061 -                    gtk_style_context_get_border(style, 0, &border);
  1115 -                    gtk_style_context_get_border(style, 0, &border);
  1062 +                    gtk_style_context_get_border(style, gtk_style_context_get_state(style), &border);
  1116 +                    gtk_style_context_get_border(style, gtk_style_context_get_state(style), &border);
  1063                      separator_width = border.left;
  1117                      separator_width = border.left;
  1064                  }
  1118                  }
  1065              }
  1119              }
  1066 @@ -2814,14 +3002,17 @@ moz_gtk_get_widget_border(GtkThemeWidget
  1120 @@ -2814,14 +3021,17 @@ moz_gtk_get_widget_border(GtkThemeWidget
  1067          w = gTabWidget;
  1121          w = gTabWidget;
  1068          break;
  1122          break;
  1069      case MOZ_GTK_PROGRESSBAR:
  1123      case MOZ_GTK_PROGRESSBAR:
  1070 -        ensure_progress_widget();
  1124 -        ensure_progress_widget();
  1071 -        w = gProgressWidget;
  1125 -        w = gProgressWidget;
  1083 -        w = gSpinWidget;
  1137 -        w = gSpinWidget;
  1084 +        w = gSpin.widget;
  1138 +        w = gSpin.widget;
  1085          break;
  1139          break;
  1086      case MOZ_GTK_SCALE_HORIZONTAL:
  1140      case MOZ_GTK_SCALE_HORIZONTAL:
  1087          ensure_scale_widget();
  1141          ensure_scale_widget();
  1088 @@ -2840,12 +3031,13 @@ moz_gtk_get_widget_border(GtkThemeWidget
  1142 @@ -2840,12 +3050,13 @@ moz_gtk_get_widget_border(GtkThemeWidget
  1089          {
  1143          {
  1090              if (widget == MOZ_GTK_CHECKBUTTON_CONTAINER) {
  1144              if (widget == MOZ_GTK_CHECKBUTTON_CONTAINER) {
  1091                  ensure_checkbox_widget();
  1145                  ensure_checkbox_widget();
  1092 -                w = gCheckboxWidget;
  1146 -                w = gCheckboxWidget;
  1093 +                w = gCheckbox.widget;
  1147 +                w = gCheckbox.widget;
  1100              }
  1154              }
  1101 -            style = gtk_widget_get_style_context(w);
  1155 -            style = gtk_widget_get_style_context(w);
  1102  
  1156  
  1103              *left = *top = *right = *bottom = gtk_container_get_border_width(GTK_CONTAINER(w));
  1157              *left = *top = *right = *bottom = gtk_container_get_border_width(GTK_CONTAINER(w));
  1104              moz_gtk_add_style_border(style,
  1158              moz_gtk_add_style_border(style,
  1105 @@ -2978,6 +3170,32 @@ moz_gtk_get_combo_box_entry_button_size(
  1159 @@ -2904,7 +3115,6 @@ moz_gtk_get_widget_border(GtkThemeWidget
       
  1160      case MOZ_GTK_MENUSEPARATOR:
       
  1161      /* These widgets have no borders.*/
       
  1162      case MOZ_GTK_SPINBUTTON:
       
  1163 -    case MOZ_GTK_TOOLTIP:
       
  1164      case MOZ_GTK_WINDOW:
       
  1165      case MOZ_GTK_RESIZER:
       
  1166      case MOZ_GTK_MENUARROW:
       
  1167 @@ -2978,6 +3188,32 @@ moz_gtk_get_combo_box_entry_button_size(
  1106  }
  1168  }
  1107  
  1169  
  1108  gint
  1170  gint
  1109 +moz_gtk_get_entry_height(gint* height)
  1171 +moz_gtk_get_entry_height(gint* height)
  1110 +{
  1172 +{
  1133 +
  1195 +
  1134 +gint
  1196 +gint
  1135  moz_gtk_get_tab_scroll_arrow_size(gint* width, gint* height)
  1197  moz_gtk_get_tab_scroll_arrow_size(gint* width, gint* height)
  1136  {
  1198  {
  1137      gint arrow_size;
  1199      gint arrow_size;
  1138 @@ -3030,7 +3248,7 @@ moz_gtk_get_toolbar_separator_width(gint
  1200 @@ -3030,7 +3266,7 @@ moz_gtk_get_toolbar_separator_width(gint
  1139                           "separator-width", &separator_width,
  1201                           "separator-width", &separator_width,
  1140                           NULL);
  1202                           NULL);
  1141      /* Just in case... */
  1203      /* Just in case... */
  1142 -    gtk_style_context_get_border(style, 0, &border);
  1204 -    gtk_style_context_get_border(style, 0, &border);
  1143 +    gtk_style_context_get_border(style, gtk_style_context_get_state(style), &border);
  1205 +    gtk_style_context_get_border(style, gtk_style_context_get_state(style), &border);
  1144      *size = MAX(*size, (wide_separators ? separator_width : border.left));
  1206      *size = MAX(*size, (wide_separators ? separator_width : border.left));
  1145      return MOZ_GTK_SUCCESS;
  1207      return MOZ_GTK_SUCCESS;
  1146  }
  1208  }
  1147 @@ -3072,7 +3290,7 @@ moz_gtk_get_menu_separator_height(gint *
  1209 @@ -3072,7 +3308,7 @@ moz_gtk_get_menu_separator_height(gint *
  1148      border_width = gtk_container_get_border_width(GTK_CONTAINER(gMenuSeparatorWidget));
  1210      border_width = gtk_container_get_border_width(GTK_CONTAINER(gMenuSeparatorWidget));
  1149  
  1211  
  1150      style = gtk_widget_get_style_context(gMenuSeparatorWidget);
  1212      style = gtk_widget_get_style_context(gMenuSeparatorWidget);
  1151 -    gtk_style_context_get_padding(style, 0, &padding);
  1213 -    gtk_style_context_get_padding(style, 0, &padding);
  1152 +    gtk_style_context_get_padding(style, gtk_style_context_get_state(style), &padding);
  1214 +    gtk_style_context_get_padding(style, gtk_style_context_get_state(style), &padding);
  1153  
  1215  
  1154      gtk_style_context_save(style);
  1216      gtk_style_context_save(style);
  1155      gtk_style_context_add_class(style, GTK_STYLE_CLASS_SEPARATOR);
  1217      gtk_style_context_add_class(style, GTK_STYLE_CLASS_SEPARATOR);
  1156 @@ -3130,15 +3348,21 @@ moz_gtk_get_scrollbar_metrics(MozGtkScro
  1218 @@ -3130,15 +3366,21 @@ moz_gtk_get_scrollbar_metrics(MozGtkScro
  1157  {
  1219  {
  1158      ensure_scrollbar_widget();
  1220      ensure_scrollbar_widget();
  1159  
  1221  
  1160 -    gtk_widget_style_get (gHorizScrollbarWidget,
  1222 -    gtk_widget_style_get (gHorizScrollbarWidget,
  1161 +    gtk_widget_style_get (gHorizScrollbar.widget,
  1223 +    gtk_widget_style_get (gHorizScrollbar.widget,
  1176 +            gtk_range_get_min_slider_size(GTK_RANGE(gVertScrollbar.widget));
  1238 +            gtk_range_get_min_slider_size(GTK_RANGE(gVertScrollbar.widget));
  1177 +    }
  1239 +    }
  1178  
  1240  
  1179      return MOZ_GTK_SUCCESS;
  1241      return MOZ_GTK_SUCCESS;
  1180  }
  1242  }
  1181 @@ -3163,7 +3387,7 @@ moz_gtk_images_in_buttons()
  1243 @@ -3163,7 +3405,7 @@ moz_gtk_images_in_buttons()
  1182      GtkSettings* settings;
  1244      GtkSettings* settings;
  1183  
  1245  
  1184      ensure_button_widget();
  1246      ensure_button_widget();
  1185 -    settings = gtk_widget_get_settings(gButtonWidget);
  1247 -    settings = gtk_widget_get_settings(gButtonWidget);
  1186 +    settings = gtk_widget_get_settings(gButton.widget);
  1248 +    settings = gtk_widget_get_settings(gButton.widget);
  1187  
  1249  
  1188      g_object_get(settings, "gtk-button-images", &result, NULL);
  1250      g_object_get(settings, "gtk-button-images", &result, NULL);
  1189      return result;
  1251      return result;
  1190 @@ -3191,7 +3415,7 @@ moz_gtk_widget_paint(GtkThemeWidgetType
  1252 @@ -3191,7 +3433,7 @@ moz_gtk_widget_paint(GtkThemeWidgetType
  1191          }
  1253          }
  1192          ensure_button_widget();
  1254          ensure_button_widget();
  1193          return moz_gtk_button_paint(cr, rect, state,
  1255          return moz_gtk_button_paint(cr, rect, state,
  1194 -                                    (GtkReliefStyle) flags, gButtonWidget,
  1256 -                                    (GtkReliefStyle) flags, gButtonWidget,
  1195 +                                    (GtkReliefStyle) flags, gButton.widget,
  1257 +                                    (GtkReliefStyle) flags, gButton.widget,
  1196                                      direction);
  1258                                      direction);
  1197          break;
  1259          break;
  1198      case MOZ_GTK_CHECKBUTTON:
  1260      case MOZ_GTK_CHECKBUTTON:
  1199 @@ -3241,7 +3465,7 @@ moz_gtk_widget_paint(GtkThemeWidgetType
  1261 @@ -3241,7 +3483,7 @@ moz_gtk_widget_paint(GtkThemeWidgetType
  1200      case MOZ_GTK_SPINBUTTON_ENTRY:
  1262      case MOZ_GTK_SPINBUTTON_ENTRY:
  1201          ensure_spin_widget();
  1263          ensure_spin_widget();
  1202          return moz_gtk_entry_paint(cr, rect, state,
  1264          return moz_gtk_entry_paint(cr, rect, state,
  1203 -                                   gSpinWidget, direction);
  1265 -                                   gSpinWidget, direction);
  1204 +                                   &gSpin, direction);
  1266 +                                   &gSpin, direction);
  1205          break;
  1267          break;
  1206      case MOZ_GTK_GRIPPER:
  1268      case MOZ_GTK_GRIPPER:
  1207          return moz_gtk_gripper_paint(cr, rect, state,
  1269          return moz_gtk_gripper_paint(cr, rect, state,
  1208 @@ -3268,7 +3492,7 @@ moz_gtk_widget_paint(GtkThemeWidgetType
  1270 @@ -3268,7 +3510,7 @@ moz_gtk_widget_paint(GtkThemeWidgetType
  1209      case MOZ_GTK_ENTRY:
  1271      case MOZ_GTK_ENTRY:
  1210          ensure_entry_widget();
  1272          ensure_entry_widget();
  1211          return moz_gtk_entry_paint(cr, rect, state,
  1273          return moz_gtk_entry_paint(cr, rect, state,
  1212 -                                   gEntryWidget, direction);
  1274 -                                   gEntryWidget, direction);
  1213 +                                   &gEntry, direction);
  1275 +                                   &gEntry, direction);
  1214          break;
  1276          break;
  1215      case MOZ_GTK_DROPDOWN:
  1277      case MOZ_GTK_DROPDOWN:
  1216          return moz_gtk_combo_box_paint(cr, rect, state, direction);
  1278          return moz_gtk_combo_box_paint(cr, rect, state, direction);
  1217 @@ -3280,7 +3504,7 @@ moz_gtk_widget_paint(GtkThemeWidgetType
  1279 @@ -3280,7 +3522,7 @@ moz_gtk_widget_paint(GtkThemeWidgetType
  1218      case MOZ_GTK_DROPDOWN_ENTRY:
  1280      case MOZ_GTK_DROPDOWN_ENTRY:
  1219          ensure_combo_box_entry_widgets();
  1281          ensure_combo_box_entry_widgets();
  1220          return moz_gtk_entry_paint(cr, rect, state,
  1282          return moz_gtk_entry_paint(cr, rect, state,
  1221 -                                   gComboBoxEntryTextareaWidget, direction);
  1283 -                                   gComboBoxEntryTextareaWidget, direction);
  1222 +                                   &gComboBoxEntryTextarea, direction);
  1284 +                                   &gComboBoxEntryTextarea, direction);
  1223          break;
  1285          break;
  1224      case MOZ_GTK_CHECKBUTTON_CONTAINER:
  1286      case MOZ_GTK_CHECKBUTTON_CONTAINER:
  1225      case MOZ_GTK_RADIOBUTTON_CONTAINER:
  1287      case MOZ_GTK_RADIOBUTTON_CONTAINER:
  1226 @@ -3332,7 +3556,7 @@ moz_gtk_widget_paint(GtkThemeWidgetType
  1288 @@ -3332,7 +3574,7 @@ moz_gtk_widget_paint(GtkThemeWidgetType
  1227                                                (GtkArrowType) flags, direction);
  1289                                                (GtkArrowType) flags, direction);
  1228          break;
  1290          break;
  1229      case MOZ_GTK_MENUBAR:
  1291      case MOZ_GTK_MENUBAR:
  1230 -        return moz_gtk_menu_bar_paint(cr, rect, direction);
  1292 -        return moz_gtk_menu_bar_paint(cr, rect, direction);
  1231 +        return moz_gtk_menu_bar_paint(cr, rect, state, direction);
  1293 +        return moz_gtk_menu_bar_paint(cr, rect, state, direction);
  1232          break;
  1294          break;
  1233      case MOZ_GTK_MENUPOPUP:
  1295      case MOZ_GTK_MENUPOPUP:
  1234          return moz_gtk_menu_popup_paint(cr, rect, direction);
  1296          return moz_gtk_menu_popup_paint(cr, rect, direction);
  1235 @@ -3383,7 +3607,7 @@ GtkWidget* moz_gtk_get_scrollbar_widget(
  1297 @@ -3383,7 +3625,7 @@ GtkWidget* moz_gtk_get_scrollbar_widget(
  1236  {
  1298  {
  1237      MOZ_ASSERT(is_initialized, "Forgot to call moz_gtk_init()");
  1299      MOZ_ASSERT(is_initialized, "Forgot to call moz_gtk_init()");
  1238      ensure_scrollbar_widget();
  1300      ensure_scrollbar_widget();
  1239 -    return gHorizScrollbarWidget;
  1301 -    return gHorizScrollbarWidget;
  1240 +    return gVertScrollbar.widget;
  1302 +    return gVertScrollbar.widget;
  1241  }
  1303  }
  1242  
  1304  
  1243  gboolean moz_gtk_has_scrollbar_buttons(void)
  1305  gboolean moz_gtk_has_scrollbar_buttons(void)
  1244 @@ -3391,7 +3615,7 @@ gboolean moz_gtk_has_scrollbar_buttons(v
  1306 @@ -3391,7 +3633,7 @@ gboolean moz_gtk_has_scrollbar_buttons(v
  1245      gboolean backward, forward, secondary_backward, secondary_forward;
  1307      gboolean backward, forward, secondary_backward, secondary_forward;
  1246      MOZ_ASSERT(is_initialized, "Forgot to call moz_gtk_init()");
  1308      MOZ_ASSERT(is_initialized, "Forgot to call moz_gtk_init()");
  1247      ensure_scrollbar_widget();
  1309      ensure_scrollbar_widget();
  1248 -    gtk_widget_style_get (gHorizScrollbarWidget,
  1310 -    gtk_widget_style_get (gHorizScrollbarWidget,
  1249 +    gtk_widget_style_get (gHorizScrollbar.widget,
  1311 +    gtk_widget_style_get (gHorizScrollbar.widget,
  1250                            "has-backward-stepper", &backward,
  1312                            "has-backward-stepper", &backward,
  1251                            "has-forward-stepper", &forward,
  1313                            "has-forward-stepper", &forward,
  1252                            "has-secondary-backward-stepper", &secondary_backward,
  1314                            "has-secondary-backward-stepper", &secondary_backward,
  1253 @@ -3415,17 +3639,19 @@ moz_gtk_shutdown()
  1315 @@ -3403,8 +3645,8 @@ gboolean moz_gtk_has_scrollbar_buttons(v
       
  1316  gint
       
  1317  moz_gtk_shutdown()
       
  1318  {
       
  1319 -    if (gTooltipWidget)
       
  1320 -        gtk_widget_destroy(gTooltipWidget);
       
  1321 +    moz_gtk_widget_free(&gTooltip);
       
  1322 +
       
  1323      /* This will destroy all of our widgets */
       
  1324      if (gProtoWindow)
       
  1325          gtk_widget_destroy(gProtoWindow);
       
  1326 @@ -3415,17 +3657,19 @@ moz_gtk_shutdown()
  1254  
  1327  
  1255      gProtoWindow = NULL;
  1328      gProtoWindow = NULL;
  1256      gProtoLayout = NULL;
  1329      gProtoLayout = NULL;
  1257 -    gButtonWidget = NULL;
  1330 -    gButtonWidget = NULL;
  1258 +
  1331 +
  1275 -    gEntryWidget = NULL;
  1348 -    gEntryWidget = NULL;
  1276 +    moz_gtk_widget_free(&gEntry);
  1349 +    moz_gtk_widget_free(&gEntry);
  1277      gComboBoxWidget = NULL;
  1350      gComboBoxWidget = NULL;
  1278      gComboBoxButtonWidget = NULL;
  1351      gComboBoxButtonWidget = NULL;
  1279      gComboBoxSeparatorWidget = NULL;
  1352      gComboBoxSeparatorWidget = NULL;
  1280 @@ -3433,12 +3659,12 @@ moz_gtk_shutdown()
  1353 @@ -3433,14 +3677,13 @@ moz_gtk_shutdown()
  1281      gComboBoxEntryWidget = NULL;
  1354      gComboBoxEntryWidget = NULL;
  1282      gComboBoxEntryButtonWidget = NULL;
  1355      gComboBoxEntryButtonWidget = NULL;
  1283      gComboBoxEntryArrowWidget = NULL;
  1356      gComboBoxEntryArrowWidget = NULL;
  1284 -    gComboBoxEntryTextareaWidget = NULL;
  1357 -    gComboBoxEntryTextareaWidget = NULL;
  1285 +    moz_gtk_widget_free(&gComboBoxEntryTextarea);
  1358 +    moz_gtk_widget_free(&gComboBoxEntryTextarea);
  1288      gStatusbarWidget = NULL;
  1361      gStatusbarWidget = NULL;
  1289      gFrameWidget = NULL;
  1362      gFrameWidget = NULL;
  1290 -    gProgressWidget = NULL;
  1363 -    gProgressWidget = NULL;
  1291 +    moz_gtk_widget_free(&gProgressBar);
  1364 +    moz_gtk_widget_free(&gProgressBar);
  1292      gTabWidget = NULL;
  1365      gTabWidget = NULL;
  1293      gTooltipWidget = NULL;
  1366 -    gTooltipWidget = NULL;
  1294      gMenuBarWidget = NULL;
  1367      gMenuBarWidget = NULL;
  1295 diff -up firefox-46.0/widget/gtk/gtkdrawing.h.gtk3-20 firefox-46.0/widget/gtk/gtkdrawing.h
  1368      gMenuBarItemWidget = NULL;
  1296 --- firefox-46.0/widget/gtk/gtkdrawing.h.gtk3-20	2016-04-22 02:37:27.000000000 +0200
  1369      gMenuPopupWidget = NULL;
  1297 +++ firefox-46.0/widget/gtk/gtkdrawing.h	2016-04-25 14:42:42.000000000 +0200
  1370 diff -up firefox-46.0.1/widget/gtk/gtkdrawing.h.gtk3-20 firefox-46.0.1/widget/gtk/gtkdrawing.h
       
  1371 --- firefox-46.0.1/widget/gtk/gtkdrawing.h.gtk3-20	2016-05-03 07:31:12.000000000 +0200
       
  1372 +++ firefox-46.0.1/widget/gtk/gtkdrawing.h	2016-05-19 15:20:11.656519199 +0200
  1298 @@ -67,6 +67,13 @@ typedef enum {
  1373 @@ -67,6 +67,13 @@ typedef enum {
  1299    MOZ_GTK_TAB_SELECTED        = 1 << 10
  1374    MOZ_GTK_TAB_SELECTED        = 1 << 10
  1300  } GtkTabFlags;
  1375  } GtkTabFlags;
  1301  
  1376  
  1302 +typedef struct {
  1377 +typedef struct {
  1330 +
  1405 +
  1331 +
  1406 +
  1332  #ifdef __cplusplus
  1407  #ifdef __cplusplus
  1333  }
  1408  }
  1334  #endif /* __cplusplus */
  1409  #endif /* __cplusplus */
  1335 diff -up firefox-46.0/widget/gtk/mozgtk/mozgtk.c.gtk3-20 firefox-46.0/widget/gtk/mozgtk/mozgtk.c
  1410 diff -up firefox-46.0.1/widget/gtk/mozgtk/mozgtk.c.gtk3-20 firefox-46.0.1/widget/gtk/mozgtk/mozgtk.c
  1336 --- firefox-46.0/widget/gtk/mozgtk/mozgtk.c.gtk3-20	2016-04-22 02:37:27.000000000 +0200
  1411 --- firefox-46.0.1/widget/gtk/mozgtk/mozgtk.c.gtk3-20	2016-05-03 07:31:12.000000000 +0200
  1337 +++ firefox-46.0/widget/gtk/mozgtk/mozgtk.c	2016-04-25 14:46:15.299592716 +0200
  1412 +++ firefox-46.0.1/widget/gtk/mozgtk/mozgtk.c	2016-05-20 10:40:19.442320669 +0200
  1338 @@ -504,6 +504,11 @@ STUB(gtk_window_set_type_hint)
  1413 @@ -504,6 +504,11 @@ STUB(gtk_window_set_type_hint)
  1339  STUB(gtk_window_set_wmclass)
  1414  STUB(gtk_window_set_wmclass)
  1340  STUB(gtk_window_unfullscreen)
  1415  STUB(gtk_window_unfullscreen)
  1341  STUB(gtk_window_unmaximize)
  1416  STUB(gtk_window_unmaximize)
  1342 +STUB(gtk_widget_get_preferred_height_and_baseline_for_width)
  1417 +STUB(gtk_widget_get_preferred_height_and_baseline_for_width)
  1345 +STUB(gtk_spin_button_get_type)
  1420 +STUB(gtk_spin_button_get_type)
  1346 +STUB(gtk_button_get_type)
  1421 +STUB(gtk_button_get_type)
  1347  #endif
  1422  #endif
  1348  
  1423  
  1349  #ifdef GTK3_SYMBOLS
  1424  #ifdef GTK3_SYMBOLS
  1350 @@ -581,6 +586,13 @@ STUB(gtk_color_chooser_get_type)
  1425 @@ -581,6 +586,14 @@ STUB(gtk_color_chooser_get_type)
  1351  STUB(gtk_color_chooser_set_rgba)
  1426  STUB(gtk_color_chooser_set_rgba)
  1352  STUB(gtk_color_chooser_get_rgba)
  1427  STUB(gtk_color_chooser_get_rgba)
  1353  STUB(gtk_color_chooser_set_use_alpha)
  1428  STUB(gtk_color_chooser_set_use_alpha)
  1354 +STUB(gtk_style_context_get_path)
  1429 +STUB(gtk_style_context_get_path)
  1355 +STUB(gtk_widget_path_copy)
  1430 +STUB(gtk_widget_path_copy)
  1356 +STUB(gtk_widget_path_iter_set_object_name)
  1431 +STUB(gtk_widget_path_iter_set_object_name)
  1357 +STUB(gtk_widget_path_iter_add_class)
  1432 +STUB(gtk_widget_path_iter_add_class)
  1358 +STUB(gtk_widget_path_iter_get_state)
  1433 +STUB(gtk_widget_path_iter_get_state)
  1359 +STUB(gtk_style_context_set_parent)
  1434 +STUB(gtk_style_context_set_parent)
  1360 +STUB(gtk_widget_path_unref)
  1435 +STUB(gtk_widget_path_unref)
       
  1436 +STUB(gtk_tooltip_get_type)
  1361  #endif
  1437  #endif
  1362  
  1438  
  1363  #ifdef GTK2_SYMBOLS
  1439  #ifdef GTK2_SYMBOLS
  1364 diff -up firefox-46.0/widget/gtk/nsLookAndFeel.cpp.gtk3-20 firefox-46.0/widget/gtk/nsLookAndFeel.cpp
  1440 diff -up firefox-46.0.1/widget/gtk/nsLookAndFeel.cpp.gtk3-20 firefox-46.0.1/widget/gtk/nsLookAndFeel.cpp
  1365 --- firefox-46.0/widget/gtk/nsLookAndFeel.cpp.gtk3-20	2016-04-22 02:37:27.000000000 +0200
  1441 --- firefox-46.0.1/widget/gtk/nsLookAndFeel.cpp.gtk3-20	2016-05-03 07:31:12.000000000 +0200
  1366 +++ firefox-46.0/widget/gtk/nsLookAndFeel.cpp	2016-04-25 14:18:25.000000000 +0200
  1442 +++ firefox-46.0.1/widget/gtk/nsLookAndFeel.cpp	2016-05-20 13:53:54.085049707 +0200
  1367 @@ -353,14 +353,18 @@ nsLookAndFeel::NativeGetColor(ColorID aI
  1443 @@ -353,14 +353,18 @@ nsLookAndFeel::NativeGetColor(ColorID aI
  1368      case eColorID_activeborder:
  1444      case eColorID_activeborder:
  1369          // active window border
  1445          // active window border
  1370          gtk_style_context_get_border_color(mBackgroundStyle, 
  1446          gtk_style_context_get_border_color(mBackgroundStyle, 
  1371 -                                           GTK_STATE_FLAG_NORMAL, &gdk_color);
  1447 -                                           GTK_STATE_FLAG_NORMAL, &gdk_color);
  1417                                                 &gdk_color);
  1493                                                 &gdk_color);
  1418 +        gtk_style_context_restore(mButtonStyle);
  1494 +        gtk_style_context_restore(mButtonStyle);
  1419          aColor = GDK_RGBA_TO_NS_RGBA(gdk_color);
  1495          aColor = GDK_RGBA_TO_NS_RGBA(gdk_color);
  1420          break;
  1496          break;
  1421      case eColorID__moz_buttonhovertext:
  1497      case eColorID__moz_buttonhovertext:
  1422 @@ -1110,7 +1121,7 @@ nsLookAndFeel::Init()
  1498 @@ -1110,27 +1126,29 @@ nsLookAndFeel::Init()
  1423      style = create_context(path);
  1499      style = create_context(path);
  1424      gtk_style_context_add_class(style, GTK_STYLE_CLASS_SCROLLBAR);
  1500      gtk_style_context_add_class(style, GTK_STYLE_CLASS_SCROLLBAR);
  1425      gtk_style_context_add_class(style, GTK_STYLE_CLASS_TROUGH);
  1501      gtk_style_context_add_class(style, GTK_STYLE_CLASS_TROUGH);
  1426 -    gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL, &color);
  1502 -    gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL, &color);
  1427 +    gtk_style_context_get_background_color(style, gtk_style_context_get_state(style), &color);
  1503 +    gtk_style_context_get_background_color(style, gtk_style_context_get_state(style), &color);
  1428      sMozScrollbar = GDK_RGBA_TO_NS_RGBA(color);
  1504      sMozScrollbar = GDK_RGBA_TO_NS_RGBA(color);
  1429      g_object_unref(style);
  1505      g_object_unref(style);
  1430  
  1506  
  1431 @@ -1118,18 +1129,18 @@ nsLookAndFeel::Init()
  1507      // Window colors
  1432      style = create_context(path);
  1508      style = create_context(path);
  1433      gtk_style_context_save(style);
  1509 -    gtk_style_context_save(style);
  1434      gtk_style_context_add_class(style, GTK_STYLE_CLASS_BACKGROUND);
  1510      gtk_style_context_add_class(style, GTK_STYLE_CLASS_BACKGROUND);
  1435 -    gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL, &color);
  1511 -    gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL, &color);
  1436 +    gtk_style_context_get_background_color(style, gtk_style_context_get_state(style), &color);
  1512 +    gtk_style_context_get_background_color(style, gtk_style_context_get_state(style), &color);
  1437      sMozWindowBackground = GDK_RGBA_TO_NS_RGBA(color);
  1513      sMozWindowBackground = GDK_RGBA_TO_NS_RGBA(color);
  1438 -    gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color);
  1514 -    gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color);
  1439 +    gtk_style_context_get_color(style, gtk_style_context_get_state(style), &color);
  1515 +    gtk_style_context_get_color(style, gtk_style_context_get_state(style), &color);
  1440      sMozWindowText = GDK_RGBA_TO_NS_RGBA(color);
  1516      sMozWindowText = GDK_RGBA_TO_NS_RGBA(color);
  1441      gtk_style_context_restore(style);
  1517 -    gtk_style_context_restore(style);
       
  1518 +    g_object_unref(style);
  1442  
  1519  
  1443      // tooltip foreground and background
  1520      // tooltip foreground and background
  1444      gtk_style_context_add_class(style, GTK_STYLE_CLASS_TOOLTIP);
  1521 -    gtk_style_context_add_class(style, GTK_STYLE_CLASS_TOOLTIP);
       
  1522 +    GtkCssNode tooltipPath[] = { 
       
  1523 +         { GTK_TYPE_TOOLTIP, "tooltip", NULL, NULL},
       
  1524 +    };
       
  1525 +    style = moz_gtk_style_create(tooltipPath, NULL);
       
  1526 +    gtk_style_context_get_color(style, gtk_style_context_get_state(style), &color);
       
  1527 +    sInfoText = GDK_RGBA_TO_NS_RGBA(color);
  1445      gtk_style_context_add_class(style, GTK_STYLE_CLASS_BACKGROUND);
  1528      gtk_style_context_add_class(style, GTK_STYLE_CLASS_BACKGROUND);
  1446 -    gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL, &color);
  1529 -    gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL, &color);
  1447 +    gtk_style_context_get_background_color(style, gtk_style_context_get_state(style), &color);
  1530 +    gtk_style_context_get_background_color(style, gtk_style_context_get_state(style), &color);
  1448      sInfoBackground = GDK_RGBA_TO_NS_RGBA(color);
  1531      sInfoBackground = GDK_RGBA_TO_NS_RGBA(color);
  1449 -    gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color);
  1532 -    gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color);
  1450 +    gtk_style_context_get_color(style, gtk_style_context_get_state(style), &color);
  1533 -    sInfoText = GDK_RGBA_TO_NS_RGBA(color);
  1451      sInfoText = GDK_RGBA_TO_NS_RGBA(color);
       
  1452      g_object_unref(style);
  1534      g_object_unref(style);
  1453  
  1535  
  1454 @@ -1144,20 +1155,26 @@ nsLookAndFeel::Init()
  1536      // menu foreground & menu background
       
  1537 @@ -1144,20 +1162,26 @@ nsLookAndFeel::Init()
  1455      gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
  1538      gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
  1456  
  1539  
  1457      style = gtk_widget_get_style_context(accel_label);
  1540      style = gtk_widget_get_style_context(accel_label);
  1458 -    gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color);
  1541 -    gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color);
  1459 +    gtk_style_context_get_color(style, gtk_style_context_get_state(style), &color);
  1542 +    gtk_style_context_get_color(style, gtk_style_context_get_state(style), &color);
  1481      sMenuHoverText = GDK_RGBA_TO_NS_RGBA(color);
  1564      sMenuHoverText = GDK_RGBA_TO_NS_RGBA(color);
  1482 +    gtk_style_context_restore(style);
  1565 +    gtk_style_context_restore(style);
  1483  
  1566  
  1484      g_object_unref(menu);
  1567      g_object_unref(menu);
  1485  #endif
  1568  #endif
  1486 @@ -1266,44 +1283,54 @@ nsLookAndFeel::Init()
  1569 @@ -1266,44 +1290,54 @@ nsLookAndFeel::Init()
  1487              GDK_COLOR_TO_NS_RGB(style->dark[GTK_STATE_NORMAL]);
  1570              GDK_COLOR_TO_NS_RGB(style->dark[GTK_STATE_NORMAL]);
  1488      }
  1571      }
  1489  #else
  1572  #else
  1490 +    GtkCssNode labelPath[] = {
  1573 +    GtkCssNode labelPath[] = {
  1491 +       { GTK_TYPE_LABEL, "label", "view", NULL },
  1574 +       { GTK_TYPE_LABEL, "label", "view", NULL },
  1553      sMenuBarHoverText = GDK_RGBA_TO_NS_RGBA(color);
  1636      sMenuBarHoverText = GDK_RGBA_TO_NS_RGBA(color);
  1554 +    gtk_style_context_restore(style);
  1637 +    gtk_style_context_restore(style);
  1555  
  1638  
  1556      // GTK's guide to fancy odd row background colors:
  1639      // GTK's guide to fancy odd row background colors:
  1557      // 1) Check if a theme explicitly defines an odd row color
  1640      // 1) Check if a theme explicitly defines an odd row color
  1558 @@ -1316,7 +1343,7 @@ nsLookAndFeel::Init()
  1641 @@ -1316,7 +1350,7 @@ nsLookAndFeel::Init()
  1559      // Get odd row background color
  1642      // Get odd row background color
  1560      gtk_style_context_save(style);
  1643      gtk_style_context_save(style);
  1561      gtk_style_context_add_region(style, GTK_STYLE_REGION_ROW, GTK_REGION_ODD);
  1644      gtk_style_context_add_region(style, GTK_STYLE_REGION_ROW, GTK_REGION_ODD);
  1562 -    gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL, &color);
  1645 -    gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL, &color);
  1563 +    gtk_style_context_get_background_color(style, gtk_style_context_get_state(style), &color);
  1646 +    gtk_style_context_get_background_color(style, gtk_style_context_get_state(style), &color);
  1564      sOddCellBackground = GDK_RGBA_TO_NS_RGBA(color);
  1647      sOddCellBackground = GDK_RGBA_TO_NS_RGBA(color);
  1565      gtk_style_context_restore(style);
  1648      gtk_style_context_restore(style);
  1566  
  1649  
  1567 @@ -1334,9 +1361,11 @@ nsLookAndFeel::Init()
  1650 @@ -1334,9 +1368,11 @@ nsLookAndFeel::Init()
  1568      gtk_container_add(GTK_CONTAINER(parent), infoBar);
  1651      gtk_container_add(GTK_CONTAINER(parent), infoBar);
  1569      gtk_container_add(GTK_CONTAINER(infoBarContent), infoBarLabel);
  1652      gtk_container_add(GTK_CONTAINER(infoBarContent), infoBarLabel);
  1570      style = gtk_widget_get_style_context(infoBarLabel);
  1653      style = gtk_widget_get_style_context(infoBarLabel);
  1571 +    gtk_style_context_save(style);
  1654 +    gtk_style_context_save(style);
  1572      gtk_style_context_add_class(style, GTK_STYLE_CLASS_INFO);
  1655      gtk_style_context_add_class(style, GTK_STYLE_CLASS_INFO);
  1575      sInfoBarText = GDK_RGBA_TO_NS_RGBA(color);
  1658      sInfoBarText = GDK_RGBA_TO_NS_RGBA(color);
  1576 +    gtk_style_context_restore(style);
  1659 +    gtk_style_context_restore(style);
  1577  #endif
  1660  #endif
  1578      // Some themes have a unified menu bar, and support window dragging on it
  1661      // Some themes have a unified menu bar, and support window dragging on it
  1579      gboolean supports_menubar_drag = FALSE;
  1662      gboolean supports_menubar_drag = FALSE;
  1580 diff -up firefox-46.0/widget/gtk/nsNativeThemeGTK.cpp.gtk3-20 firefox-46.0/widget/gtk/nsNativeThemeGTK.cpp
  1663 diff -up firefox-46.0.1/widget/gtk/nsNativeThemeGTK.cpp.gtk3-20 firefox-46.0.1/widget/gtk/nsNativeThemeGTK.cpp
  1581 --- firefox-46.0/widget/gtk/nsNativeThemeGTK.cpp.gtk3-20	2016-04-25 14:46:15.300592722 +0200
  1664 --- firefox-46.0.1/widget/gtk/nsNativeThemeGTK.cpp.gtk3-20	2016-05-03 07:31:12.000000000 +0200
  1582 +++ firefox-46.0/widget/gtk/nsNativeThemeGTK.cpp	2016-04-25 14:40:42.000000000 +0200
  1665 +++ firefox-46.0.1/widget/gtk/nsNativeThemeGTK.cpp	2016-05-19 15:20:11.658519202 +0200
  1583 @@ -1567,9 +1567,6 @@ nsNativeThemeGTK::GetMinimumWidgetSize(n
  1666 @@ -1567,9 +1567,6 @@ nsNativeThemeGTK::GetMinimumWidgetSize(n
  1584    case NS_THEME_RADIO_CONTAINER:
  1667    case NS_THEME_RADIO_CONTAINER:
  1585    case NS_THEME_CHECKBOX_LABEL:
  1668    case NS_THEME_CHECKBOX_LABEL:
  1586    case NS_THEME_RADIO_LABEL:
  1669    case NS_THEME_RADIO_LABEL:
  1587 -  case NS_THEME_BUTTON:
  1670 -  case NS_THEME_BUTTON:
  1610 +    } 
  1693 +    } 
  1611 +    break;
  1694 +    break;
  1612    case NS_THEME_TOOLBAR_SEPARATOR:
  1695    case NS_THEME_TOOLBAR_SEPARATOR:
  1613      {
  1696      {
  1614        gint separator_width;
  1697        gint separator_width;
  1615