1 /* GTK - The GIMP Toolkit
2 * Copyright (C) 2011 Red Hat, Inc.
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
20 #include "gtkcssinheritvalueprivate.h"
22 #include "gtkcssstylepropertyprivate.h"
23 #include "gtkstylecontextprivate.h"
30 gtk_css_value_inherit_free (GtkCssValue *value)
32 /* Can only happen if the unique value gets unreffed too often */
33 g_assert_not_reached ();
37 gtk_css_value_inherit_compute (GtkCssValue *value,
39 GtkStyleContext *context,
40 GtkCssDependencies *dependencies)
42 GtkStyleContext *parent = gtk_style_context_get_parent (context);
46 *dependencies = GTK_CSS_EQUALS_PARENT;
47 return _gtk_css_value_ref (_gtk_style_context_peek_property (parent, property_id));
51 return _gtk_css_value_compute (_gtk_css_style_property_get_initial_value (_gtk_css_style_property_lookup_by_id (property_id)),
59 gtk_css_value_inherit_equal (const GtkCssValue *value1,
60 const GtkCssValue *value2)
66 gtk_css_value_inherit_transition (GtkCssValue *start,
75 gtk_css_value_inherit_print (const GtkCssValue *value,
78 g_string_append (string, "inherit");
81 static const GtkCssValueClass GTK_CSS_VALUE_INHERIT = {
82 gtk_css_value_inherit_free,
83 gtk_css_value_inherit_compute,
84 gtk_css_value_inherit_equal,
85 gtk_css_value_inherit_transition,
86 gtk_css_value_inherit_print
89 static GtkCssValue inherit = { >K_CSS_VALUE_INHERIT, 1 };
92 _gtk_css_inherit_value_new (void)
94 return _gtk_css_value_ref (&inherit);