Closed Bug 1259433 Opened 8 years ago Closed 8 years ago

remove gtk_widget_style_get() from gtk3drawing

Categories

(Core :: Widget: Gtk, defect)

All
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla48
Tracking Status
firefox48 --- fixed

People

(Reporter: stransky, Unassigned)

References

Details

Attachments

(1 file, 2 obsolete files)

Follow up from Bug 1234158 comment 26

This patch replaces gtk_widget_style_get() with gtk_style_context_get_style() for all widgets in gtk3drawing.

From my testing there's no regression in appearance. I suppose to check-in this patch to nightly as a test for upcoming changes in Bug 1234158.

If there's no regression we can replace the widgets here with styles.
Attached patch patch (obsolete) — Splinter Review
Attachment #8734349 - Flags: review?(karlt)
Comment on attachment 8734349 [details] [diff] [review]
patch

>+    gtk_style_context_get_style(gtk_widget_get_style_context(scrollbar),
>+                                "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(gtk_widget_get_style_context(scrollbar),
>+                                    "arrow-displacement-x", &arrow_displacement_x,
>+                                    "arrow-displacement-y", &arrow_displacement_y,
>+                                    NULL);

This function already has the |style| variable with the result of
gtk_widget_get_style_context(scrollbar), so please use that instead of calling
gtk_widget_get_style_context() each time.

>     style = gtk_widget_get_style_context(gComboBoxSeparatorWidget);

>+    gtk_style_context_get_style(gtk_widget_get_style_context(gComboBoxSeparatorWidget),
>+                                "wide-separators", &wide_separators,
>+                                "separator-width", &separator_width,
>+                                NULL);


>     style = gtk_widget_get_style_context(gTabWidget);

>+        gtk_style_context_get_style(gtk_widget_get_style_context(gTabWidget),
>+                                    "initial-gap", &initial_gap, NULL);


>     gtk_style_context_add_class(style, GTK_STYLE_CLASS_SEPARATOR);

>+    gtk_style_context_get_style(gtk_widget_get_style_context(gMenuSeparatorWidget),
>+                                "wide-separators",    &wide_separators,
>+                                "separator-height",   &separator_height,
>+                                NULL);


>+    gtk_style_context_get_style(gtk_widget_get_style_context(gCheckMenuItemWidget),
>+                                "indicator-size", &indicator_size,
>+                                "horizontal-padding", &horizontal_padding,
>+                                NULL);
> 
>     style = gtk_widget_get_style_context(gCheckMenuItemWidget);


>+                gtk_style_context_get_style(gtk_widget_get_style_context(gComboBoxSeparatorWidget),
>+                                            "wide-separators", &wide_separators,
>+                                            "separator-width", &separator_width,
>+                                            NULL);
> 
>                 if (!wide_separators) {
>                     style = gtk_widget_get_style_context(gComboBoxSeparatorWidget);


>     style = gtk_widget_get_style_context(gTabWidget);

>+    gtk_style_context_get_style(gtk_widget_get_style_context (gTabWidget),
>+                                "tab-curvature", &tab_curvature, NULL);
>     *left += tab_curvature;
>     *right += tab_curvature;
> 
>     if (flags & MOZ_GTK_TAB_FIRST) {
>       int initial_gap;

>+      gtk_style_context_get_style(gtk_widget_get_style_context(gTabWidget),
>+                                  "initial-gap", &initial_gap, NULL);


>     style = gtk_widget_get_style_context(gToolbarWidget);
> 

>+    gtk_style_context_get_style(gtk_widget_get_style_context(gToolbarWidget),


>     style = gtk_widget_get_style_context(gMenuSeparatorWidget);
>     gtk_style_context_get_padding(style, 0, &padding);
> 
>     gtk_style_context_save(style);
>     gtk_style_context_add_class(style, GTK_STYLE_CLASS_SEPARATOR);
> 

>+    gtk_style_context_get_style(gtk_widget_get_style_context(gMenuSeparatorWidget),


And these places, too.
Attachment #8734349 - Flags: review?(karlt) → review+
Attached patch v.3 patch for check-in (obsolete) — Splinter Review
Attachment #8734349 - Attachment is obsolete: true
An updated patch for gtk3drawing change from c to cpp file.
Attachment #8735814 - Attachment is obsolete: true
https://hg.mozilla.org/mozilla-central/rev/eb7426df3b9b
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla48
You need to log in before you can comment on or make changes to this bug.