Bug 1259433 - remove gtk_widget_style_get() from gtk3drawing, r=karlt a=kwierso
authorMartin Stransky <stransky@redhat.com>
Thu, 31 Mar 2016 14:21:15 -0700
changeset 291107 eb7426df3b9be4e82ebc5316d38ae51f81bd99a2
parent 291106 36888eb8c404b95f6d746a2fc6150154538fa81a
child 291108 aeb9cc61c8ad3f99b23f56c890b887e703472af8
push id19656
push usergwagner@mozilla.com
push dateMon, 04 Apr 2016 13:43:23 +0000
treeherderb2g-inbound@e99061fde28a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskarlt, kwierso
bugs1259433
milestone48.0a1
Bug 1259433 - remove gtk_widget_style_get() from gtk3drawing, r=karlt a=kwierso MozReview-Commit-ID: 13VFxv518qc
widget/gtk/gtk3drawing.cpp
widget/gtk/mozgtk/mozgtk.c
--- a/widget/gtk/gtk3drawing.cpp
+++ b/widget/gtk/gtk3drawing.cpp
@@ -733,47 +733,48 @@ moz_gtk_init()
     if (gtk_major_version > 3 ||
        (gtk_major_version == 3 && gtk_minor_version >= 14))
         checkbox_check_state = GTK_STATE_FLAG_CHECKED;
     else
         checkbox_check_state = GTK_STATE_FLAG_ACTIVE;
 
     if(!gtk_check_version(3, 12, 0)) {
         ensure_tab_widget();
-        gtk_widget_style_get(gTabWidget, "has-tab-gap", &notebook_has_tab_gap, NULL);
+        gtk_style_context_get_style(gtk_widget_get_style_context(gTabWidget),
+                                    "has-tab-gap", &notebook_has_tab_gap, NULL);
     }
     else {
         notebook_has_tab_gap = TRUE;
     }
 
     return MOZ_GTK_SUCCESS;
 }
 
 gint
 moz_gtk_checkbox_get_metrics(gint* indicator_size, gint* indicator_spacing)
 {
     ensure_checkbox_widget();
 
-    gtk_widget_style_get (gCheckboxWidget,
-                          "indicator_size", indicator_size,
-                          "indicator_spacing", indicator_spacing,
-                          NULL);
+    gtk_style_context_get_style(gtk_widget_get_style_context(gCheckboxWidget),
+                                "indicator_size", indicator_size,
+                                "indicator_spacing", indicator_spacing,
+                                NULL);
 
     return MOZ_GTK_SUCCESS;
 }
 
 gint
 moz_gtk_radio_get_metrics(gint* indicator_size, gint* indicator_spacing)
 {
     ensure_radiobutton_widget();
 
-    gtk_widget_style_get (gRadiobuttonWidget,
-                          "indicator_size", indicator_size,
-                          "indicator_spacing", indicator_spacing,
-                          NULL);
+    gtk_style_context_get_style(gtk_widget_get_style_context(gRadiobuttonWidget),
+                                "indicator_size", indicator_size,
+                                "indicator_spacing", indicator_spacing,
+                                NULL);
 
     return MOZ_GTK_SUCCESS;
 }
 
 gint
 moz_gtk_get_focus_outline_size(gint* focus_h_width, gint* focus_v_width)
 {
     GtkBorder border;
@@ -790,45 +791,45 @@ moz_gtk_get_focus_outline_size(gint* foc
     return MOZ_GTK_SUCCESS;
 }
 
 gint
 moz_gtk_menuitem_get_horizontal_padding(gint* horizontal_padding)
 {
     ensure_menu_item_widget();
 
-    gtk_widget_style_get (gMenuItemWidget,
-                          "horizontal-padding", horizontal_padding,
-                          NULL);
+    gtk_style_context_get_style(gtk_widget_get_style_context(gMenuItemWidget),
+                                "horizontal-padding", horizontal_padding,
+                                NULL);
 
     return MOZ_GTK_SUCCESS;
 }
 
 gint
 moz_gtk_checkmenuitem_get_horizontal_padding(gint* horizontal_padding)
 {
     ensure_check_menu_item_widget();
 
-    gtk_widget_style_get (gCheckMenuItemWidget,
-                          "horizontal-padding", horizontal_padding,
-                          NULL);
+    gtk_style_context_get_style(gtk_widget_get_style_context(gCheckMenuItemWidget),
+                                "horizontal-padding", horizontal_padding,
+                                NULL);
 
     return MOZ_GTK_SUCCESS;
 }
 
 gint
 moz_gtk_button_get_default_overflow(gint* border_top, gint* border_left,
                                     gint* border_bottom, gint* border_right)
 {
     GtkBorder* default_outside_border;
 
     ensure_button_widget();
-    gtk_widget_style_get(gButtonWidget,
-                         "default-outside-border", &default_outside_border,
-                         NULL);
+    gtk_style_context_get_style(gtk_widget_get_style_context(gButtonWidget),
+                                "default-outside-border", &default_outside_border,
+                                NULL);
 
     if (default_outside_border) {
         *border_top = default_outside_border->top;
         *border_left = default_outside_border->left;
         *border_bottom = default_outside_border->bottom;
         *border_right = default_outside_border->right;
         gtk_border_free(default_outside_border);
     } else {
@@ -839,19 +840,19 @@ moz_gtk_button_get_default_overflow(gint
 
 static gint
 moz_gtk_button_get_default_border(gint* border_top, gint* border_left,
                                   gint* border_bottom, gint* border_right)
 {
     GtkBorder* default_border;
 
     ensure_button_widget();
-    gtk_widget_style_get(gButtonWidget,
-                         "default-border", &default_border,
-                         NULL);
+    gtk_style_context_get_style(gtk_widget_get_style_context(gButtonWidget),
+                                "default-border", &default_border,
+                                NULL);
 
     if (default_border) {
         *border_top = default_border->top;
         *border_left = default_border->left;
         *border_bottom = default_border->bottom;
         *border_right = default_border->right;
         gtk_border_free(default_border);
     } else {
@@ -861,20 +862,22 @@ moz_gtk_button_get_default_border(gint* 
     return MOZ_GTK_SUCCESS;
 }
 
 gint
 moz_gtk_splitter_get_metrics(gint orientation, gint* size)
 {
     if (orientation == GTK_ORIENTATION_HORIZONTAL) {
         ensure_hpaned_widget();
-        gtk_widget_style_get(gHPanedWidget, "handle_size", size, NULL);
+        gtk_style_context_get_style(gtk_widget_get_style_context(gHPanedWidget),
+                                    "handle_size", size, NULL);
     } else {
         ensure_vpaned_widget();
-        gtk_widget_style_get(gVPanedWidget, "handle_size", size, NULL);
+        gtk_style_context_get_style(gtk_widget_get_style_context(gVPanedWidget),
+                                    "handle_size", size, NULL);
     }
     return MOZ_GTK_SUCCESS;
 }
 
 static gint
 moz_gtk_window_paint(cairo_t *cr, GdkRectangle* rect,
                      GtkTextDirection direction)
 {
@@ -1057,17 +1060,18 @@ calculate_arrow_rect(GtkWidget* arrow, G
     gfloat arrow_scaling = 0.7;
     gfloat xalign, xpad;
     gint extent;
     gint mxpad, mypad;
     gfloat mxalign, myalign;
     GtkMisc* misc = GTK_MISC(arrow);
 
     if (have_arrow_scaling)
-        gtk_widget_style_get(arrow, "arrow_scaling", &arrow_scaling, NULL);
+        gtk_style_context_get_style(gtk_widget_get_style_context(arrow),
+                                    "arrow_scaling", &arrow_scaling, NULL);
 
     gtk_misc_get_padding(misc, &mxpad, &mypad); 
     extent = MIN((rect->width - mxpad * 2),
                  (rect->height - mypad * 2)) * arrow_scaling;
 
     gtk_misc_get_alignment(misc, &mxalign, &myalign);
     
     xalign = direction == GTK_TEXT_DIR_LTR ? mxalign : 1.0 - mxalign;
@@ -1142,27 +1146,27 @@ moz_gtk_scrollbar_button_paint(cairo_t *
 
     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);
 
     arrow_rect.width = rect->width / 2;
     arrow_rect.height = rect->height / 2;
     
     gfloat arrow_scaling;
-    gtk_widget_style_get (scrollbar, "arrow-scaling", &arrow_scaling, NULL);
+    gtk_style_context_get_style(style, "arrow-scaling", &arrow_scaling, NULL);
 
     gdouble arrow_size = MIN(rect->width, rect->height) * arrow_scaling;
     arrow_rect.x = rect->x + (rect->width - arrow_size) / 2;
     arrow_rect.y = rect->y + (rect->height - arrow_size) / 2;
 
     if (state_flags & GTK_STATE_FLAG_ACTIVE) {
-        gtk_widget_style_get(scrollbar,
-                             "arrow-displacement-x", &arrow_displacement_x,
-                             "arrow-displacement-y", &arrow_displacement_y,
-                             NULL);
+        gtk_style_context_get_style(style,
+                                    "arrow-displacement-x", &arrow_displacement_x,
+                                    "arrow-displacement-y", &arrow_displacement_y,
+                                    NULL);
 
         arrow_rect.x += arrow_displacement_x;
         arrow_rect.y += arrow_displacement_y;
     }
   
     gtk_render_arrow(style, cr, arrow_angle,
                      arrow_rect.x,
                      arrow_rect.y, 
@@ -1681,20 +1685,20 @@ moz_gtk_combo_box_paint(cairo_t *cr, Gdk
     gtk_render_arrow(style, cr, ARROW_DOWN,
                      real_arrow_rect.x, real_arrow_rect.y,
                      real_arrow_rect.width);
 
     /* If there is no separator in the theme, there's nothing left to do. */
     if (!gComboBoxSeparatorWidget)
         return MOZ_GTK_SUCCESS;
     style = gtk_widget_get_style_context(gComboBoxSeparatorWidget);
-    gtk_widget_style_get(gComboBoxSeparatorWidget,
-                         "wide-separators", &wide_separators,
-                         "separator-width", &separator_width,
-                         NULL);
+    gtk_style_context_get_style(style,
+                                "wide-separators", &wide_separators,
+                                "separator-width", &separator_width,
+                                NULL);
 
     if (wide_separators) {
         if (direction == GTK_TEXT_DIR_LTR)
             arrow_rect.x -= separator_width;
         else
             arrow_rect.x += arrow_rect.width;
         
         gtk_render_frame(style, cr, arrow_rect.x, arrow_rect.y, separator_width, arrow_rect.height);
@@ -1773,20 +1777,20 @@ moz_gtk_combo_box_entry_button_paint(cai
     ensure_combo_box_entry_widgets();
 
     moz_gtk_button_paint(cr, rect, state, GTK_RELIEF_NORMAL,
                          gComboBoxEntryButtonWidget, direction);
 
     calculate_button_inner_rect(gComboBoxEntryButtonWidget,
                                 rect, &arrow_rect, direction);
     if (state_flags & GTK_STATE_FLAG_ACTIVE) {
-        gtk_widget_style_get(gComboBoxEntryButtonWidget,
-                             "child-displacement-x", &x_displacement,
-                             "child-displacement-y", &y_displacement,
-                             NULL);
+        gtk_style_context_get_style(gtk_widget_get_style_context(gComboBoxEntryButtonWidget),
+                                    "child-displacement-x", &x_displacement,
+                                    "child-displacement-y", &y_displacement,
+                                    NULL);
         arrow_rect.x += x_displacement;
         arrow_rect.y += y_displacement;
     }
 
     calculate_arrow_rect(gComboBoxEntryArrowWidget,
                          &arrow_rect, &real_arrow_rect, direction);
 
     style = gtk_widget_get_style_context(gComboBoxEntryArrowWidget);
@@ -1901,20 +1905,20 @@ moz_gtk_toolbar_separator_paint(cairo_t 
     const double start_fraction = 0.2;
     const double end_fraction = 0.8;
 
     ensure_toolbar_separator_widget();
     gtk_widget_set_direction(gToolbarSeparatorWidget, direction);
 
     style = gtk_widget_get_style_context(gToolbarSeparatorWidget);
 
-    gtk_widget_style_get(gToolbarWidget,
-                         "wide-separators", &wide_separators,
-                         "separator-width", &separator_width,
-                         NULL);
+    gtk_style_context_get_style(gtk_widget_get_style_context(gToolbarWidget),
+                                "wide-separators", &wide_separators,
+                                "separator-width", &separator_width,
+                                NULL);
 
     if (wide_separators) {
         if (separator_width > rect->width)
             separator_width = rect->width;
         
         gtk_render_frame(style, cr,
                           rect->x + (rect->width - separator_width) / 2,
                           rect->y + rect->height * start_fraction,
@@ -2141,17 +2145,17 @@ moz_gtk_tab_paint(cairo_t *cr, GdkRectan
 
     style = gtk_widget_get_style_context(gTabWidget);
     gtk_style_context_save(style);
     moz_gtk_tab_prepare_style_context(style, flags);
 
     tabRect = *rect;
 
     if (flags & MOZ_GTK_TAB_FIRST) {
-        gtk_widget_style_get (gTabWidget, "initial-gap", &initial_gap, NULL);
+        gtk_style_context_get_style(style, "initial-gap", &initial_gap, NULL);
         tabRect.width -= initial_gap;
 
         if (direction != GTK_TEXT_DIR_RTL) {
             tabRect.x += initial_gap;
         }
     }
 
     focusRect = backRect = tabRect;
@@ -2472,20 +2476,20 @@ moz_gtk_menu_separator_paint(cairo_t *cr
 
     x = rect->x + border_width;
     y = rect->y + border_width;
     w = rect->width - border_width * 2;
 
     gtk_style_context_save(style);
     gtk_style_context_add_class(style, GTK_STYLE_CLASS_SEPARATOR);
 
-    gtk_widget_style_get(gMenuSeparatorWidget,
-                         "wide-separators",    &wide_separators,
-                         "separator-height",   &separator_height,
-                         NULL);
+    gtk_style_context_get_style(style,
+                                "wide-separators",    &wide_separators,
+                                "separator-height",   &separator_height,
+                                NULL);
 
     if (wide_separators) {
       gtk_render_frame(style, cr,
                        x + padding.left,
                        y + padding.top,
                        w - padding.left - padding.right,
                        separator_height);
     } else {
@@ -2583,23 +2587,24 @@ moz_gtk_check_menu_item_paint(cairo_t *c
     gint indicator_size, horizontal_padding;
     gint x, y;
 
     moz_gtk_menu_item_paint(cr, rect, state, FALSE, direction);
 
     ensure_check_menu_item_widget();
     gtk_widget_set_direction(gCheckMenuItemWidget, direction);
 
-    gtk_widget_style_get (gCheckMenuItemWidget,
-                          "indicator-size", &indicator_size,
-                          "horizontal-padding", &horizontal_padding,
-                          NULL);
-
     style = gtk_widget_get_style_context(gCheckMenuItemWidget);
     gtk_style_context_save(style);
+
+    gtk_style_context_get_style(style,
+                                "indicator-size", &indicator_size,
+                                "horizontal-padding", &horizontal_padding,
+                                NULL);
+
     if (isradio) {
       gtk_style_context_add_class(style, GTK_STYLE_CLASS_RADIO);
     } else {
       gtk_style_context_add_class(style, GTK_STYLE_CLASS_CHECK);
     }
 
     if (checked) {
       state_flags = static_cast<GtkStateFlags>(state_flags|checkbox_check_state);
@@ -2783,23 +2788,23 @@ moz_gtk_get_widget_border(GtkThemeWidget
             style = gtk_widget_get_style_context(gComboBoxButtonWidget);
 
             moz_gtk_add_style_padding(style, left, top, right, bottom);
             moz_gtk_add_style_border(style, left, top, right, bottom);
 
             /* If there is no separator, don't try to count its width. */
             separator_width = 0;
             if (gComboBoxSeparatorWidget) {
-                gtk_widget_style_get(gComboBoxSeparatorWidget,
-                                     "wide-separators", &wide_separators,
-                                     "separator-width", &separator_width,
-                                     NULL);
+                style = gtk_widget_get_style_context(gComboBoxSeparatorWidget);
+                gtk_style_context_get_style(style,
+                                            "wide-separators", &wide_separators,
+                                            "separator-width", &separator_width,
+                                            NULL);
 
                 if (!wide_separators) {
-                    style = gtk_widget_get_style_context(gComboBoxSeparatorWidget);
                     gtk_style_context_get_border(style, GTK_STATE_FLAG_NORMAL, &border);
                     separator_width = border.left;
                 }
             }
 
             gtk_widget_get_preferred_size(gComboBoxArrowWidget, NULL, &arrow_req);
 
             if (direction == GTK_TEXT_DIR_RTL)
@@ -2936,23 +2941,23 @@ moz_gtk_get_tab_border(gint* left, gint*
 
     style = gtk_widget_get_style_context(gTabWidget);
     gtk_style_context_save(style);
     moz_gtk_tab_prepare_style_context(style, flags);
 
     *left = *top = *right = *bottom = 0;
     moz_gtk_add_style_padding(style, left, top, right, bottom);
 
-    gtk_widget_style_get (gTabWidget, "tab-curvature", &tab_curvature, NULL);
+    gtk_style_context_get_style(style, "tab-curvature", &tab_curvature, NULL);
     *left += tab_curvature;
     *right += tab_curvature;
 
     if (flags & MOZ_GTK_TAB_FIRST) {
       int initial_gap;
-      gtk_widget_style_get (gTabWidget, "initial-gap", &initial_gap, NULL);
+      gtk_style_context_get_style(style, "initial-gap", &initial_gap, NULL);
       if (direction == GTK_TEXT_DIR_RTL)
         *right += initial_gap;
       else
         *left += initial_gap;
     }
 
     gtk_style_context_restore(style);
 
@@ -2978,19 +2983,19 @@ moz_gtk_get_combo_box_entry_button_size(
 }
 
 gint
 moz_gtk_get_tab_scroll_arrow_size(gint* width, gint* height)
 {
     gint arrow_size;
 
     ensure_tab_widget();
-    gtk_widget_style_get(gTabWidget,
-                         "scroll-arrow-hlength", &arrow_size,
-                         NULL);
+    gtk_style_context_get_style(gtk_widget_get_style_context(gTabWidget),
+                                "scroll-arrow-hlength", &arrow_size,
+                                NULL);
 
     *height = *width = arrow_size;
 
     return MOZ_GTK_SUCCESS;
 }
 
 void
 moz_gtk_get_arrow_size(GtkThemeWidgetType widgetType, gint* width, gint* height)
@@ -3018,46 +3023,45 @@ moz_gtk_get_toolbar_separator_width(gint
 {
     gboolean wide_separators;
     gint separator_width;
     GtkStyleContext* style;
     GtkBorder border;
 
     ensure_toolbar_widget();
     style = gtk_widget_get_style_context(gToolbarWidget);
-
-    gtk_widget_style_get(gToolbarWidget,
-                         "space-size", size,
-                         "wide-separators",  &wide_separators,
-                         "separator-width", &separator_width,
-                         NULL);
+    gtk_style_context_get_style(style,
+                                "space-size", size,
+                                "wide-separators",  &wide_separators,
+                                "separator-width", &separator_width,
+                                NULL);
     /* Just in case... */
     gtk_style_context_get_border(style, GTK_STATE_FLAG_NORMAL, &border);
     *size = MAX(*size, (wide_separators ? separator_width : border.left));
     return MOZ_GTK_SUCCESS;
 }
 
 gint
 moz_gtk_get_expander_size(gint* size)
 {
     ensure_expander_widget();
-    gtk_widget_style_get(gExpanderWidget,
-                         "expander-size", size,
-                         NULL);
+    gtk_style_context_get_style(gtk_widget_get_style_context(gExpanderWidget),
+                                "expander-size", size,
+                                NULL);
 
     return MOZ_GTK_SUCCESS;
 }
 
 gint
 moz_gtk_get_treeview_expander_size(gint* size)
 {
     ensure_tree_view_widget();
-    gtk_widget_style_get(gTreeViewWidget,
-                         "expander-size", size,
-                         NULL);
+    gtk_style_context_get_style(gtk_widget_get_style_context(gTreeViewWidget),
+                                "expander-size", size,
+                                NULL);
 
     return MOZ_GTK_SUCCESS;
 }
 
 // See gtk_menu_item_draw() for reference.
 gint
 moz_gtk_get_menu_separator_height(gint *size)
 {
@@ -3072,20 +3076,20 @@ moz_gtk_get_menu_separator_height(gint *
     border_width = gtk_container_get_border_width(GTK_CONTAINER(gMenuSeparatorWidget));
 
     style = gtk_widget_get_style_context(gMenuSeparatorWidget);
     gtk_style_context_get_padding(style, GTK_STATE_FLAG_NORMAL, &padding);
 
     gtk_style_context_save(style);
     gtk_style_context_add_class(style, GTK_STYLE_CLASS_SEPARATOR);
 
-    gtk_widget_style_get(gMenuSeparatorWidget,
-                          "wide-separators",  &wide_separators,
-                          "separator-height", &separator_height,
-                          NULL);
+    gtk_style_context_get_style(style,
+                                "wide-separators",  &wide_separators,
+                                "separator-height", &separator_height,
+                                NULL);
 
     gtk_style_context_restore(style);
 
     *size = padding.top + padding.bottom + border_width*2;
     *size += (wide_separators) ? separator_height : 1;
 
     return MOZ_GTK_SUCCESS;
 }
@@ -3093,17 +3097,18 @@ moz_gtk_get_menu_separator_height(gint *
 void
 moz_gtk_get_scale_metrics(GtkOrientation orient, gint* scale_width,
                           gint* scale_height)
 {
   gint thumb_length, thumb_height, trough_border;
   GtkWidget* widget = orient == GTK_ORIENTATION_HORIZONTAL ?
                       gHScaleWidget : gVScaleWidget;
   moz_gtk_get_scalethumb_metrics(orient, &thumb_length, &thumb_height);
-  gtk_widget_style_get(widget, "trough-border", &trough_border, NULL);
+  gtk_style_context_get_style(gtk_widget_get_style_context(widget),
+                              "trough-border", &trough_border, NULL);
 
   if (orient == GTK_ORIENTATION_HORIZONTAL) {
       *scale_width = thumb_length + trough_border * 2;
       *scale_height = thumb_height + trough_border * 2;
   } else {
       *scale_width = thumb_height + trough_border * 2;
       *scale_height = thumb_length + trough_border * 2;
   }
@@ -3112,35 +3117,35 @@ moz_gtk_get_scale_metrics(GtkOrientation
 gint
 moz_gtk_get_scalethumb_metrics(GtkOrientation orient, gint* thumb_length, gint* thumb_height)
 {
   GtkWidget* widget;
 
   ensure_scale_widget();
   widget = ((orient == GTK_ORIENTATION_HORIZONTAL) ? gHScaleWidget : gVScaleWidget);
 
-  gtk_widget_style_get (widget,
-                        "slider_length", thumb_length,
-                        "slider_width", thumb_height,
-                        NULL);
+  gtk_style_context_get_style(gtk_widget_get_style_context(widget),
+                              "slider_length", thumb_length,
+                              "slider_width", thumb_height,
+                              NULL);
 
   return MOZ_GTK_SUCCESS;
 }
 
 gint
 moz_gtk_get_scrollbar_metrics(MozGtkScrollbarMetrics *metrics)
 {
     ensure_scrollbar_widget();
 
-    gtk_widget_style_get (gHorizScrollbarWidget,
-                          "slider_width", &metrics->slider_width,
-                          "trough_border", &metrics->trough_border,
-                          "stepper_size", &metrics->stepper_size,
-                          "stepper_spacing", &metrics->stepper_spacing,
-                          NULL);
+    gtk_style_context_get_style(gtk_widget_get_style_context(gHorizScrollbarWidget),
+                                "slider_width", &metrics->slider_width,
+                                "trough_border", &metrics->trough_border,
+                                "stepper_size", &metrics->stepper_size,
+                                "stepper_spacing", &metrics->stepper_spacing,
+                                NULL);
 
     metrics->min_slider_size = 
         gtk_range_get_min_slider_size(GTK_RANGE(gHorizScrollbarWidget));
 
     return MOZ_GTK_SUCCESS;
 }
 
 gboolean
@@ -3386,22 +3391,22 @@ GtkWidget* moz_gtk_get_scrollbar_widget(
     return gHorizScrollbarWidget;
 }
 
 gboolean moz_gtk_has_scrollbar_buttons(void)
 {
     gboolean backward, forward, secondary_backward, secondary_forward;
     MOZ_ASSERT(is_initialized, "Forgot to call moz_gtk_init()");
     ensure_scrollbar_widget();
-    gtk_widget_style_get (gHorizScrollbarWidget,
-                          "has-backward-stepper", &backward,
-                          "has-forward-stepper", &forward,
-                          "has-secondary-backward-stepper", &secondary_backward,
-                          "has-secondary-forward-stepper", &secondary_forward,
-                          NULL);
+    gtk_style_context_get_style(gtk_widget_get_style_context(gHorizScrollbarWidget),
+                                "has-backward-stepper", &backward,
+                                "has-forward-stepper", &forward,
+                                "has-secondary-backward-stepper", &secondary_backward,
+                                "has-secondary-forward-stepper", &secondary_forward,
+                                NULL);
     return backward | forward | secondary_forward | secondary_forward;
 }
 
 gint
 moz_gtk_shutdown()
 {
     if (gTooltipWidget)
         gtk_widget_destroy(gTooltipWidget);
--- a/widget/gtk/mozgtk/mozgtk.c
+++ b/widget/gtk/mozgtk/mozgtk.c
@@ -548,16 +548,17 @@ STUB(gtk_style_context_get)
 STUB(gtk_style_context_get_background_color)
 STUB(gtk_style_context_get_border)
 STUB(gtk_style_context_get_border_color)
 STUB(gtk_style_context_get_color)
 STUB(gtk_style_context_get_margin)
 STUB(gtk_style_context_get_padding)
 STUB(gtk_style_context_get_property)
 STUB(gtk_style_context_get_state)
+STUB(gtk_style_context_get_style)
 STUB(gtk_style_context_has_class)
 STUB(gtk_style_context_new)
 STUB(gtk_style_context_remove_class)
 STUB(gtk_style_context_remove_region)
 STUB(gtk_style_context_restore)
 STUB(gtk_style_context_save)
 STUB(gtk_style_context_set_path)
 STUB(gtk_style_context_set_state)