Compare commits
4 Commits
matthiasc/
...
css-style-
Author | SHA1 | Date | |
---|---|---|---|
|
8a14144658 | ||
|
0ff6176525 | ||
|
c30befed1e | ||
|
9d38806ced |
@@ -28,11 +28,14 @@ void
|
|||||||
_gtk_css_lookup_init (GtkCssLookup *lookup)
|
_gtk_css_lookup_init (GtkCssLookup *lookup)
|
||||||
{
|
{
|
||||||
memset (lookup, 0, sizeof (*lookup));
|
memset (lookup, 0, sizeof (*lookup));
|
||||||
|
|
||||||
|
lookup->set_values = _gtk_bitmask_new ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_gtk_css_lookup_destroy (GtkCssLookup *lookup)
|
_gtk_css_lookup_destroy (GtkCssLookup *lookup)
|
||||||
{
|
{
|
||||||
|
_gtk_bitmask_free (lookup->set_values);
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
@@ -41,13 +44,7 @@ _gtk_css_lookup_is_missing (const GtkCssLookup *lookup,
|
|||||||
{
|
{
|
||||||
gtk_internal_return_val_if_fail (lookup != NULL, FALSE);
|
gtk_internal_return_val_if_fail (lookup != NULL, FALSE);
|
||||||
|
|
||||||
return lookup->values[id].value == NULL;
|
return !_gtk_bitmask_get (lookup->set_values, id);
|
||||||
}
|
|
||||||
|
|
||||||
gboolean
|
|
||||||
_gtk_css_lookup_all_set (const GtkCssLookup *lookup)
|
|
||||||
{
|
|
||||||
return lookup->n_set_values == GTK_CSS_PROPERTY_N_PROPERTIES;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -75,41 +72,5 @@ _gtk_css_lookup_set (GtkCssLookup *lookup,
|
|||||||
|
|
||||||
lookup->values[id].value = value;
|
lookup->values[id].value = value;
|
||||||
lookup->values[id].section = section;
|
lookup->values[id].section = section;
|
||||||
lookup->n_set_values ++;
|
lookup->set_values = _gtk_bitmask_set (lookup->set_values, id, TRUE);
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* _gtk_css_lookup_resolve:
|
|
||||||
* @lookup: the lookup
|
|
||||||
* @context: the context the values are resolved for
|
|
||||||
* @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”.
|
|
||||||
*
|
|
||||||
* XXX: This bypasses the notion of “specified value”. If this ever becomes
|
|
||||||
* an issue, go fix it.
|
|
||||||
**/
|
|
||||||
void
|
|
||||||
_gtk_css_lookup_resolve (GtkCssLookup *lookup,
|
|
||||||
GtkStyleProvider *provider,
|
|
||||||
GtkCssStaticStyle *style,
|
|
||||||
GtkCssStyle *parent_style)
|
|
||||||
{
|
|
||||||
guint i;
|
|
||||||
|
|
||||||
gtk_internal_return_if_fail (lookup != NULL);
|
|
||||||
gtk_internal_return_if_fail (GTK_IS_STYLE_PROVIDER (provider));
|
|
||||||
gtk_internal_return_if_fail (GTK_IS_CSS_STATIC_STYLE (style));
|
|
||||||
gtk_internal_return_if_fail (parent_style == NULL || GTK_IS_CSS_STYLE (parent_style));
|
|
||||||
|
|
||||||
for (i = 0; i < GTK_CSS_PROPERTY_N_PROPERTIES; i++)
|
|
||||||
{
|
|
||||||
gtk_css_static_style_compute_value (style,
|
|
||||||
provider,
|
|
||||||
parent_style,
|
|
||||||
i,
|
|
||||||
lookup->values[i].value,
|
|
||||||
lookup->values[i].section);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -36,7 +36,7 @@ typedef struct {
|
|||||||
} GtkCssLookupValue;
|
} GtkCssLookupValue;
|
||||||
|
|
||||||
struct _GtkCssLookup {
|
struct _GtkCssLookup {
|
||||||
guint n_set_values;
|
GtkBitmask *set_values;
|
||||||
GtkCssLookupValue values[GTK_CSS_PROPERTY_N_PROPERTIES];
|
GtkCssLookupValue values[GTK_CSS_PROPERTY_N_PROPERTIES];
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -44,15 +44,16 @@ void _gtk_css_lookup_init (GtkCssLookup
|
|||||||
void _gtk_css_lookup_destroy (GtkCssLookup *lookup);
|
void _gtk_css_lookup_destroy (GtkCssLookup *lookup);
|
||||||
gboolean _gtk_css_lookup_is_missing (const GtkCssLookup *lookup,
|
gboolean _gtk_css_lookup_is_missing (const GtkCssLookup *lookup,
|
||||||
guint id);
|
guint id);
|
||||||
gboolean _gtk_css_lookup_all_set (const GtkCssLookup *lookup);
|
|
||||||
void _gtk_css_lookup_set (GtkCssLookup *lookup,
|
void _gtk_css_lookup_set (GtkCssLookup *lookup,
|
||||||
guint id,
|
guint id,
|
||||||
GtkCssSection *section,
|
GtkCssSection *section,
|
||||||
GtkCssValue *value);
|
GtkCssValue *value);
|
||||||
void _gtk_css_lookup_resolve (GtkCssLookup *lookup,
|
|
||||||
GtkStyleProvider *provider,
|
static inline const GtkBitmask *
|
||||||
GtkCssStaticStyle *style,
|
_gtk_css_lookup_get_set_values (const GtkCssLookup *lookup)
|
||||||
GtkCssStyle *parent_style);
|
{
|
||||||
|
return lookup->set_values;
|
||||||
|
}
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
@@ -489,9 +489,6 @@ gtk_css_style_provider_lookup (GtkStyleProvider *provider,
|
|||||||
ruleset->styles[j].section,
|
ruleset->styles[j].section,
|
||||||
ruleset->styles[j].value);
|
ruleset->styles[j].value);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_gtk_css_lookup_all_set (lookup))
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
g_ptr_array_free (tree_rules, TRUE);
|
g_ptr_array_free (tree_rules, TRUE);
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -34,11 +34,164 @@ G_BEGIN_DECLS
|
|||||||
|
|
||||||
typedef struct _GtkCssStaticStyleClass GtkCssStaticStyleClass;
|
typedef struct _GtkCssStaticStyleClass GtkCssStaticStyleClass;
|
||||||
|
|
||||||
|
/* inherited */
|
||||||
|
typedef struct {
|
||||||
|
int ref_count;
|
||||||
|
GtkCssValue *color;
|
||||||
|
GtkCssValue *dpi;
|
||||||
|
GtkCssValue *font_size;
|
||||||
|
GtkCssValue *icon_theme;
|
||||||
|
GtkCssValue *icon_palette;
|
||||||
|
} GtkCssCoreValues;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int ref_count;
|
||||||
|
GtkCssValue *background_color;
|
||||||
|
GtkCssValue *box_shadow;
|
||||||
|
GtkCssValue *background_clip;
|
||||||
|
GtkCssValue *background_origin;
|
||||||
|
GtkCssValue *background_size;
|
||||||
|
GtkCssValue *background_position;
|
||||||
|
GtkCssValue *background_repeat;
|
||||||
|
GtkCssValue *background_image;
|
||||||
|
GtkCssValue *background_blend_mode;
|
||||||
|
} GtkCssBackgroundValues;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int ref_count;
|
||||||
|
GtkCssValue *border_top_style;
|
||||||
|
GtkCssValue *border_top_width;
|
||||||
|
GtkCssValue *border_left_style;
|
||||||
|
GtkCssValue *border_left_width;
|
||||||
|
GtkCssValue *border_bottom_style;
|
||||||
|
GtkCssValue *border_bottom_width;
|
||||||
|
GtkCssValue *border_right_style;
|
||||||
|
GtkCssValue *border_right_width;
|
||||||
|
GtkCssValue *border_top_left_radius;
|
||||||
|
GtkCssValue *border_top_right_radius;
|
||||||
|
GtkCssValue *border_bottom_right_radius;
|
||||||
|
GtkCssValue *border_bottom_left_radius;
|
||||||
|
GtkCssValue *border_top_color;
|
||||||
|
GtkCssValue *border_right_color;
|
||||||
|
GtkCssValue *border_bottom_color;
|
||||||
|
GtkCssValue *border_left_color;
|
||||||
|
GtkCssValue *border_image_source;
|
||||||
|
GtkCssValue *border_image_repeat;
|
||||||
|
GtkCssValue *border_image_slice;
|
||||||
|
GtkCssValue *border_image_width;
|
||||||
|
} GtkCssBorderValues;
|
||||||
|
|
||||||
|
/* inherited */
|
||||||
|
typedef struct {
|
||||||
|
int ref_count;
|
||||||
|
GtkCssValue *icon_size;
|
||||||
|
GtkCssValue *icon_shadow;
|
||||||
|
GtkCssValue *icon_style;
|
||||||
|
} GtkCssIconValues;
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int ref_count;
|
||||||
|
GtkCssValue *outline_style;
|
||||||
|
GtkCssValue *outline_width;
|
||||||
|
GtkCssValue *outline_offset;
|
||||||
|
GtkCssValue *outline_top_left_radius;
|
||||||
|
GtkCssValue *outline_top_right_radius;
|
||||||
|
GtkCssValue *outline_bottom_right_radius;
|
||||||
|
GtkCssValue *outline_bottom_left_radius;
|
||||||
|
GtkCssValue *outline_color;
|
||||||
|
} GtkCssOutlineValues;
|
||||||
|
|
||||||
|
/* inherited */
|
||||||
|
typedef struct {
|
||||||
|
int ref_count;
|
||||||
|
GtkCssValue *font_family;
|
||||||
|
GtkCssValue *font_style;
|
||||||
|
GtkCssValue *font_weight;
|
||||||
|
GtkCssValue *font_stretch;
|
||||||
|
GtkCssValue *letter_spacing;
|
||||||
|
GtkCssValue *text_shadow;
|
||||||
|
GtkCssValue *caret_color;
|
||||||
|
GtkCssValue *secondary_caret_color;
|
||||||
|
GtkCssValue *font_feature_settings;
|
||||||
|
GtkCssValue *font_variation_settings;
|
||||||
|
} GtkCssFontValues;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int ref_count;
|
||||||
|
GtkCssValue *text_decoration_line;
|
||||||
|
GtkCssValue *text_decoration_color;
|
||||||
|
GtkCssValue *text_decoration_style;
|
||||||
|
GtkCssValue *font_kerning;
|
||||||
|
GtkCssValue *font_variant_ligatures;
|
||||||
|
GtkCssValue *font_variant_position;
|
||||||
|
GtkCssValue *font_variant_caps;
|
||||||
|
GtkCssValue *font_variant_numeric;
|
||||||
|
GtkCssValue *font_variant_alternates;
|
||||||
|
GtkCssValue *font_variant_east_asian;
|
||||||
|
} GtkCssFontVariantValues;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int ref_count;
|
||||||
|
GtkCssValue *animation_name;
|
||||||
|
GtkCssValue *animation_duration;
|
||||||
|
GtkCssValue *animation_timing_function;
|
||||||
|
GtkCssValue *animation_iteration_count;
|
||||||
|
GtkCssValue *animation_direction;
|
||||||
|
GtkCssValue *animation_play_state;
|
||||||
|
GtkCssValue *animation_delay;
|
||||||
|
GtkCssValue *animation_fill_mode;
|
||||||
|
} GtkCssAnimationValues;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int ref_count;
|
||||||
|
GtkCssValue *transition_property;
|
||||||
|
GtkCssValue *transition_duration;
|
||||||
|
GtkCssValue *transition_timing_function;
|
||||||
|
GtkCssValue *transition_delay;
|
||||||
|
} GtkCssTransitionValues;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int ref_count;
|
||||||
|
GtkCssValue *margin_top;
|
||||||
|
GtkCssValue *margin_left;
|
||||||
|
GtkCssValue *margin_bottom;
|
||||||
|
GtkCssValue *margin_right;
|
||||||
|
GtkCssValue *padding_top;
|
||||||
|
GtkCssValue *padding_left;
|
||||||
|
GtkCssValue *padding_bottom;
|
||||||
|
GtkCssValue *padding_right;
|
||||||
|
GtkCssValue *border_spacing;
|
||||||
|
GtkCssValue *min_width;
|
||||||
|
GtkCssValue *min_height;
|
||||||
|
} GtkCssSizeValues;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int ref_count;
|
||||||
|
GtkCssValue *icon_source;
|
||||||
|
GtkCssValue *icon_transform;
|
||||||
|
GtkCssValue *icon_filter;
|
||||||
|
GtkCssValue *transform;
|
||||||
|
GtkCssValue *opacity;
|
||||||
|
GtkCssValue *filter;
|
||||||
|
} GtkCssOtherValues;
|
||||||
|
|
||||||
struct _GtkCssStaticStyle
|
struct _GtkCssStaticStyle
|
||||||
{
|
{
|
||||||
GtkCssStyle parent;
|
GtkCssStyle parent;
|
||||||
|
|
||||||
GtkCssValue *values[GTK_CSS_PROPERTY_N_PROPERTIES]; /* the values */
|
GtkCssCoreValues *core;
|
||||||
|
GtkCssBackgroundValues *background;
|
||||||
|
GtkCssBorderValues *border;
|
||||||
|
GtkCssIconValues *icon;
|
||||||
|
GtkCssOutlineValues *outline;
|
||||||
|
GtkCssFontValues *font;
|
||||||
|
GtkCssFontVariantValues *font_variant;
|
||||||
|
GtkCssAnimationValues *animation;
|
||||||
|
GtkCssTransitionValues *transition;
|
||||||
|
GtkCssSizeValues *size;
|
||||||
|
GtkCssOtherValues *other;
|
||||||
|
|
||||||
GPtrArray *sections; /* sections the values are defined in */
|
GPtrArray *sections; /* sections the values are defined in */
|
||||||
|
|
||||||
GtkCssChange change; /* change as returned by value lookup */
|
GtkCssChange change; /* change as returned by value lookup */
|
||||||
@@ -57,13 +210,6 @@ GtkCssStyle * gtk_css_static_style_new_compute (GtkStyleProvide
|
|||||||
GtkCssStyle *parent,
|
GtkCssStyle *parent,
|
||||||
GtkCssChange change);
|
GtkCssChange change);
|
||||||
|
|
||||||
void gtk_css_static_style_compute_value (GtkCssStaticStyle *style,
|
|
||||||
GtkStyleProvider *provider,
|
|
||||||
GtkCssStyle *parent_style,
|
|
||||||
guint id,
|
|
||||||
GtkCssValue *specified,
|
|
||||||
GtkCssSection *section);
|
|
||||||
|
|
||||||
GtkCssChange gtk_css_static_style_get_change (GtkCssStaticStyle *style);
|
GtkCssChange gtk_css_static_style_get_change (GtkCssStaticStyle *style);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
Reference in New Issue
Block a user