author | Martin Stransky <stransky@redhat.com> |
Wed, 20 Feb 2013 08:50:51 -0500 | |
changeset 122452 | 0c8e1a272c78100ec6082fc29334be4a93695bbd |
parent 122451 | b46c006a7696832b2763b13f3934a226510db373 |
child 122453 | cb220ef54f3d11fb7b9772afd6fd7ad79c566733 |
push id | 24342 |
push user | ryanvm@gmail.com |
push date | Thu, 21 Feb 2013 13:05:06 +0000 |
treeherder | mozilla-central@702d2814efbf [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | karlt |
bugs | 627699 |
milestone | 22.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/widget/gtk2/gtk3drawing.c +++ b/widget/gtk2/gtk3drawing.c @@ -863,17 +863,17 @@ moz_gtk_button_get_inner_border(GtkWidge else *inner_border = default_inner_border; return MOZ_GTK_SUCCESS; } static gint moz_gtk_button_paint(cairo_t *cr, GdkRectangle* rect, - GdkRectangle* cliprect, GtkWidgetState* state, + GtkWidgetState* state, GtkReliefStyle relief, GtkWidget* widget, GtkTextDirection direction) { GtkStateFlags state_flags = GetStateFlagsFromGtkWidgetState(state); GtkStyleContext* style = gtk_widget_get_style_context(widget); gint x = rect->x, y=rect->y, width=rect->width, height=rect->height; gboolean interior_focus; @@ -938,17 +938,17 @@ moz_gtk_button_paint(cairo_t *cr, GdkRec gtk_render_focus(style, cr, x, y, width, height); } gtk_style_context_restore(style); return MOZ_GTK_SUCCESS; } static gint moz_gtk_toggle_paint(cairo_t *cr, GdkRectangle* rect, - GdkRectangle* cliprect, GtkWidgetState* state, + GtkWidgetState* state, gboolean selected, gboolean inconsistent, gboolean isradio, GtkTextDirection direction) { gint indicator_size, indicator_spacing; gint x, y, width, height; gint focus_x, focus_y, focus_width, focus_height; GtkWidget *w; GtkStyleContext *style; @@ -1088,17 +1088,17 @@ calculate_arrow_rect(GtkWidget* arrow, G arrow_rect->width = arrow_rect->height = extent; return MOZ_GTK_SUCCESS; } static gint moz_gtk_scrollbar_button_paint(cairo_t *cr, GdkRectangle* rect, - GdkRectangle* cliprect, GtkWidgetState* state, + GtkWidgetState* state, GtkScrollbarButtonFlags flags, GtkTextDirection direction) { GtkStateFlags state_flags = GetStateFlagsFromGtkWidgetState(state); GtkStateType saved_state; GdkRectangle arrow_rect; gdouble arrow_angle; GtkStyleContext* style; @@ -1154,17 +1154,17 @@ moz_gtk_scrollbar_button_paint(cairo_t * gtk_style_context_restore(style); return MOZ_GTK_SUCCESS; } static gint moz_gtk_scrollbar_trough_paint(GtkThemeWidgetType widget, cairo_t *cr, GdkRectangle* rect, - GdkRectangle* cliprect, GtkWidgetState* state, + GtkWidgetState* state, GtkTextDirection direction) { GtkStyleContext* style; GtkScrollbar *scrollbar; ensure_scrollbar_widget(); if (widget == MOZ_GTK_SCROLLBAR_TRACK_HORIZONTAL) @@ -1187,17 +1187,17 @@ moz_gtk_scrollbar_trough_paint(GtkThemeW } gtk_style_context_restore(style); return MOZ_GTK_SUCCESS; } static gint moz_gtk_scrollbar_thumb_paint(GtkThemeWidgetType widget, cairo_t *cr, GdkRectangle* rect, - GdkRectangle* cliprect, GtkWidgetState* state, + GtkWidgetState* state, GtkTextDirection direction) { GtkStateFlags state_flags = GetStateFlagsFromGtkWidgetState(state); GtkStyleContext* style; GtkScrollbar *scrollbar; GtkAdjustment *adj; ensure_scrollbar_widget(); @@ -1274,17 +1274,17 @@ moz_gtk_spin_updown_paint(cairo_t *cr, G arrow_rect.x, arrow_rect.y, arrow_rect.width); gtk_style_context_restore(style); return MOZ_GTK_SUCCESS; } static gint moz_gtk_scale_paint(cairo_t *cr, GdkRectangle* rect, - GdkRectangle* cliprect, GtkWidgetState* state, + GtkWidgetState* state, GtkOrientation flags, GtkTextDirection direction) { GtkStateFlags state_flags = GetStateFlagsFromGtkWidgetState(state); gint x = 0, y = 0; GtkStyleContext* style; GtkWidget* widget; GtkBorder border; @@ -1315,17 +1315,17 @@ moz_gtk_scale_paint(cairo_t *cr, GdkRect gtk_render_focus(style, cr, rect->x, rect->y, rect->width, rect->height); gtk_style_context_restore(style); return MOZ_GTK_SUCCESS; } static gint moz_gtk_scale_thumb_paint(cairo_t *cr, GdkRectangle* rect, - GdkRectangle* cliprect, GtkWidgetState* state, + GtkWidgetState* state, GtkOrientation flags, GtkTextDirection direction) { GtkStateFlags state_flags = GetStateFlagsFromGtkWidgetState(state); GtkStyleContext* style; GtkWidget* widget; gint thumb_width, thumb_height, x, y; ensure_scale_widget(); @@ -1351,17 +1351,17 @@ moz_gtk_scale_thumb_paint(cairo_t *cr, G gtk_render_slider(style, cr, x, y, thumb_width, thumb_height, flags); gtk_style_context_restore(style); return MOZ_GTK_SUCCESS; } static gint moz_gtk_gripper_paint(cairo_t *cr, GdkRectangle* rect, - GdkRectangle* cliprect, GtkWidgetState* state, + GtkWidgetState* state, GtkTextDirection direction) { GtkStyleContext* style; ensure_handlebox_widget(); gtk_widget_set_direction(gHandleBoxWidget, direction); style = gtk_widget_get_style_context(gHandleBoxWidget); @@ -1373,17 +1373,17 @@ moz_gtk_gripper_paint(cairo_t *cr, GdkRe gtk_render_frame(style, cr, rect->x, rect->y, rect->width, rect->height); gtk_style_context_restore(style); return MOZ_GTK_SUCCESS; } static gint moz_gtk_hpaned_paint(cairo_t *cr, GdkRectangle* rect, - GdkRectangle* cliprect, GtkWidgetState* state) + GtkWidgetState* state) { GtkStyleContext* style; ensure_hpaned_widget(); style = gtk_widget_get_style_context(gHPanedWidget); gtk_style_context_save(style); gtk_style_context_add_class(style, GTK_STYLE_CLASS_PANE_SEPARATOR); gtk_style_context_set_state(style, GetStateFlagsFromGtkWidgetState(state)); @@ -1391,17 +1391,17 @@ moz_gtk_hpaned_paint(cairo_t *cr, GdkRec rect->x, rect->y, rect->width, rect->height); gtk_style_context_restore(style); return MOZ_GTK_SUCCESS; } static gint moz_gtk_vpaned_paint(cairo_t *cr, GdkRectangle* rect, - GdkRectangle* cliprect, GtkWidgetState* state) + GtkWidgetState* state) { GtkStyleContext* style; ensure_vpaned_widget(); style = gtk_widget_get_style_context(gVPanedWidget); gtk_style_context_save(style); gtk_style_context_add_class(style, GTK_STYLE_CLASS_PANE_SEPARATOR); gtk_style_context_set_state(style, GetStateFlagsFromGtkWidgetState(state)); @@ -1409,34 +1409,34 @@ moz_gtk_vpaned_paint(cairo_t *cr, GdkRec rect->x, rect->y, rect->width, rect->height); gtk_style_context_restore(style); return MOZ_GTK_SUCCESS; } static gint moz_gtk_caret_paint(cairo_t *cr, GdkRectangle* rect, - GdkRectangle* cliprect, GtkTextDirection direction) + GtkTextDirection direction) { GdkRectangle location = *rect; if (direction == GTK_TEXT_DIR_RTL) { /* gtk_draw_insertion_cursor ignores location.width */ location.x = rect->x + rect->width; } ensure_entry_widget(); gtk_draw_insertion_cursor(gEntryWidget, cr, &location, TRUE, direction, FALSE); return MOZ_GTK_SUCCESS; } static gint moz_gtk_entry_paint(cairo_t *cr, GdkRectangle* rect, - GdkRectangle* cliprect, GtkWidgetState* state, + GtkWidgetState* state, GtkWidget* widget, GtkTextDirection direction) { gint x = rect->x, y = rect->y, width = rect->width, height = rect->height; GtkStyleContext* style; gboolean interior_focus; gint focus_width; gtk_widget_set_direction(widget, direction); @@ -1491,17 +1491,17 @@ moz_gtk_entry_paint(cairo_t *cr, GdkRect } gtk_style_context_restore(style); return MOZ_GTK_SUCCESS; } static gint moz_gtk_treeview_paint(cairo_t *cr, GdkRectangle* rect, - GdkRectangle* cliprect, GtkWidgetState* state, + GtkWidgetState* state, GtkTextDirection direction) { gint xthickness, ythickness; GtkStyleContext *style; GtkStyleContext *style_tree; GtkStateFlags state_flags; GtkBorder border; @@ -1534,27 +1534,26 @@ moz_gtk_treeview_paint(cairo_t *cr, GdkR rect->x, rect->y, rect->width, rect->height); gtk_style_context_restore(style); gtk_style_context_restore(style_tree); return MOZ_GTK_SUCCESS; } static gint moz_gtk_tree_header_cell_paint(cairo_t *cr, GdkRectangle* rect, - GdkRectangle* cliprect, GtkWidgetState* state, + GtkWidgetState* state, gboolean isSorted, GtkTextDirection direction) { - moz_gtk_button_paint(cr, rect, cliprect, state, GTK_RELIEF_NORMAL, + moz_gtk_button_paint(cr, rect, state, GTK_RELIEF_NORMAL, gTreeHeaderCellWidget, direction); return MOZ_GTK_SUCCESS; } static gint moz_gtk_tree_header_sort_arrow_paint(cairo_t *cr, GdkRectangle* rect, - GdkRectangle* cliprect, GtkWidgetState* state, GtkArrowType arrow_type, GtkTextDirection direction) { GdkRectangle arrow_rect; gdouble arrow_angle; GtkStyleContext* style; ensure_tree_header_cell_widget(); @@ -1588,17 +1587,17 @@ moz_gtk_tree_header_sort_arrow_paint(cai arrow_rect.x, arrow_rect.y, arrow_rect.width); gtk_style_context_restore(style); return MOZ_GTK_SUCCESS; } static gint moz_gtk_treeview_expander_paint(cairo_t *cr, GdkRectangle* rect, - GdkRectangle* cliprect, GtkWidgetState* state, + GtkWidgetState* state, GtkExpanderStyle expander_state, GtkTextDirection direction) { GtkStyleContext *style; ensure_tree_view_widget(); gtk_widget_set_direction(gTreeViewWidget, direction); @@ -1612,17 +1611,17 @@ moz_gtk_treeview_expander_paint(cairo_t rect->x + rect->width / 2, rect->y + rect->height / 2, rect->width, rect->height); gtk_style_context_restore(style); return MOZ_GTK_SUCCESS; } static gint moz_gtk_expander_paint(cairo_t *cr, GdkRectangle* rect, - GdkRectangle* cliprect, GtkWidgetState* state, + GtkWidgetState* state, GtkExpanderStyle expander_state, GtkTextDirection direction) { GtkStyleContext *style; ensure_expander_widget(); gtk_widget_set_direction(gExpanderWidget, direction); @@ -1634,30 +1633,30 @@ moz_gtk_expander_paint(cairo_t *cr, GdkR rect->x + rect->width / 2, rect->y + rect->height / 2, rect->width, rect->height); gtk_style_context_restore(style); return MOZ_GTK_SUCCESS; } static gint moz_gtk_combo_box_paint(cairo_t *cr, GdkRectangle* rect, - GdkRectangle* cliprect, GtkWidgetState* state, + GtkWidgetState* state, gboolean ishtml, GtkTextDirection direction) { GdkRectangle arrow_rect, real_arrow_rect; gint arrow_size, separator_width; gboolean wide_separators; GtkStyleContext* style; GtkRequisition arrow_req; ensure_combo_box_widgets(); /* Also sets the direction on gComboBoxButtonWidget, which is then * inherited by the separator and arrow */ - moz_gtk_button_paint(cr, rect, cliprect, state, GTK_RELIEF_NORMAL, + moz_gtk_button_paint(cr, rect, state, GTK_RELIEF_NORMAL, gComboBoxButtonWidget, direction); calculate_button_inner_rect(gComboBoxButtonWidget, rect, &arrow_rect, direction, ishtml); /* Now arrow_rect contains the inner rect ; we want to correct the width * to what the arrow needs (see gtk_combo_box_size_allocate) */ gtk_widget_size_request(gComboBoxArrowWidget, &arrow_req); if (direction == GTK_TEXT_DIR_LTR) @@ -1701,17 +1700,17 @@ moz_gtk_combo_box_paint(cairo_t *cr, Gdk arrow_rect.x, arrow_rect.y, arrow_rect.x, arrow_rect.y + arrow_rect.height); } return MOZ_GTK_SUCCESS; } static gint moz_gtk_arrow_paint(cairo_t *cr, GdkRectangle* rect, - GdkRectangle* cliprect, GtkWidgetState* state, + GtkWidgetState* state, GtkArrowType arrow_type, GtkTextDirection direction) { GtkStyleContext* style; GtkStateFlags state_flags = GetStateFlagsFromGtkWidgetState(state); GdkRectangle arrow_rect; gdouble arrow_angle = ARROW_UP; ensure_button_arrow_widget(); @@ -1735,29 +1734,28 @@ moz_gtk_arrow_paint(cairo_t *cr, GdkRect gtk_render_arrow(style, cr, arrow_angle, arrow_rect.x, arrow_rect.y, arrow_rect.width); gtk_style_context_restore(style); return MOZ_GTK_SUCCESS; } static gint moz_gtk_combo_box_entry_button_paint(cairo_t *cr, GdkRectangle* rect, - GdkRectangle* cliprect, GtkWidgetState* state, gboolean input_focus, GtkTextDirection direction) { gint x_displacement, y_displacement; GdkRectangle arrow_rect, real_arrow_rect; GtkStateFlags state_flags = GetStateFlagsFromGtkWidgetState(state); GtkStyleContext* style; ensure_combo_box_entry_widgets(); - moz_gtk_button_paint(cr, rect, cliprect, state, GTK_RELIEF_NORMAL, + moz_gtk_button_paint(cr, rect, state, GTK_RELIEF_NORMAL, gComboBoxEntryButtonWidget, direction); calculate_button_inner_rect(gComboBoxEntryButtonWidget, rect, &arrow_rect, direction, FALSE); if (state_flags & GTK_STATE_FLAG_ACTIVE) { gtk_widget_style_get(gComboBoxEntryButtonWidget, "child-displacement-x", &x_displacement, "child-displacement-y", &y_displacement, @@ -1775,17 +1773,17 @@ moz_gtk_combo_box_entry_button_paint(cai real_arrow_rect.x, real_arrow_rect.y, real_arrow_rect.width); return MOZ_GTK_SUCCESS; } static gint moz_gtk_container_paint(cairo_t *cr, GdkRectangle* rect, - GdkRectangle* cliprect, GtkWidgetState* state, + GtkWidgetState* state, gboolean isradio, GtkTextDirection direction) { GtkStateFlags state_flags = GetStateFlagsFromGtkWidgetState(state); GtkStyleContext* style; GtkWidget *widget; gboolean interior_focus; gint focus_width, focus_pad; @@ -1815,17 +1813,17 @@ moz_gtk_container_paint(cairo_t *cr, Gdk } gtk_style_context_restore(style); return MOZ_GTK_SUCCESS; } static gint moz_gtk_toggle_label_paint(cairo_t *cr, GdkRectangle* rect, - GdkRectangle* cliprect, GtkWidgetState* state, + GtkWidgetState* state, gboolean isradio, GtkTextDirection direction) { GtkStyleContext *style; GtkWidget *widget; gboolean interior_focus; if (!state->focused) return MOZ_GTK_SUCCESS; @@ -1855,17 +1853,17 @@ moz_gtk_toggle_label_paint(cairo_t *cr, rect->x, rect->y, rect->width, rect->height); gtk_style_context_restore(style); return MOZ_GTK_SUCCESS; } static gint moz_gtk_toolbar_paint(cairo_t *cr, GdkRectangle* rect, - GdkRectangle* cliprect, GtkTextDirection direction) + GtkTextDirection direction) { GtkStyleContext* style; ensure_toolbar_widget(); gtk_widget_set_direction(gToolbarWidget, direction); style = gtk_widget_get_style_context(gToolbarWidget); gtk_style_context_save(style); @@ -1875,17 +1873,16 @@ moz_gtk_toolbar_paint(cairo_t *cr, GdkRe gtk_render_frame(style, cr, rect->x, rect->y, rect->width, rect->height); gtk_style_context_restore(style); return MOZ_GTK_SUCCESS; } static gint moz_gtk_toolbar_separator_paint(cairo_t *cr, GdkRectangle* rect, - GdkRectangle* cliprect, GtkTextDirection direction) { GtkStyleContext* style; gint separator_width; gint paint_width; gboolean wide_separators; /* Defined as constants in GTK+ 2.10.14 */ @@ -1927,17 +1924,17 @@ moz_gtk_toolbar_separator_paint(cairo_t rect->y + rect->height * end_fraction); } return MOZ_GTK_SUCCESS; } static gint moz_gtk_tooltip_paint(cairo_t *cr, GdkRectangle* rect, - GdkRectangle* cliprect, GtkTextDirection direction) + GtkTextDirection direction) { GtkStyleContext* style; ensure_tooltip_widget(); gtk_widget_set_direction(gTooltipWidget, direction); style = gtk_widget_get_style_context(gTooltipWidget); gtk_style_context_save(style); @@ -1945,17 +1942,17 @@ moz_gtk_tooltip_paint(cairo_t *cr, GdkRe 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); gtk_style_context_restore(style); return MOZ_GTK_SUCCESS; } static gint moz_gtk_resizer_paint(cairo_t *cr, GdkRectangle* rect, - GdkRectangle* cliprect, GtkWidgetState* state, + GtkWidgetState* state, GtkTextDirection direction) { GtkStyleContext* style; ensure_frame_widget(); gtk_widget_set_direction(gStatusbarWidget, direction); style = gtk_widget_get_style_context(gStatusbarWidget); @@ -1966,34 +1963,34 @@ moz_gtk_resizer_paint(cairo_t *cr, GdkRe gtk_render_handle(style, cr, rect->x, rect->y, rect->width, rect->height); gtk_style_context_restore(style); return MOZ_GTK_SUCCESS; } static gint moz_gtk_frame_paint(cairo_t *cr, GdkRectangle* rect, - GdkRectangle* cliprect, GtkTextDirection direction) + GtkTextDirection direction) { GtkStyleContext* style; ensure_frame_widget(); gtk_widget_set_direction(gFrameWidget, direction); style = gtk_widget_get_style_context(gFrameWidget); gtk_style_context_save(style); gtk_style_context_add_class(style, GTK_STYLE_CLASS_FRAME); gtk_render_frame(style, cr, rect->x, rect->y, rect->width, rect->height); gtk_style_context_restore(style); return MOZ_GTK_SUCCESS; } static gint moz_gtk_progressbar_paint(cairo_t *cr, GdkRectangle* rect, - GdkRectangle* cliprect, GtkTextDirection direction) + GtkTextDirection direction) { GtkStyleContext* style; ensure_progress_widget(); gtk_widget_set_direction(gProgressWidget, direction); style = gtk_widget_get_style_context(gProgressWidget); gtk_style_context_save(style); @@ -2003,17 +2000,17 @@ moz_gtk_progressbar_paint(cairo_t *cr, G gtk_render_frame(style, cr, rect->x, rect->y, rect->width, rect->height); gtk_style_context_restore(style); return MOZ_GTK_SUCCESS; } static gint moz_gtk_progress_chunk_paint(cairo_t *cr, GdkRectangle* rect, - GdkRectangle* cliprect, GtkTextDirection direction, + GtkTextDirection direction, GtkThemeWidgetType widget) { GtkStyleContext* style; ensure_progress_widget(); gtk_widget_set_direction(gProgressWidget, direction); style = gtk_widget_get_style_context(gProgressWidget); @@ -2075,17 +2072,17 @@ moz_gtk_get_tab_thickness(void) return 2; /* some themes don't set ythickness correctly */ return border.top; } /* actual small tabs */ static gint moz_gtk_tab_paint(cairo_t *cr, GdkRectangle* rect, - GdkRectangle* cliprect, GtkWidgetState* state, + GtkWidgetState* state, GtkTabFlags flags, GtkTextDirection direction) { /* When the tab isn't selected, we just draw a notebook extension. * When it is selected, we overwrite the adjacent border of the tabpanel * touching the tab with a pierced border (called "the gap") to make the * tab appear physically attached to the tabpanel; see details below. */ GtkStyleContext* style; @@ -2230,17 +2227,17 @@ moz_gtk_tab_paint(cairo_t *cr, GdkRectan gtk_style_context_restore(style); return MOZ_GTK_SUCCESS; } /* tab area*/ static gint moz_gtk_tabpanels_paint(cairo_t *cr, GdkRectangle* rect, - GdkRectangle* cliprect, GtkTextDirection direction) + GtkTextDirection direction) { GtkStyleContext* style; ensure_tab_widget(); gtk_widget_set_direction(gTabWidget, direction); style = gtk_widget_get_style_context(gTabWidget); gtk_style_context_save(style); @@ -2282,17 +2279,17 @@ moz_gtk_tabpanels_paint(cairo_t *cr, Gdk cairo_restore(cr); gtk_style_context_restore(style); return MOZ_GTK_SUCCESS; } static gint moz_gtk_tab_scroll_arrow_paint(cairo_t *cr, GdkRectangle* rect, - GdkRectangle* cliprect, GtkWidgetState* state, + GtkWidgetState* state, GtkArrowType arrow_type, GtkTextDirection direction) { GtkStateFlags state_flags = GetStateFlagsFromGtkWidgetState(state); GtkStyleContext* style; gdouble arrow_angle; gint arrow_size = MIN(rect->width, rect->height); gint x = rect->x + (rect->width - arrow_size) / 2; @@ -2327,17 +2324,17 @@ moz_gtk_tab_scroll_arrow_paint(cairo_t * x, y, arrow_size); } gtk_style_context_restore(style); return MOZ_GTK_SUCCESS; } static gint moz_gtk_menu_bar_paint(cairo_t *cr, GdkRectangle* rect, - GdkRectangle* cliprect, GtkTextDirection direction) + GtkTextDirection direction) { GtkStyleContext* style; ensure_menu_bar_widget(); gtk_widget_set_direction(gMenuBarWidget, direction); style = gtk_widget_get_style_context(gMenuBarWidget); gtk_style_context_save(style); @@ -2346,17 +2343,17 @@ moz_gtk_menu_bar_paint(cairo_t *cr, GdkR gtk_render_frame(style, cr, rect->x, rect->y, rect->width, rect->height); gtk_style_context_restore(style); return MOZ_GTK_SUCCESS; } static gint moz_gtk_menu_popup_paint(cairo_t *cr, GdkRectangle* rect, - GdkRectangle* cliprect, GtkTextDirection direction) + GtkTextDirection direction) { GtkStyleContext* style; ensure_menu_popup_widget(); gtk_widget_set_direction(gMenuPopupWidget, direction); style = gtk_widget_get_style_context(gMenuPopupWidget); gtk_style_context_save(style); @@ -2366,17 +2363,17 @@ moz_gtk_menu_popup_paint(cairo_t *cr, Gd gtk_render_frame(style, cr, rect->x, rect->y, rect->width, rect->height); gtk_style_context_restore(style); return MOZ_GTK_SUCCESS; } static gint moz_gtk_menu_separator_paint(cairo_t *cr, GdkRectangle* rect, - GdkRectangle* cliprect, GtkTextDirection direction) + GtkTextDirection direction) { GtkStyleContext* style; gboolean wide_separators; gint separator_height; guint horizontal_padding; gint paint_height; GtkBorder border; @@ -2417,17 +2414,17 @@ moz_gtk_menu_separator_paint(cairo_t *cr } gtk_style_context_restore(style); return MOZ_GTK_SUCCESS; } static gint moz_gtk_menu_item_paint(cairo_t *cr, GdkRectangle* rect, - GdkRectangle* cliprect, GtkWidgetState* state, + GtkWidgetState* state, gint flags, GtkTextDirection direction) { GtkStyleContext* style; GtkWidget* item_widget; if (state->inHover && !state->disabled) { if (flags & MOZ_TOPLEVEL_MENU_ITEM) { ensure_menu_bar_item_widget(); @@ -2452,17 +2449,17 @@ moz_gtk_menu_item_paint(cairo_t *cr, Gdk gtk_style_context_restore(style); } return MOZ_GTK_SUCCESS; } static gint moz_gtk_menu_arrow_paint(cairo_t *cr, GdkRectangle* rect, - GdkRectangle* cliprect, GtkWidgetState* state, + GtkWidgetState* state, GtkTextDirection direction) { GtkStyleContext* style; GtkStateFlags state_flags = GetStateFlagsFromGtkWidgetState(state); ensure_menu_item_widget(); gtk_widget_set_direction(gMenuItemWidget, direction); @@ -2475,28 +2472,28 @@ moz_gtk_menu_arrow_paint(cairo_t *cr, Gd rect->x, rect->y, rect->width); gtk_style_context_restore(style); return MOZ_GTK_SUCCESS; } static gint moz_gtk_check_menu_item_paint(cairo_t *cr, GdkRectangle* rect, - GdkRectangle* cliprect, GtkWidgetState* state, + GtkWidgetState* state, gboolean checked, gboolean isradio, GtkTextDirection direction) { GtkStateFlags state_flags = GetStateFlagsFromGtkWidgetState(state); GtkStyleContext* style; GtkBorder border; gint offset; gint indicator_size, horizontal_padding; gint x, y; - moz_gtk_menu_item_paint(cr, rect, cliprect, state, FALSE, direction); + 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); @@ -2529,17 +2526,17 @@ moz_gtk_check_menu_item_paint(cairo_t *c } gtk_style_context_restore(style); return MOZ_GTK_SUCCESS; } static gint moz_gtk_window_paint(cairo_t *cr, GdkRectangle* rect, - GdkRectangle* cliprect, GtkTextDirection direction) + GtkTextDirection direction) { GtkStyleContext* style; ensure_window_widget(); gtk_widget_set_direction(gProtoWindow, direction); style = gtk_widget_get_style_context(gProtoWindow); gtk_style_context_save(style); @@ -3018,216 +3015,215 @@ moz_gtk_images_in_buttons() ensure_button_widget(); settings = gtk_widget_get_settings(gButtonWidget); g_object_get(settings, "gtk-button-images", &result, NULL); return result; } /* cairo_t *cr argument has to be a system-cairo. */ -/* TODO: GdkRectangle* cliprect is unused, shall we remove it? */ gint moz_gtk_widget_paint(GtkThemeWidgetType widget, cairo_t *cr, - GdkRectangle* rect, GdkRectangle* cliprect, + GdkRectangle* rect, GtkWidgetState* state, gint flags, GtkTextDirection direction) { switch (widget) { case MOZ_GTK_BUTTON: if (state->depressed) { ensure_toggle_button_widget(); - return moz_gtk_button_paint(cr, rect, cliprect, state, + return moz_gtk_button_paint(cr, rect, state, (GtkReliefStyle) flags, gToggleButtonWidget, direction); } ensure_button_widget(); - return moz_gtk_button_paint(cr, rect, cliprect, state, + return moz_gtk_button_paint(cr, rect, state, (GtkReliefStyle) flags, gButtonWidget, direction); break; case MOZ_GTK_CHECKBUTTON: case MOZ_GTK_RADIOBUTTON: - return moz_gtk_toggle_paint(cr, rect, cliprect, state, + return moz_gtk_toggle_paint(cr, rect, state, !!(flags & MOZ_GTK_WIDGET_CHECKED), !!(flags & MOZ_GTK_WIDGET_INCONSISTENT), (widget == MOZ_GTK_RADIOBUTTON), direction); break; case MOZ_GTK_SCROLLBAR_BUTTON: - return moz_gtk_scrollbar_button_paint(cr, rect, cliprect, state, + return moz_gtk_scrollbar_button_paint(cr, rect, state, (GtkScrollbarButtonFlags) flags, direction); break; case MOZ_GTK_SCROLLBAR_TRACK_HORIZONTAL: case MOZ_GTK_SCROLLBAR_TRACK_VERTICAL: return moz_gtk_scrollbar_trough_paint(widget, cr, rect, - cliprect, state, direction); + state, direction); break; case MOZ_GTK_SCROLLBAR_THUMB_HORIZONTAL: case MOZ_GTK_SCROLLBAR_THUMB_VERTICAL: return moz_gtk_scrollbar_thumb_paint(widget, cr, rect, - cliprect, state, direction); + state, direction); break; case MOZ_GTK_SCALE_HORIZONTAL: case MOZ_GTK_SCALE_VERTICAL: - return moz_gtk_scale_paint(cr, rect, cliprect, state, + return moz_gtk_scale_paint(cr, rect, state, (GtkOrientation) flags, direction); break; case MOZ_GTK_SCALE_THUMB_HORIZONTAL: case MOZ_GTK_SCALE_THUMB_VERTICAL: - return moz_gtk_scale_thumb_paint(cr, rect, cliprect, state, + return moz_gtk_scale_thumb_paint(cr, rect, state, (GtkOrientation) flags, direction); break; case MOZ_GTK_SPINBUTTON: return moz_gtk_spin_paint(cr, rect, direction); break; case MOZ_GTK_SPINBUTTON_UP: case MOZ_GTK_SPINBUTTON_DOWN: return moz_gtk_spin_updown_paint(cr, rect, (widget == MOZ_GTK_SPINBUTTON_DOWN), state, direction); break; case MOZ_GTK_SPINBUTTON_ENTRY: ensure_spin_widget(); - return moz_gtk_entry_paint(cr, rect, cliprect, state, + return moz_gtk_entry_paint(cr, rect, state, gSpinWidget, direction); break; case MOZ_GTK_GRIPPER: - return moz_gtk_gripper_paint(cr, rect, cliprect, state, + return moz_gtk_gripper_paint(cr, rect, state, direction); break; case MOZ_GTK_TREEVIEW: - return moz_gtk_treeview_paint(cr, rect, cliprect, state, + return moz_gtk_treeview_paint(cr, rect, state, direction); break; case MOZ_GTK_TREE_HEADER_CELL: - return moz_gtk_tree_header_cell_paint(cr, rect, cliprect, state, + return moz_gtk_tree_header_cell_paint(cr, rect, state, flags, direction); break; case MOZ_GTK_TREE_HEADER_SORTARROW: return moz_gtk_tree_header_sort_arrow_paint(cr, rect, cliprect, state, (GtkArrowType) flags, direction); break; case MOZ_GTK_TREEVIEW_EXPANDER: - return moz_gtk_treeview_expander_paint(cr, rect, cliprect, state, + return moz_gtk_treeview_expander_paint(cr, rect, state, (GtkExpanderStyle) flags, direction); break; case MOZ_GTK_EXPANDER: - return moz_gtk_expander_paint(cr, rect, cliprect, state, + return moz_gtk_expander_paint(cr, rect, state, (GtkExpanderStyle) flags, direction); break; case MOZ_GTK_ENTRY: ensure_entry_widget(); - return moz_gtk_entry_paint(cr, rect, cliprect, state, + return moz_gtk_entry_paint(cr, rect, state, gEntryWidget, direction); break; case MOZ_GTK_ENTRY_CARET: - return moz_gtk_caret_paint(cr, rect, cliprect, direction); + return moz_gtk_caret_paint(cr, rect, direction); break; case MOZ_GTK_DROPDOWN: - return moz_gtk_combo_box_paint(cr, rect, cliprect, state, + return moz_gtk_combo_box_paint(cr, rect, state, (gboolean) flags, direction); break; case MOZ_GTK_DROPDOWN_ARROW: return moz_gtk_combo_box_entry_button_paint(cr, rect, cliprect, state, flags, direction); break; case MOZ_GTK_DROPDOWN_ENTRY: ensure_combo_box_entry_widgets(); - return moz_gtk_entry_paint(cr, rect, cliprect, state, + return moz_gtk_entry_paint(cr, rect, state, gComboBoxEntryTextareaWidget, direction); break; case MOZ_GTK_CHECKBUTTON_CONTAINER: case MOZ_GTK_RADIOBUTTON_CONTAINER: - return moz_gtk_container_paint(cr, rect, cliprect, state, + return moz_gtk_container_paint(cr, rect, state, (widget == MOZ_GTK_RADIOBUTTON_CONTAINER), direction); break; case MOZ_GTK_CHECKBUTTON_LABEL: case MOZ_GTK_RADIOBUTTON_LABEL: - return moz_gtk_toggle_label_paint(cr, rect, cliprect, state, + return moz_gtk_toggle_label_paint(cr, rect, state, (widget == MOZ_GTK_RADIOBUTTON_LABEL), direction); break; case MOZ_GTK_TOOLBAR: - return moz_gtk_toolbar_paint(cr, rect, cliprect, direction); + return moz_gtk_toolbar_paint(cr, rect, direction); break; case MOZ_GTK_TOOLBAR_SEPARATOR: return moz_gtk_toolbar_separator_paint(cr, rect, cliprect, direction); break; case MOZ_GTK_TOOLTIP: - return moz_gtk_tooltip_paint(cr, rect, cliprect, direction); + return moz_gtk_tooltip_paint(cr, rect, direction); break; case MOZ_GTK_FRAME: - return moz_gtk_frame_paint(cr, rect, cliprect, direction); + return moz_gtk_frame_paint(cr, rect, direction); break; case MOZ_GTK_RESIZER: - return moz_gtk_resizer_paint(cr, rect, cliprect, state, + return moz_gtk_resizer_paint(cr, rect, state, direction); break; case MOZ_GTK_PROGRESSBAR: - return moz_gtk_progressbar_paint(cr, rect, cliprect, direction); + return moz_gtk_progressbar_paint(cr, rect, direction); break; case MOZ_GTK_PROGRESS_CHUNK: case MOZ_GTK_PROGRESS_CHUNK_INDETERMINATE: case MOZ_GTK_PROGRESS_CHUNK_VERTICAL_INDETERMINATE: return moz_gtk_progress_chunk_paint(cr, rect, cliprect, direction, widget); break; case MOZ_GTK_TAB: - return moz_gtk_tab_paint(cr, rect, cliprect, state, + return moz_gtk_tab_paint(cr, rect, state, (GtkTabFlags) flags, direction); break; case MOZ_GTK_TABPANELS: - return moz_gtk_tabpanels_paint(cr, rect, cliprect, direction); + return moz_gtk_tabpanels_paint(cr, rect, direction); break; case MOZ_GTK_TAB_SCROLLARROW: - return moz_gtk_tab_scroll_arrow_paint(cr, rect, cliprect, state, + return moz_gtk_tab_scroll_arrow_paint(cr, rect, state, (GtkArrowType) flags, direction); break; case MOZ_GTK_MENUBAR: - return moz_gtk_menu_bar_paint(cr, rect, cliprect, direction); + return moz_gtk_menu_bar_paint(cr, rect, direction); break; case MOZ_GTK_MENUPOPUP: - return moz_gtk_menu_popup_paint(cr, rect, cliprect, direction); + return moz_gtk_menu_popup_paint(cr, rect, direction); break; case MOZ_GTK_MENUSEPARATOR: return moz_gtk_menu_separator_paint(cr, rect, cliprect, direction); break; case MOZ_GTK_MENUITEM: - return moz_gtk_menu_item_paint(cr, rect, cliprect, state, flags, + return moz_gtk_menu_item_paint(cr, rect, state, flags, direction); break; case MOZ_GTK_MENUARROW: - return moz_gtk_menu_arrow_paint(cr, rect, cliprect, state, + return moz_gtk_menu_arrow_paint(cr, rect, state, direction); break; case MOZ_GTK_TOOLBARBUTTON_ARROW: - return moz_gtk_arrow_paint(cr, rect, cliprect, state, + return moz_gtk_arrow_paint(cr, rect, state, (GtkArrowType) flags, direction); break; case MOZ_GTK_CHECKMENUITEM: case MOZ_GTK_RADIOMENUITEM: - return moz_gtk_check_menu_item_paint(cr, rect, cliprect, state, + return moz_gtk_check_menu_item_paint(cr, rect, state, (gboolean) flags, (widget == MOZ_GTK_RADIOMENUITEM), direction); break; case MOZ_GTK_SPLITTER_HORIZONTAL: - return moz_gtk_vpaned_paint(cr, rect, cliprect, state); + return moz_gtk_vpaned_paint(cr, rect, state); break; case MOZ_GTK_SPLITTER_VERTICAL: - return moz_gtk_hpaned_paint(cr, rect, cliprect, state); + return moz_gtk_hpaned_paint(cr, rect, state); break; case MOZ_GTK_WINDOW: - return moz_gtk_window_paint(cr, rect, cliprect, direction); + return moz_gtk_window_paint(cr, rect, direction); break; default: g_warning("Unknown widget type: %d", widget); } return MOZ_GTK_UNKNOWN_WIDGET; }
--- a/widget/gtk2/gtkdrawing.h +++ b/widget/gtk2/gtkdrawing.h @@ -236,17 +236,17 @@ GdkColormap* moz_gtk_widget_get_colormap gint moz_gtk_widget_paint(GtkThemeWidgetType widget, GdkDrawable* drawable, GdkRectangle* rect, GdkRectangle* cliprect, GtkWidgetState* state, gint flags, GtkTextDirection direction); #else gint moz_gtk_widget_paint(GtkThemeWidgetType widget, cairo_t *cr, - GdkRectangle* rect, GdkRectangle* cliprect, + GdkRectangle* rect, GtkWidgetState* state, gint flags, GtkTextDirection direction); #endif /*** Widget metrics ***/ /** * Get the border size of a widget
--- a/widget/gtk2/nsNativeThemeGTK.cpp +++ b/widget/gtk2/nsNativeThemeGTK.cpp @@ -607,16 +607,17 @@ nsNativeThemeGTK::GetGtkWidgetAndState(u break; default: return false; } return true; } +#if defined(MOZ_WIDGET_GTK2) class ThemeRenderer : public gfxGdkNativeRenderer { public: ThemeRenderer(GtkWidgetState aState, GtkThemeWidgetType aGTKWidgetType, gint aFlags, GtkTextDirection aDirection, const GdkRectangle& aGDKRect, const GdkRectangle& aGDKClip) : mState(aState), mGTKWidgetType(aGTKWidgetType), mFlags(aFlags), mDirection(aDirection), mGDKRect(aGDKRect), mGDKClip(aGDKClip) {} nsresult DrawWithGDK(GdkDrawable * drawable, gint offsetX, gint offsetY, @@ -649,16 +650,17 @@ ThemeRenderer::DrawWithGDK(GdkDrawable * gdk_rectangle_intersect(&gdk_clip, &surfaceRect, &gdk_clip); NS_ASSERTION(numClipRects == 0, "We don't support clipping!!!"); moz_gtk_widget_paint(mGTKWidgetType, drawable, &gdk_rect, &gdk_clip, &mState, mFlags, mDirection); return NS_OK; } +#endif bool nsNativeThemeGTK::GetExtraSizeForWidget(nsIFrame* aFrame, uint8_t aWidgetType, nsIntMargin* aExtra) { *aExtra = nsIntMargin(0,0,0,0); // Allow an extra one pixel above and below the thumb for certain // GTK2 themes (Ximian Industrial, Bluecurve, Misty, at least); @@ -777,34 +779,19 @@ nsNativeThemeGTK::DrawWidgetBackground(n int32_t(dirtyRect.Width()), int32_t(dirtyRect.Height())); if (widgetRect.IsEmpty() || !drawingRect.IntersectRect(overflowRect, drawingRect)) return NS_OK; // gdk rectangles are wrt the drawing rect. - // The gdk_clip is just advisory here, meaning "you don't - // need to draw outside this rect if you don't feel like it!" - GdkRectangle gdk_clip = {0, 0, drawingRect.width, drawingRect.height}; - GdkRectangle gdk_rect = {-drawingRect.x, -drawingRect.y, widgetRect.width, widgetRect.height}; - ThemeRenderer renderer(state, gtkWidgetType, flags, direction, - gdk_rect, gdk_clip); - - // Some themes (e.g. Clearlooks) just don't clip properly to any - // clip rect we provide, so we cannot advertise support for clipping within - // the widget bounds. - uint32_t rendererFlags = 0; - if (GetWidgetTransparency(aFrame, aWidgetType) == eOpaque) { - rendererFlags |= gfxGdkNativeRenderer::DRAW_IS_OPAQUE; - } - // translate everything so (0,0) is the top left of the drawingRect gfxContextAutoSaveRestore autoSR(ctx); if (snapXY) { // Rects are in device coords. ctx->IdentityMatrix(); } ctx->Translate(rect.TopLeft() + gfxPoint(drawingRect.x, drawingRect.y)); @@ -812,21 +799,41 @@ nsNativeThemeGTK::DrawWidgetBackground(n "Trying to render an unsafe widget!"); bool safeState = IsWidgetStateSafe(mSafeWidgetStates, aWidgetType, &state); if (!safeState) { gLastGdkError = 0; gdk_error_trap_push (); } +#if defined(MOZ_WIDGET_GTK2) + // The gdk_clip is just advisory here, meaning "you don't + // need to draw outside this rect if you don't feel like it!" + GdkRectangle gdk_clip = {0, 0, drawingRect.width, drawingRect.height}; + + ThemeRenderer renderer(state, gtkWidgetType, flags, direction, + gdk_rect, gdk_clip); + + // Some themes (e.g. Clearlooks) just don't clip properly to any + // clip rect we provide, so we cannot advertise support for clipping within + // the widget bounds. + uint32_t rendererFlags = 0; + if (GetWidgetTransparency(aFrame, aWidgetType) == eOpaque) { + rendererFlags |= gfxGdkNativeRenderer::DRAW_IS_OPAQUE; + } + // GtkStyles (used by the widget drawing backend) are created for a // particular colormap/visual. GdkColormap* colormap = moz_gtk_widget_get_colormap(); renderer.Draw(ctx, drawingRect.Size(), rendererFlags, colormap); +#else + moz_gtk_widget_paint(gtkWidgetType, ctx->GetCairo(), &gdk_rect, + &state, flags, direction); +#endif if (!safeState) { gdk_flush(); gLastGdkError = gdk_error_trap_pop (); if (gLastGdkError) { #ifdef DEBUG printf("GTK theme failed for widget type %d, error was %d, state was "