[gtk+/wip/cssstyle: 2/27] cssstyle: Rename GtkCssComputedValues => GtkCssStyle
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/cssstyle: 2/27] cssstyle: Rename GtkCssComputedValues => GtkCssStyle
- Date: Wed, 24 Dec 2014 02:19:32 +0000 (UTC)
commit 660386eca6e3876f3c3d580f4f1209a870d73bad
Author: Benjamin Otte <otte redhat com>
Date: Wed Oct 22 23:41:50 2014 +0200
cssstyle: Rename GtkCssComputedValues => GtkCssStyle
This is literally just renaming of the object (and the associated source
files). No other changes are in there.
gtk/Makefile.am | 4 +-
gtk/deprecated/gtkgradient.c | 10 +-
gtk/deprecated/gtkgradientprivate.h | 4 +-
gtk/gtkcssanimation.c | 6 +-
gtk/gtkcssarrayvalue.c | 4 +-
gtk/gtkcssbgsizevalue.c | 4 +-
gtk/gtkcssbordervalue.c | 4 +-
gtk/gtkcsscolorvalue.c | 12 +-
gtk/gtkcsscomputedvalues.c | 657 -----------------------------------
gtk/gtkcsscomputedvaluesprivate.h | 106 ------
gtk/gtkcsscornervalue.c | 4 +-
gtk/gtkcsseasevalue.c | 4 +-
gtk/gtkcssenginevalue.c | 4 +-
gtk/gtkcssenumvalue.c | 14 +-
gtk/gtkcssimage.c | 14 +-
gtk/gtkcssimagebuiltin.c | 4 +-
gtk/gtkcssimagegradient.c | 4 +-
gtk/gtkcssimageicontheme.c | 6 +-
gtk/gtkcssimagelinear.c | 4 +-
gtk/gtkcssimageprivate.h | 8 +-
gtk/gtkcssimagescaled.c | 4 +-
gtk/gtkcssimageurl.c | 4 +-
gtk/gtkcssimagevalue.c | 4 +-
gtk/gtkcssinheritvalue.c | 6 +-
gtk/gtkcssinitialvalue.c | 4 +-
gtk/gtkcsskeyframes.c | 12 +-
gtk/gtkcsskeyframesprivate.h | 4 +-
gtk/gtkcsslookup.c | 24 +-
gtk/gtkcsslookupprivate.h | 6 +-
gtk/gtkcssnumbervalue.c | 12 +-
gtk/gtkcsspositionvalue.c | 4 +-
gtk/gtkcssrepeatvalue.c | 4 +-
gtk/gtkcssrgbavalue.c | 4 +-
gtk/gtkcssshadowsvalue.c | 4 +-
gtk/gtkcssshadowvalue.c | 4 +-
gtk/gtkcssstringvalue.c | 4 +-
gtk/gtkcssstyle.c | 657 +++++++++++++++++++++++++++++++++++
gtk/gtkcssstylefuncs.c | 30 +-
gtk/gtkcssstylefuncsprivate.h | 4 +-
gtk/gtkcssstyleprivate.h | 106 ++++++
gtk/gtkcsstransformvalue.c | 8 +-
gtk/gtkcsstransition.c | 10 +-
gtk/gtkcsstypedvalue.c | 4 +-
gtk/gtkcsstypesprivate.h | 2 +-
gtk/gtkcssunsetvalue.c | 4 +-
gtk/gtkcssvalue.c | 10 +-
gtk/gtkcssvalueprivate.h | 8 +-
gtk/gtkroundedbox.c | 12 +-
gtk/gtkstyleanimation.c | 6 +-
gtk/gtkstyleanimationprivate.h | 6 +-
gtk/gtkstylecontext.c | 68 ++--
51 files changed, 960 insertions(+), 956 deletions(-)
---
diff --git a/gtk/Makefile.am b/gtk/Makefile.am
index d897df8..d2ffbd8 100644
--- a/gtk/Makefile.am
+++ b/gtk/Makefile.am
@@ -372,7 +372,6 @@ gtk_private_h_sources = \
gtkcssbgsizevalueprivate.h \
gtkcssbordervalueprivate.h \
gtkcsscolorvalueprivate.h \
- gtkcsscomputedvaluesprivate.h \
gtkcsscornervalueprivate.h \
gtkcsscustompropertyprivate.h \
gtkcsseasevalueprivate.h \
@@ -408,6 +407,7 @@ gtk_private_h_sources = \
gtkcssshorthandpropertyprivate.h \
gtkcssstringvalueprivate.h \
gtkcssstylefuncsprivate.h \
+ gtkcssstyleprivate.h \
gtkcssstylepropertyprivate.h \
gtkcsstransformvalueprivate.h \
gtkcsstransitionprivate.h \
@@ -596,7 +596,6 @@ gtk_base_c_sources = \
gtkcssbgsizevalue.c \
gtkcssbordervalue.c \
gtkcsscolorvalue.c \
- gtkcsscomputedvalues.c \
gtkcsscornervalue.c \
gtkcsscustomproperty.c \
gtkcsseasevalue.c \
@@ -628,6 +627,7 @@ gtk_base_c_sources = \
gtkcsssection.c \
gtkcssselector.c \
gtkcssstringvalue.c \
+ gtkcssstyle.c \
gtkcssshadowsvalue.c \
gtkcssshadowvalue.c \
gtkcssshorthandproperty.c \
diff --git a/gtk/deprecated/gtkgradient.c b/gtk/deprecated/gtkgradient.c
index 19dc034..b01296c 100644
--- a/gtk/deprecated/gtkgradient.c
+++ b/gtk/deprecated/gtkgradient.c
@@ -305,8 +305,8 @@ gtk_gradient_resolve (GtkGradient *gradient,
cairo_pattern_t *
_gtk_gradient_resolve_full (GtkGradient *gradient,
GtkStyleProviderPrivate *provider,
- GtkCssComputedValues *values,
- GtkCssComputedValues *parent_values,
+ GtkCssStyle *values,
+ GtkCssStyle *parent_values,
GtkCssDependencies *dependencies)
{
cairo_pattern_t *pattern;
@@ -314,8 +314,8 @@ _gtk_gradient_resolve_full (GtkGradient *gradient,
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 (GTK_IS_CSS_STYLE (values), NULL);
+ g_return_val_if_fail (parent_values == NULL || GTK_IS_CSS_STYLE (parent_values), NULL);
g_return_val_if_fail (*dependencies == 0, NULL);
if (gradient->radius0 == 0 && gradient->radius1 == 0)
@@ -339,7 +339,7 @@ _gtk_gradient_resolve_full (GtkGradient *gradient,
/* 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_style_get_value (values, GTK_CSS_PROPERTY_COLOR),
GTK_CSS_DEPENDS_ON_COLOR,
&stop_deps,
NULL);
diff --git a/gtk/deprecated/gtkgradientprivate.h b/gtk/deprecated/gtkgradientprivate.h
index 9cd37f2..9484e96 100644
--- a/gtk/deprecated/gtkgradientprivate.h
+++ b/gtk/deprecated/gtkgradientprivate.h
@@ -25,8 +25,8 @@ G_BEGIN_DECLS
cairo_pattern_t * _gtk_gradient_resolve_full (GtkGradient *gradient,
GtkStyleProviderPrivate *provider,
- GtkCssComputedValues *values,
- GtkCssComputedValues *parent_values,
+ GtkCssStyle *values,
+ GtkCssStyle *parent_values,
GtkCssDependencies *dependencies);
GtkGradient * _gtk_gradient_transition (GtkGradient *start,
diff --git a/gtk/gtkcssanimation.c b/gtk/gtkcssanimation.c
index df2e609..8ffb537 100644
--- a/gtk/gtkcssanimation.c
+++ b/gtk/gtkcssanimation.c
@@ -104,7 +104,7 @@ gtk_css_animation_get_progress_from_iteration (GtkCssAnimation *animation,
static void
gtk_css_animation_set_values (GtkStyleAnimation *style_animation,
gint64 for_time_us,
- GtkCssComputedValues *values)
+ GtkCssStyle *values)
{
GtkCssAnimation *animation = GTK_CSS_ANIMATION (style_animation);
double iteration, progress;
@@ -128,8 +128,8 @@ gtk_css_animation_set_values (GtkStyleAnimation *style_animation,
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_style_get_intrinsic_value (values, property_id));
+ gtk_css_style_set_animated_value (values, property_id, value);
_gtk_css_value_unref (value);
}
}
diff --git a/gtk/gtkcssarrayvalue.c b/gtk/gtkcssarrayvalue.c
index 3491fb8..73452ad 100644
--- a/gtk/gtkcssarrayvalue.c
+++ b/gtk/gtkcssarrayvalue.c
@@ -47,8 +47,8 @@ gtk_css_value_array_compute (GtkCssValue *value,
guint property_id,
GtkStyleProviderPrivate *provider,
int scale,
- GtkCssComputedValues *values,
- GtkCssComputedValues *parent_values,
+ GtkCssStyle *values,
+ GtkCssStyle *parent_values,
GtkCssDependencies *dependencies)
{
GtkCssValue *result;
diff --git a/gtk/gtkcssbgsizevalue.c b/gtk/gtkcssbgsizevalue.c
index df29d97..ef8c525 100644
--- a/gtk/gtkcssbgsizevalue.c
+++ b/gtk/gtkcssbgsizevalue.c
@@ -45,8 +45,8 @@ gtk_css_value_bg_size_compute (GtkCssValue *value,
guint property_id,
GtkStyleProviderPrivate *provider,
int scale,
- GtkCssComputedValues *values,
- GtkCssComputedValues *parent_values,
+ GtkCssStyle *values,
+ GtkCssStyle *parent_values,
GtkCssDependencies *dependencies)
{
GtkCssValue *x, *y;
diff --git a/gtk/gtkcssbordervalue.c b/gtk/gtkcssbordervalue.c
index 998e432..edf0c67 100644
--- a/gtk/gtkcssbordervalue.c
+++ b/gtk/gtkcssbordervalue.c
@@ -46,8 +46,8 @@ gtk_css_value_border_compute (GtkCssValue *value,
guint property_id,
GtkStyleProviderPrivate *provider,
int scale,
- GtkCssComputedValues *values,
- GtkCssComputedValues *parent_values,
+ GtkCssStyle *values,
+ GtkCssStyle *parent_values,
GtkCssDependencies *dependencies)
{
GtkCssValue *computed;
diff --git a/gtk/gtkcsscolorvalue.c b/gtk/gtkcsscolorvalue.c
index 20ccfef..b9b247d 100644
--- a/gtk/gtkcsscolorvalue.c
+++ b/gtk/gtkcsscolorvalue.c
@@ -101,8 +101,8 @@ static GtkCssValue *
gtk_css_value_color_get_fallback (guint property_id,
GtkStyleProviderPrivate *provider,
int scale,
- GtkCssComputedValues *values,
- GtkCssComputedValues *parent_values)
+ GtkCssStyle *values,
+ GtkCssStyle *parent_values)
{
static const GdkRGBA transparent = { 0, 0, 0, 0 };
@@ -303,8 +303,8 @@ gtk_css_value_color_compute (GtkCssValue *value,
guint property_id,
GtkStyleProviderPrivate *provider,
int scale,
- GtkCssComputedValues *values,
- GtkCssComputedValues *parent_values,
+ GtkCssStyle *values,
+ GtkCssStyle *parent_values,
GtkCssDependencies *dependencies)
{
GtkCssValue *resolved, *current;
@@ -318,7 +318,7 @@ gtk_css_value_color_compute (GtkCssValue *value,
{
if (parent_values)
{
- current = _gtk_css_computed_values_get_value (parent_values, GTK_CSS_PROPERTY_COLOR);
+ current = gtk_css_style_get_value (parent_values, GTK_CSS_PROPERTY_COLOR);
current_deps = GTK_CSS_EQUALS_PARENT;
}
else
@@ -329,7 +329,7 @@ gtk_css_value_color_compute (GtkCssValue *value,
}
else
{
- current = _gtk_css_computed_values_get_value (values, GTK_CSS_PROPERTY_COLOR);
+ current = gtk_css_style_get_value (values, GTK_CSS_PROPERTY_COLOR);
current_deps = GTK_CSS_DEPENDS_ON_COLOR;
}
diff --git a/gtk/gtkcsscornervalue.c b/gtk/gtkcsscornervalue.c
index 625e802..d977372 100644
--- a/gtk/gtkcsscornervalue.c
+++ b/gtk/gtkcsscornervalue.c
@@ -41,8 +41,8 @@ gtk_css_value_corner_compute (GtkCssValue *corner,
guint property_id,
GtkStyleProviderPrivate *provider,
int scale,
- GtkCssComputedValues *values,
- GtkCssComputedValues *parent_values,
+ GtkCssStyle *values,
+ GtkCssStyle *parent_values,
GtkCssDependencies *dependencies)
{
GtkCssValue *x, *y;
diff --git a/gtk/gtkcsseasevalue.c b/gtk/gtkcsseasevalue.c
index f4d56fd..e1ec50d 100644
--- a/gtk/gtkcsseasevalue.c
+++ b/gtk/gtkcsseasevalue.c
@@ -54,8 +54,8 @@ gtk_css_value_ease_compute (GtkCssValue *value,
guint property_id,
GtkStyleProviderPrivate *provider,
int scale,
- GtkCssComputedValues *values,
- GtkCssComputedValues *parent_values,
+ GtkCssStyle *values,
+ GtkCssStyle *parent_values,
GtkCssDependencies *dependencies)
{
return _gtk_css_value_ref (value);
diff --git a/gtk/gtkcssenginevalue.c b/gtk/gtkcssenginevalue.c
index 7038bd0..554a894 100644
--- a/gtk/gtkcssenginevalue.c
+++ b/gtk/gtkcssenginevalue.c
@@ -40,8 +40,8 @@ gtk_css_value_engine_compute (GtkCssValue *value,
guint property_id,
GtkStyleProviderPrivate *provider,
int scale,
- GtkCssComputedValues *values,
- GtkCssComputedValues *parent_values,
+ GtkCssStyle *values,
+ GtkCssStyle *parent_values,
GtkCssDependencies *dependencies)
{
return _gtk_css_value_ref (value);
diff --git a/gtk/gtkcssenumvalue.c b/gtk/gtkcssenumvalue.c
index d898c03..1514052 100644
--- a/gtk/gtkcssenumvalue.c
+++ b/gtk/gtkcssenumvalue.c
@@ -19,7 +19,7 @@
#include "gtkcssenumvalueprivate.h"
-#include "gtkcsscomputedvaluesprivate.h"
+#include "gtkcssstyleprivate.h"
#include "gtkcssnumbervalueprivate.h"
#include "gtkstyleproviderprivate.h"
@@ -42,8 +42,8 @@ gtk_css_value_enum_compute (GtkCssValue *value,
guint property_id,
GtkStyleProviderPrivate *provider,
int scale,
- GtkCssComputedValues *values,
- GtkCssComputedValues *parent_values,
+ GtkCssStyle *values,
+ GtkCssStyle *parent_values,
GtkCssDependencies *dependencies)
{
return _gtk_css_value_ref (value);
@@ -166,8 +166,8 @@ gtk_css_value_font_size_compute (GtkCssValue *value,
guint property_id,
GtkStyleProviderPrivate *provider,
int scale,
- GtkCssComputedValues *values,
- GtkCssComputedValues *parent_values,
+ GtkCssStyle *values,
+ GtkCssStyle *parent_values,
GtkCssDependencies *dependencies)
{
double font_size;
@@ -201,7 +201,7 @@ gtk_css_value_font_size_compute (GtkCssValue *value,
case GTK_CSS_FONT_SIZE_SMALLER:
*dependencies = GTK_CSS_DEPENDS_ON_PARENT;
if (parent_values)
- font_size = _gtk_css_number_value_get (_gtk_css_computed_values_get_value (parent_values,
GTK_CSS_PROPERTY_FONT_SIZE), 100);
+ font_size = _gtk_css_number_value_get (gtk_css_style_get_value (parent_values,
GTK_CSS_PROPERTY_FONT_SIZE), 100);
else
font_size = _gtk_css_font_size_get_default (provider);
/* XXX: This is what WebKit does... */
@@ -210,7 +210,7 @@ gtk_css_value_font_size_compute (GtkCssValue *value,
case GTK_CSS_FONT_SIZE_LARGER:
*dependencies = GTK_CSS_DEPENDS_ON_PARENT;
if (parent_values)
- font_size = _gtk_css_number_value_get (_gtk_css_computed_values_get_value (parent_values,
GTK_CSS_PROPERTY_FONT_SIZE), 100);
+ font_size = _gtk_css_number_value_get (gtk_css_style_get_value (parent_values,
GTK_CSS_PROPERTY_FONT_SIZE), 100);
else
font_size = _gtk_css_font_size_get_default (provider);
/* XXX: This is what WebKit does... */
diff --git a/gtk/gtkcssimage.c b/gtk/gtkcssimage.c
index 049d49e..bdcbcf3 100644
--- a/gtk/gtkcssimage.c
+++ b/gtk/gtkcssimage.c
@@ -21,7 +21,7 @@
#include "gtkcssimageprivate.h"
-#include "gtkcsscomputedvaluesprivate.h"
+#include "gtkcssstyleprivate.h"
/* for the types only */
#include "gtk/gtkcssimagecrossfadeprivate.h"
@@ -65,8 +65,8 @@ gtk_css_image_real_compute (GtkCssImage *image,
guint property_id,
GtkStyleProviderPrivate *provider,
int scale,
- GtkCssComputedValues *values,
- GtkCssComputedValues *parent_values,
+ GtkCssStyle *values,
+ GtkCssStyle *parent_values,
GtkCssDependencies *dependencies)
{
return g_object_ref (image);
@@ -150,16 +150,16 @@ _gtk_css_image_compute (GtkCssImage *image,
guint property_id,
GtkStyleProviderPrivate *provider,
int scale,
- GtkCssComputedValues *values,
- GtkCssComputedValues *parent_values,
+ GtkCssStyle *values,
+ GtkCssStyle *parent_values,
GtkCssDependencies *dependencies)
{
GtkCssDependencies unused;
GtkCssImageClass *klass;
g_return_val_if_fail (GTK_IS_CSS_IMAGE (image), 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 (GTK_IS_CSS_STYLE (values), NULL);
+ g_return_val_if_fail (parent_values == NULL || GTK_IS_CSS_STYLE (parent_values), NULL);
if (dependencies == NULL)
dependencies = &unused;
diff --git a/gtk/gtkcssimagebuiltin.c b/gtk/gtkcssimagebuiltin.c
index 87995a5..7f72ce1 100644
--- a/gtk/gtkcssimagebuiltin.c
+++ b/gtk/gtkcssimagebuiltin.c
@@ -60,8 +60,8 @@ gtk_css_image_builtin_compute (GtkCssImage *image,
guint property_id,
GtkStyleProviderPrivate *provider,
int scale,
- GtkCssComputedValues *values,
- GtkCssComputedValues *parent_values,
+ GtkCssStyle *values,
+ GtkCssStyle *parent_values,
GtkCssDependencies *dependencies)
{
return g_object_ref (image);
diff --git a/gtk/gtkcssimagegradient.c b/gtk/gtkcssimagegradient.c
index 93ae750..8be1957 100644
--- a/gtk/gtkcssimagegradient.c
+++ b/gtk/gtkcssimagegradient.c
@@ -35,8 +35,8 @@ gtk_css_image_gradient_compute (GtkCssImage *image,
guint property_id,
GtkStyleProviderPrivate *provider,
int scale,
- GtkCssComputedValues *values,
- GtkCssComputedValues *parent_values,
+ GtkCssStyle *values,
+ GtkCssStyle *parent_values,
GtkCssDependencies *dependencies)
{
GtkCssImageGradient *gradient = GTK_CSS_IMAGE_GRADIENT (image);
diff --git a/gtk/gtkcssimageicontheme.c b/gtk/gtkcssimageicontheme.c
index 28c3e02..799724b 100644
--- a/gtk/gtkcssimageicontheme.c
+++ b/gtk/gtkcssimageicontheme.c
@@ -129,8 +129,8 @@ gtk_css_image_icon_theme_compute (GtkCssImage *image,
guint property_id,
GtkStyleProviderPrivate *provider,
int scale,
- GtkCssComputedValues *values,
- GtkCssComputedValues *parent_values,
+ GtkCssStyle *values,
+ GtkCssStyle *parent_values,
GtkCssDependencies *dependencies)
{
GtkCssImageIconTheme *icon_theme = GTK_CSS_IMAGE_ICON_THEME (image);
@@ -148,7 +148,7 @@ gtk_css_image_icon_theme_compute (GtkCssImage *image,
copy->name = g_strdup (icon_theme->name);
copy->icon_theme = gtk_icon_theme_get_for_screen (screen);
copy->scale = scale;
- copy->color = *_gtk_css_rgba_value_get_rgba (_gtk_css_computed_values_get_value (values,
GTK_CSS_PROPERTY_COLOR));
+ copy->color = *_gtk_css_rgba_value_get_rgba (gtk_css_style_get_value (values, GTK_CSS_PROPERTY_COLOR));
*dependencies = GTK_CSS_DEPENDS_ON_COLOR;
diff --git a/gtk/gtkcssimagelinear.c b/gtk/gtkcssimagelinear.c
index 9268d2b..a5b0955 100644
--- a/gtk/gtkcssimagelinear.c
+++ b/gtk/gtkcssimagelinear.c
@@ -421,8 +421,8 @@ gtk_css_image_linear_compute (GtkCssImage *image,
guint property_id,
GtkStyleProviderPrivate *provider,
int scale,
- GtkCssComputedValues *values,
- GtkCssComputedValues *parent_values,
+ GtkCssStyle *values,
+ GtkCssStyle *parent_values,
GtkCssDependencies *dependencies)
{
GtkCssImageLinear *linear = GTK_CSS_IMAGE_LINEAR (image);
diff --git a/gtk/gtkcssimageprivate.h b/gtk/gtkcssimageprivate.h
index 23188e7..b253a2f 100644
--- a/gtk/gtkcssimageprivate.h
+++ b/gtk/gtkcssimageprivate.h
@@ -59,8 +59,8 @@ struct _GtkCssImageClass
guint property_id,
GtkStyleProviderPrivate *provider,
int scale,
- GtkCssComputedValues *values,
- GtkCssComputedValues *parent_values,
+ GtkCssStyle *values,
+ GtkCssStyle *parent_values,
GtkCssDependencies *dependencies);
/* compare two images for equality */
gboolean (* equal) (GtkCssImage *image1,
@@ -97,8 +97,8 @@ GtkCssImage * _gtk_css_image_compute (GtkCssImage *
guint property_id,
GtkStyleProviderPrivate *provider,
int scale,
- GtkCssComputedValues *values,
- GtkCssComputedValues *parent_values,
+ GtkCssStyle *values,
+ GtkCssStyle *parent_values,
GtkCssDependencies *dependencies);
gboolean _gtk_css_image_equal (GtkCssImage *image1,
GtkCssImage *image2);
diff --git a/gtk/gtkcssimagescaled.c b/gtk/gtkcssimagescaled.c
index 125e53e..b009338 100644
--- a/gtk/gtkcssimagescaled.c
+++ b/gtk/gtkcssimagescaled.c
@@ -95,8 +95,8 @@ gtk_css_image_scaled_compute (GtkCssImage *image,
guint property_id,
GtkStyleProviderPrivate *provider,
int scale,
- GtkCssComputedValues *values,
- GtkCssComputedValues *parent_values,
+ GtkCssStyle *values,
+ GtkCssStyle *parent_values,
GtkCssDependencies *dependencies)
{
GtkCssImageScaled *scaled = GTK_CSS_IMAGE_SCALED (image);
diff --git a/gtk/gtkcssimageurl.c b/gtk/gtkcssimageurl.c
index efb025d..e04b9f2 100644
--- a/gtk/gtkcssimageurl.c
+++ b/gtk/gtkcssimageurl.c
@@ -124,8 +124,8 @@ gtk_css_image_url_compute (GtkCssImage *image,
guint property_id,
GtkStyleProviderPrivate *provider,
int scale,
- GtkCssComputedValues *values,
- GtkCssComputedValues *parent_values,
+ GtkCssStyle *values,
+ GtkCssStyle *parent_values,
GtkCssDependencies *dependencies)
{
GtkCssImageUrl *url = GTK_CSS_IMAGE_URL (image);
diff --git a/gtk/gtkcssimagevalue.c b/gtk/gtkcssimagevalue.c
index 4dcba24..febfef9 100644
--- a/gtk/gtkcssimagevalue.c
+++ b/gtk/gtkcssimagevalue.c
@@ -38,8 +38,8 @@ gtk_css_value_image_compute (GtkCssValue *value,
guint property_id,
GtkStyleProviderPrivate *provider,
int scale,
- GtkCssComputedValues *values,
- GtkCssComputedValues *parent_values,
+ GtkCssStyle *values,
+ GtkCssStyle *parent_values,
GtkCssDependencies *dependencies)
{
GtkCssImage *image, *computed;
diff --git a/gtk/gtkcssinheritvalue.c b/gtk/gtkcssinheritvalue.c
index bfea779..90dae5e 100644
--- a/gtk/gtkcssinheritvalue.c
+++ b/gtk/gtkcssinheritvalue.c
@@ -38,14 +38,14 @@ gtk_css_value_inherit_compute (GtkCssValue *value,
guint property_id,
GtkStyleProviderPrivate *provider,
int scale,
- GtkCssComputedValues *values,
- GtkCssComputedValues *parent_values,
+ GtkCssStyle *values,
+ GtkCssStyle *parent_values,
GtkCssDependencies *dependencies)
{
if (parent_values)
{
*dependencies = GTK_CSS_EQUALS_PARENT;
- return _gtk_css_value_ref (_gtk_css_computed_values_get_value (parent_values, property_id));
+ return _gtk_css_value_ref (gtk_css_style_get_value (parent_values, property_id));
}
else
{
diff --git a/gtk/gtkcssinitialvalue.c b/gtk/gtkcssinitialvalue.c
index c53a5cf..5e2aa91 100644
--- a/gtk/gtkcssinitialvalue.c
+++ b/gtk/gtkcssinitialvalue.c
@@ -41,8 +41,8 @@ gtk_css_value_initial_compute (GtkCssValue *value,
guint property_id,
GtkStyleProviderPrivate *provider,
int scale,
- GtkCssComputedValues *values,
- GtkCssComputedValues *parent_values,
+ GtkCssStyle *values,
+ GtkCssStyle *parent_values,
GtkCssDependencies *dependencies)
{
GtkSettings *settings;
diff --git a/gtk/gtkcsskeyframes.c b/gtk/gtkcsskeyframes.c
index 5fe9055..e40bdad 100644
--- a/gtk/gtkcsskeyframes.c
+++ b/gtk/gtkcsskeyframes.c
@@ -438,16 +438,16 @@ GtkCssKeyframes *
_gtk_css_keyframes_compute (GtkCssKeyframes *keyframes,
GtkStyleProviderPrivate *provider,
int scale,
- GtkCssComputedValues *values,
- GtkCssComputedValues *parent_values)
+ GtkCssStyle *style,
+ GtkCssStyle *parent_style)
{
GtkCssKeyframes *resolved;
guint k, p;
g_return_val_if_fail (keyframes != NULL, NULL);
g_return_val_if_fail (GTK_IS_STYLE_PROVIDER_PRIVATE (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 (GTK_IS_CSS_STYLE (style), NULL);
+ g_return_val_if_fail (parent_style == NULL || GTK_IS_CSS_STYLE (parent_style), NULL);
resolved = gtk_css_keyframes_alloc ();
resolved->n_keyframes = keyframes->n_keyframes;
@@ -467,8 +467,8 @@ _gtk_css_keyframes_compute (GtkCssKeyframes *keyframes,
resolved->property_ids[p],
provider,
scale,
- values,
- parent_values,
+ style,
+ parent_style,
NULL);
}
}
diff --git a/gtk/gtkcsskeyframesprivate.h b/gtk/gtkcsskeyframesprivate.h
index 160d4c5..0b88d63 100644
--- a/gtk/gtkcsskeyframesprivate.h
+++ b/gtk/gtkcsskeyframesprivate.h
@@ -39,8 +39,8 @@ void _gtk_css_keyframes_print (GtkCssKeyframes
GtkCssKeyframes * _gtk_css_keyframes_compute (GtkCssKeyframes *keyframes,
GtkStyleProviderPrivate *provider,
int scale,
- GtkCssComputedValues *values,
- GtkCssComputedValues *parent_values);
+ GtkCssStyle *style,
+ GtkCssStyle *parent_style);
guint _gtk_css_keyframes_get_n_properties (GtkCssKeyframes *keyframes);
guint _gtk_css_keyframes_get_property_id (GtkCssKeyframes *keyframes,
diff --git a/gtk/gtkcsslookup.c b/gtk/gtkcsslookup.c
index 5f0eaa7..ed58601 100644
--- a/gtk/gtkcsslookup.c
+++ b/gtk/gtkcsslookup.c
@@ -94,7 +94,7 @@ _gtk_css_lookup_set (GtkCssLookup *lookup,
* _gtk_css_lookup_resolve:
* @lookup: the lookup
* @context: the context the values are resolved for
- * @values: a new #GtkCssComputedValues to be filled with the new properties
+ * @values: a new #GtkCssStyle to be filled with the new properties
*
* Resolves the current lookup into a styleproperties object. This is done
* by converting from the “winning declaration” to the “computed value”.
@@ -106,15 +106,15 @@ void
_gtk_css_lookup_resolve (GtkCssLookup *lookup,
GtkStyleProviderPrivate *provider,
int scale,
- GtkCssComputedValues *values,
- GtkCssComputedValues *parent_values)
+ GtkCssStyle *values,
+ GtkCssStyle *parent_values)
{
guint i, n;
g_return_if_fail (lookup != NULL);
g_return_if_fail (GTK_IS_STYLE_PROVIDER_PRIVATE (provider));
- g_return_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values));
- g_return_if_fail (parent_values == NULL || GTK_IS_CSS_COMPUTED_VALUES (parent_values));
+ g_return_if_fail (GTK_IS_CSS_STYLE (values));
+ g_return_if_fail (parent_values == NULL || GTK_IS_CSS_STYLE (parent_values));
n = _gtk_css_style_property_get_n_properties ();
@@ -122,13 +122,13 @@ _gtk_css_lookup_resolve (GtkCssLookup *lookup,
{
if (lookup->values[i].value ||
_gtk_bitmask_get (lookup->missing, i))
- _gtk_css_computed_values_compute_value (values,
- provider,
- scale,
- parent_values,
- i,
- lookup->values[i].value,
- lookup->values[i].section);
+ gtk_css_style_compute_value (values,
+ provider,
+ scale,
+ parent_values,
+ i,
+ lookup->values[i].value,
+ lookup->values[i].section);
/* else not a relevant property */
}
}
diff --git a/gtk/gtkcsslookupprivate.h b/gtk/gtkcsslookupprivate.h
index 5b257c5..897fe9e 100644
--- a/gtk/gtkcsslookupprivate.h
+++ b/gtk/gtkcsslookupprivate.h
@@ -20,7 +20,7 @@
#include <glib-object.h>
#include "gtk/gtkbitmaskprivate.h"
-#include "gtk/gtkcsscomputedvaluesprivate.h"
+#include "gtk/gtkcssstyleprivate.h"
#include "gtk/gtkcsssection.h"
@@ -51,8 +51,8 @@ void _gtk_css_lookup_set (GtkCssLookup
void _gtk_css_lookup_resolve (GtkCssLookup *lookup,
GtkStyleProviderPrivate *provider,
int scale,
- GtkCssComputedValues *values,
- GtkCssComputedValues *parent_values);
+ GtkCssStyle *values,
+ GtkCssStyle *parent_values);
static inline const GtkBitmask *
_gtk_css_lookup_get_missing (const GtkCssLookup *lookup)
diff --git a/gtk/gtkcssnumbervalue.c b/gtk/gtkcssnumbervalue.c
index a66dc09..e827819 100644
--- a/gtk/gtkcssnumbervalue.c
+++ b/gtk/gtkcssnumbervalue.c
@@ -38,21 +38,21 @@ gtk_css_value_number_free (GtkCssValue *value)
static double
get_base_font_size (guint property_id,
GtkStyleProviderPrivate *provider,
- GtkCssComputedValues *values,
- GtkCssComputedValues *parent_values,
+ GtkCssStyle *values,
+ GtkCssStyle *parent_values,
GtkCssDependencies *dependencies)
{
if (property_id == GTK_CSS_PROPERTY_FONT_SIZE)
{
*dependencies = GTK_CSS_DEPENDS_ON_PARENT;
if (parent_values)
- return _gtk_css_number_value_get (_gtk_css_computed_values_get_value (parent_values,
GTK_CSS_PROPERTY_FONT_SIZE), 100);
+ return _gtk_css_number_value_get (gtk_css_style_get_value (parent_values,
GTK_CSS_PROPERTY_FONT_SIZE), 100);
else
return _gtk_css_font_size_get_default (provider);
}
*dependencies = GTK_CSS_DEPENDS_ON_FONT_SIZE;
- return _gtk_css_number_value_get (_gtk_css_computed_values_get_value (values, GTK_CSS_PROPERTY_FONT_SIZE),
100);
+ return _gtk_css_number_value_get (gtk_css_style_get_value (values, GTK_CSS_PROPERTY_FONT_SIZE), 100);
}
static GtkCssValue *
@@ -60,8 +60,8 @@ gtk_css_value_number_compute (GtkCssValue *number,
guint property_id,
GtkStyleProviderPrivate *provider,
int scale,
- GtkCssComputedValues *values,
- GtkCssComputedValues *parent_values,
+ GtkCssStyle *values,
+ GtkCssStyle *parent_values,
GtkCssDependencies *dependencies)
{
switch (number->unit)
diff --git a/gtk/gtkcsspositionvalue.c b/gtk/gtkcsspositionvalue.c
index dd9e0ad..371ec69 100644
--- a/gtk/gtkcsspositionvalue.c
+++ b/gtk/gtkcsspositionvalue.c
@@ -41,8 +41,8 @@ gtk_css_value_position_compute (GtkCssValue *position,
guint property_id,
GtkStyleProviderPrivate *provider,
int scale,
- GtkCssComputedValues *values,
- GtkCssComputedValues *parent_values,
+ GtkCssStyle *values,
+ GtkCssStyle *parent_values,
GtkCssDependencies *dependencies)
{
GtkCssValue *x, *y;
diff --git a/gtk/gtkcssrepeatvalue.c b/gtk/gtkcssrepeatvalue.c
index 5ecaaca..efc89e8 100644
--- a/gtk/gtkcssrepeatvalue.c
+++ b/gtk/gtkcssrepeatvalue.c
@@ -38,8 +38,8 @@ gtk_css_value_repeat_compute (GtkCssValue *value,
guint property_id,
GtkStyleProviderPrivate *provider,
int scale,
- GtkCssComputedValues *values,
- GtkCssComputedValues *parent_values,
+ GtkCssStyle *values,
+ GtkCssStyle *parent_values,
GtkCssDependencies *dependencies)
{
return _gtk_css_value_ref (value);
diff --git a/gtk/gtkcssrgbavalue.c b/gtk/gtkcssrgbavalue.c
index c58534a..f994819 100644
--- a/gtk/gtkcssrgbavalue.c
+++ b/gtk/gtkcssrgbavalue.c
@@ -38,8 +38,8 @@ gtk_css_value_rgba_compute (GtkCssValue *value,
guint property_id,
GtkStyleProviderPrivate *provider,
int scale,
- GtkCssComputedValues *values,
- GtkCssComputedValues *parent_values,
+ GtkCssStyle *values,
+ GtkCssStyle *parent_values,
GtkCssDependencies *dependencies)
{
return _gtk_css_value_ref (value);
diff --git a/gtk/gtkcssshadowsvalue.c b/gtk/gtkcssshadowsvalue.c
index f99401a..590fa24 100644
--- a/gtk/gtkcssshadowsvalue.c
+++ b/gtk/gtkcssshadowsvalue.c
@@ -55,8 +55,8 @@ gtk_css_value_shadows_compute (GtkCssValue *value,
guint property_id,
GtkStyleProviderPrivate *provider,
int scale,
- GtkCssComputedValues *values,
- GtkCssComputedValues *parent_values,
+ GtkCssStyle *values,
+ GtkCssStyle *parent_values,
GtkCssDependencies *dependencies)
{
GtkCssValue *result;
diff --git a/gtk/gtkcssshadowvalue.c b/gtk/gtkcssshadowvalue.c
index 4ea2f76..b5c4233 100644
--- a/gtk/gtkcssshadowvalue.c
+++ b/gtk/gtkcssshadowvalue.c
@@ -67,8 +67,8 @@ gtk_css_value_shadow_compute (GtkCssValue *shadow,
guint property_id,
GtkStyleProviderPrivate *provider,
int scale,
- GtkCssComputedValues *values,
- GtkCssComputedValues *parent_values,
+ GtkCssStyle *values,
+ GtkCssStyle *parent_values,
GtkCssDependencies *dependencies)
{
GtkCssValue *hoffset, *voffset, *radius, *spread, *color;
diff --git a/gtk/gtkcssstringvalue.c b/gtk/gtkcssstringvalue.c
index 56ccc69..ee62822 100644
--- a/gtk/gtkcssstringvalue.c
+++ b/gtk/gtkcssstringvalue.c
@@ -38,8 +38,8 @@ gtk_css_value_string_compute (GtkCssValue *value,
guint property_id,
GtkStyleProviderPrivate *provider,
int scale,
- GtkCssComputedValues *values,
- GtkCssComputedValues *parent_values,
+ GtkCssStyle *values,
+ GtkCssStyle *parent_values,
GtkCssDependencies *dependencies)
{
return _gtk_css_value_ref (value);
diff --git a/gtk/gtkcssstyle.c b/gtk/gtkcssstyle.c
new file mode 100644
index 0000000..21c89a1
--- /dev/null
+++ b/gtk/gtkcssstyle.c
@@ -0,0 +1,657 @@
+/*
+ * Copyright © 2012 Red Hat Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors: Benjamin Otte <otte gnome org>
+ */
+
+#include "config.h"
+
+#include "gtkprivate.h"
+#include "gtkcssstyleprivate.h"
+
+#include "gtkcssanimationprivate.h"
+#include "gtkcssarrayvalueprivate.h"
+#include "gtkcssenumvalueprivate.h"
+#include "gtkcssinheritvalueprivate.h"
+#include "gtkcssinitialvalueprivate.h"
+#include "gtkcssnumbervalueprivate.h"
+#include "gtkcsssectionprivate.h"
+#include "gtkcssshorthandpropertyprivate.h"
+#include "gtkcssstringvalueprivate.h"
+#include "gtkcssstylepropertyprivate.h"
+#include "gtkcsstransitionprivate.h"
+#include "gtkstyleanimationprivate.h"
+#include "gtkstylepropertyprivate.h"
+#include "gtkstyleproviderprivate.h"
+
+G_DEFINE_TYPE (GtkCssStyle, gtk_css_style, G_TYPE_OBJECT)
+
+static void
+gtk_css_style_dispose (GObject *object)
+{
+ GtkCssStyle *style = GTK_CSS_STYLE (object);
+
+ if (style->values)
+ {
+ g_ptr_array_unref (style->values);
+ style->values = NULL;
+ }
+ if (style->sections)
+ {
+ g_ptr_array_unref (style->sections);
+ style->sections = NULL;
+ }
+ if (style->animated_values)
+ {
+ g_ptr_array_unref (style->animated_values);
+ style->animated_values = NULL;
+ }
+
+ g_slist_free_full (style->animations, g_object_unref);
+ style->animations = NULL;
+
+ G_OBJECT_CLASS (gtk_css_style_parent_class)->dispose (object);
+}
+
+static void
+gtk_css_style_finalize (GObject *object)
+{
+ GtkCssStyle *style = GTK_CSS_STYLE (object);
+
+ _gtk_bitmask_free (style->depends_on_parent);
+ _gtk_bitmask_free (style->equals_parent);
+ _gtk_bitmask_free (style->depends_on_color);
+ _gtk_bitmask_free (style->depends_on_font_size);
+
+ G_OBJECT_CLASS (gtk_css_style_parent_class)->finalize (object);
+}
+
+static void
+gtk_css_style_class_init (GtkCssStyleClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->dispose = gtk_css_style_dispose;
+ object_class->finalize = gtk_css_style_finalize;
+}
+
+static void
+gtk_css_style_init (GtkCssStyle *style)
+{
+ style->depends_on_parent = _gtk_bitmask_new ();
+ style->equals_parent = _gtk_bitmask_new ();
+ style->depends_on_color = _gtk_bitmask_new ();
+ style->depends_on_font_size = _gtk_bitmask_new ();
+}
+
+GtkCssStyle *
+gtk_css_style_new (void)
+{
+ return g_object_new (GTK_TYPE_CSS_STYLE, NULL);
+}
+
+static void
+maybe_unref_section (gpointer section)
+{
+ if (section)
+ gtk_css_section_unref (section);
+}
+
+void
+gtk_css_style_compute_value (GtkCssStyle *style,
+ GtkStyleProviderPrivate *provider,
+ int scale,
+ GtkCssStyle *parent_style,
+ guint id,
+ GtkCssValue *specified,
+ GtkCssSection *section)
+{
+ GtkCssDependencies dependencies;
+ GtkCssValue *value;
+
+ gtk_internal_return_if_fail (GTK_IS_CSS_STYLE (style));
+ gtk_internal_return_if_fail (GTK_IS_STYLE_PROVIDER_PRIVATE (provider));
+ gtk_internal_return_if_fail (parent_style == NULL || GTK_IS_CSS_STYLE (parent_style));
+
+ /* 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, scale, style, parent_style, &dependencies);
+
+ if (style->values == NULL)
+ style->values = g_ptr_array_new_full (_gtk_css_style_property_get_n_properties (),
+ (GDestroyNotify)_gtk_css_value_unref);
+ if (id >= style->values->len)
+ g_ptr_array_set_size (style->values, id + 1);
+
+ if (g_ptr_array_index (style->values, id))
+ _gtk_css_value_unref (g_ptr_array_index (style->values, id));
+ g_ptr_array_index (style->values, id) = _gtk_css_value_ref (value);
+
+ if (dependencies & (GTK_CSS_DEPENDS_ON_PARENT | GTK_CSS_EQUALS_PARENT))
+ style->depends_on_parent = _gtk_bitmask_set (style->depends_on_parent, id, TRUE);
+ if (dependencies & (GTK_CSS_EQUALS_PARENT))
+ style->equals_parent = _gtk_bitmask_set (style->equals_parent, id, TRUE);
+ if (dependencies & (GTK_CSS_DEPENDS_ON_COLOR))
+ style->depends_on_color = _gtk_bitmask_set (style->depends_on_color, id, TRUE);
+ if (dependencies & (GTK_CSS_DEPENDS_ON_FONT_SIZE))
+ style->depends_on_font_size = _gtk_bitmask_set (style->depends_on_font_size, id, TRUE);
+
+ if (style->sections && style->sections->len > id && g_ptr_array_index (style->sections, id))
+ {
+ gtk_css_section_unref (g_ptr_array_index (style->sections, id));
+ g_ptr_array_index (style->sections, id) = NULL;
+ }
+
+ if (section)
+ {
+ if (style->sections == NULL)
+ style->sections = g_ptr_array_new_with_free_func (maybe_unref_section);
+ if (style->sections->len <= id)
+ g_ptr_array_set_size (style->sections, id + 1);
+
+ g_ptr_array_index (style->sections, id) = gtk_css_section_ref (section);
+ }
+
+ _gtk_css_value_unref (value);
+ _gtk_css_value_unref (specified);
+}
+
+void
+gtk_css_style_set_animated_value (GtkCssStyle *style,
+ guint id,
+ GtkCssValue *value)
+{
+ gtk_internal_return_if_fail (GTK_IS_CSS_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);
+
+}
+
+GtkCssValue *
+gtk_css_style_get_value (GtkCssStyle *style,
+ guint id)
+{
+ gtk_internal_return_val_if_fail (GTK_IS_CSS_STYLE (style), NULL);
+
+ if (style->animated_values &&
+ id < style->animated_values->len &&
+ g_ptr_array_index (style->animated_values, id))
+ return g_ptr_array_index (style->animated_values, id);
+
+ return gtk_css_style_get_intrinsic_value (style, id);
+}
+
+GtkCssValue *
+gtk_css_style_get_intrinsic_value (GtkCssStyle *style,
+ guint id)
+{
+ gtk_internal_return_val_if_fail (GTK_IS_CSS_STYLE (style), NULL);
+
+ if (style->values == NULL ||
+ id >= style->values->len)
+ return NULL;
+
+ return g_ptr_array_index (style->values, id);
+}
+
+GtkCssSection *
+gtk_css_style_get_section (GtkCssStyle *style,
+ guint id)
+{
+ gtk_internal_return_val_if_fail (GTK_IS_CSS_STYLE (style), NULL);
+
+ if (style->sections == NULL ||
+ id >= style->sections->len)
+ return NULL;
+
+ return g_ptr_array_index (style->sections, id);
+}
+
+GtkBitmask *
+gtk_css_style_get_difference (GtkCssStyle *style,
+ GtkCssStyle *other)
+{
+ GtkBitmask *result;
+ guint i, len;
+
+ len = MIN (style->values->len, other->values->len);
+ result = _gtk_bitmask_new ();
+ if (style->values->len != other->values->len)
+ result = _gtk_bitmask_invert_range (result, len, MAX (style->values->len, other->values->len));
+
+ for (i = 0; i < len; i++)
+ {
+ if (!_gtk_css_value_equal (g_ptr_array_index (style->values, i),
+ g_ptr_array_index (other->values, i)))
+ result = _gtk_bitmask_set (result, i, TRUE);
+ }
+
+ return result;
+}
+
+/* TRANSITIONS */
+
+typedef struct _TransitionInfo TransitionInfo;
+struct _TransitionInfo {
+ guint index; /* index into value arrays */
+ gboolean pending; /* TRUE if we still need to handle it */
+};
+
+static void
+transition_info_add (TransitionInfo infos[GTK_CSS_PROPERTY_N_PROPERTIES],
+ GtkStyleProperty *property,
+ guint index)
+{
+ if (property == NULL)
+ {
+ guint i;
+
+ for (i = 0; i < _gtk_css_style_property_get_n_properties (); i++)
+ {
+ GtkCssStyleProperty *prop = _gtk_css_style_property_lookup_by_id (i);
+
+ transition_info_add (infos, GTK_STYLE_PROPERTY (prop), index);
+ }
+ }
+ else if (GTK_IS_CSS_SHORTHAND_PROPERTY (property))
+ {
+ GtkCssShorthandProperty *shorthand = GTK_CSS_SHORTHAND_PROPERTY (property);
+ guint i;
+
+ for (i = 0; i < _gtk_css_shorthand_property_get_n_subproperties (shorthand); i++)
+ {
+ GtkCssStyleProperty *prop = _gtk_css_shorthand_property_get_subproperty (shorthand, i);
+
+ transition_info_add (infos, GTK_STYLE_PROPERTY (prop), index);
+ }
+ }
+ else if (GTK_IS_CSS_STYLE_PROPERTY (property))
+ {
+ guint id;
+
+ if (!_gtk_css_style_property_is_animated (GTK_CSS_STYLE_PROPERTY (property)))
+ return;
+
+ id = _gtk_css_style_property_get_id (GTK_CSS_STYLE_PROPERTY (property));
+ g_assert (id < GTK_CSS_PROPERTY_N_PROPERTIES);
+ infos[id].index = index;
+ infos[id].pending = TRUE;
+ }
+ else
+ {
+ g_assert_not_reached ();
+ }
+}
+
+static void
+transition_infos_set (TransitionInfo infos[GTK_CSS_PROPERTY_N_PROPERTIES],
+ GtkCssValue *transitions)
+{
+ guint i;
+
+ for (i = 0; i < _gtk_css_array_value_get_n_values (transitions); i++)
+ {
+ GtkStyleProperty *property;
+ GtkCssValue *prop_value;
+
+ prop_value = _gtk_css_array_value_get_nth (transitions, i);
+ if (g_ascii_strcasecmp (_gtk_css_ident_value_get (prop_value), "all") == 0)
+ property = NULL;
+ else
+ {
+ property = _gtk_style_property_lookup (_gtk_css_ident_value_get (prop_value));
+ if (property == NULL)
+ continue;
+ }
+
+ transition_info_add (infos, property, i);
+ }
+}
+
+static GtkStyleAnimation *
+gtk_css_style_find_transition (GtkCssStyle *style,
+ guint property_id)
+{
+ GSList *list;
+
+ for (list = style->animations; list; list = list->next)
+ {
+ if (!GTK_IS_CSS_TRANSITION (list->data))
+ continue;
+
+ if (_gtk_css_transition_get_property (list->data) == property_id)
+ return list->data;
+ }
+
+ return NULL;
+}
+
+static void
+gtk_css_style_create_css_transitions (GtkCssStyle *style,
+ gint64 timestamp,
+ GtkCssStyle *source)
+{
+ TransitionInfo transitions[GTK_CSS_PROPERTY_N_PROPERTIES] = { { 0, } };
+ GtkCssValue *durations, *delays, *timing_functions;
+ guint i;
+
+ transition_infos_set (transitions, gtk_css_style_get_value (style, GTK_CSS_PROPERTY_TRANSITION_PROPERTY));
+
+ durations = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_TRANSITION_DURATION);
+ delays = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_TRANSITION_DELAY);
+ timing_functions = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_TRANSITION_TIMING_FUNCTION);
+
+ for (i = 0; i < GTK_CSS_PROPERTY_N_PROPERTIES; i++)
+ {
+ GtkStyleAnimation *animation;
+ GtkCssValue *start, *end;
+ double duration, delay;
+
+ if (!transitions[i].pending)
+ continue;
+
+ duration = _gtk_css_number_value_get (_gtk_css_array_value_get_nth (durations, transitions[i].index),
100);
+ delay = _gtk_css_number_value_get (_gtk_css_array_value_get_nth (delays, transitions[i].index), 100);
+ if (duration + delay == 0.0)
+ continue;
+
+ start = gtk_css_style_get_intrinsic_value (source, i);
+ end = gtk_css_style_get_intrinsic_value (style, i);
+ if (_gtk_css_value_equal (start, end))
+ {
+ animation = gtk_css_style_find_transition (GTK_CSS_STYLE (source), i);
+ if (animation)
+ style->animations = g_slist_prepend (style->animations, g_object_ref (animation));
+ }
+ else
+ {
+ animation = _gtk_css_transition_new (i,
+ gtk_css_style_get_value (source, i),
+ _gtk_css_array_value_get_nth (timing_functions, i),
+ timestamp + delay * G_USEC_PER_SEC,
+ timestamp + (delay + duration) * G_USEC_PER_SEC);
+ style->animations = g_slist_prepend (style->animations, animation);
+ }
+ }
+}
+
+static GtkStyleAnimation *
+gtk_css_style_find_animation (GtkCssStyle *style,
+ const char *name)
+{
+ GSList *list;
+
+ for (list = style->animations; list; list = list->next)
+ {
+ if (!GTK_IS_CSS_ANIMATION (list->data))
+ continue;
+
+ if (g_str_equal (_gtk_css_animation_get_name (list->data), name))
+ return list->data;
+ }
+
+ return NULL;
+}
+
+static void
+gtk_css_style_create_css_animations (GtkCssStyle *style,
+ GtkCssStyle *parent_style,
+ gint64 timestamp,
+ GtkStyleProviderPrivate *provider,
+ int scale,
+ GtkCssStyle *source)
+{
+ GtkCssValue *durations, *delays, *timing_functions, *animations;
+ GtkCssValue *iteration_counts, *directions, *play_states, *fill_modes;
+ guint i;
+
+ animations = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_ANIMATION_NAME);
+ durations = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_ANIMATION_DURATION);
+ delays = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_ANIMATION_DELAY);
+ timing_functions = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_ANIMATION_TIMING_FUNCTION);
+ iteration_counts = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_ANIMATION_ITERATION_COUNT);
+ directions = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_ANIMATION_DIRECTION);
+ play_states = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_ANIMATION_PLAY_STATE);
+ fill_modes = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_ANIMATION_FILL_MODE);
+
+ for (i = 0; i < _gtk_css_array_value_get_n_values (animations); i++)
+ {
+ GtkStyleAnimation *animation;
+ GtkCssKeyframes *keyframes;
+ const char *name;
+
+ name = _gtk_css_ident_value_get (_gtk_css_array_value_get_nth (animations, i));
+ if (g_ascii_strcasecmp (name, "none") == 0)
+ continue;
+
+ animation = gtk_css_style_find_animation (style, name);
+ if (animation)
+ continue;
+
+ if (source)
+ animation = gtk_css_style_find_animation (source, name);
+
+ if (animation)
+ {
+ animation = _gtk_css_animation_copy (GTK_CSS_ANIMATION (animation),
+ timestamp,
+ _gtk_css_play_state_value_get (_gtk_css_array_value_get_nth
(play_states, i)));
+ }
+ else
+ {
+ keyframes = _gtk_style_provider_private_get_keyframes (provider, name);
+ if (keyframes == NULL)
+ continue;
+
+ keyframes = _gtk_css_keyframes_compute (keyframes, provider, scale, style, parent_style);
+
+ animation = _gtk_css_animation_new (name,
+ keyframes,
+ timestamp,
+ _gtk_css_number_value_get (_gtk_css_array_value_get_nth
(delays, i), 100) * G_USEC_PER_SEC,
+ _gtk_css_number_value_get (_gtk_css_array_value_get_nth
(durations, i), 100) * G_USEC_PER_SEC,
+ _gtk_css_array_value_get_nth (timing_functions, i),
+ _gtk_css_direction_value_get (_gtk_css_array_value_get_nth
(directions, i)),
+ _gtk_css_play_state_value_get (_gtk_css_array_value_get_nth
(play_states, i)),
+ _gtk_css_fill_mode_value_get (_gtk_css_array_value_get_nth
(fill_modes, i)),
+ _gtk_css_number_value_get (_gtk_css_array_value_get_nth
(iteration_counts, i), 100));
+ _gtk_css_keyframes_unref (keyframes);
+ }
+ style->animations = g_slist_prepend (style->animations, animation);
+ }
+}
+
+/* PUBLIC API */
+
+void
+gtk_css_style_create_animations (GtkCssStyle *style,
+ GtkCssStyle *parent_style,
+ gint64 timestamp,
+ GtkStyleProviderPrivate *provider,
+ int scale,
+ GtkCssStyle *source)
+{
+ if (source != NULL)
+ gtk_css_style_create_css_transitions (style, timestamp, source);
+ gtk_css_style_create_css_animations (style, parent_style, timestamp, provider, scale, source);
+}
+
+GtkBitmask *
+gtk_css_style_advance (GtkCssStyle *style,
+ gint64 timestamp)
+{
+ GtkBitmask *changed;
+ GPtrArray *old_computed_values;
+ GSList *list;
+ guint i;
+
+ gtk_internal_return_val_if_fail (GTK_IS_CSS_STYLE (style), NULL);
+ gtk_internal_return_val_if_fail (timestamp >= style->current_time, NULL);
+
+ style->current_time = timestamp;
+ old_computed_values = style->animated_values;
+ style->animated_values = NULL;
+
+ list = style->animations;
+ while (list)
+ {
+ GtkStyleAnimation *animation = list->data;
+
+ list = list->next;
+
+ _gtk_style_animation_set_values (animation,
+ timestamp,
+ GTK_CSS_STYLE (style));
+
+ if (_gtk_style_animation_is_finished (animation, timestamp))
+ {
+ style->animations = g_slist_remove (style->animations, animation);
+ g_object_unref (animation);
+ }
+ }
+
+ /* figure out changes */
+ changed = _gtk_bitmask_new ();
+
+ for (i = 0; i < GTK_CSS_PROPERTY_N_PROPERTIES; i++)
+ {
+ GtkCssValue *old_animated, *new_animated;
+
+ old_animated = old_computed_values && i < old_computed_values->len ? g_ptr_array_index
(old_computed_values, i) : NULL;
+ new_animated = style->animated_values && i < style->animated_values->len ? g_ptr_array_index
(style->animated_values, i) : NULL;
+
+ if (!_gtk_css_value_equal0 (old_animated, new_animated))
+ changed = _gtk_bitmask_set (changed, i, TRUE);
+ }
+
+ if (old_computed_values)
+ g_ptr_array_unref (old_computed_values);
+
+ return changed;
+}
+
+gboolean
+gtk_css_style_is_static (GtkCssStyle *style)
+{
+ GSList *list;
+
+ gtk_internal_return_val_if_fail (GTK_IS_CSS_STYLE (style), TRUE);
+
+ for (list = style->animations; list; list = list->next)
+ {
+ if (!_gtk_style_animation_is_static (list->data, style->current_time))
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+void
+gtk_css_style_cancel_animations (GtkCssStyle *style)
+{
+ gtk_internal_return_if_fail (GTK_IS_CSS_STYLE (style));
+
+ if (style->animated_values)
+ {
+ g_ptr_array_unref (style->animated_values);
+ style->animated_values = NULL;
+ }
+
+ g_slist_free_full (style->animations, g_object_unref);
+ style->animations = NULL;
+}
+
+GtkBitmask *
+gtk_css_style_compute_dependencies (GtkCssStyle *style,
+ const GtkBitmask *parent_changes)
+{
+ GtkBitmask *changes;
+
+ gtk_internal_return_val_if_fail (GTK_IS_CSS_STYLE (style), _gtk_bitmask_new ());
+
+ changes = _gtk_bitmask_copy (parent_changes);
+ changes = _gtk_bitmask_intersect (changes, style->depends_on_parent);
+ if (_gtk_bitmask_get (changes, GTK_CSS_PROPERTY_COLOR))
+ changes = _gtk_bitmask_union (changes, style->depends_on_color);
+ if (_gtk_bitmask_get (changes, GTK_CSS_PROPERTY_FONT_SIZE))
+ changes = _gtk_bitmask_union (changes, style->depends_on_font_size);
+
+ return changes;
+}
+
+void
+gtk_css_style_print (GtkCssStyle *style,
+ GString *string)
+{
+ guint i;
+
+ g_return_if_fail (GTK_IS_CSS_STYLE (style));
+ g_return_if_fail (string != NULL);
+
+ for (i = 0; i < _gtk_css_style_property_get_n_properties (); i++)
+ {
+ GtkCssSection *section = gtk_css_style_get_section (style, i);
+ g_string_append (string, _gtk_style_property_get_name (GTK_STYLE_PROPERTY
(_gtk_css_style_property_lookup_by_id (i))));
+ g_string_append (string, ": ");
+ _gtk_css_value_print (gtk_css_style_get_value (style, i), string);
+ g_string_append (string, ";");
+ if (section)
+ {
+ g_string_append (string, " /* ");
+ _gtk_css_section_print (section, string);
+ g_string_append (string, " */");
+ }
+ g_string_append (string, "\n");
+ }
+}
+
+char *
+gtk_css_style_to_string (GtkCssStyle *style)
+{
+ GString *string;
+
+ g_return_val_if_fail (GTK_IS_CSS_STYLE (style), NULL);
+
+ string = g_string_new ("");
+
+ gtk_css_style_print (style, string);
+
+ return g_string_free (string, FALSE);
+}
+
diff --git a/gtk/gtkcssstylefuncs.c b/gtk/gtkcssstylefuncs.c
index 56f5cdf..c2fdf95 100644
--- a/gtk/gtkcssstylefuncs.c
+++ b/gtk/gtkcssstylefuncs.c
@@ -56,8 +56,8 @@ typedef gboolean (* GtkStyleParseFunc) (GtkCssParser
typedef void (* GtkStylePrintFunc) (const GValue *value,
GString *string);
typedef GtkCssValue * (* GtkStyleComputeFunc) (GtkStyleProviderPrivate *provider,
- GtkCssComputedValues *values,
- GtkCssComputedValues *parent_values,
+ GtkCssStyle *values,
+ GtkCssStyle *parent_values,
GtkCssValue *specified,
GtkCssDependencies *dependencies);
@@ -183,8 +183,8 @@ rgba_value_print (const GValue *value,
static GtkCssValue *
rgba_value_compute (GtkStyleProviderPrivate *provider,
- GtkCssComputedValues *values,
- GtkCssComputedValues *parent_values,
+ GtkCssStyle *values,
+ GtkCssStyle *parent_values,
GtkCssValue *specified,
GtkCssDependencies *dependencies)
{
@@ -204,7 +204,7 @@ rgba_value_compute (GtkStyleProviderPrivate *provider,
val = _gtk_css_color_value_resolve (_gtk_symbolic_color_get_css_value (symbolic),
provider,
- _gtk_css_computed_values_get_value (values,
GTK_CSS_PROPERTY_COLOR),
+ gtk_css_style_get_value (values, GTK_CSS_PROPERTY_COLOR),
GTK_CSS_DEPENDS_ON_COLOR,
dependencies,
NULL);
@@ -282,8 +282,8 @@ G_GNUC_END_IGNORE_DEPRECATIONS
static GtkCssValue *
color_value_compute (GtkStyleProviderPrivate *provider,
- GtkCssComputedValues *values,
- GtkCssComputedValues *parent_values,
+ GtkCssStyle *values,
+ GtkCssStyle *parent_values,
GtkCssValue *specified,
GtkCssDependencies *dependencies)
{
@@ -301,7 +301,7 @@ color_value_compute (GtkStyleProviderPrivate *provider,
val = _gtk_css_color_value_resolve (_gtk_symbolic_color_get_css_value (g_value_get_boxed (value)),
provider,
- _gtk_css_computed_values_get_value (values,
GTK_CSS_PROPERTY_COLOR),
+ gtk_css_style_get_value (values, GTK_CSS_PROPERTY_COLOR),
GTK_CSS_DEPENDS_ON_COLOR,
dependencies,
NULL);
@@ -847,8 +847,8 @@ pattern_value_print (const GValue *value,
static GtkCssValue *
pattern_value_compute (GtkStyleProviderPrivate *provider,
- GtkCssComputedValues *values,
- GtkCssComputedValues *parent_values,
+ GtkCssStyle *values,
+ GtkCssStyle *parent_values,
GtkCssValue *specified,
GtkCssDependencies *dependencies)
{
@@ -1154,8 +1154,8 @@ _gtk_css_style_funcs_print_value (const GValue *value,
**/
GtkCssValue *
_gtk_css_style_funcs_compute_value (GtkStyleProviderPrivate *provider,
- GtkCssComputedValues *values,
- GtkCssComputedValues *parent_values,
+ GtkCssStyle *style,
+ GtkCssStyle *parent_style,
GType target_type,
GtkCssValue *specified,
GtkCssDependencies *dependencies)
@@ -1163,8 +1163,8 @@ _gtk_css_style_funcs_compute_value (GtkStyleProviderPrivate *provider,
GtkStyleComputeFunc func;
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 (GTK_IS_CSS_STYLE (style), NULL);
+ g_return_val_if_fail (parent_style == NULL || GTK_IS_CSS_STYLE (parent_style), NULL);
g_return_val_if_fail (*dependencies == 0, NULL);
gtk_css_style_funcs_init ();
@@ -1176,7 +1176,7 @@ _gtk_css_style_funcs_compute_value (GtkStyleProviderPrivate *provider,
GSIZE_TO_POINTER (g_type_fundamental (target_type)));
if (func)
- return func (provider, values, parent_values, specified, dependencies);
+ return func (provider, style, parent_style, specified, dependencies);
else
return _gtk_css_value_ref (specified);
}
diff --git a/gtk/gtkcssstylefuncsprivate.h b/gtk/gtkcssstylefuncsprivate.h
index 47c52a5..4003498 100644
--- a/gtk/gtkcssstylefuncsprivate.h
+++ b/gtk/gtkcssstylefuncsprivate.h
@@ -29,8 +29,8 @@ gboolean _gtk_css_style_funcs_parse_value (GValue
void _gtk_css_style_funcs_print_value (const GValue *value,
GString *string);
GtkCssValue * _gtk_css_style_funcs_compute_value (GtkStyleProviderPrivate *provider,
- GtkCssComputedValues *values,
- GtkCssComputedValues *parent_values,
+ GtkCssStyle *style,
+ GtkCssStyle *parent_style,
GType target_type,
GtkCssValue *specified,
GtkCssDependencies *dependencies);
diff --git a/gtk/gtkcssstyleprivate.h b/gtk/gtkcssstyleprivate.h
new file mode 100644
index 0000000..f566426
--- /dev/null
+++ b/gtk/gtkcssstyleprivate.h
@@ -0,0 +1,106 @@
+/*
+ * Copyright © 2012 Red Hat Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors: Benjamin Otte <otte gnome org>
+ */
+
+#ifndef __GTK_CSS_STYLE_PRIVATE_H__
+#define __GTK_CSS_STYLE_PRIVATE_H__
+
+#include <glib-object.h>
+
+#include "gtk/gtkbitmaskprivate.h"
+#include "gtk/gtkcsssection.h"
+#include "gtk/gtkcssvalueprivate.h"
+
+G_BEGIN_DECLS
+
+#define GTK_TYPE_CSS_STYLE (gtk_css_style_get_type ())
+#define GTK_CSS_STYLE(obj) (G_TYPE_CHECK_INSTANCE_CAST (obj, GTK_TYPE_CSS_STYLE, GtkCssStyle))
+#define GTK_CSS_STYLE_CLASS(cls) (G_TYPE_CHECK_CLASS_CAST (cls, GTK_TYPE_CSS_STYLE, GtkCssStyleClass))
+#define GTK_IS_CSS_STYLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE (obj, GTK_TYPE_CSS_STYLE))
+#define GTK_IS_CSS_STYLE_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE (obj, GTK_TYPE_CSS_STYLE))
+#define GTK_CSS_STYLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_CSS_STYLE,
GtkCssStyleClass))
+
+/* typedef struct _GtkCssStyle GtkCssStyle; */
+typedef struct _GtkCssStyleClass GtkCssStyleClass;
+
+struct _GtkCssStyle
+{
+ GObject parent;
+
+ GPtrArray *values; /* the unanimated (aka intrinsic) values */
+ GPtrArray *sections; /* sections the values are defined in */
+
+ GPtrArray *animated_values; /* NULL or array of animated values/NULL if not animated */
+ gint64 current_time; /* the current time in our world */
+ GSList *animations; /* the running animations, least important one first */
+
+ GtkBitmask *depends_on_parent; /* for intrinsic values */
+ GtkBitmask *equals_parent; /* dito */
+ GtkBitmask *depends_on_color; /* dito */
+ GtkBitmask *depends_on_font_size; /* dito */
+};
+
+struct _GtkCssStyleClass
+{
+ GObjectClass parent_class;
+};
+
+GType gtk_css_style_get_type (void) G_GNUC_CONST;
+
+GtkCssStyle * gtk_css_style_new (void);
+
+void gtk_css_style_compute_value (GtkCssStyle *style,
+ GtkStyleProviderPrivate*provider,
+ int scale,
+ GtkCssStyle *parent_style,
+ guint id,
+ GtkCssValue *specified,
+ GtkCssSection *section);
+void gtk_css_style_set_animated_value (GtkCssStyle *style,
+ guint id,
+ GtkCssValue *value);
+
+GtkCssValue * gtk_css_style_get_value (GtkCssStyle *style,
+ guint id);
+GtkCssSection * gtk_css_style_get_section (GtkCssStyle *style,
+ guint id);
+GtkCssValue * gtk_css_style_get_intrinsic_value (GtkCssStyle *style,
+ guint id);
+GtkBitmask * gtk_css_style_get_difference (GtkCssStyle *style,
+ GtkCssStyle *other);
+GtkBitmask * gtk_css_style_compute_dependencies (GtkCssStyle *style,
+ const GtkBitmask *parent_changes);
+
+void gtk_css_style_create_animations (GtkCssStyle *style,
+ GtkCssStyle *parent_style,
+ gint64 timestamp,
+ GtkStyleProviderPrivate*provider,
+ int scale,
+ GtkCssStyle *source);
+GtkBitmask * gtk_css_style_advance (GtkCssStyle *style,
+ gint64 timestamp);
+void gtk_css_style_cancel_animations (GtkCssStyle *style);
+gboolean gtk_css_style_is_static (GtkCssStyle *style);
+
+char * gtk_css_style_to_string (GtkCssStyle *style);
+void gtk_css_style_print (GtkCssStyle *style,
+ GString *string);
+
+G_END_DECLS
+
+#endif /* __GTK_CSS_STYLE_PRIVATE_H__ */
diff --git a/gtk/gtkcsstransformvalue.c b/gtk/gtkcsstransformvalue.c
index cae3c4c..901f093 100644
--- a/gtk/gtkcsstransformvalue.c
+++ b/gtk/gtkcsstransformvalue.c
@@ -232,8 +232,8 @@ gtk_css_transform_compute (GtkCssTransform *dest,
guint property_id,
GtkStyleProviderPrivate *provider,
int scale,
- GtkCssComputedValues *values,
- GtkCssComputedValues *parent_values,
+ GtkCssStyle *values,
+ GtkCssStyle *parent_values,
GtkCssDependencies *dependencies)
{
GtkCssDependencies x_deps, y_deps;
@@ -286,8 +286,8 @@ gtk_css_value_transform_compute (GtkCssValue *value,
guint property_id,
GtkStyleProviderPrivate *provider,
int scale,
- GtkCssComputedValues *values,
- GtkCssComputedValues *parent_values,
+ GtkCssStyle *values,
+ GtkCssStyle *parent_values,
GtkCssDependencies *dependencies)
{
GtkCssDependencies transform_deps;
diff --git a/gtk/gtkcsstransition.c b/gtk/gtkcsstransition.c
index 08db428..0d0f581 100644
--- a/gtk/gtkcsstransition.c
+++ b/gtk/gtkcsstransition.c
@@ -26,15 +26,15 @@
G_DEFINE_TYPE (GtkCssTransition, _gtk_css_transition, GTK_TYPE_STYLE_ANIMATION)
static void
-gtk_css_transition_set_values (GtkStyleAnimation *animation,
- gint64 for_time_us,
- GtkCssComputedValues *values)
+gtk_css_transition_set_values (GtkStyleAnimation *animation,
+ gint64 for_time_us,
+ GtkCssStyle *style)
{
GtkCssTransition *transition = GTK_CSS_TRANSITION (animation);
GtkCssValue *value, *end;
double progress;
- end = _gtk_css_computed_values_get_intrinsic_value (values, transition->property);
+ end = gtk_css_style_get_intrinsic_value (style, transition->property);
if (transition->start_time >= for_time_us)
value = _gtk_css_value_ref (transition->start);
@@ -55,7 +55,7 @@ gtk_css_transition_set_values (GtkStyleAnimation *animation,
if (value)
{
- _gtk_css_computed_values_set_animated_value (values, transition->property, value);
+ gtk_css_style_set_animated_value (style, transition->property, value);
_gtk_css_value_unref (value);
}
}
diff --git a/gtk/gtkcsstypedvalue.c b/gtk/gtkcsstypedvalue.c
index be24584..cfce35f 100644
--- a/gtk/gtkcsstypedvalue.c
+++ b/gtk/gtkcsstypedvalue.c
@@ -39,8 +39,8 @@ gtk_css_value_typed_compute (GtkCssValue *value,
guint property_id,
GtkStyleProviderPrivate *provider,
int scale,
- GtkCssComputedValues *values,
- GtkCssComputedValues *parent_values,
+ GtkCssStyle *values,
+ GtkCssStyle *parent_values,
GtkCssDependencies *dependencies)
{
GtkCssCustomProperty *custom = GTK_CSS_CUSTOM_PROPERTY (_gtk_css_style_property_lookup_by_id
(property_id));
diff --git a/gtk/gtkcsstypesprivate.h b/gtk/gtkcsstypesprivate.h
index 314d3dd..a9796cc 100644
--- a/gtk/gtkcsstypesprivate.h
+++ b/gtk/gtkcsstypesprivate.h
@@ -24,7 +24,7 @@
G_BEGIN_DECLS
/* forward declaration for GtkCssValue */
-typedef struct _GtkCssComputedValues GtkCssComputedValues;
+typedef struct _GtkCssStyle GtkCssStyle;
typedef struct _GtkStyleProviderPrivate GtkStyleProviderPrivate; /* dummy typedef */
typedef enum { /*< skip >*/
diff --git a/gtk/gtkcssunsetvalue.c b/gtk/gtkcssunsetvalue.c
index dda5c73..73b0c6f 100644
--- a/gtk/gtkcssunsetvalue.c
+++ b/gtk/gtkcssunsetvalue.c
@@ -39,8 +39,8 @@ gtk_css_value_unset_compute (GtkCssValue *value,
guint property_id,
GtkStyleProviderPrivate *provider,
int scale,
- GtkCssComputedValues *values,
- GtkCssComputedValues *parent_values,
+ GtkCssStyle *values,
+ GtkCssStyle *parent_values,
GtkCssDependencies *dependencies)
{
GtkCssStyleProperty *property;
diff --git a/gtk/gtkcssvalue.c b/gtk/gtkcssvalue.c
index fb9dfe3..ec73f41 100644
--- a/gtk/gtkcssvalue.c
+++ b/gtk/gtkcssvalue.c
@@ -20,7 +20,7 @@
#include "gtkprivate.h"
#include "gtkcssvalueprivate.h"
-#include "gtkcsscomputedvaluesprivate.h"
+#include "gtkcssstyleprivate.h"
#include "gtkstyleproviderprivate.h"
struct _GtkCssValue {
@@ -88,16 +88,16 @@ _gtk_css_value_compute (GtkCssValue *value,
guint property_id,
GtkStyleProviderPrivate *provider,
int scale,
- GtkCssComputedValues *values,
- GtkCssComputedValues *parent_values,
+ GtkCssStyle *values,
+ GtkCssStyle *parent_values,
GtkCssDependencies *dependencies)
{
GtkCssDependencies fallback;
gtk_internal_return_val_if_fail (value != NULL, NULL);
gtk_internal_return_val_if_fail (GTK_IS_STYLE_PROVIDER_PRIVATE (provider), NULL);
- gtk_internal_return_val_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values), NULL);
- gtk_internal_return_val_if_fail (parent_values == NULL || GTK_IS_CSS_COMPUTED_VALUES (parent_values),
NULL);
+ gtk_internal_return_val_if_fail (GTK_IS_CSS_STYLE (values), NULL);
+ gtk_internal_return_val_if_fail (parent_values == NULL || GTK_IS_CSS_STYLE (parent_values), NULL);
if (dependencies == NULL)
dependencies = &fallback;
diff --git a/gtk/gtkcssvalueprivate.h b/gtk/gtkcssvalueprivate.h
index 9871ab3..973ecc5 100644
--- a/gtk/gtkcssvalueprivate.h
+++ b/gtk/gtkcssvalueprivate.h
@@ -44,8 +44,8 @@ struct _GtkCssValueClass {
guint property_id,
GtkStyleProviderPrivate *provider,
int scale,
- GtkCssComputedValues *values,
- GtkCssComputedValues *parent_values,
+ GtkCssStyle *values,
+ GtkCssStyle *parent_values,
GtkCssDependencies *dependencies);
gboolean (* equal) (const GtkCssValue *value1,
const GtkCssValue *value2);
@@ -70,8 +70,8 @@ GtkCssValue *_gtk_css_value_compute (GtkCssValue
guint property_id,
GtkStyleProviderPrivate *provider,
int scale,
- GtkCssComputedValues *values,
- GtkCssComputedValues *parent_values,
+ GtkCssStyle *values,
+ GtkCssStyle *parent_values,
GtkCssDependencies *dependencies);
gboolean _gtk_css_value_equal (const GtkCssValue *value1,
const GtkCssValue *value2);
diff --git a/gtk/gtkroundedbox.c b/gtk/gtkroundedbox.c
index 2b5ac21..b439a8f 100644
--- a/gtk/gtkroundedbox.c
+++ b/gtk/gtkroundedbox.c
@@ -221,17 +221,19 @@ _cairo_ellipsis (cairo_t *cr,
double xradius, double yradius,
double angle1, double angle2)
{
+ cairo_matrix_t save;
+
if (xradius <= 0.0 || yradius <= 0.0)
{
cairo_line_to (cr, xc, yc);
return;
}
- cairo_save (cr);
+ cairo_get_matrix (cr, &save);
cairo_translate (cr, xc, yc);
cairo_scale (cr, xradius, yradius);
cairo_arc (cr, 0, 0, 1.0, angle1, angle2);
- cairo_restore (cr);
+ cairo_set_matrix (cr, &save);
}
static void
@@ -240,17 +242,19 @@ _cairo_ellipsis_negative (cairo_t *cr,
double xradius, double yradius,
double angle1, double angle2)
{
+ cairo_matrix_t save;
+
if (xradius <= 0.0 || yradius <= 0.0)
{
cairo_line_to (cr, xc, yc);
return;
}
- cairo_save (cr);
+ cairo_get_matrix (cr, &save);
cairo_translate (cr, xc, yc);
cairo_scale (cr, xradius, yradius);
cairo_arc_negative (cr, 0, 0, 1.0, angle1, angle2);
- cairo_restore (cr);
+ cairo_set_matrix (cr, &save);
}
void
diff --git a/gtk/gtkstyleanimation.c b/gtk/gtkstyleanimation.c
index 2ee49f3..7bca5b7 100644
--- a/gtk/gtkstyleanimation.c
+++ b/gtk/gtkstyleanimation.c
@@ -26,7 +26,7 @@ G_DEFINE_ABSTRACT_TYPE (GtkStyleAnimation, _gtk_style_animation, G_TYPE_OBJECT)
static void
gtk_style_animation_real_set_values (GtkStyleAnimation *animation,
gint64 for_time_us,
- GtkCssComputedValues *values)
+ GtkCssStyle *values)
{
}
@@ -60,12 +60,12 @@ _gtk_style_animation_init (GtkStyleAnimation *animation)
void
_gtk_style_animation_set_values (GtkStyleAnimation *animation,
gint64 for_time_us,
- GtkCssComputedValues *values)
+ GtkCssStyle *values)
{
GtkStyleAnimationClass *klass;
g_return_if_fail (GTK_IS_STYLE_ANIMATION (animation));
- g_return_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values));
+ g_return_if_fail (GTK_IS_CSS_STYLE (values));
klass = GTK_STYLE_ANIMATION_GET_CLASS (animation);
diff --git a/gtk/gtkstyleanimationprivate.h b/gtk/gtkstyleanimationprivate.h
index 4db2a07..fbeb9d7 100644
--- a/gtk/gtkstyleanimationprivate.h
+++ b/gtk/gtkstyleanimationprivate.h
@@ -21,7 +21,7 @@
#define __GTK_STYLE_ANIMATION_PRIVATE_H__
#include <glib-object.h>
-#include "gtkcsscomputedvaluesprivate.h"
+#include "gtkcssstyleprivate.h"
G_BEGIN_DECLS
@@ -50,14 +50,14 @@ struct _GtkStyleAnimationClass
gint64 at_time_us);
void (* set_values) (GtkStyleAnimation *animation,
gint64 for_time_us,
- GtkCssComputedValues *values);
+ GtkCssStyle *values);
};
GType _gtk_style_animation_get_type (void) G_GNUC_CONST;
void _gtk_style_animation_set_values (GtkStyleAnimation *animation,
gint64 for_time_us,
- GtkCssComputedValues *values);
+ GtkCssStyle *values);
gboolean _gtk_style_animation_is_finished (GtkStyleAnimation *animation,
gint64 at_time_us);
gboolean _gtk_style_animation_is_static (GtkStyleAnimation *animation,
diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c
index 7773997..25dd480 100644
--- a/gtk/gtkstylecontext.c
+++ b/gtk/gtkstylecontext.c
@@ -143,7 +143,7 @@ struct PropertyValue
struct GtkStyleInfo
{
GtkCssNodeDeclaration *decl;
- GtkCssComputedValues *values;
+ GtkCssStyle *values;
};
struct _GtkStyleContextPrivate
@@ -198,7 +198,7 @@ static void gtk_style_context_impl_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec);
-static GtkCssComputedValues *style_values_lookup(GtkStyleContext *context);
+static GtkCssStyle *style_values_lookup(GtkStyleContext *context);
static void gtk_style_context_disconnect_update (GtkStyleContext *context);
@@ -305,7 +305,7 @@ style_info_new (void)
static void
style_info_set_values (GtkStyleInfo *info,
- GtkCssComputedValues *values)
+ GtkCssStyle *values)
{
if (info->values == values)
return;
@@ -491,7 +491,7 @@ static gboolean
gtk_style_context_should_animate (GtkStyleContext *context)
{
GtkStyleContextPrivate *priv;
- GtkCssComputedValues *values;
+ GtkCssStyle *values;
gboolean animate;
priv = context->priv;
@@ -503,7 +503,7 @@ gtk_style_context_should_animate (GtkStyleContext *context)
return FALSE;
values = style_values_lookup (context);
- if (_gtk_css_computed_values_is_static (values))
+ if (gtk_css_style_is_static (values))
return FALSE;
g_object_get (gtk_widget_get_settings (context->priv->widget),
@@ -668,7 +668,7 @@ create_query_path (GtkStyleContext *context,
static void
build_properties (GtkStyleContext *context,
- GtkCssComputedValues *values,
+ GtkCssStyle *values,
const GtkCssNodeDeclaration *decl,
const GtkBitmask *relevant_changes,
GtkCssChange *out_change)
@@ -699,11 +699,11 @@ build_properties (GtkStyleContext *context,
gtk_widget_path_free (path);
}
-static GtkCssComputedValues *
+static GtkCssStyle *
style_values_lookup (GtkStyleContext *context)
{
GtkStyleContextPrivate *priv;
- GtkCssComputedValues *values;
+ GtkCssStyle *values;
GtkStyleInfo *info;
priv = context->priv;
@@ -722,7 +722,7 @@ style_values_lookup (GtkStyleContext *context)
return values;
}
- values = _gtk_css_computed_values_new ();
+ values = gtk_css_style_new ();
style_info_set_values (info, values);
if (gtk_style_context_is_saved (context))
@@ -745,12 +745,12 @@ style_values_lookup (GtkStyleContext *context)
return values;
}
-static GtkCssComputedValues *
+static GtkCssStyle *
style_values_lookup_for_state (GtkStyleContext *context,
GtkStateFlags state)
{
GtkCssNodeDeclaration *decl;
- GtkCssComputedValues *values;
+ GtkCssStyle *values;
if (gtk_css_node_declaration_get_state (context->priv->info->decl) == state)
return g_object_ref (style_values_lookup (context));
@@ -760,7 +760,7 @@ style_values_lookup_for_state (GtkStyleContext *context,
decl = gtk_css_node_declaration_ref (context->priv->info->decl);
gtk_css_node_declaration_set_state (&decl, state);
- values = _gtk_css_computed_values_new ();
+ values = gtk_css_style_new ();
build_properties (context, values, decl, NULL, NULL);
gtk_css_node_declaration_unref (decl);
@@ -1038,7 +1038,7 @@ gtk_style_context_get_section (GtkStyleContext *context,
const gchar *property)
{
GtkStyleContextPrivate *priv;
- GtkCssComputedValues *values;
+ GtkCssStyle *values;
GtkStyleProperty *prop;
g_return_val_if_fail (GTK_IS_STYLE_CONTEXT (context), NULL);
@@ -1052,14 +1052,14 @@ gtk_style_context_get_section (GtkStyleContext *context,
return NULL;
values = style_values_lookup (context);
- return _gtk_css_computed_values_get_section (values, _gtk_css_style_property_get_id
(GTK_CSS_STYLE_PROPERTY (prop)));
+ return gtk_css_style_get_section (values, _gtk_css_style_property_get_id (GTK_CSS_STYLE_PROPERTY (prop)));
}
static GtkCssValue *
gtk_style_context_query_func (guint id,
gpointer values)
{
- return _gtk_css_computed_values_get_value (values, id);
+ return gtk_css_style_get_value (values, id);
}
/**
@@ -1083,7 +1083,7 @@ gtk_style_context_get_property (GtkStyleContext *context,
GValue *value)
{
GtkStyleContextPrivate *priv;
- GtkCssComputedValues *values;
+ GtkCssStyle *values;
GtkStyleProperty *prop;
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
@@ -1816,9 +1816,9 @@ GtkCssValue *
_gtk_style_context_peek_property (GtkStyleContext *context,
guint property_id)
{
- GtkCssComputedValues *values = style_values_lookup (context);
+ GtkCssStyle *values = style_values_lookup (context);
- return _gtk_css_computed_values_get_value (values, property_id);
+ return gtk_css_style_get_value (values, property_id);
}
const GValue *
@@ -2642,10 +2642,10 @@ gtk_style_context_update_cache (GtkStyleContext *context,
while (g_hash_table_iter_next (&iter, &key, &value))
{
const GtkCssNodeDeclaration *decl = key;
- GtkCssComputedValues *values = value;
+ GtkCssStyle *values = value;
GtkBitmask *changes;
- changes = _gtk_css_computed_values_compute_dependencies (values, parent_changes);
+ changes = gtk_css_style_compute_dependencies (values, parent_changes);
if (!_gtk_bitmask_is_empty (changes))
build_properties (context, values, decl, changes, NULL);
@@ -2684,13 +2684,13 @@ gtk_style_context_update_animations (GtkStyleContext *context,
gint64 timestamp)
{
GtkBitmask *differences;
- GtkCssComputedValues *values;
+ GtkCssStyle *values;
values = style_values_lookup (context);
- differences = _gtk_css_computed_values_advance (values, timestamp);
+ differences = gtk_css_style_advance (values, timestamp);
- if (_gtk_css_computed_values_is_static (values))
+ if (gtk_css_style_is_static (values))
_gtk_style_context_update_animating (context);
return differences;
@@ -2741,7 +2741,7 @@ _gtk_style_context_validate (GtkStyleContext *context,
{
GtkStyleContextPrivate *priv;
GtkStyleInfo *info;
- GtkCssComputedValues *current;
+ GtkCssStyle *current;
GtkBitmask *changes;
GSList *list;
@@ -2782,7 +2782,7 @@ _gtk_style_context_validate (GtkStyleContext *context,
if (current == NULL ||
gtk_style_context_needs_full_revalidate (context, change))
{
- GtkCssComputedValues *values;
+ GtkCssStyle *values;
if ((priv->relevant_changes & change) & ~GTK_STYLE_CONTEXT_CACHED_CHANGE)
{
@@ -2797,13 +2797,13 @@ _gtk_style_context_validate (GtkStyleContext *context,
values = style_values_lookup (context);
if (values != current)
- _gtk_css_computed_values_create_animations (values,
- priv->parent ? style_values_lookup (priv->parent) : NULL,
- timestamp,
- GTK_STYLE_PROVIDER_PRIVATE (priv->cascade),
- priv->scale,
- gtk_style_context_should_create_transitions (context) ?
current : NULL);
- if (_gtk_css_computed_values_is_static (values))
+ gtk_css_style_create_animations (values,
+ priv->parent ? style_values_lookup (priv->parent) : NULL,
+ timestamp,
+ GTK_STYLE_PROVIDER_PRIVATE (priv->cascade),
+ priv->scale,
+ gtk_style_context_should_create_transitions (context) ? current :
NULL);
+ if (gtk_css_style_is_static (values))
change &= ~GTK_CSS_CHANGE_ANIMATE;
else
change |= GTK_CSS_CHANGE_ANIMATE;
@@ -2811,7 +2811,7 @@ _gtk_style_context_validate (GtkStyleContext *context,
if (current)
{
- changes = _gtk_css_computed_values_get_difference (values, current);
+ changes = gtk_css_style_get_difference (values, current);
}
else
{
@@ -2821,7 +2821,7 @@ _gtk_style_context_validate (GtkStyleContext *context,
}
else
{
- changes = _gtk_css_computed_values_compute_dependencies (current, parent_changes);
+ changes = gtk_css_style_compute_dependencies (current, parent_changes);
if (!_gtk_bitmask_is_empty (changes))
build_properties (context, current, info->decl, changes, NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]