static GtkCssValue * gtk_css_win32_size_value_parse_part_size (GtkCssValue *value, GtkCssParser *parser) { if (!_gtk_css_parser_try_int (parser, &value->val.part.part)) { _gtk_css_value_unref (value); _gtk_css_parser_error (parser, "Expected an integer part ID"); return NULL; } if (! _gtk_css_parser_try (parser, ",", TRUE)) { _gtk_css_value_unref (value); _gtk_css_parser_error (parser, "Expected ','"); return NULL; } if (!_gtk_css_parser_try_int (parser, &value->val.part.state)) { _gtk_css_value_unref (value); _gtk_css_parser_error (parser, "Expected an integer state ID"); return NULL; } return value; }
static GtkCssValue * gtk_css_win32_size_value_parse_size (GtkCssValue *value, GtkCssParser *parser) { char *name; name = _gtk_css_parser_try_ident (parser, TRUE); if (name) { value->val.size.id = gtk_win32_get_sys_metric_id_for_name (name); if (value->val.size.id == -1) { _gtk_css_parser_error (parser, "'%s' is not a name for a win32 metric.", name); _gtk_css_value_unref (value); g_free (name); return NULL; } g_free (name); } else if (!_gtk_css_parser_try_int (parser, &value->val.size.id)) { _gtk_css_value_unref (value); _gtk_css_parser_error (parser, "Expected an integer ID"); return NULL; } return value; }
/** * gtk_symbolic_color_resolve: * @color: a #GtkSymbolicColor * @props: (allow-none): #GtkStyleProperties to use when resolving * named colors, or %NULL * @resolved_color: (out): return location for the resolved color * * If @color is resolvable, @resolved_color will be filled in * with the resolved color, and %TRUE will be returned. Generally, * if @color can't be resolved, it is due to it being defined on * top of a named color that doesn't exist in @props. * * When @props is %NULL, resolving of named colors will fail, so if * your @color is or references such a color, this function will * return %FALSE. * * Returns: %TRUE if the color has been resolved * * Since: 3.0 * * Deprecated: 3.8: #GtkSymbolicColor is deprecated. **/ gboolean gtk_symbolic_color_resolve (GtkSymbolicColor *color, GtkStyleProperties *props, GdkRGBA *resolved_color) { GdkRGBA pink = { 1.0, 0.5, 0.5, 1.0 }; GtkCssValue *v, *current; g_return_val_if_fail (color != NULL, FALSE); g_return_val_if_fail (resolved_color != NULL, FALSE); g_return_val_if_fail (props == NULL || GTK_IS_STYLE_PROPERTIES (props), FALSE); current = _gtk_css_rgba_value_new_from_rgba (&pink); v = _gtk_css_color_value_resolve (color->value, GTK_STYLE_PROVIDER_PRIVATE (props), current, 0, NULL); _gtk_css_value_unref (current); if (v == NULL) return FALSE; *resolved_color = *_gtk_css_rgba_value_get_rgba (v); _gtk_css_value_unref (v); return TRUE; }
static void gtk_css_image_radial_dispose (GObject *object) { GtkCssImageRadial *radial = GTK_CSS_IMAGE_RADIAL (object); int i; if (radial->stops) { g_array_free (radial->stops, TRUE); radial->stops = NULL; } if (radial->position) { _gtk_css_value_unref (radial->position); radial->position = NULL; } for (i = 0; i < 2; i++) if (radial->sizes[i]) { _gtk_css_value_unref (radial->sizes[i]); radial->sizes[i] = NULL; } G_OBJECT_CLASS (_gtk_css_image_radial_parent_class)->dispose (object); }
static void gtk_css_image_clear_color_stop (gpointer color_stop) { GtkCssImageRadialColorStop *stop = color_stop; _gtk_css_value_unref (stop->color); if (stop->offset) _gtk_css_value_unref (stop->offset); }
static void gtk_css_value_bg_size_free (GtkCssValue *value) { if (value->x) _gtk_css_value_unref (value->x); if (value->y) _gtk_css_value_unref (value->y); g_slice_free (GtkCssValue, value); }
static void gtk_css_transition_finalize (GObject *object) { GtkCssTransition *transition = GTK_CSS_TRANSITION (object); _gtk_css_value_unref (transition->start); _gtk_css_value_unref (transition->end); _gtk_css_value_unref (transition->ease); G_OBJECT_CLASS (_gtk_css_transition_parent_class)->finalize (object); }
static void gtk_css_animation_set_values (GtkStyleAnimation *style_animation, gint64 for_time_us, GtkCssComputedValues *values) { GtkCssAnimation *animation = GTK_CSS_ANIMATION (style_animation); double iteration, progress; guint i; iteration = gtk_css_animation_get_iteration (animation, for_time_us); if (!gtk_css_animation_is_executing_at_iteration (animation, iteration)) return; progress = gtk_css_animation_get_progress_from_iteration (animation, iteration); progress = _gtk_css_ease_value_transform (animation->ease, progress); for (i = 0; i < _gtk_css_keyframes_get_n_properties (animation->keyframes); i++) { GtkCssValue *value; guint property_id; property_id = _gtk_css_keyframes_get_property_id (animation->keyframes, i); value = _gtk_css_keyframes_get_value (animation->keyframes, i, progress, _gtk_css_computed_values_get_intrinsic_value (values, property_id)); _gtk_css_computed_values_set_animated_value (values, property_id, value); _gtk_css_value_unref (value); } }
static gboolean int_value_parse (GtkCssParser *parser, GValue *value) { gint i; if (_gtk_css_parser_has_prefix (parser, "-gtk")) { GtkCssValue *cssvalue = gtk_css_win32_size_value_parse (parser, GTK_CSS_PARSE_NUMBER | GTK_CSS_NUMBER_AS_PIXELS); if (cssvalue) { g_value_set_int (value, _gtk_css_number_value_get (cssvalue, 100)); _gtk_css_value_unref (cssvalue); return TRUE; } return FALSE; } if (!_gtk_css_parser_try_int (parser, &i)) { _gtk_css_parser_error (parser, "Expected a valid integer value"); return FALSE; } g_value_set_int (value, i); return TRUE; }
static GtkBitmask * gtk_css_transition_set_values (GtkStyleAnimation *animation, GtkBitmask *changed, gint64 for_time_us, GtkCssComputedValues *values) { GtkCssTransition *transition = GTK_CSS_TRANSITION (animation); GtkCssValue *value; double progress; if (transition->start_time >= for_time_us) value = _gtk_css_value_ref (transition->start); else if (transition->end_time <= for_time_us) value = _gtk_css_value_ref (transition->end); else { progress = (double) (for_time_us - transition->start_time) / (transition->end_time - transition->start_time); progress = _gtk_css_ease_value_transform (transition->ease, progress); value = _gtk_css_value_transition (transition->start, transition->end, progress); if (value == NULL) value = _gtk_css_value_ref (transition->end); } _gtk_css_computed_values_set_value (values, transition->property, value, NULL); _gtk_css_value_unref (value); return _gtk_bitmask_set (changed, transition->property, TRUE); }
/** * gtk_style_properties_register_property: (skip) * @parse_func: parsing function to use, or %NULL * @pspec: the #GParamSpec for the new property * * Registers a property so it can be used in the CSS file format. * This function is the low-level equivalent of * gtk_theming_engine_register_property(), if you are implementing * a theming engine, you want to use that function instead. * * Since: 3.0 * * Deprecated: 3.8: Code should use the default properties provided by CSS. **/ void gtk_style_properties_register_property (GtkStylePropertyParser parse_func, GParamSpec *pspec) { GtkCssCustomProperty *node; GtkCssValue *initial; g_return_if_fail (G_IS_PARAM_SPEC (pspec)); /* This also initializes the default properties */ if (_gtk_style_property_lookup (pspec->name)) { g_warning ("a property with name '%s' already exists", pspec->name); return; } initial = gtk_css_custom_property_create_initial_value (pspec); node = g_object_new (GTK_TYPE_CSS_CUSTOM_PROPERTY, "initial-value", initial, "name", pspec->name, "value-type", pspec->value_type, NULL); node->pspec = pspec; node->property_parse_func = parse_func; _gtk_css_value_unref (initial); }
static GtkCssValue * gtk_css_shorthand_property_parse_value (GtkStyleProperty *property, GtkCssParser *parser, GFile *base) { GtkCssShorthandProperty *shorthand = GTK_CSS_SHORTHAND_PROPERTY (property); GtkCssValue **data; GtkCssValue *result; guint i; data = g_new0 (GtkCssValue *, shorthand->subproperties->len); if (_gtk_css_parser_try (parser, "initial", TRUE)) { /* the initial value can be explicitly specified with the * ‘initial’ keyword which all properties accept. */ for (i = 0; i < shorthand->subproperties->len; i++) { data[i] = _gtk_css_initial_value_new (); } } else if (_gtk_css_parser_try (parser, "inherit", TRUE)) { /* All properties accept the ‘inherit’ value which * explicitly specifies that the value will be determined * by inheritance. The ‘inherit’ value can be used to * strengthen inherited values in the cascade, and it can * also be used on properties that are not normally inherited. */ for (i = 0; i < shorthand->subproperties->len; i++) { data[i] = _gtk_css_inherit_value_new (); } } else if (!shorthand->parse (shorthand, data, parser, base)) { for (i = 0; i < shorthand->subproperties->len; i++) { if (data[i] != NULL) _gtk_css_value_unref (data[i]); } g_free (data); return NULL; } /* All values that aren't set by the parse func are set to their * default values here. * XXX: Is the default always initial or can it be inherit? */ for (i = 0; i < shorthand->subproperties->len; i++) { if (data[i] == NULL) data[i] = _gtk_css_initial_value_new (); } result = _gtk_css_array_value_new_from_array (data, shorthand->subproperties->len); g_free (data); return result; }
cairo_pattern_t * _gtk_gradient_resolve_full (GtkGradient *gradient, GtkStyleProviderPrivate *provider, GtkCssComputedValues *values, GtkCssComputedValues *parent_values, GtkCssDependencies *dependencies) { cairo_pattern_t *pattern; guint i; g_return_val_if_fail (gradient != NULL, NULL); g_return_val_if_fail (GTK_IS_STYLE_PROVIDER (provider), NULL); g_return_val_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values), NULL); g_return_val_if_fail (parent_values == NULL || GTK_IS_CSS_COMPUTED_VALUES (parent_values), NULL); g_return_val_if_fail (*dependencies == 0, NULL); if (gradient->radius0 == 0 && gradient->radius1 == 0) pattern = cairo_pattern_create_linear (gradient->x0, gradient->y0, gradient->x1, gradient->y1); else pattern = cairo_pattern_create_radial (gradient->x0, gradient->y0, gradient->radius0, gradient->x1, gradient->y1, gradient->radius1); for (i = 0; i < gradient->stops->len; i++) { ColorStop *stop; GtkCssValue *val; GdkRGBA rgba; GtkCssDependencies stop_deps; stop = &g_array_index (gradient->stops, ColorStop, i); /* if color resolving fails, assume transparency */ val = _gtk_css_color_value_resolve (_gtk_symbolic_color_get_css_value (stop->color), provider, _gtk_css_computed_values_get_value (values, GTK_CSS_PROPERTY_COLOR), GTK_CSS_DEPENDS_ON_COLOR, &stop_deps, NULL); if (val) { rgba = *_gtk_css_rgba_value_get_rgba (val); *dependencies = _gtk_css_dependencies_union (*dependencies, stop_deps); _gtk_css_value_unref (val); } else { rgba.red = rgba.green = rgba.blue = rgba.alpha = 0.0; } cairo_pattern_add_color_stop_rgba (pattern, stop->offset, rgba.red, rgba.green, rgba.blue, rgba.alpha); } return pattern; }
static void gtk_css_animation_finalize (GObject *object) { GtkCssAnimation *animation = GTK_CSS_ANIMATION (object); g_free (animation->name); _gtk_css_keyframes_unref (animation->keyframes); _gtk_css_value_unref (animation->ease); G_OBJECT_CLASS (_gtk_css_animation_parent_class)->finalize (object); }
/** * gtk_symbolic_color_unref: * @color: a #GtkSymbolicColor * * Decreases the reference count of @color, freeing its memory if the * reference count reaches 0. * * Since: 3.0 * * Deprecated: 3.8: #GtkSymbolicColor is deprecated. **/ void gtk_symbolic_color_unref (GtkSymbolicColor *color) { g_return_if_fail (color != NULL); if (--color->ref_count) return; _gtk_css_value_unref (color->value); g_slice_free (GtkSymbolicColor, color); }
static gboolean border_value_parse (GtkCssParser *parser, GValue *value) { GtkBorder border = { 0, }; guint i; int numbers[4]; for (i = 0; i < G_N_ELEMENTS (numbers); i++) { if (_gtk_css_parser_has_prefix (parser, "-gtk")) { GtkCssValue *cssvalue = gtk_css_win32_size_value_parse (parser, GTK_CSS_PARSE_NUMBER | GTK_CSS_NUMBER_AS_PIXELS); if (cssvalue) { numbers[i] = _gtk_css_number_value_get (cssvalue, 100); _gtk_css_value_unref (cssvalue); return TRUE; } return FALSE; } else { if (!_gtk_css_parser_try_length (parser, &numbers[i])) break; } } if (i == 0) { _gtk_css_parser_error (parser, "Expected valid border"); return FALSE; } border.top = numbers[0]; if (i > 1) border.right = numbers[1]; else border.right = border.top; if (i > 2) border.bottom = numbers[2]; else border.bottom = border.top; if (i > 3) border.left = numbers[3]; else border.left = border.right; g_value_set_boxed (value, &border); return TRUE; }
static void gtk_css_value_shadows_free (GtkCssValue *value) { guint i; for (i = 0; i < value->len; i++) { _gtk_css_value_unref (value->values[i]); } g_slice_free1 (sizeof (GtkCssValue) + sizeof (GtkCssValue *) * (value->len - 1), value); }
static void gtk_css_custom_property_assign (GtkStyleProperty *property, GtkStyleProperties *props, GtkStateFlags state, const GValue *value) { GtkCssValue *css_value = _gtk_css_typed_value_new (value); _gtk_style_properties_set_property_by_property (props, GTK_CSS_STYLE_PROPERTY (property), state, css_value); _gtk_css_value_unref (css_value); }
static GtkCssValue * gtk_css_win32_size_value_parse_size (GtkCssValue *value, GtkCssParser *parser) { if (!_gtk_css_parser_try_int (parser, &value->val.size.id)) { _gtk_css_value_unref (value); _gtk_css_parser_error (parser, "Expected an integer ID"); return NULL; } return value; }
void _gtk_css_computed_values_compute_value (GtkCssComputedValues *values, GtkStyleProviderPrivate *provider, GtkCssComputedValues *parent_values, guint id, GtkCssValue *specified, GtkCssSection *section) { GtkCssDependencies dependencies; GtkCssValue *value; gtk_internal_return_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values)); gtk_internal_return_if_fail (GTK_IS_STYLE_PROVIDER_PRIVATE (provider)); gtk_internal_return_if_fail (parent_values == NULL || GTK_IS_CSS_COMPUTED_VALUES (parent_values)); /* http://www.w3.org/TR/css3-cascade/#cascade * Then, for every element, the value for each property can be found * by following this pseudo-algorithm: * 1) Identify all declarations that apply to the element */ if (specified == NULL) { GtkCssStyleProperty *prop = _gtk_css_style_property_lookup_by_id (id); if (_gtk_css_style_property_is_inherit (prop)) specified = _gtk_css_inherit_value_new (); else specified = _gtk_css_initial_value_new (); } else _gtk_css_value_ref (specified); value = _gtk_css_value_compute (specified, id, provider, values, parent_values, &dependencies); _gtk_css_computed_values_set_value (values, id, value, dependencies, section); _gtk_css_value_unref (value); _gtk_css_value_unref (specified); }
static gboolean gtk_css_image_cross_fade_parse (GtkCssImage *image, GtkCssParser *parser) { GtkCssImageCrossFade *cross_fade = GTK_CSS_IMAGE_CROSS_FADE (image); if (!_gtk_css_parser_try (parser, "cross-fade(", TRUE)) { _gtk_css_parser_error (parser, "Expected 'cross-fade('"); return FALSE; } if (_gtk_css_parser_has_number (parser)) { GtkCssValue *number; number = _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_PERCENT | GTK_CSS_POSITIVE_ONLY); if (number == NULL) return FALSE; cross_fade->progress = _gtk_css_number_value_get (number, 1); _gtk_css_value_unref (number); if (cross_fade->progress > 1.0) { _gtk_css_parser_error (parser, "Percentages over 100%% are not allowed"); return FALSE; } } else cross_fade->progress = 0.5; cross_fade->start = _gtk_css_image_new_parse (parser); if (cross_fade->start == NULL) return FALSE; if (_gtk_css_parser_try (parser, ",", TRUE)) { /* XXX: allow parsing colors here */ cross_fade->end = _gtk_css_image_new_parse (parser); if (cross_fade->end == NULL) return FALSE; } if (!_gtk_css_parser_try (parser, ")", TRUE)) { _gtk_css_parser_error (parser, "Missing closing bracket"); return FALSE; } return TRUE; }
void gtk_css_animated_style_set_animated_value (GtkCssAnimatedStyle *style, guint id, GtkCssValue *value) { gtk_internal_return_if_fail (GTK_IS_CSS_ANIMATED_STYLE (style)); gtk_internal_return_if_fail (value != NULL); if (style->animated_values == NULL) style->animated_values = g_ptr_array_new_with_free_func ((GDestroyNotify)_gtk_css_value_unref); if (id >= style->animated_values->len) g_ptr_array_set_size (style->animated_values, id + 1); if (g_ptr_array_index (style->animated_values, id)) _gtk_css_value_unref (g_ptr_array_index (style->animated_values, id)); g_ptr_array_index (style->animated_values, id) = _gtk_css_value_ref (value); }
static void _gtk_css_style_property_assign (GtkStyleProperty *property, GtkStyleProperties *props, GtkStateFlags state, const GValue *value) { GtkCssStyleProperty *style; GtkCssValue *css_value; style = GTK_CSS_STYLE_PROPERTY (property); css_value = style->assign_value (style, value); _gtk_style_properties_set_property_by_property (props, style, state, css_value); _gtk_css_value_unref (css_value); }
void _gtk_css_computed_values_set_animated_value (GtkCssComputedValues *values, guint id, GtkCssValue *value) { gtk_internal_return_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values)); gtk_internal_return_if_fail (value != NULL); if (values->animated_values == NULL) values->animated_values = g_ptr_array_new_with_free_func ((GDestroyNotify)_gtk_css_value_unref); if (id >= values->animated_values->len) g_ptr_array_set_size (values->animated_values, id + 1); if (g_ptr_array_index (values->animated_values, id)) _gtk_css_value_unref (g_ptr_array_index (values->animated_values, id)); g_ptr_array_index (values->animated_values, id) = _gtk_css_value_ref (value); }
void _gtk_css_computed_values_set_value (GtkCssComputedValues *values, guint id, GtkCssValue *value, GtkCssDependencies dependencies, GtkCssSection *section) { gtk_internal_return_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values)); if (values->values == NULL) values->values = g_ptr_array_new_full (_gtk_css_style_property_get_n_properties (), (GDestroyNotify)_gtk_css_value_unref); if (id >= values->values->len) g_ptr_array_set_size (values->values, id + 1); if (g_ptr_array_index (values->values, id)) _gtk_css_value_unref (g_ptr_array_index (values->values, id)); g_ptr_array_index (values->values, id) = _gtk_css_value_ref (value); if (dependencies & (GTK_CSS_DEPENDS_ON_PARENT | GTK_CSS_EQUALS_PARENT)) values->depends_on_parent = _gtk_bitmask_set (values->depends_on_parent, id, TRUE); if (dependencies & (GTK_CSS_EQUALS_PARENT)) values->equals_parent = _gtk_bitmask_set (values->equals_parent, id, TRUE); if (dependencies & (GTK_CSS_DEPENDS_ON_COLOR)) values->depends_on_color = _gtk_bitmask_set (values->depends_on_color, id, TRUE); if (dependencies & (GTK_CSS_DEPENDS_ON_FONT_SIZE)) values->depends_on_font_size = _gtk_bitmask_set (values->depends_on_font_size, id, TRUE); if (values->sections && values->sections->len > id && g_ptr_array_index (values->sections, id)) { gtk_css_section_unref (g_ptr_array_index (values->sections, id)); g_ptr_array_index (values->sections, id) = NULL; } if (section) { if (values->sections == NULL) values->sections = g_ptr_array_new_with_free_func (maybe_unref_section); if (values->sections->len <= id) g_ptr_array_set_size (values->sections, id + 1); g_ptr_array_index (values->sections, id) = gtk_css_section_ref (section); } }
static void gtk_css_image_linear_dispose (GObject *object) { GtkCssImageLinear *linear = GTK_CSS_IMAGE_LINEAR (object); if (linear->stops) { g_array_free (linear->stops, TRUE); linear->stops = NULL; } if (linear->angle) { _gtk_css_value_unref (linear->angle); linear->angle = NULL; } G_OBJECT_CLASS (_gtk_css_image_linear_parent_class)->dispose (object); }
static void gtk_css_image_fallback_dispose (GObject *object) { GtkCssImageFallback *fallback = GTK_CSS_IMAGE_FALLBACK (object); int i; for (i = 0; i < fallback->n_images; i++) g_object_unref (fallback->images[i]); g_free (fallback->images); fallback->images = NULL; if (fallback->color) { _gtk_css_value_unref (fallback->color); fallback->color = NULL; } G_OBJECT_CLASS (_gtk_css_image_fallback_parent_class)->dispose (object); }
GtkCssValue * _gtk_css_bg_size_value_parse (GtkCssParser *parser) { GtkCssValue *x, *y; if (_gtk_css_parser_try (parser, "cover", TRUE)) return _gtk_css_value_ref (&cover_singleton); else if (_gtk_css_parser_try (parser, "contain", TRUE)) return _gtk_css_value_ref (&contain_singleton); if (_gtk_css_parser_try (parser, "auto", TRUE)) x = NULL; else { x = _gtk_css_number_value_parse (parser, GTK_CSS_POSITIVE_ONLY | GTK_CSS_PARSE_PERCENT | GTK_CSS_PARSE_LENGTH); if (x == NULL) return NULL; } if (_gtk_css_parser_try (parser, "auto", TRUE)) y = NULL; else if (!gtk_css_number_value_can_parse (parser)) y = NULL; else { y = _gtk_css_number_value_parse (parser, GTK_CSS_POSITIVE_ONLY | GTK_CSS_PARSE_PERCENT | GTK_CSS_PARSE_LENGTH); if (y == NULL) { _gtk_css_value_unref (x); return NULL; } } return _gtk_css_bg_size_value_new (x, y); }
static GtkCssValue * gtk_css_value_bg_size_transition (GtkCssValue *start, GtkCssValue *end, guint property_id, double progress) { GtkCssValue *x, *y; if (start->cover) return end->cover ? _gtk_css_value_ref (end) : NULL; if (start->contain) return end->contain ? _gtk_css_value_ref (end) : NULL; if ((start->x != NULL) ^ (end->x != NULL) || (start->y != NULL) ^ (end->y != NULL)) return NULL; if (start->x) { x = _gtk_css_value_transition (start->x, end->x, property_id, progress); if (x == NULL) return NULL; } else x = NULL; if (start->y) { y = _gtk_css_value_transition (start->y, end->y, property_id, progress); if (y == NULL) { _gtk_css_value_unref (x); return NULL; } } else y = NULL; return _gtk_css_bg_size_value_new (x, y); }
GtkCssValue * gtk_css_win32_size_value_parse (GtkCssParser *parser, GtkCssNumberParseFlags flags) { GtkWin32Theme *theme; GtkCssValue *result; guint type; for (type = 0; type < G_N_ELEMENTS(css_value_names); type++) { if (_gtk_css_parser_try (parser, css_value_names[type], TRUE)) break; } if (type >= G_N_ELEMENTS(css_value_names)) { _gtk_css_parser_error (parser, "Not a win32 size value"); return NULL; } theme = gtk_win32_theme_parse (parser); if (theme == NULL) return NULL; result = gtk_css_win32_size_value_new (1.0, theme, type); gtk_win32_theme_unref (theme); if (! _gtk_css_parser_try (parser, ",", TRUE)) { _gtk_css_value_unref (result); _gtk_css_parser_error (parser, "Expected ','"); return NULL; } switch (result->type) { case GTK_WIN32_SIZE: result = gtk_css_win32_size_value_parse_size (result, parser); break; case GTK_WIN32_PART_WIDTH: case GTK_WIN32_PART_HEIGHT: case GTK_WIN32_PART_BORDER_TOP: case GTK_WIN32_PART_BORDER_RIGHT: case GTK_WIN32_PART_BORDER_BOTTOM: case GTK_WIN32_PART_BORDER_LEFT: result = gtk_css_win32_size_value_parse_part_size (result, parser); break; default: g_assert_not_reached (); _gtk_css_value_unref (result); result = NULL; break; } if (result == NULL) return NULL; if (!_gtk_css_parser_try (parser, ")", TRUE)) { _gtk_css_value_unref (result); _gtk_css_parser_error (parser, "Expected ')'"); return NULL; } return result; }