summaryrefslogtreecommitdiff
path: root/widget/gtk/gtk3drawing.cpp
diff options
context:
space:
mode:
authortrav90 <travawine@protonmail.ch>2018-04-05 15:49:41 -0500
committertrav90 <travawine@protonmail.ch>2018-04-05 15:49:41 -0500
commitcf1b29fe4740e18a8aa0e2e35cba9dea524829ee (patch)
treec11357a763eaa8c2970eb3133d56beece0312fba /widget/gtk/gtk3drawing.cpp
parentfe4175e799cffb712a088221faeb1dffcdaea7bb (diff)
downloaduxp-cf1b29fe4740e18a8aa0e2e35cba9dea524829ee.tar.gz
[GTK] Rename radio/check menuitem and indicator as used with ClaimStyleContext.
The same name is retained for moz_gtk_widget_paint(), which is now more consistent.
Diffstat (limited to 'widget/gtk/gtk3drawing.cpp')
-rw-r--r--widget/gtk/gtk3drawing.cpp30
1 files changed, 13 insertions, 17 deletions
diff --git a/widget/gtk/gtk3drawing.cpp b/widget/gtk/gtk3drawing.cpp
index 3662851a79..89ac5001f8 100644
--- a/widget/gtk/gtk3drawing.cpp
+++ b/widget/gtk/gtk3drawing.cpp
@@ -171,7 +171,7 @@ moz_gtk_menuitem_get_horizontal_padding(gint* horizontal_padding)
gint
moz_gtk_checkmenuitem_get_horizontal_padding(gint* horizontal_padding)
{
- GtkStyleContext *style = ClaimStyleContext(MOZ_GTK_CHECKMENUITEM_CONTAINER);
+ GtkStyleContext *style = ClaimStyleContext(MOZ_GTK_CHECKMENUITEM);
gtk_style_context_get_style(style,
"horizontal-padding", horizontal_padding,
nullptr);
@@ -1883,10 +1883,10 @@ moz_gtk_menu_arrow_paint(cairo_t *cr, GdkRectangle* rect,
// See gtk_real_check_menu_item_draw_indicator() for reference.
static gint
-moz_gtk_check_menu_item_paint(cairo_t *cr, GdkRectangle* rect,
+moz_gtk_check_menu_item_paint(WidgetNodeType widgetType,
+ cairo_t *cr, GdkRectangle* rect,
GtkWidgetState* state,
- gboolean checked, gboolean isradio,
- GtkTextDirection direction)
+ gboolean checked, GtkTextDirection direction)
{
GtkStateFlags state_flags = GetStateFlagsFromGtkWidgetState(state);
GtkStyleContext* style;
@@ -1900,9 +1900,7 @@ moz_gtk_check_menu_item_paint(cairo_t *cr, GdkRectangle* rect,
state_flags = static_cast<GtkStateFlags>(state_flags|checkbox_check_state);
}
- style = ClaimStyleContext(isradio ? MOZ_GTK_RADIOMENUITEM_CONTAINER :
- MOZ_GTK_CHECKMENUITEM_CONTAINER,
- direction);
+ style = ClaimStyleContext(widgetType, direction);
gtk_style_context_get_style(style,
"indicator-size", &indicator_size,
"horizontal-padding", &horizontal_padding,
@@ -1910,9 +1908,10 @@ moz_gtk_check_menu_item_paint(cairo_t *cr, GdkRectangle* rect,
gtk_style_context_get_padding(style, state_flags, &padding);
ReleaseStyleContext(style);
- style = ClaimStyleContext(isradio ? MOZ_GTK_RADIOMENUITEM :
- MOZ_GTK_CHECKMENUITEM,
- direction, state_flags);
+ bool isRadio = (widgetType == MOZ_GTK_RADIOMENUITEM);
+ WidgetNodeType indicatorType = isRadio ? MOZ_GTK_RADIOMENUITEM_INDICATOR
+ : MOZ_GTK_CHECKMENUITEM_INDICATOR;
+ style = ClaimStyleContext(indicatorType, direction, state_flags);
gint offset = padding.left + 2;
if (direction == GTK_TEXT_DIR_RTL) {
@@ -1928,7 +1927,7 @@ moz_gtk_check_menu_item_paint(cairo_t *cr, GdkRectangle* rect,
gtk_render_frame(style, cr, x, y, indicator_size, indicator_size);
}
- if (isradio) {
+ if (isRadio) {
gtk_render_option(style, cr, x, y, indicator_size, indicator_size);
} else {
gtk_render_check(style, cr, x, y, indicator_size, indicator_size);
@@ -2173,8 +2172,7 @@ moz_gtk_get_widget_border(WidgetNodeType widget, gint* left, gint* top,
{
// Bug 1274143 for MOZ_GTK_MENUBARITEM
WidgetNodeType type =
- widget == MOZ_GTK_MENUBARITEM || widget == MOZ_GTK_MENUITEM ?
- MOZ_GTK_MENUITEM : MOZ_GTK_CHECKMENUITEM_CONTAINER;
+ widget == MOZ_GTK_MENUBARITEM ? MOZ_GTK_MENUITEM : widget;
style = ClaimStyleContext(type);
moz_gtk_add_style_padding(style, left, top, right, bottom);
@@ -2793,10 +2791,8 @@ moz_gtk_widget_paint(WidgetNodeType widget, cairo_t *cr,
break;
case MOZ_GTK_CHECKMENUITEM:
case MOZ_GTK_RADIOMENUITEM:
- return moz_gtk_check_menu_item_paint(cr, rect, state,
- (gboolean) flags,
- (widget == MOZ_GTK_RADIOMENUITEM),
- direction);
+ return moz_gtk_check_menu_item_paint(widget, cr, rect, state,
+ (gboolean) flags, direction);
break;
case MOZ_GTK_SPLITTER_HORIZONTAL:
return moz_gtk_vpaned_paint(cr, rect, state);