Compare commits

...

64 Commits

Author SHA1 Message Date
Matthias Clasen 31ba72bad2 testsuite: Don't print default styles
This somewhat defeats the point that we want
to verify the regulars styles, not some weird
initial conditions.
2020-01-15 08:06:06 -05:00
Matthias Clasen 911528923f css: Mark the default style in debug dumps
This helps identifying unexpected situations,
since the default style should never be seen
in the wild.
2020-01-15 08:06:06 -05:00
Matthias Clasen 968e21158e css: Don't got to the selector tree for change
The tree is optimized for mimizing the decisions, and
that prevents us from taking advantage of the more exact
superset matching that we can do now. So, instead do what
we used to do for verifiation: use the tree for finding the
superset matches, then just walk the rulesets to collect the
changes.
2020-01-15 08:06:06 -05:00
Matthias Clasen d0f75d9231 css: Avoid computing change too often
Most of the time when styles need to be recreated,
the name and classes of the css node haven't changed.
In this case, the change value will not either, since
we are computing change under the assumption that
name and classes are unchanged, so there is no need
to recompute the change.
2020-01-15 08:06:06 -05:00
Matthias Clasen d3d5a03da5 Make the superset matcher more exact
When the superset matcher is built from a node matcher,
we can make the parent or previous matchers be superset
matchers for the corresponding node, with the same
relevant parts. This is more precise than the any matcher
that we were returning previously.
2020-01-15 08:06:06 -05:00
Matthias Clasen 133e39d807 Allow printing css matchers
This can help in debugging css matching.
2020-01-15 02:10:30 -05:00
Matthias Clasen e94fc900b5 cssmatcher: Add a type enum
For now, this just replaces the is_any boolean
by a type field in the class, and does away with
the unused Superset struct.supserset matcher fixup
2020-01-15 02:10:04 -05:00
Matthias Clasen cd25da9d1a Add selector statistics to the debug output 2020-01-14 22:26:11 -05:00
Matthias Clasen e1c2aeaccb css: Drop unsused bitmasks
GtkCssProvider was maintaining bitmasks for the
set properties in each ruleset. The masks are never
used, so drop them.
2020-01-14 21:43:23 -05:00
Matthias Clasen 8b2f5ddecc css: Remove an unused function
_gtk_css_style_property_get_mask_affecting was superseded
by GtkCssStyleChange back in 2015.
2020-01-14 21:43:23 -05:00
Matthias Clasen 0813d787b6 cssstyle: Try harder to skip initial values
Compare values against the computed value of their
properties initial value. This works for fine for
all expect the border-width properties, whose special
handling defeats this.
2020-01-14 21:43:23 -05:00
Matthias Clasen 0edd7ca7ad css: Don't return nonsense when comparing values
Comparing icon theme values for equality is not
very important, but an equal() implementation that
always returns FALSE is nonsense.
2020-01-14 21:43:23 -05:00
Matthias Clasen 55dbc5c4ab testsuite: Update expected output for css style tests
These now include the change values.
2020-01-14 21:43:23 -05:00
Matthias Clasen 5b19617e9a testsuite: Improve --generate support
We don't want annoying spew from GTest when
using --generate, since it interferes with just
piping the output to a text file.
2020-01-14 21:43:23 -05:00
Matthias Clasen 004b5aad72 testsuite: Include change in css style tests
This will help debugging css change tracking.
2020-01-14 21:43:23 -05:00
Matthias Clasen b930aa8bf5 Add a way to dump css node change values
Add a GTK_STYLE_CONTEXT_PRINT_SHOW_CHANGE flag that
tells gtk_style_context_to_string to include the
change values of nodes in the output. This will
help debugging css change tracking.
2020-01-14 21:43:23 -05:00
Matthias Clasen e1d6f05061 inspector: Show change in the css node tree
This is useful for debugging why we update to damn much
css on enter/leave.
2020-01-14 21:43:23 -05:00
Matthias Clasen 2b7715a0aa Revert "wip: reimplement css matching from scratch"
This reverts commit 7047a2e9c6f32da068bbfef78c6a4bda2d7d39f2.
2020-01-14 21:43:23 -05:00
Matthias Clasen d72bebf187 wip: reimplement css matching from scratch
First step: Strip out all optimizations.
2020-01-14 21:43:23 -05:00
Matthias Clasen 6be4347558 quiet a compiler warning in release builds 2020-01-14 21:43:23 -05:00
Matthias Clasen 24a0f83194 Add some css style tests
These are meant to test selectors.
2020-01-14 21:43:23 -05:00
Matthias Clasen 3e9960e06f css: Add gtk_css_style_get_static_style
This lets us avoid poking directly at the GtkCssAnimatedStyle
struct in gtkcssnode.c.
2020-01-14 21:43:23 -05:00
Matthias Clasen 4cf2b87654 Speed up gtk_widget_pick
Add early exits, and avoid as much work as
possible.
2020-01-14 21:43:23 -05:00
Matthias Clasen a5dc2caa13 Revert "css: Faster matching for simple selectors"
This reverts commit 05f7d68e29.
2020-01-14 16:59:27 -05:00
Matthias Clasen 05f7d68e29 css: Faster matching for simple selectors
Inline simple selectors for node matchers.
A bit ugly, but works.
2020-01-14 15:47:30 -05:00
Matthias Clasen e9eacdeded css: Implement the superset matcher smarter
Instead of wrapping the individual vfuncs, and having
a branch in the inner loop, rewrite the matcher class.
2020-01-14 15:47:30 -05:00
Matthias Clasen 616c0ab8c5 css: Compute selector tree changes ahead of time
These only depend on the selector tree, so we can
compute them while constructing the tree.
2020-01-14 15:47:30 -05:00
Matthias Clasen 792130437e css: Handle initial values more efficiently
Instead of creating a new values every time we
resolve the initial values for dpi and font family,
keep a css value around for the settings.
2020-01-14 15:47:30 -05:00
Matthias Clasen 0afa486d41 css: Mark transform value as computed
This is not very useful, since transitions generate
a ton of transforms anyway.
2020-01-14 15:47:30 -05:00
Matthias Clasen 6e5f56684d css: Simplify default values
We no longer need to create one-element arrays or
corners with two identical values.
2020-01-14 15:47:30 -05:00
Matthias Clasen 52c7a3672e css: Re-add a lost special case
When the border-style special cases were moved in
c687f485fd, the one for outline-width was lost.

Make the code more compact, and bring the special
case back.
2020-01-14 15:47:30 -05:00
Timm Bäder cfc7540c3b gl renderer: Render simple border nodes in a simple way
Roughly 80% of the border nodes are just one color and have the same
width on all sides, so we can draw them by uploading just one rect and
not four.
2020-01-14 17:32:59 +01:00
Timm Bäder 0d15eb7d01 numbervalue: Add early-out to multiply()
If the factor is 1, we already know what the result is going to be.
2020-01-14 17:32:59 +01:00
Timm Bäder 6d4cecb0c6 cssnumbervalue: Move early-out code to GtkCssValue
These checks make sense for all css values.
2020-01-14 17:32:59 +01:00
Timm Bäder ada5ff8a91 cssdimensionvalue: Implement transition()
Instead of falling back to the generic gtk_css_number_value_transition
(which can allocate multiple new css values), just implement this here.
2020-01-14 17:32:59 +01:00
Timm Bäder 940910770a testsuite: Remove an invalid test case 2020-01-14 17:32:59 +01:00
Timm Bäder 3a2d6c58ba Remove GtkCssShadowsValue
Previously, we wrapped all GtkCssShadowValues in a GtkCssShadowsValue,
even if it was just one shadow.
2020-01-14 17:32:55 +01:00
Timm Bäder bac51a05db cssshadowvalue: Only create 2 shadows values for transitions
This is for cases where we want to transition from "no shadow" to
"shadow", which we need quite a lot.
2020-01-14 15:28:19 +01:00
Timm Bäder 9d3704c62a cssdimensionvalue: Allow transitioning between different units...
... as long as one of the two values is 0.
2020-01-14 15:28:17 +01:00
Timm Bäder 5cdeca2e25 cssvalue: Improve css value accounting output
And make it fully optional behind an #ifdef.
2020-01-14 15:28:15 +01:00
Timm Bäder d3ad97073b csscolorvalue: check for singletons in new_literal
Gets rid of another ~400 GtkCssValue instances in the widget-factory.
2020-01-12 15:53:26 +01:00
Timm Bäder c2e680f4f0 cssimage: Add is_computed vfunc
Same semantics as the is_computed field of GtkCssValue
2020-01-11 17:17:27 +01:00
Timm Bäder ab868a3207 css: Set the is_computed flag for more values
With these changes, we skip roughly 85% of compute() calls during
widget-factory startup
2020-01-11 17:17:27 +01:00
Timm Bäder ab78c19236 cssvalue: Don't call compute() for already computed css values
As per the previous commit, this is unnecessary.

Even with the small amount of css values we mark as is_computed, we
already skip computing over 60% of them like this during the startup of
the widget factory.
2020-01-11 17:17:27 +01:00
Timm Bäder a3a71c149e cssvalue: Add is_computed flag
When a css value has "child" css values (e.g. a linear gradient has
several color stop css values) which are all computed (won't change when
compute() is called on them), we want to skip computing the entire
subtree.

Since css values are immutable, we can set the is_computed flag at
construct time.

Since GtkCssValue instances are 0-initialized in _gtk_css_value_alloc,
the default for is_computed it FALSE. This commit only sets it to TRUE
in a few cases, such as various "none" singleton values which will never
change. Later commits will refine this and set it for more values.
2020-01-11 17:17:27 +01:00
Timm Bäder 6b6f0856f0 testsuite: Update css color output 2020-01-11 17:17:27 +01:00
Timm Bäder c687f485fd css: Move border-width special cases out of GtkCssDimensionValue
Move them to style computation instead, so we don't have them in such a
generic place.
2020-01-11 17:17:25 +01:00
Timm Bäder a5b2ac73c8 csscolorvalue: Don't copy rgbas when applying function
We get const pointers to the colors, so just use those and unref the
values later.
2020-01-11 12:49:00 +01:00
Timm Bäder b544f7c6bb gl renderer: Look at shadow color in the outset shadow cache
It would probably be better to not do this and always render the outline
in plain white, then later recolor it but do this for no, just for
correctness.
2020-01-11 12:49:00 +01:00
Timm Bäder a10c5b74a1 cssimageradial: Avoid computing a new image if it didn't change 2020-01-11 12:49:00 +01:00
Timm Bäder 8af3a86dda cssimageradial: Use array + length instead of GArray
This makes sense since we're not going to change the (amount of) colors
after parsing.
2020-01-11 12:49:00 +01:00
Timm Bäder 11a78a0736 cssimagelinear: Don't compute new image if it didn't change 2020-01-11 12:49:00 +01:00
Timm Bäder b7d9ec73ec cssimagelinear: Use count+array for the color stops, not GArray
This makse sense but will also make later changes to GtkCssImageLinear
simpler.
2020-01-11 12:48:59 +01:00
Timm Bäder c1a5221941 cssimagefallback: Don't compute new image if only a color is set
Themes might use e.g. image(red), which is a constant value and will
never change. In that case, the fallback image has ->color set, but not
->images. If that's the case and the computed color is the same as
the one we already have, just return the already existing image.
2020-01-11 12:48:59 +01:00
Timm Bäder 7b40541889 Remove GtkCssRgbaValue
The differenciation between a literal color value and an RGBA value
caused problems in various situations. Just treat the two the same but
don't allow access to the rgba value of a non-literal color value.

This gets rid of around 1.6k rgba values in the widget-factory.
2020-01-11 12:48:59 +01:00
Matthias Clasen 2b9e5bdb4b dump css value stats 2020-01-11 12:48:59 +01:00
Timm Bäder 439238c502 csssshadwovalue: Remove unused function prototype 2020-01-11 12:48:59 +01:00
Timm Bäder e90c499f2c cssnumbervalue: Add early-outs to transition code
we don't need to do the calculation at all if the progress is 0 or 1
anyway.

We also sometimes transition from 0 to 0 etc., so we can short-circuit
that as well by doing the fast pointer-equality check and relying on the
singletons.
2020-01-11 12:48:59 +01:00
Timm Bäder a3a31d229b csscornervalue: Accept other values if x == y
Most corners are square, so x == y. In that case, just accept either of
them. This makes the corner value unnecessary.

In fact none of the corner values in the widget-factory are needed, so
this spares us around 500 corner value allocations.

css value stats before:

GtkCssBgSizeValue: 23
GtkCssIdentValue: 25
GtkCssPositionValue: 81
GtkCssCornerValue: 556
GtkCssArrayValue: 143
GtkCssStringValue: 33
GtkCssPaletteValue: 29
GtkCssImageValue: 2765
GtkCssColorValue: 1452
GtkCssFilterValue: 3
GtkCssRgbaValue: 1092
GtkCssShadowValue: 708
GtkCssEaseValue: 33
GtkCssBorderValue: 2
GtkCssTransformValue: 11
GtkCssDimensionValue: 882
GtkCssShadowsValue: 584
SUM: 8428

and after:

GtkCssColorValue: 1452
GtkCssFilterValue: 3
GtkCssRgbaValue: 1092
GtkCssShadowValue: 708
GtkCssEaseValue: 33
GtkCssBorderValue: 2
GtkCssTransformValue: 11
GtkCssDimensionValue: 882
GtkCssShadowsValue: 584
GtkCssBgSizeValue: 23
GtkCssIdentValue: 25
GtkCssPositionValue: 81
GtkCssArrayValue: 143
GtkCssStringValue: 33
GtkCssPaletteValue: 29
GtkCssImageValue: 2765
SUM: 7872

8428 to 7872 is a 556 reduction (6.5%)

asdf
2020-01-11 12:48:59 +01:00
Timm Bäder 65344cc3cf cssarrayvalue: Don't allocate memory when parsing array values
We probably won't find CSS with more than 128 values in array.
2020-01-11 12:48:55 +01:00
Timm Bäder a26c615305 cssarrayvalue: Allow calling array API on non-arrays
Just allow calling _get_nth() and _get_n_values() on every kind of css
value. This way we can allow all values in places where only array
values would be allowed before.

This spares us around 1000 array values in the widget factory.

css value stats before:

GtkCssFilterValue: 3
GtkCssRgbaValue: 1092
GtkCssShadowValue: 708
GtkCssEaseValue: 33
GtkCssBorderValue: 2
GtkCssTransformValue: 11
GtkCssDimensionValue: 882
GtkCssShadowsValue: 584
GtkCssBgSizeValue: 23
GtkCssIdentValue: 25
GtkCssPositionValue: 81
GtkCssCornerValue: 556
GtkCssArrayValue: 1130
GtkCssStringValue: 33
GtkCssPaletteValue: 29
GtkCssImageValue: 2765
GtkCssColorValue: 1452
SUM: 9415

and after:

GtkCssBgSizeValue: 23
GtkCssIdentValue: 25
GtkCssPositionValue: 81
GtkCssCornerValue: 556
GtkCssArrayValue: 143
GtkCssStringValue: 33
GtkCssPaletteValue: 29
GtkCssImageValue: 2765
GtkCssColorValue: 1452
GtkCssFilterValue: 3
GtkCssRgbaValue: 1092
GtkCssShadowValue: 708
GtkCssEaseValue: 33
GtkCssBorderValue: 2
GtkCssTransformValue: 11
GtkCssDimensionValue: 882
GtkCssShadowsValue: 584
SUM: 8428

9415 to 8428 is a 987 reduction (10.4%)
2020-01-11 08:09:17 +01:00
Timm Bäder 37a559ffe5 cssvalue: Add type names for all classes
This is important to have for debugging and e.g. to print statistics for
the individual css value types
2020-01-11 08:09:17 +01:00
Timm Bäder 5a12448f9a csscolorvalue: Compute alpha/shade/mix of color literals directly
The values of these are never gonna change so we can as well create
literal color values from the resulting colors instead.
2020-01-11 08:09:17 +01:00
Timm Bäder 6b19f493ab csscolorvalue: Don't resolve literal color values 2020-01-11 08:09:16 +01:00
100 changed files with 2670 additions and 1888 deletions
+24 -1
View File
@@ -761,6 +761,26 @@ render_border_node (GskGLRenderer *self,
float h;
} sizes[4];
if (og_widths[0] == og_widths[1] &&
og_widths[0] == og_widths[2] &&
og_widths[0] == og_widths[3] &&
gdk_rgba_equal (&colors[0], &colors[1]) &&
gdk_rgba_equal (&colors[0], &colors[2]) &&
gdk_rgba_equal (&colors[0], &colors[3]))
{
OpShadow *op;
ops_set_program (builder, &self->inset_shadow_program);
op = ops_begin (builder, OP_CHANGE_INSET_SHADOW);
op->color = &colors[0];
op->outline = transform_rect (self, builder, rounded_outline);
op->spread = og_widths[0] * scale;
op->offset[0] = 0;
op->offset[1] = 0;
load_vertex_data (ops_draw (builder, NULL), node, builder);
return;
}
for (i = 0; i < 4; i ++)
widths[i] = og_widths[i];
@@ -1652,6 +1672,7 @@ render_outset_shadow_node (GskGLRenderer *self,
{
const float scale = ops_get_scale (builder);
const GskRoundedRect *outline = gsk_outset_shadow_node_peek_outline (node);
const GdkRGBA *color = gsk_outset_shadow_node_peek_color (node);
const float blur_radius = gsk_outset_shadow_node_get_blur_radius (node);
const float blur_extra = blur_radius * 3; /* 3 Because we use that in the shader as well */
const float spread = gsk_outset_shadow_node_get_spread (node);
@@ -1696,6 +1717,7 @@ render_outset_shadow_node (GskGLRenderer *self,
cached_tid = gsk_gl_shadow_cache_get_texture_id (&self->shadow_cache,
self->gl_driver,
&scaled_outline,
color,
blur_radius);
if (cached_tid == 0)
@@ -1727,7 +1749,7 @@ render_outset_shadow_node (GskGLRenderer *self,
/* Draw outline */
ops_set_program (builder, &self->color_program);
ops_push_clip (builder, &scaled_outline);
ops_set_color (builder, gsk_outset_shadow_node_peek_color (node));
ops_set_color (builder, color);
ops_draw (builder, (GskQuadVertex[GL_N_VERTICES]) {
{ { 0, }, { 0, 1 }, },
{ { 0, texture_height }, { 0, 0 }, },
@@ -1754,6 +1776,7 @@ render_outset_shadow_node (GskGLRenderer *self,
gsk_gl_driver_mark_texture_permanent (self->gl_driver, blurred_texture_id);
gsk_gl_shadow_cache_commit (&self->shadow_cache,
&scaled_outline,
color,
blur_radius,
blurred_texture_id);
}
+10 -4
View File
@@ -7,12 +7,14 @@ typedef struct
{
GskRoundedRect outline;
float blur_radius;
GdkRGBA color;
} CacheKey;
typedef struct
{
GskRoundedRect outline;
float blur_radius;
GdkRGBA color;
int texture_id;
int unused_frames;
@@ -25,12 +27,13 @@ key_equal (const void *x,
const CacheKey *a = x;
const CacheKey *b = y;
return graphene_size_equal (&a->outline.corner[0], &b->outline.corner[0]) &&
return a->blur_radius == b->blur_radius &&
graphene_size_equal (&a->outline.corner[0], &b->outline.corner[0]) &&
graphene_size_equal (&a->outline.corner[1], &b->outline.corner[1]) &&
graphene_size_equal (&a->outline.corner[2], &b->outline.corner[2]) &&
graphene_size_equal (&a->outline.corner[3], &b->outline.corner[3]) &&
graphene_rect_equal (&a->outline.bounds, &b->outline.bounds) &&
a->blur_radius == b->blur_radius;
gdk_rgba_equal (&a->color, &b->color);
}
void
@@ -88,6 +91,7 @@ int
gsk_gl_shadow_cache_get_texture_id (GskGLShadowCache *self,
GskGLDriver *gl_driver,
const GskRoundedRect *shadow_rect,
const GdkRGBA *color,
float blur_radius)
{
CacheItem *item= NULL;
@@ -101,8 +105,8 @@ gsk_gl_shadow_cache_get_texture_id (GskGLShadowCache *self,
{
CacheItem *k = &g_array_index (self->textures, CacheItem, i);
if (key_equal (&(CacheKey){*shadow_rect, blur_radius},
&(CacheKey){k->outline, k->blur_radius}))
if (key_equal (&(CacheKey){*shadow_rect, blur_radius, *color},
&(CacheKey){k->outline, k->blur_radius, k->color}))
{
item = k;
break;
@@ -122,6 +126,7 @@ gsk_gl_shadow_cache_get_texture_id (GskGLShadowCache *self,
void
gsk_gl_shadow_cache_commit (GskGLShadowCache *self,
const GskRoundedRect *shadow_rect,
const GdkRGBA *color,
float blur_radius,
int texture_id)
{
@@ -135,6 +140,7 @@ gsk_gl_shadow_cache_commit (GskGLShadowCache *self,
item = &g_array_index (self->textures, CacheItem, self->textures->len - 1);
item->outline = *shadow_rect;
item->color = *color;
item->blur_radius = blur_radius;
item->unused_frames = 0;
item->texture_id = texture_id;
+2
View File
@@ -21,9 +21,11 @@ void gsk_gl_shadow_cache_begin_frame (GskGLShadowCache *self,
int gsk_gl_shadow_cache_get_texture_id (GskGLShadowCache *self,
GskGLDriver *gl_driver,
const GskRoundedRect *shadow_rect,
const GdkRGBA *color,
float blur_radius);
void gsk_gl_shadow_cache_commit (GskGLShadowCache *self,
const GskRoundedRect *shadow_rect,
const GdkRGBA *color,
float blur_radius,
int texture_id);
+10
View File
@@ -79,6 +79,15 @@ gtk_css_animated_style_is_static (GtkCssStyle *style)
return TRUE;
}
static GtkCssStyle *
gtk_css_animated_style_get_static_style (GtkCssStyle *style)
{
/* This is called a lot, so we avoid a dynamic type check here */
GtkCssAnimatedStyle *animated = (GtkCssAnimatedStyle *) style;
return animated->style;
}
static void
gtk_css_animated_style_dispose (GObject *object)
{
@@ -123,6 +132,7 @@ gtk_css_animated_style_class_init (GtkCssAnimatedStyleClass *klass)
style_class->get_value = gtk_css_animated_style_get_value;
style_class->get_section = gtk_css_animated_style_get_section;
style_class->is_static = gtk_css_animated_style_is_static;
style_class->get_static_style = gtk_css_animated_style_get_static_style;
}
static void
+37 -13
View File
@@ -369,6 +369,7 @@ gtk_css_value_array_print (const GtkCssValue *value,
}
static const GtkCssValueClass GTK_CSS_VALUE_ARRAY = {
"GtkCssArrayValue",
gtk_css_value_array_free,
gtk_css_value_array_compute,
gtk_css_value_array_equal,
@@ -391,14 +392,28 @@ _gtk_css_array_value_new_from_array (GtkCssValue **values,
guint n_values)
{
GtkCssValue *result;
guint i;
g_return_val_if_fail (values != NULL, NULL);
g_return_val_if_fail (n_values > 0, NULL);
if (n_values == 1)
return values[0];
result = _gtk_css_value_alloc (&GTK_CSS_VALUE_ARRAY, sizeof (GtkCssValue) + sizeof (GtkCssValue *) * (n_values - 1));
result->n_values = n_values;
memcpy (&result->values[0], values, sizeof (GtkCssValue *) * n_values);
result->is_computed = TRUE;
for (i = 0; i < n_values; i ++)
{
if (!gtk_css_value_is_computed (values[i]))
{
result->is_computed = FALSE;
break;
}
}
return result;
}
@@ -407,32 +422,38 @@ _gtk_css_array_value_parse (GtkCssParser *parser,
GtkCssValue *(* parse_func) (GtkCssParser *parser))
{
GtkCssValue *value, *result;
GPtrArray *values;
values = g_ptr_array_new ();
GtkCssValue *values[128];
guint n_values = 0;
guint i;
do {
value = parse_func (parser);
if (value == NULL)
{
g_ptr_array_set_free_func (values, (GDestroyNotify) _gtk_css_value_unref);
g_ptr_array_free (values, TRUE);
for (i = 0; i < n_values; i ++)
_gtk_css_value_unref (values[i]);
return NULL;
}
g_ptr_array_add (values, value);
values[n_values] = value;
n_values ++;
if (G_UNLIKELY (n_values > G_N_ELEMENTS (values)))
g_error ("Only %d elements in a css array are allowed", (int)G_N_ELEMENTS (values));
} while (gtk_css_parser_try_token (parser, GTK_CSS_TOKEN_COMMA));
result = _gtk_css_array_value_new_from_array ((GtkCssValue **) values->pdata, values->len);
g_ptr_array_free (values, TRUE);
result = _gtk_css_array_value_new_from_array (values, n_values);
return result;
}
GtkCssValue *
_gtk_css_array_value_get_nth (const GtkCssValue *value,
guint i)
_gtk_css_array_value_get_nth (GtkCssValue *value,
guint i)
{
if (value->class != &GTK_CSS_VALUE_ARRAY)
return value;
g_return_val_if_fail (value != NULL, NULL);
g_return_val_if_fail (value->class == &GTK_CSS_VALUE_ARRAY, NULL);
g_return_val_if_fail (value->n_values > 0, NULL);
@@ -443,6 +464,9 @@ _gtk_css_array_value_get_nth (const GtkCssValue *value,
guint
_gtk_css_array_value_get_n_values (const GtkCssValue *value)
{
if (value->class != &GTK_CSS_VALUE_ARRAY)
return 1;
g_return_val_if_fail (value != NULL, 0);
g_return_val_if_fail (value->class == &GTK_CSS_VALUE_ARRAY, 0);
+1 -1
View File
@@ -32,7 +32,7 @@ GtkCssValue * _gtk_css_array_value_new_from_array (GtkCssValue **
GtkCssValue * _gtk_css_array_value_parse (GtkCssParser *parser,
GtkCssValue * (* parse_func) (GtkCssParser *));
GtkCssValue * _gtk_css_array_value_get_nth (const GtkCssValue *value,
GtkCssValue * _gtk_css_array_value_get_nth (GtkCssValue *value,
guint i);
guint _gtk_css_array_value_get_n_values (const GtkCssValue *value);
+6 -3
View File
@@ -153,6 +153,7 @@ gtk_css_value_bg_size_print (const GtkCssValue *value,
}
static const GtkCssValueClass GTK_CSS_VALUE_BG_SIZE = {
"GtkCssBgSizeValue",
gtk_css_value_bg_size_free,
gtk_css_value_bg_size_compute,
gtk_css_value_bg_size_equal,
@@ -162,9 +163,9 @@ static const GtkCssValueClass GTK_CSS_VALUE_BG_SIZE = {
gtk_css_value_bg_size_print
};
static GtkCssValue auto_singleton = { &GTK_CSS_VALUE_BG_SIZE, 1, FALSE, FALSE, NULL, NULL };
static GtkCssValue cover_singleton = { &GTK_CSS_VALUE_BG_SIZE, 1, TRUE, FALSE, NULL, NULL };
static GtkCssValue contain_singleton = { &GTK_CSS_VALUE_BG_SIZE, 1, FALSE, TRUE, NULL, NULL };
static GtkCssValue auto_singleton = { &GTK_CSS_VALUE_BG_SIZE, 1, TRUE, FALSE, FALSE, NULL, NULL };
static GtkCssValue cover_singleton = { &GTK_CSS_VALUE_BG_SIZE, 1, TRUE, TRUE, FALSE, NULL, NULL };
static GtkCssValue contain_singleton = { &GTK_CSS_VALUE_BG_SIZE, 1, TRUE, FALSE, TRUE, NULL, NULL };
GtkCssValue *
_gtk_css_bg_size_value_new (GtkCssValue *x,
@@ -178,6 +179,8 @@ _gtk_css_bg_size_value_new (GtkCssValue *x,
result = _gtk_css_value_new (GtkCssValue, &GTK_CSS_VALUE_BG_SIZE);
result->x = x;
result->y = y;
result->is_computed = (!x || gtk_css_value_is_computed (x)) &&
(!y || gtk_css_value_is_computed (y));
return result;
}
+13
View File
@@ -140,6 +140,7 @@ gtk_css_value_border_print (const GtkCssValue *value,
}
static const GtkCssValueClass GTK_CSS_VALUE_BORDER = {
"GtkCssBorderValue",
gtk_css_value_border_free,
gtk_css_value_border_compute,
gtk_css_value_border_equal,
@@ -162,6 +163,10 @@ _gtk_css_border_value_new (GtkCssValue *top,
result->values[GTK_CSS_RIGHT] = right;
result->values[GTK_CSS_BOTTOM] = bottom;
result->values[GTK_CSS_LEFT] = left;
result->is_computed = (top && gtk_css_value_is_computed (top)) &&
(right && gtk_css_value_is_computed (right)) &&
(bottom && gtk_css_value_is_computed (bottom)) &&
(left && gtk_css_value_is_computed (left));
return result;
}
@@ -212,6 +217,14 @@ _gtk_css_border_value_parse (GtkCssParser *parser,
result->values[i] = _gtk_css_value_ref (result->values[(i - 1) >> 1]);
}
result->is_computed = TRUE;
for (; i < 4; i++)
if (result->values[i] && !gtk_css_value_is_computed (result->values[i]))
{
result->is_computed = FALSE;
break;
}
return result;
}
+3 -2
View File
@@ -211,8 +211,8 @@ gtk_css_value_calc_has_percent (const GtkCssValue *value)
}
static GtkCssValue *
gtk_css_value_calc_multiply (const GtkCssValue *value,
double factor)
gtk_css_value_calc_multiply (GtkCssValue *value,
double factor)
{
GtkCssValue *result;
gsize i;
@@ -245,6 +245,7 @@ gtk_css_value_calc_get_calc_term_order (const GtkCssValue *value)
static const GtkCssNumberValueClass GTK_CSS_VALUE_CALC = {
{
"GtkCssCalcValue",
gtk_css_value_calc_free,
gtk_css_value_calc_compute,
gtk_css_value_calc_equal,
+179 -55
View File
@@ -19,7 +19,6 @@
#include "gtkcsscolorvalueprivate.h"
#include "gtkcssrgbavalueprivate.h"
#include "gtkcssstylepropertyprivate.h"
#include "gtkhslaprivate.h"
#include "gtkprivate.h"
@@ -45,6 +44,7 @@ struct _GtkCssValue
union
{
gchar *name;
GdkRGBA rgba;
struct
{
@@ -104,7 +104,7 @@ gtk_css_value_color_get_fallback (guint property_id,
case GTK_CSS_PROPERTY_TEXT_SHADOW:
case GTK_CSS_PROPERTY_ICON_SHADOW:
case GTK_CSS_PROPERTY_BOX_SHADOW:
return _gtk_css_rgba_value_new_transparent ();
return gtk_css_color_value_new_transparent ();
case GTK_CSS_PROPERTY_COLOR:
case GTK_CSS_PROPERTY_BACKGROUND_COLOR:
case GTK_CSS_PROPERTY_BORDER_TOP_COLOR:
@@ -125,7 +125,7 @@ gtk_css_value_color_get_fallback (guint property_id,
if (property_id < GTK_CSS_PROPERTY_N_PROPERTIES)
g_warning ("No fallback color defined for property '%s'",
_gtk_style_property_get_name (GTK_STYLE_PROPERTY (_gtk_css_style_property_lookup_by_id (property_id))));
return _gtk_css_rgba_value_new_transparent ();
return gtk_css_color_value_new_transparent ();
}
}
@@ -136,7 +136,7 @@ gtk_css_value_color_compute (GtkCssValue *value,
GtkCssStyle *style,
GtkCssStyle *parent_style)
{
GtkCssValue *resolved, *current;
GtkCssValue *resolved;
/* The computed value of the currentColor keyword is the computed
* value of the color property. If the currentColor keyword is
@@ -144,20 +144,31 @@ gtk_css_value_color_compute (GtkCssValue *value,
*/
if (property_id == GTK_CSS_PROPERTY_COLOR)
{
GtkCssValue *current;
if (parent_style)
current = gtk_css_style_get_value (parent_style, GTK_CSS_PROPERTY_COLOR);
else
current = NULL;
resolved = _gtk_css_color_value_resolve (value,
provider,
current,
NULL);
}
else if (value->type == COLOR_TYPE_LITERAL)
{
resolved = _gtk_css_value_ref (value);
}
else
{
current = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_COLOR);
GtkCssValue *current = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_COLOR);
resolved = _gtk_css_color_value_resolve (value,
provider,
current,
NULL);
}
resolved = _gtk_css_color_value_resolve (value,
provider,
current,
NULL);
if (resolved == NULL)
return gtk_css_value_color_get_fallback (property_id, provider, style, parent_style);
@@ -175,7 +186,7 @@ gtk_css_value_color_equal (const GtkCssValue *value1,
switch (value1->type)
{
case COLOR_TYPE_LITERAL:
return _gtk_css_value_equal (value1->last_value, value2->last_value);
return gdk_rgba_equal (&value1->sym_col.rgba, &value2->sym_col.rgba);
case COLOR_TYPE_NAME:
return g_str_equal (value1->sym_col.name, value2->sym_col.name);
case COLOR_TYPE_SHADE:
@@ -216,7 +227,11 @@ gtk_css_value_color_print (const GtkCssValue *value,
switch (value->type)
{
case COLOR_TYPE_LITERAL:
_gtk_css_value_print (value->last_value, string);
{
char *s = gdk_rgba_to_string (&value->sym_col.rgba);
g_string_append (string, s);
g_free (s);
}
break;
case COLOR_TYPE_NAME:
g_string_append (string, "@");
@@ -269,6 +284,7 @@ gtk_css_value_color_print (const GtkCssValue *value,
}
static const GtkCssValueClass GTK_CSS_VALUE_COLOR = {
"GtkCssColorValue",
gtk_css_value_color_free,
gtk_css_value_color_compute,
gtk_css_value_color_equal,
@@ -278,6 +294,57 @@ static const GtkCssValueClass GTK_CSS_VALUE_COLOR = {
gtk_css_value_color_print
};
static void
apply_alpha (const GdkRGBA *in,
GdkRGBA *out,
double factor)
{
*out = *in;
out->alpha = CLAMP (in->alpha * factor, 0, 1);
}
static void
apply_shade (const GdkRGBA *in,
GdkRGBA *out,
double factor)
{
GtkHSLA hsla;
_gtk_hsla_init_from_rgba (&hsla, in);
_gtk_hsla_shade (&hsla, &hsla, factor);
_gdk_rgba_init_from_hsla (out, &hsla);
}
static inline double
transition (double start,
double end,
double progress)
{
return start + (end - start) * progress;
}
static void
apply_mix (const GdkRGBA *in1,
const GdkRGBA *in2,
GdkRGBA *out,
double factor)
{
out->alpha = CLAMP (transition (in1->alpha, in2->alpha, factor), 0, 1);
if (out->alpha <= 0.0)
{
out->red = out->green = out->blue = 0.0;
}
else
{
out->red = CLAMP (transition (in1->red * in1->alpha, in2->red * in2->alpha, factor), 0, 1) / out->alpha;
out->green = CLAMP (transition (in1->green * in1->alpha, in2->green * in2->alpha, factor), 0, 1) / out->alpha;
out->blue = CLAMP (transition (in1->blue * in1->alpha, in2->blue * in2->alpha, factor), 0, 1) / out->alpha;
}
}
GtkCssValue *
_gtk_css_color_value_resolve (GtkCssValue *color,
GtkStyleProvider *provider,
@@ -291,7 +358,7 @@ _gtk_css_color_value_resolve (GtkCssValue *color,
switch (color->type)
{
case COLOR_TYPE_LITERAL:
return _gtk_css_value_ref (color->last_value);
return _gtk_css_value_ref (color);
case COLOR_TYPE_NAME:
{
GtkCssValue *named;
@@ -314,66 +381,61 @@ _gtk_css_color_value_resolve (GtkCssValue *color,
break;
case COLOR_TYPE_SHADE:
{
GtkCssValue *val;
GtkHSLA hsla;
GdkRGBA shade;
const GdkRGBA *c;
GtkCssValue *val;
GdkRGBA shade;
val = _gtk_css_color_value_resolve (color->sym_col.shade.color, provider, current, cycle_list);
if (val == NULL)
return NULL;
val = _gtk_css_color_value_resolve (color->sym_col.shade.color, provider, current, cycle_list);
if (val == NULL)
return NULL;
c = gtk_css_color_value_get_rgba (val);
_gtk_hsla_init_from_rgba (&hsla, _gtk_css_rgba_value_get_rgba (val));
_gtk_hsla_shade (&hsla, &hsla, color->sym_col.shade.factor);
apply_shade (c, &shade, color->sym_col.shade.factor);
_gdk_rgba_init_from_hsla (&shade, &hsla);
_gtk_css_value_unref (val);
value = _gtk_css_rgba_value_new_from_rgba (&shade);
value = _gtk_css_color_value_new_literal (&shade);
_gtk_css_value_unref (val);
}
break;
case COLOR_TYPE_ALPHA:
{
GtkCssValue *val;
GdkRGBA alpha;
const GdkRGBA *c;
GtkCssValue *val;
GdkRGBA alpha;
val = _gtk_css_color_value_resolve (color->sym_col.alpha.color, provider, current, cycle_list);
if (val == NULL)
return NULL;
val = _gtk_css_color_value_resolve (color->sym_col.alpha.color, provider, current, cycle_list);
if (val == NULL)
return NULL;
c = gtk_css_color_value_get_rgba (val);
alpha = *_gtk_css_rgba_value_get_rgba (val);
alpha.alpha = CLAMP (alpha.alpha * color->sym_col.alpha.factor, 0, 1);
apply_alpha (c, &alpha, color->sym_col.alpha.factor);
_gtk_css_value_unref (val);
value = _gtk_css_rgba_value_new_from_rgba (&alpha);
value = _gtk_css_color_value_new_literal (&alpha);
_gtk_css_value_unref (val);
}
break;
case COLOR_TYPE_MIX:
{
GtkCssValue *val;
GdkRGBA color1, color2, res;
const GdkRGBA *color1, *color2;
GtkCssValue *val1, *val2;
GdkRGBA res;
val = _gtk_css_color_value_resolve (color->sym_col.mix.color1, provider, current, cycle_list);
if (val == NULL)
return NULL;
color1 = *_gtk_css_rgba_value_get_rgba (val);
_gtk_css_value_unref (val);
val1 = _gtk_css_color_value_resolve (color->sym_col.mix.color1, provider, current, cycle_list);
if (val1 == NULL)
return NULL;
color1 = gtk_css_color_value_get_rgba (val1);
val = _gtk_css_color_value_resolve (color->sym_col.mix.color2, provider, current, cycle_list);
if (val == NULL)
return NULL;
color2 = *_gtk_css_rgba_value_get_rgba (val);
_gtk_css_value_unref (val);
val2 = _gtk_css_color_value_resolve (color->sym_col.mix.color2, provider, current, cycle_list);
if (val2 == NULL)
return NULL;
color2 = gtk_css_color_value_get_rgba (val2);
res.red = CLAMP (color1.red + ((color2.red - color1.red) * color->sym_col.mix.factor), 0, 1);
res.green = CLAMP (color1.green + ((color2.green - color1.green) * color->sym_col.mix.factor), 0, 1);
res.blue = CLAMP (color1.blue + ((color2.blue - color1.blue) * color->sym_col.mix.factor), 0, 1);
res.alpha = CLAMP (color1.alpha + ((color2.alpha - color1.alpha) * color->sym_col.mix.factor), 0, 1);
apply_mix (color1, color2, &res, color->sym_col.mix.factor);
value =_gtk_css_rgba_value_new_from_rgba (&res);
value = _gtk_css_color_value_new_literal (&res);
_gtk_css_value_unref (val1);
_gtk_css_value_unref (val2);
}
break;
@@ -420,6 +482,24 @@ _gtk_css_color_value_resolve (GtkCssValue *color,
return value;
}
static GtkCssValue transparent_black_singleton = { &GTK_CSS_VALUE_COLOR, 1, TRUE, COLOR_TYPE_LITERAL, NULL,
.sym_col.rgba = {0, 0, 0, 0} };
static GtkCssValue white_singleton = { &GTK_CSS_VALUE_COLOR, 1, TRUE, COLOR_TYPE_LITERAL, NULL,
.sym_col.rgba = {1, 1, 1, 1} };
GtkCssValue *
gtk_css_color_value_new_transparent (void)
{
return _gtk_css_value_ref (&transparent_black_singleton);
}
GtkCssValue *
gtk_css_color_value_new_white (void)
{
return _gtk_css_value_ref (&white_singleton);
}
GtkCssValue *
_gtk_css_color_value_new_literal (const GdkRGBA *color)
{
@@ -427,9 +507,16 @@ _gtk_css_color_value_new_literal (const GdkRGBA *color)
g_return_val_if_fail (color != NULL, NULL);
if (gdk_rgba_equal (color, &white_singleton.sym_col.rgba))
return _gtk_css_value_ref (&white_singleton);
if (gdk_rgba_equal (color, &transparent_black_singleton.sym_col.rgba))
return _gtk_css_value_ref (&transparent_black_singleton);
value = _gtk_css_value_new (GtkCssValue, &GTK_CSS_VALUE_COLOR);
value->type = COLOR_TYPE_LITERAL;
value->last_value = _gtk_css_rgba_value_new_from_rgba (color);
value->is_computed = TRUE;
value->sym_col.rgba = *color;
return value;
}
@@ -456,6 +543,15 @@ _gtk_css_color_value_new_shade (GtkCssValue *color,
gtk_internal_return_val_if_fail (color->class == &GTK_CSS_VALUE_COLOR, NULL);
if (color->type == COLOR_TYPE_LITERAL)
{
GdkRGBA c;
apply_shade (&color->sym_col.rgba, &c, factor);
return _gtk_css_color_value_new_literal (&c);
}
value = _gtk_css_value_new (GtkCssValue, &GTK_CSS_VALUE_COLOR);
value->type = COLOR_TYPE_SHADE;
value->sym_col.shade.color = _gtk_css_value_ref (color);
@@ -472,6 +568,15 @@ _gtk_css_color_value_new_alpha (GtkCssValue *color,
gtk_internal_return_val_if_fail (color->class == &GTK_CSS_VALUE_COLOR, NULL);
if (color->type == COLOR_TYPE_LITERAL)
{
GdkRGBA c;
apply_alpha (&color->sym_col.rgba, &c, factor);
return _gtk_css_color_value_new_literal (&c);
}
value = _gtk_css_value_new (GtkCssValue, &GTK_CSS_VALUE_COLOR);
value->type = COLOR_TYPE_ALPHA;
value->sym_col.alpha.color = _gtk_css_value_ref (color);
@@ -490,6 +595,17 @@ _gtk_css_color_value_new_mix (GtkCssValue *color1,
gtk_internal_return_val_if_fail (color1->class == &GTK_CSS_VALUE_COLOR, NULL);
gtk_internal_return_val_if_fail (color2->class == &GTK_CSS_VALUE_COLOR, NULL);
if (color1->type == COLOR_TYPE_LITERAL &&
color2->type == COLOR_TYPE_LITERAL)
{
GdkRGBA result;
apply_mix (&color1->sym_col.rgba, &color2->sym_col.rgba, &result, factor);
return _gtk_css_color_value_new_literal (&result);
}
value = _gtk_css_value_new (GtkCssValue, &GTK_CSS_VALUE_COLOR);
value->type = COLOR_TYPE_MIX;
value->sym_col.mix.color1 = _gtk_css_value_ref (color1);
@@ -502,7 +618,7 @@ _gtk_css_color_value_new_mix (GtkCssValue *color1,
GtkCssValue *
_gtk_css_color_value_new_current_color (void)
{
static GtkCssValue current_color = { &GTK_CSS_VALUE_COLOR, 1, COLOR_TYPE_CURRENT_COLOR, NULL, };
static GtkCssValue current_color = { &GTK_CSS_VALUE_COLOR, 1, FALSE, COLOR_TYPE_CURRENT_COLOR, NULL, };
return _gtk_css_value_ref (&current_color);
}
@@ -665,3 +781,11 @@ _gtk_css_color_value_parse (GtkCssParser *parser)
return NULL;
}
const GdkRGBA *
gtk_css_color_value_get_rgba (const GtkCssValue *color)
{
g_assert (color->class == &GTK_CSS_VALUE_COLOR);
g_assert (color->type == COLOR_TYPE_LITERAL);
return &color->sym_col.rgba;
}
+3
View File
@@ -24,6 +24,8 @@
G_BEGIN_DECLS
GtkCssValue * gtk_css_color_value_new_transparent (void);
GtkCssValue * gtk_css_color_value_new_white (void);
GtkCssValue * _gtk_css_color_value_new_literal (const GdkRGBA *color);
GtkCssValue * _gtk_css_color_value_new_name (const gchar *name);
GtkCssValue * _gtk_css_color_value_new_shade (GtkCssValue *color,
@@ -42,6 +44,7 @@ GtkCssValue * _gtk_css_color_value_resolve (GtkCssValue *color
GtkStyleProvider *provider,
GtkCssValue *current,
GSList *cycle_list);
const GdkRGBA * gtk_css_color_value_get_rgba (const GtkCssValue *color);
G_END_DECLS
+13
View File
@@ -99,6 +99,7 @@ gtk_css_value_corner_print (const GtkCssValue *corner,
}
static const GtkCssValueClass GTK_CSS_VALUE_CORNER = {
"GtkCssCornerValue",
gtk_css_value_corner_free,
gtk_css_value_corner_compute,
gtk_css_value_corner_equal,
@@ -114,6 +115,12 @@ _gtk_css_corner_value_new (GtkCssValue *x,
{
GtkCssValue *result;
if (_gtk_css_value_equal (x, y))
{
_gtk_css_value_unref (y);
return x;
}
result = _gtk_css_value_new (GtkCssValue, &GTK_CSS_VALUE_CORNER);
result->x = x;
result->y = y;
@@ -155,6 +162,9 @@ double
_gtk_css_corner_value_get_x (const GtkCssValue *corner,
double one_hundred_percent)
{
if (corner->class != &GTK_CSS_VALUE_CORNER)
return _gtk_css_number_value_get (corner, one_hundred_percent);
g_return_val_if_fail (corner != NULL, 0.0);
g_return_val_if_fail (corner->class == &GTK_CSS_VALUE_CORNER, 0.0);
@@ -165,6 +175,9 @@ double
_gtk_css_corner_value_get_y (const GtkCssValue *corner,
double one_hundred_percent)
{
if (corner->class != &GTK_CSS_VALUE_CORNER)
return _gtk_css_number_value_get (corner, one_hundred_percent);
g_return_val_if_fail (corner != NULL, 0.0);
g_return_val_if_fail (corner->class == &GTK_CSS_VALUE_CORNER, 0.0);
+54 -61
View File
@@ -66,40 +66,6 @@ gtk_css_value_dimension_compute (GtkCssValue *number,
GtkCssStyle *style,
GtkCssStyle *parent_style)
{
GtkBorderStyle border_style;
/* special case according to http://dev.w3.org/csswg/css-backgrounds/#the-border-width */
switch (property_id)
{
case GTK_CSS_PROPERTY_BORDER_TOP_WIDTH:
border_style = _gtk_css_border_style_value_get(gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BORDER_TOP_STYLE));
if (border_style == GTK_BORDER_STYLE_NONE || border_style == GTK_BORDER_STYLE_HIDDEN)
return gtk_css_dimension_value_new (0, GTK_CSS_NUMBER);
break;
case GTK_CSS_PROPERTY_BORDER_RIGHT_WIDTH:
border_style = _gtk_css_border_style_value_get(gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BORDER_RIGHT_STYLE));
if (border_style == GTK_BORDER_STYLE_NONE || border_style == GTK_BORDER_STYLE_HIDDEN)
return gtk_css_dimension_value_new (0, GTK_CSS_NUMBER);
break;
case GTK_CSS_PROPERTY_BORDER_BOTTOM_WIDTH:
border_style = _gtk_css_border_style_value_get(gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BORDER_BOTTOM_STYLE));
if (border_style == GTK_BORDER_STYLE_NONE || border_style == GTK_BORDER_STYLE_HIDDEN)
return gtk_css_dimension_value_new (0, GTK_CSS_NUMBER);
break;
case GTK_CSS_PROPERTY_BORDER_LEFT_WIDTH:
border_style = _gtk_css_border_style_value_get(gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BORDER_LEFT_STYLE));
if (border_style == GTK_BORDER_STYLE_NONE || border_style == GTK_BORDER_STYLE_HIDDEN)
return gtk_css_dimension_value_new (0, GTK_CSS_NUMBER);
break;
case GTK_CSS_PROPERTY_OUTLINE_WIDTH:
border_style = _gtk_css_border_style_value_get(gtk_css_style_get_value (style, GTK_CSS_PROPERTY_OUTLINE_STYLE));
if (border_style == GTK_BORDER_STYLE_NONE || border_style == GTK_BORDER_STYLE_HIDDEN)
return gtk_css_dimension_value_new (0, GTK_CSS_NUMBER);
break;
default:
break;
}
switch (number->unit)
{
default:
@@ -228,8 +194,8 @@ gtk_css_value_dimension_has_percent (const GtkCssValue *value)
}
static GtkCssValue *
gtk_css_value_dimension_multiply (const GtkCssValue *value,
double factor)
gtk_css_value_dimension_multiply (GtkCssValue *value,
double factor)
{
return gtk_css_dimension_value_new (value->value * factor, value->unit);
}
@@ -238,15 +204,15 @@ static GtkCssValue *
gtk_css_value_dimension_try_add (GtkCssValue *value1,
GtkCssValue *value2)
{
if (value1->unit != value2->unit)
return NULL;
if (value1->value == 0)
return _gtk_css_value_ref (value2);
if (value2->value == 0)
return _gtk_css_value_ref (value1);
if (value1->unit != value2->unit)
return NULL;
return gtk_css_dimension_value_new (value1->value + value2->value, value1->unit);
}
@@ -277,12 +243,34 @@ gtk_css_value_dimension_get_calc_term_order (const GtkCssValue *value)
return 1000 + order_per_unit[value->unit];
}
static GtkCssValue *
gtk_css_value_dimension_transition (GtkCssValue *start,
GtkCssValue *end,
guint property_id,
double progress)
{
if (progress == 0)
return _gtk_css_value_ref (start);
if (progress == 1)
return _gtk_css_value_ref (end);
if (start == end)
return _gtk_css_value_ref (start);
if (start->unit != end->unit)
return NULL;
return gtk_css_dimension_value_new (start->value + (end->value - start->value) * progress, start->unit);
}
static const GtkCssNumberValueClass GTK_CSS_VALUE_DIMENSION = {
{
"GtkCssDimensionValue",
gtk_css_value_dimension_free,
gtk_css_value_dimension_compute,
gtk_css_value_dimension_equal,
gtk_css_number_value_transition,
gtk_css_value_dimension_transition,
NULL,
NULL,
gtk_css_value_dimension_print
@@ -300,35 +288,35 @@ gtk_css_dimension_value_new (double value,
GtkCssUnit unit)
{
static GtkCssValue number_singletons[] = {
{ &GTK_CSS_VALUE_DIMENSION.value_class, 1, GTK_CSS_NUMBER, 0 },
{ &GTK_CSS_VALUE_DIMENSION.value_class, 1, GTK_CSS_NUMBER, 1 },
{ &GTK_CSS_VALUE_DIMENSION.value_class, 1, GTK_CSS_NUMBER, 96 }, /* DPI default */
{ &GTK_CSS_VALUE_DIMENSION.value_class, 1, TRUE, GTK_CSS_NUMBER, 0 },
{ &GTK_CSS_VALUE_DIMENSION.value_class, 1, TRUE, GTK_CSS_NUMBER, 1 },
{ &GTK_CSS_VALUE_DIMENSION.value_class, 1, TRUE, GTK_CSS_NUMBER, 96 }, /* DPI default */
};
static GtkCssValue px_singletons[] = {
{ &GTK_CSS_VALUE_DIMENSION.value_class, 1, GTK_CSS_PX, 0 },
{ &GTK_CSS_VALUE_DIMENSION.value_class, 1, GTK_CSS_PX, 1 },
{ &GTK_CSS_VALUE_DIMENSION.value_class, 1, GTK_CSS_PX, 2 },
{ &GTK_CSS_VALUE_DIMENSION.value_class, 1, GTK_CSS_PX, 3 },
{ &GTK_CSS_VALUE_DIMENSION.value_class, 1, GTK_CSS_PX, 4 },
{ &GTK_CSS_VALUE_DIMENSION.value_class, 1, GTK_CSS_PX, 8 },
{ &GTK_CSS_VALUE_DIMENSION.value_class, 1, GTK_CSS_PX, 16 }, /* Icon size default */
{ &GTK_CSS_VALUE_DIMENSION.value_class, 1, GTK_CSS_PX, 32 },
{ &GTK_CSS_VALUE_DIMENSION.value_class, 1, GTK_CSS_PX, 64 },
{ &GTK_CSS_VALUE_DIMENSION.value_class, 1, TRUE, GTK_CSS_PX, 0 },
{ &GTK_CSS_VALUE_DIMENSION.value_class, 1, TRUE, GTK_CSS_PX, 1 },
{ &GTK_CSS_VALUE_DIMENSION.value_class, 1, TRUE, GTK_CSS_PX, 2 },
{ &GTK_CSS_VALUE_DIMENSION.value_class, 1, TRUE, GTK_CSS_PX, 3 },
{ &GTK_CSS_VALUE_DIMENSION.value_class, 1, TRUE, GTK_CSS_PX, 4 },
{ &GTK_CSS_VALUE_DIMENSION.value_class, 1, TRUE, GTK_CSS_PX, 8 },
{ &GTK_CSS_VALUE_DIMENSION.value_class, 1, TRUE, GTK_CSS_PX, 16 }, /* Icon size default */
{ &GTK_CSS_VALUE_DIMENSION.value_class, 1, TRUE, GTK_CSS_PX, 32 },
{ &GTK_CSS_VALUE_DIMENSION.value_class, 1, TRUE, GTK_CSS_PX, 64 },
};
static GtkCssValue percent_singletons[] = {
{ &GTK_CSS_VALUE_DIMENSION.value_class, 1, GTK_CSS_PERCENT, 0 },
{ &GTK_CSS_VALUE_DIMENSION.value_class, 1, GTK_CSS_PERCENT, 50 },
{ &GTK_CSS_VALUE_DIMENSION.value_class, 1, GTK_CSS_PERCENT, 100 },
{ &GTK_CSS_VALUE_DIMENSION.value_class, 1, TRUE, GTK_CSS_PERCENT, 0 },
{ &GTK_CSS_VALUE_DIMENSION.value_class, 1, FALSE, GTK_CSS_PERCENT, 50 },
{ &GTK_CSS_VALUE_DIMENSION.value_class, 1, FALSE, GTK_CSS_PERCENT, 100 },
};
static GtkCssValue second_singletons[] = {
{ &GTK_CSS_VALUE_DIMENSION.value_class, 1, GTK_CSS_S, 0 },
{ &GTK_CSS_VALUE_DIMENSION.value_class, 1, GTK_CSS_S, 1 },
{ &GTK_CSS_VALUE_DIMENSION.value_class, 1, TRUE, GTK_CSS_S, 0 },
{ &GTK_CSS_VALUE_DIMENSION.value_class, 1, TRUE, GTK_CSS_S, 1 },
};
static GtkCssValue deg_singletons[] = {
{ &GTK_CSS_VALUE_DIMENSION.value_class, 1, GTK_CSS_DEG, 0 },
{ &GTK_CSS_VALUE_DIMENSION.value_class, 1, GTK_CSS_DEG, 90 },
{ &GTK_CSS_VALUE_DIMENSION.value_class, 1, GTK_CSS_DEG, 180 },
{ &GTK_CSS_VALUE_DIMENSION.value_class, 1, GTK_CSS_DEG, 270 },
{ &GTK_CSS_VALUE_DIMENSION.value_class, 1, TRUE, GTK_CSS_DEG, 0 },
{ &GTK_CSS_VALUE_DIMENSION.value_class, 1, TRUE, GTK_CSS_DEG, 90 },
{ &GTK_CSS_VALUE_DIMENSION.value_class, 1, TRUE, GTK_CSS_DEG, 180 },
{ &GTK_CSS_VALUE_DIMENSION.value_class, 1, TRUE, GTK_CSS_DEG, 270 },
};
GtkCssValue *result;
@@ -396,6 +384,11 @@ gtk_css_dimension_value_new (double value,
result = _gtk_css_value_new (GtkCssValue, &GTK_CSS_VALUE_DIMENSION.value_class);
result->unit = unit;
result->value = value;
result->is_computed = value == 0 ||
unit == GTK_CSS_NUMBER ||
unit == GTK_CSS_PX ||
unit == GTK_CSS_DEG ||
unit == GTK_CSS_S;
return result;
}
+5 -2
View File
@@ -135,6 +135,7 @@ gtk_css_value_ease_print (const GtkCssValue *ease,
}
static const GtkCssValueClass GTK_CSS_VALUE_EASE = {
"GtkCssEaseValue",
gtk_css_value_ease_free,
gtk_css_value_ease_compute,
gtk_css_value_ease_equal,
@@ -158,12 +159,13 @@ _gtk_css_ease_value_new_cubic_bezier (double x1,
g_return_val_if_fail (x2 <= 1.0, NULL);
value = _gtk_css_value_new (GtkCssValue, &GTK_CSS_VALUE_EASE);
value->type = GTK_CSS_EASE_CUBIC_BEZIER;
value->u.cubic.x1 = x1;
value->u.cubic.y1 = y1;
value->u.cubic.x2 = x2;
value->u.cubic.y2 = y2;
value->is_computed = TRUE;
return value;
}
@@ -177,10 +179,11 @@ _gtk_css_ease_value_new_steps (guint n_steps,
g_return_val_if_fail (n_steps > 0, NULL);
value = _gtk_css_value_new (GtkCssValue, &GTK_CSS_VALUE_EASE);
value->type = GTK_CSS_EASE_STEPS;
value->u.steps.steps = n_steps;
value->u.steps.start = start;
value->is_computed = TRUE;
return value;
}
+109 -86
View File
@@ -78,6 +78,7 @@ gtk_css_value_enum_print (const GtkCssValue *value,
/* GtkBorderStyle */
static const GtkCssValueClass GTK_CSS_VALUE_BORDER_STYLE = {
"GtkCssBorderStyleValue",
gtk_css_value_enum_free,
gtk_css_value_enum_compute,
gtk_css_value_enum_equal,
@@ -88,16 +89,16 @@ static const GtkCssValueClass GTK_CSS_VALUE_BORDER_STYLE = {
};
static GtkCssValue border_style_values[] = {
{ &GTK_CSS_VALUE_BORDER_STYLE, 1, GTK_BORDER_STYLE_NONE, "none" },
{ &GTK_CSS_VALUE_BORDER_STYLE, 1, GTK_BORDER_STYLE_SOLID, "solid" },
{ &GTK_CSS_VALUE_BORDER_STYLE, 1, GTK_BORDER_STYLE_INSET, "inset" },
{ &GTK_CSS_VALUE_BORDER_STYLE, 1, GTK_BORDER_STYLE_OUTSET, "outset" },
{ &GTK_CSS_VALUE_BORDER_STYLE, 1, GTK_BORDER_STYLE_HIDDEN, "hidden" },
{ &GTK_CSS_VALUE_BORDER_STYLE, 1, GTK_BORDER_STYLE_DOTTED, "dotted" },
{ &GTK_CSS_VALUE_BORDER_STYLE, 1, GTK_BORDER_STYLE_DASHED, "dashed" },
{ &GTK_CSS_VALUE_BORDER_STYLE, 1, GTK_BORDER_STYLE_DOUBLE, "double" },
{ &GTK_CSS_VALUE_BORDER_STYLE, 1, GTK_BORDER_STYLE_GROOVE, "groove" },
{ &GTK_CSS_VALUE_BORDER_STYLE, 1, GTK_BORDER_STYLE_RIDGE, "ridge" }
{ &GTK_CSS_VALUE_BORDER_STYLE, 1, TRUE, GTK_BORDER_STYLE_NONE, "none" },
{ &GTK_CSS_VALUE_BORDER_STYLE, 1, TRUE, GTK_BORDER_STYLE_SOLID, "solid" },
{ &GTK_CSS_VALUE_BORDER_STYLE, 1, TRUE, GTK_BORDER_STYLE_INSET, "inset" },
{ &GTK_CSS_VALUE_BORDER_STYLE, 1, TRUE, GTK_BORDER_STYLE_OUTSET, "outset" },
{ &GTK_CSS_VALUE_BORDER_STYLE, 1, TRUE, GTK_BORDER_STYLE_HIDDEN, "hidden" },
{ &GTK_CSS_VALUE_BORDER_STYLE, 1, TRUE, GTK_BORDER_STYLE_DOTTED, "dotted" },
{ &GTK_CSS_VALUE_BORDER_STYLE, 1, TRUE, GTK_BORDER_STYLE_DASHED, "dashed" },
{ &GTK_CSS_VALUE_BORDER_STYLE, 1, TRUE, GTK_BORDER_STYLE_DOUBLE, "double" },
{ &GTK_CSS_VALUE_BORDER_STYLE, 1, TRUE, GTK_BORDER_STYLE_GROOVE, "groove" },
{ &GTK_CSS_VALUE_BORDER_STYLE, 1, TRUE, GTK_BORDER_STYLE_RIDGE, "ridge" }
};
GtkCssValue *
@@ -135,6 +136,7 @@ _gtk_css_border_style_value_get (const GtkCssValue *value)
/* GtkCssBlendMode */
static const GtkCssValueClass GTK_CSS_VALUE_BLEND_MODE = {
"GtkCssBlendModeValue",
gtk_css_value_enum_free,
gtk_css_value_enum_compute,
gtk_css_value_enum_equal,
@@ -145,22 +147,22 @@ static const GtkCssValueClass GTK_CSS_VALUE_BLEND_MODE = {
};
static GtkCssValue blend_mode_values[] = {
{ &GTK_CSS_VALUE_BLEND_MODE, 1, GSK_BLEND_MODE_DEFAULT, "normal" },
{ &GTK_CSS_VALUE_BLEND_MODE, 1, GSK_BLEND_MODE_MULTIPLY, "multiply" },
{ &GTK_CSS_VALUE_BLEND_MODE, 1, GSK_BLEND_MODE_SCREEN, "screen" },
{ &GTK_CSS_VALUE_BLEND_MODE, 1, GSK_BLEND_MODE_OVERLAY, "overlay" },
{ &GTK_CSS_VALUE_BLEND_MODE, 1, GSK_BLEND_MODE_DARKEN, "darken" },
{ &GTK_CSS_VALUE_BLEND_MODE, 1, GSK_BLEND_MODE_LIGHTEN, "lighten" },
{ &GTK_CSS_VALUE_BLEND_MODE, 1, GSK_BLEND_MODE_COLOR_DODGE, "color-dodge" },
{ &GTK_CSS_VALUE_BLEND_MODE, 1, GSK_BLEND_MODE_COLOR_BURN, "color-burn" },
{ &GTK_CSS_VALUE_BLEND_MODE, 1, GSK_BLEND_MODE_HARD_LIGHT, "hard-light" },
{ &GTK_CSS_VALUE_BLEND_MODE, 1, GSK_BLEND_MODE_SOFT_LIGHT, "soft-light" },
{ &GTK_CSS_VALUE_BLEND_MODE, 1, GSK_BLEND_MODE_DIFFERENCE, "difference" },
{ &GTK_CSS_VALUE_BLEND_MODE, 1, GSK_BLEND_MODE_EXCLUSION, "exclusion" },
{ &GTK_CSS_VALUE_BLEND_MODE, 1, GSK_BLEND_MODE_COLOR, "color" },
{ &GTK_CSS_VALUE_BLEND_MODE, 1, GSK_BLEND_MODE_HUE, "hue" },
{ &GTK_CSS_VALUE_BLEND_MODE, 1, GSK_BLEND_MODE_SATURATION, "saturation" },
{ &GTK_CSS_VALUE_BLEND_MODE, 1, GSK_BLEND_MODE_LUMINOSITY, "luminosity" }
{ &GTK_CSS_VALUE_BLEND_MODE, 1, TRUE, GSK_BLEND_MODE_DEFAULT, "normal" },
{ &GTK_CSS_VALUE_BLEND_MODE, 1, TRUE, GSK_BLEND_MODE_MULTIPLY, "multiply" },
{ &GTK_CSS_VALUE_BLEND_MODE, 1, TRUE, GSK_BLEND_MODE_SCREEN, "screen" },
{ &GTK_CSS_VALUE_BLEND_MODE, 1, TRUE, GSK_BLEND_MODE_OVERLAY, "overlay" },
{ &GTK_CSS_VALUE_BLEND_MODE, 1, TRUE, GSK_BLEND_MODE_DARKEN, "darken" },
{ &GTK_CSS_VALUE_BLEND_MODE, 1, TRUE, GSK_BLEND_MODE_LIGHTEN, "lighten" },
{ &GTK_CSS_VALUE_BLEND_MODE, 1, TRUE, GSK_BLEND_MODE_COLOR_DODGE, "color-dodge" },
{ &GTK_CSS_VALUE_BLEND_MODE, 1, TRUE, GSK_BLEND_MODE_COLOR_BURN, "color-burn" },
{ &GTK_CSS_VALUE_BLEND_MODE, 1, TRUE, GSK_BLEND_MODE_HARD_LIGHT, "hard-light" },
{ &GTK_CSS_VALUE_BLEND_MODE, 1, TRUE, GSK_BLEND_MODE_SOFT_LIGHT, "soft-light" },
{ &GTK_CSS_VALUE_BLEND_MODE, 1, TRUE, GSK_BLEND_MODE_DIFFERENCE, "difference" },
{ &GTK_CSS_VALUE_BLEND_MODE, 1, TRUE, GSK_BLEND_MODE_EXCLUSION, "exclusion" },
{ &GTK_CSS_VALUE_BLEND_MODE, 1, TRUE, GSK_BLEND_MODE_COLOR, "color" },
{ &GTK_CSS_VALUE_BLEND_MODE, 1, TRUE, GSK_BLEND_MODE_HUE, "hue" },
{ &GTK_CSS_VALUE_BLEND_MODE, 1, TRUE, GSK_BLEND_MODE_SATURATION, "saturation" },
{ &GTK_CSS_VALUE_BLEND_MODE, 1, TRUE, GSK_BLEND_MODE_LUMINOSITY, "luminosity" }
};
GtkCssValue *
@@ -285,6 +287,7 @@ gtk_css_value_font_size_compute (GtkCssValue *value,
}
static const GtkCssValueClass GTK_CSS_VALUE_FONT_SIZE = {
"GtkCssFontSizeValue",
gtk_css_value_enum_free,
gtk_css_value_font_size_compute,
gtk_css_value_enum_equal,
@@ -295,15 +298,15 @@ static const GtkCssValueClass GTK_CSS_VALUE_FONT_SIZE = {
};
static GtkCssValue font_size_values[] = {
{ &GTK_CSS_VALUE_FONT_SIZE, 1, GTK_CSS_FONT_SIZE_SMALLER, "smaller" },
{ &GTK_CSS_VALUE_FONT_SIZE, 1, GTK_CSS_FONT_SIZE_LARGER, "larger" },
{ &GTK_CSS_VALUE_FONT_SIZE, 1, GTK_CSS_FONT_SIZE_XX_SMALL, "xx-small" },
{ &GTK_CSS_VALUE_FONT_SIZE, 1, GTK_CSS_FONT_SIZE_X_SMALL, "x-small" },
{ &GTK_CSS_VALUE_FONT_SIZE, 1, GTK_CSS_FONT_SIZE_SMALL, "small" },
{ &GTK_CSS_VALUE_FONT_SIZE, 1, GTK_CSS_FONT_SIZE_MEDIUM, "medium" },
{ &GTK_CSS_VALUE_FONT_SIZE, 1, GTK_CSS_FONT_SIZE_LARGE, "large" },
{ &GTK_CSS_VALUE_FONT_SIZE, 1, GTK_CSS_FONT_SIZE_X_LARGE, "x-large" },
{ &GTK_CSS_VALUE_FONT_SIZE, 1, GTK_CSS_FONT_SIZE_XX_LARGE, "xx-large" }
{ &GTK_CSS_VALUE_FONT_SIZE, 1, FALSE, GTK_CSS_FONT_SIZE_SMALLER, "smaller" },
{ &GTK_CSS_VALUE_FONT_SIZE, 1, FALSE, GTK_CSS_FONT_SIZE_LARGER, "larger" },
{ &GTK_CSS_VALUE_FONT_SIZE, 1, FALSE, GTK_CSS_FONT_SIZE_XX_SMALL, "xx-small" },
{ &GTK_CSS_VALUE_FONT_SIZE, 1, FALSE, GTK_CSS_FONT_SIZE_X_SMALL, "x-small" },
{ &GTK_CSS_VALUE_FONT_SIZE, 1, FALSE, GTK_CSS_FONT_SIZE_SMALL, "small" },
{ &GTK_CSS_VALUE_FONT_SIZE, 1, FALSE, GTK_CSS_FONT_SIZE_MEDIUM, "medium" },
{ &GTK_CSS_VALUE_FONT_SIZE, 1, FALSE, GTK_CSS_FONT_SIZE_LARGE, "large" },
{ &GTK_CSS_VALUE_FONT_SIZE, 1, FALSE, GTK_CSS_FONT_SIZE_X_LARGE, "x-large" },
{ &GTK_CSS_VALUE_FONT_SIZE, 1, FALSE, GTK_CSS_FONT_SIZE_XX_LARGE, "xx-large" }
};
GtkCssValue *
@@ -341,6 +344,7 @@ _gtk_css_font_size_value_get (const GtkCssValue *value)
/* PangoStyle */
static const GtkCssValueClass GTK_CSS_VALUE_FONT_STYLE = {
"GtkCssFontStyleValue",
gtk_css_value_enum_free,
gtk_css_value_enum_compute,
gtk_css_value_enum_equal,
@@ -351,9 +355,9 @@ static const GtkCssValueClass GTK_CSS_VALUE_FONT_STYLE = {
};
static GtkCssValue font_style_values[] = {
{ &GTK_CSS_VALUE_FONT_STYLE, 1, PANGO_STYLE_NORMAL, "normal" },
{ &GTK_CSS_VALUE_FONT_STYLE, 1, PANGO_STYLE_OBLIQUE, "oblique" },
{ &GTK_CSS_VALUE_FONT_STYLE, 1, PANGO_STYLE_ITALIC, "italic" }
{ &GTK_CSS_VALUE_FONT_STYLE, 1, TRUE, PANGO_STYLE_NORMAL, "normal" },
{ &GTK_CSS_VALUE_FONT_STYLE, 1, TRUE, PANGO_STYLE_OBLIQUE, "oblique" },
{ &GTK_CSS_VALUE_FONT_STYLE, 1, TRUE, PANGO_STYLE_ITALIC, "italic" }
};
GtkCssValue *
@@ -439,6 +443,7 @@ gtk_css_value_font_weight_compute (GtkCssValue *value,
}
static const GtkCssValueClass GTK_CSS_VALUE_FONT_WEIGHT = {
"GtkCssFontWeightValue",
gtk_css_value_enum_free,
gtk_css_value_font_weight_compute,
gtk_css_value_enum_equal,
@@ -449,8 +454,8 @@ static const GtkCssValueClass GTK_CSS_VALUE_FONT_WEIGHT = {
};
static GtkCssValue font_weight_values[] = {
{ &GTK_CSS_VALUE_FONT_WEIGHT, 1, BOLDER, "bolder" },
{ &GTK_CSS_VALUE_FONT_WEIGHT, 1, LIGHTER, "lighter" },
{ &GTK_CSS_VALUE_FONT_WEIGHT, 1, FALSE, BOLDER, "bolder" },
{ &GTK_CSS_VALUE_FONT_WEIGHT, 1, FALSE, LIGHTER, "lighter" },
};
GtkCssValue *
@@ -488,6 +493,7 @@ gtk_css_font_weight_value_get (const GtkCssValue *value)
/* PangoStretch */
static const GtkCssValueClass GTK_CSS_VALUE_FONT_STRETCH = {
"GtkCssFontStretchValue",
gtk_css_value_enum_free,
gtk_css_value_enum_compute,
gtk_css_value_enum_equal,
@@ -498,15 +504,15 @@ static const GtkCssValueClass GTK_CSS_VALUE_FONT_STRETCH = {
};
static GtkCssValue font_stretch_values[] = {
{ &GTK_CSS_VALUE_FONT_STRETCH, 1, PANGO_STRETCH_ULTRA_CONDENSED, "ultra-condensed" },
{ &GTK_CSS_VALUE_FONT_STRETCH, 1, PANGO_STRETCH_EXTRA_CONDENSED, "extra-condensed" },
{ &GTK_CSS_VALUE_FONT_STRETCH, 1, PANGO_STRETCH_CONDENSED, "condensed" },
{ &GTK_CSS_VALUE_FONT_STRETCH, 1, PANGO_STRETCH_SEMI_CONDENSED, "semi-condensed" },
{ &GTK_CSS_VALUE_FONT_STRETCH, 1, PANGO_STRETCH_NORMAL, "normal" },
{ &GTK_CSS_VALUE_FONT_STRETCH, 1, PANGO_STRETCH_SEMI_EXPANDED, "semi-expanded" },
{ &GTK_CSS_VALUE_FONT_STRETCH, 1, PANGO_STRETCH_EXPANDED, "expanded" },
{ &GTK_CSS_VALUE_FONT_STRETCH, 1, PANGO_STRETCH_EXTRA_EXPANDED, "extra-expanded" },
{ &GTK_CSS_VALUE_FONT_STRETCH, 1, PANGO_STRETCH_ULTRA_EXPANDED, "ultra-expanded" },
{ &GTK_CSS_VALUE_FONT_STRETCH, 1, TRUE, PANGO_STRETCH_ULTRA_CONDENSED, "ultra-condensed" },
{ &GTK_CSS_VALUE_FONT_STRETCH, 1, TRUE, PANGO_STRETCH_EXTRA_CONDENSED, "extra-condensed" },
{ &GTK_CSS_VALUE_FONT_STRETCH, 1, TRUE, PANGO_STRETCH_CONDENSED, "condensed" },
{ &GTK_CSS_VALUE_FONT_STRETCH, 1, TRUE, PANGO_STRETCH_SEMI_CONDENSED, "semi-condensed" },
{ &GTK_CSS_VALUE_FONT_STRETCH, 1, TRUE, PANGO_STRETCH_NORMAL, "normal" },
{ &GTK_CSS_VALUE_FONT_STRETCH, 1, TRUE, PANGO_STRETCH_SEMI_EXPANDED, "semi-expanded" },
{ &GTK_CSS_VALUE_FONT_STRETCH, 1, TRUE, PANGO_STRETCH_EXPANDED, "expanded" },
{ &GTK_CSS_VALUE_FONT_STRETCH, 1, TRUE, PANGO_STRETCH_EXTRA_EXPANDED, "extra-expanded" },
{ &GTK_CSS_VALUE_FONT_STRETCH, 1, TRUE, PANGO_STRETCH_ULTRA_EXPANDED, "ultra-expanded" },
};
GtkCssValue *
@@ -544,6 +550,7 @@ _gtk_css_font_stretch_value_get (const GtkCssValue *value)
/* GtkTextDecorationLine */
static const GtkCssValueClass GTK_CSS_VALUE_TEXT_DECORATION_LINE = {
"GtkCssTextDecorationLineValue",
gtk_css_value_enum_free,
gtk_css_value_enum_compute,
gtk_css_value_enum_equal,
@@ -554,9 +561,9 @@ static const GtkCssValueClass GTK_CSS_VALUE_TEXT_DECORATION_LINE = {
};
static GtkCssValue text_decoration_line_values[] = {
{ &GTK_CSS_VALUE_TEXT_DECORATION_LINE, 1, GTK_CSS_TEXT_DECORATION_LINE_NONE, "none" },
{ &GTK_CSS_VALUE_TEXT_DECORATION_LINE, 1, GTK_CSS_TEXT_DECORATION_LINE_UNDERLINE, "underline" },
{ &GTK_CSS_VALUE_TEXT_DECORATION_LINE, 1, GTK_CSS_TEXT_DECORATION_LINE_LINE_THROUGH, "line-through" },
{ &GTK_CSS_VALUE_TEXT_DECORATION_LINE, 1, TRUE, GTK_CSS_TEXT_DECORATION_LINE_NONE, "none" },
{ &GTK_CSS_VALUE_TEXT_DECORATION_LINE, 1, TRUE, GTK_CSS_TEXT_DECORATION_LINE_UNDERLINE, "underline" },
{ &GTK_CSS_VALUE_TEXT_DECORATION_LINE, 1, TRUE, GTK_CSS_TEXT_DECORATION_LINE_LINE_THROUGH, "line-through" },
};
GtkCssValue *
@@ -594,6 +601,7 @@ _gtk_css_text_decoration_line_value_get (const GtkCssValue *value)
/* GtkTextDecorationStyle */
static const GtkCssValueClass GTK_CSS_VALUE_TEXT_DECORATION_STYLE = {
"GtkCssTextDecorationStyleValue",
gtk_css_value_enum_free,
gtk_css_value_enum_compute,
gtk_css_value_enum_equal,
@@ -604,9 +612,9 @@ static const GtkCssValueClass GTK_CSS_VALUE_TEXT_DECORATION_STYLE = {
};
static GtkCssValue text_decoration_style_values[] = {
{ &GTK_CSS_VALUE_TEXT_DECORATION_STYLE, 1, GTK_CSS_TEXT_DECORATION_STYLE_SOLID, "solid" },
{ &GTK_CSS_VALUE_TEXT_DECORATION_STYLE, 1, GTK_CSS_TEXT_DECORATION_STYLE_DOUBLE, "double" },
{ &GTK_CSS_VALUE_TEXT_DECORATION_STYLE, 1, GTK_CSS_TEXT_DECORATION_STYLE_WAVY, "wavy" },
{ &GTK_CSS_VALUE_TEXT_DECORATION_STYLE, 1, TRUE, GTK_CSS_TEXT_DECORATION_STYLE_SOLID, "solid" },
{ &GTK_CSS_VALUE_TEXT_DECORATION_STYLE, 1, TRUE, GTK_CSS_TEXT_DECORATION_STYLE_DOUBLE, "double" },
{ &GTK_CSS_VALUE_TEXT_DECORATION_STYLE, 1, TRUE, GTK_CSS_TEXT_DECORATION_STYLE_WAVY, "wavy" },
};
GtkCssValue *
@@ -644,6 +652,7 @@ _gtk_css_text_decoration_style_value_get (const GtkCssValue *value)
/* GtkCssArea */
static const GtkCssValueClass GTK_CSS_VALUE_AREA = {
"GtkCssAreaValue",
gtk_css_value_enum_free,
gtk_css_value_enum_compute,
gtk_css_value_enum_equal,
@@ -654,9 +663,9 @@ static const GtkCssValueClass GTK_CSS_VALUE_AREA = {
};
static GtkCssValue area_values[] = {
{ &GTK_CSS_VALUE_AREA, 1, GTK_CSS_AREA_BORDER_BOX, "border-box" },
{ &GTK_CSS_VALUE_AREA, 1, GTK_CSS_AREA_PADDING_BOX, "padding-box" },
{ &GTK_CSS_VALUE_AREA, 1, GTK_CSS_AREA_CONTENT_BOX, "content-box" }
{ &GTK_CSS_VALUE_AREA, 1, TRUE, GTK_CSS_AREA_BORDER_BOX, "border-box" },
{ &GTK_CSS_VALUE_AREA, 1, TRUE, GTK_CSS_AREA_PADDING_BOX, "padding-box" },
{ &GTK_CSS_VALUE_AREA, 1, TRUE, GTK_CSS_AREA_CONTENT_BOX, "content-box" }
};
GtkCssValue *
@@ -700,6 +709,7 @@ _gtk_css_area_value_get (const GtkCssValue *value)
/* GtkCssDirection */
static const GtkCssValueClass GTK_CSS_VALUE_DIRECTION = {
"GtkCssDirectionValue",
gtk_css_value_enum_free,
gtk_css_value_enum_compute,
gtk_css_value_enum_equal,
@@ -710,10 +720,10 @@ static const GtkCssValueClass GTK_CSS_VALUE_DIRECTION = {
};
static GtkCssValue direction_values[] = {
{ &GTK_CSS_VALUE_DIRECTION, 1, GTK_CSS_DIRECTION_NORMAL, "normal" },
{ &GTK_CSS_VALUE_DIRECTION, 1, GTK_CSS_DIRECTION_REVERSE, "reverse" },
{ &GTK_CSS_VALUE_DIRECTION, 1, GTK_CSS_DIRECTION_ALTERNATE, "alternate" },
{ &GTK_CSS_VALUE_DIRECTION, 1, GTK_CSS_DIRECTION_ALTERNATE_REVERSE, "alternate-reverse" }
{ &GTK_CSS_VALUE_DIRECTION, 1, TRUE, GTK_CSS_DIRECTION_NORMAL, "normal" },
{ &GTK_CSS_VALUE_DIRECTION, 1, TRUE, GTK_CSS_DIRECTION_REVERSE, "reverse" },
{ &GTK_CSS_VALUE_DIRECTION, 1, TRUE, GTK_CSS_DIRECTION_ALTERNATE, "alternate" },
{ &GTK_CSS_VALUE_DIRECTION, 1, TRUE, GTK_CSS_DIRECTION_ALTERNATE_REVERSE, "alternate-reverse" }
};
GtkCssValue *
@@ -760,6 +770,7 @@ _gtk_css_direction_value_get (const GtkCssValue *value)
/* GtkCssPlayState */
static const GtkCssValueClass GTK_CSS_VALUE_PLAY_STATE = {
"GtkCssPlayStateValue",
gtk_css_value_enum_free,
gtk_css_value_enum_compute,
gtk_css_value_enum_equal,
@@ -770,8 +781,8 @@ static const GtkCssValueClass GTK_CSS_VALUE_PLAY_STATE = {
};
static GtkCssValue play_state_values[] = {
{ &GTK_CSS_VALUE_PLAY_STATE, 1, GTK_CSS_PLAY_STATE_RUNNING, "running" },
{ &GTK_CSS_VALUE_PLAY_STATE, 1, GTK_CSS_PLAY_STATE_PAUSED, "paused" }
{ &GTK_CSS_VALUE_PLAY_STATE, 1, TRUE, GTK_CSS_PLAY_STATE_RUNNING, "running" },
{ &GTK_CSS_VALUE_PLAY_STATE, 1, TRUE, GTK_CSS_PLAY_STATE_PAUSED, "paused" }
};
GtkCssValue *
@@ -815,6 +826,7 @@ _gtk_css_play_state_value_get (const GtkCssValue *value)
/* GtkCssFillMode */
static const GtkCssValueClass GTK_CSS_VALUE_FILL_MODE = {
"GtkCssFillModeValue",
gtk_css_value_enum_free,
gtk_css_value_enum_compute,
gtk_css_value_enum_equal,
@@ -825,10 +837,10 @@ static const GtkCssValueClass GTK_CSS_VALUE_FILL_MODE = {
};
static GtkCssValue fill_mode_values[] = {
{ &GTK_CSS_VALUE_FILL_MODE, 1, GTK_CSS_FILL_NONE, "none" },
{ &GTK_CSS_VALUE_FILL_MODE, 1, GTK_CSS_FILL_FORWARDS, "forwards" },
{ &GTK_CSS_VALUE_FILL_MODE, 1, GTK_CSS_FILL_BACKWARDS, "backwards" },
{ &GTK_CSS_VALUE_FILL_MODE, 1, GTK_CSS_FILL_BOTH, "both" }
{ &GTK_CSS_VALUE_FILL_MODE, 1, TRUE, GTK_CSS_FILL_NONE, "none" },
{ &GTK_CSS_VALUE_FILL_MODE, 1, TRUE, GTK_CSS_FILL_FORWARDS, "forwards" },
{ &GTK_CSS_VALUE_FILL_MODE, 1, TRUE, GTK_CSS_FILL_BACKWARDS, "backwards" },
{ &GTK_CSS_VALUE_FILL_MODE, 1, TRUE, GTK_CSS_FILL_BOTH, "both" }
};
GtkCssValue *
@@ -872,6 +884,7 @@ _gtk_css_fill_mode_value_get (const GtkCssValue *value)
/* GtkCssIconStyle */
static const GtkCssValueClass GTK_CSS_VALUE_ICON_STYLE = {
"GtkCssIconStyleValue",
gtk_css_value_enum_free,
gtk_css_value_enum_compute,
gtk_css_value_enum_equal,
@@ -882,9 +895,9 @@ static const GtkCssValueClass GTK_CSS_VALUE_ICON_STYLE = {
};
static GtkCssValue icon_style_values[] = {
{ &GTK_CSS_VALUE_ICON_STYLE, 1, GTK_CSS_ICON_STYLE_REQUESTED, "requested" },
{ &GTK_CSS_VALUE_ICON_STYLE, 1, GTK_CSS_ICON_STYLE_REGULAR, "regular" },
{ &GTK_CSS_VALUE_ICON_STYLE, 1, GTK_CSS_ICON_STYLE_SYMBOLIC, "symbolic" }
{ &GTK_CSS_VALUE_ICON_STYLE, 1, TRUE, GTK_CSS_ICON_STYLE_REQUESTED, "requested" },
{ &GTK_CSS_VALUE_ICON_STYLE, 1, TRUE, GTK_CSS_ICON_STYLE_REGULAR, "regular" },
{ &GTK_CSS_VALUE_ICON_STYLE, 1, TRUE, GTK_CSS_ICON_STYLE_SYMBOLIC, "symbolic" }
};
GtkCssValue *
@@ -928,6 +941,7 @@ _gtk_css_icon_style_value_get (const GtkCssValue *value)
/* GtkCssFontKerning */
static const GtkCssValueClass GTK_CSS_VALUE_FONT_KERNING = {
"GtkCssFontKerningValue",
gtk_css_value_enum_free,
gtk_css_value_enum_compute,
gtk_css_value_enum_equal,
@@ -938,9 +952,9 @@ static const GtkCssValueClass GTK_CSS_VALUE_FONT_KERNING = {
};
static GtkCssValue font_kerning_values[] = {
{ &GTK_CSS_VALUE_FONT_KERNING, 1, GTK_CSS_FONT_KERNING_AUTO, "auto" },
{ &GTK_CSS_VALUE_FONT_KERNING, 1, GTK_CSS_FONT_KERNING_NORMAL, "normal" },
{ &GTK_CSS_VALUE_FONT_KERNING, 1, GTK_CSS_FONT_KERNING_NONE, "none" }
{ &GTK_CSS_VALUE_FONT_KERNING, 1, TRUE, GTK_CSS_FONT_KERNING_AUTO, "auto" },
{ &GTK_CSS_VALUE_FONT_KERNING, 1, TRUE, GTK_CSS_FONT_KERNING_NORMAL, "normal" },
{ &GTK_CSS_VALUE_FONT_KERNING, 1, TRUE, GTK_CSS_FONT_KERNING_NONE, "none" }
};
GtkCssValue *
@@ -984,6 +998,7 @@ _gtk_css_font_kerning_value_get (const GtkCssValue *value)
/* GtkCssFontVariantPos */
static const GtkCssValueClass GTK_CSS_VALUE_FONT_VARIANT_POSITION = {
"GtkCssFontVariationPositionValue",
gtk_css_value_enum_free,
gtk_css_value_enum_compute,
gtk_css_value_enum_equal,
@@ -994,9 +1009,9 @@ static const GtkCssValueClass GTK_CSS_VALUE_FONT_VARIANT_POSITION = {
};
static GtkCssValue font_variant_position_values[] = {
{ &GTK_CSS_VALUE_FONT_VARIANT_POSITION, 1, GTK_CSS_FONT_VARIANT_POSITION_NORMAL, "normal" },
{ &GTK_CSS_VALUE_FONT_VARIANT_POSITION, 1, GTK_CSS_FONT_VARIANT_POSITION_SUB, "sub" },
{ &GTK_CSS_VALUE_FONT_VARIANT_POSITION, 1, GTK_CSS_FONT_VARIANT_POSITION_SUPER, "super" }
{ &GTK_CSS_VALUE_FONT_VARIANT_POSITION, 1, TRUE, GTK_CSS_FONT_VARIANT_POSITION_NORMAL, "normal" },
{ &GTK_CSS_VALUE_FONT_VARIANT_POSITION, 1, TRUE, GTK_CSS_FONT_VARIANT_POSITION_SUB, "sub" },
{ &GTK_CSS_VALUE_FONT_VARIANT_POSITION, 1, TRUE, GTK_CSS_FONT_VARIANT_POSITION_SUPER, "super" }
};
GtkCssValue *
@@ -1040,6 +1055,7 @@ _gtk_css_font_variant_position_value_get (const GtkCssValue *value)
/* GtkCssFontVariantCaps */
static const GtkCssValueClass GTK_CSS_VALUE_FONT_VARIANT_CAPS = {
"GtkCssFontVariantCapsValue",
gtk_css_value_enum_free,
gtk_css_value_enum_compute,
gtk_css_value_enum_equal,
@@ -1050,13 +1066,13 @@ static const GtkCssValueClass GTK_CSS_VALUE_FONT_VARIANT_CAPS = {
};
static GtkCssValue font_variant_caps_values[] = {
{ &GTK_CSS_VALUE_FONT_VARIANT_CAPS, 1, GTK_CSS_FONT_VARIANT_CAPS_NORMAL, "normal" },
{ &GTK_CSS_VALUE_FONT_VARIANT_CAPS, 1, GTK_CSS_FONT_VARIANT_CAPS_SMALL_CAPS, "small-caps" },
{ &GTK_CSS_VALUE_FONT_VARIANT_CAPS, 1, GTK_CSS_FONT_VARIANT_CAPS_ALL_SMALL_CAPS, "all-small-caps" },
{ &GTK_CSS_VALUE_FONT_VARIANT_CAPS, 1, GTK_CSS_FONT_VARIANT_CAPS_PETITE_CAPS, "petite-caps" },
{ &GTK_CSS_VALUE_FONT_VARIANT_CAPS, 1, GTK_CSS_FONT_VARIANT_CAPS_ALL_PETITE_CAPS, "all-petite-caps" },
{ &GTK_CSS_VALUE_FONT_VARIANT_CAPS, 1, GTK_CSS_FONT_VARIANT_CAPS_UNICASE, "unicase" },
{ &GTK_CSS_VALUE_FONT_VARIANT_CAPS, 1, GTK_CSS_FONT_VARIANT_CAPS_TITLING_CAPS, "titling-caps" }
{ &GTK_CSS_VALUE_FONT_VARIANT_CAPS, 1, TRUE, GTK_CSS_FONT_VARIANT_CAPS_NORMAL, "normal" },
{ &GTK_CSS_VALUE_FONT_VARIANT_CAPS, 1, TRUE, GTK_CSS_FONT_VARIANT_CAPS_SMALL_CAPS, "small-caps" },
{ &GTK_CSS_VALUE_FONT_VARIANT_CAPS, 1, TRUE, GTK_CSS_FONT_VARIANT_CAPS_ALL_SMALL_CAPS, "all-small-caps" },
{ &GTK_CSS_VALUE_FONT_VARIANT_CAPS, 1, TRUE, GTK_CSS_FONT_VARIANT_CAPS_PETITE_CAPS, "petite-caps" },
{ &GTK_CSS_VALUE_FONT_VARIANT_CAPS, 1, TRUE, GTK_CSS_FONT_VARIANT_CAPS_ALL_PETITE_CAPS, "all-petite-caps" },
{ &GTK_CSS_VALUE_FONT_VARIANT_CAPS, 1, TRUE, GTK_CSS_FONT_VARIANT_CAPS_UNICASE, "unicase" },
{ &GTK_CSS_VALUE_FONT_VARIANT_CAPS, 1, TRUE, GTK_CSS_FONT_VARIANT_CAPS_TITLING_CAPS, "titling-caps" }
};
GtkCssValue *
@@ -1100,6 +1116,7 @@ _gtk_css_font_variant_caps_value_get (const GtkCssValue *value)
/* GtkCssFontVariantAlternate */
static const GtkCssValueClass GTK_CSS_VALUE_FONT_VARIANT_ALTERNATE = {
"GtkCssFontVariantAlternateValue",
gtk_css_value_enum_free,
gtk_css_value_enum_compute,
gtk_css_value_enum_equal,
@@ -1110,8 +1127,8 @@ static const GtkCssValueClass GTK_CSS_VALUE_FONT_VARIANT_ALTERNATE = {
};
static GtkCssValue font_variant_alternate_values[] = {
{ &GTK_CSS_VALUE_FONT_VARIANT_ALTERNATE, 1, GTK_CSS_FONT_VARIANT_ALTERNATE_NORMAL, "normal" },
{ &GTK_CSS_VALUE_FONT_VARIANT_ALTERNATE, 1, GTK_CSS_FONT_VARIANT_ALTERNATE_HISTORICAL_FORMS, "historical-forms" }
{ &GTK_CSS_VALUE_FONT_VARIANT_ALTERNATE, 1, TRUE, GTK_CSS_FONT_VARIANT_ALTERNATE_NORMAL, "normal" },
{ &GTK_CSS_VALUE_FONT_VARIANT_ALTERNATE, 1, TRUE, GTK_CSS_FONT_VARIANT_ALTERNATE_HISTORICAL_FORMS, "historical-forms" }
};
GtkCssValue *
@@ -1213,6 +1230,7 @@ gtk_css_font_variant_ligature_value_print (const GtkCssValue *value,
}
static const GtkCssValueClass GTK_CSS_VALUE_FONT_VARIANT_LIGATURE = {
"GtkCssFontVariantLigatureValue",
gtk_css_value_enum_free,
gtk_css_value_enum_compute,
gtk_css_value_flags_equal,
@@ -1253,6 +1271,7 @@ _gtk_css_font_variant_ligature_value_new (GtkCssFontVariantLigature ligatures)
value = _gtk_css_value_new (GtkCssValue, &GTK_CSS_VALUE_FONT_VARIANT_LIGATURE);
value->value = ligatures;
value->name = NULL;
value->is_computed = TRUE;
return value;
}
@@ -1319,6 +1338,7 @@ gtk_css_font_variant_numeric_value_print (const GtkCssValue *value,
}
static const GtkCssValueClass GTK_CSS_VALUE_FONT_VARIANT_NUMERIC = {
"GtkCssFontVariantNumbericValue",
gtk_css_value_enum_free,
gtk_css_value_enum_compute,
gtk_css_value_flags_equal,
@@ -1355,6 +1375,7 @@ _gtk_css_font_variant_numeric_value_new (GtkCssFontVariantNumeric numeric)
value = _gtk_css_value_new (GtkCssValue, &GTK_CSS_VALUE_FONT_VARIANT_NUMERIC);
value->value = numeric;
value->name = NULL;
value->is_computed = TRUE;
return value;
}
@@ -1422,6 +1443,7 @@ gtk_css_font_variant_east_asian_value_print (const GtkCssValue *value,
}
static const GtkCssValueClass GTK_CSS_VALUE_FONT_VARIANT_EAST_ASIAN = {
"GtkCssFontVariantEastAsianValue",
gtk_css_value_enum_free,
gtk_css_value_enum_compute,
gtk_css_value_flags_equal,
@@ -1497,6 +1519,7 @@ _gtk_css_font_variant_east_asian_value_new (GtkCssFontVariantEastAsian east_asia
value = _gtk_css_value_new (GtkCssValue, &GTK_CSS_VALUE_FONT_VARIANT_EAST_ASIAN);
value->value = east_asian;
value->name = NULL;
value->is_computed = TRUE;
return value;
}
+14 -2
View File
@@ -693,6 +693,7 @@ gtk_css_value_filter_print (const GtkCssValue *value,
}
static const GtkCssValueClass GTK_CSS_VALUE_FILTER = {
"GtkCssFilterValue",
gtk_css_value_filter_free,
gtk_css_value_filter_compute,
gtk_css_value_filter_equal,
@@ -702,7 +703,7 @@ static const GtkCssValueClass GTK_CSS_VALUE_FILTER = {
gtk_css_value_filter_print
};
static GtkCssValue none_singleton = { &GTK_CSS_VALUE_FILTER, 1, 0, { { GTK_CSS_FILTER_NONE } } };
static GtkCssValue none_singleton = { &GTK_CSS_VALUE_FILTER, 1, TRUE, 0, { { GTK_CSS_FILTER_NONE } } };
static GtkCssValue *
gtk_css_filter_value_alloc (guint n_filters)
@@ -777,6 +778,7 @@ gtk_css_filter_value_parse (GtkCssParser *parser)
GtkCssValue *value;
GArray *array;
guint i;
gboolean computed = TRUE;
if (gtk_css_parser_try_ident (parser, "none"))
return gtk_css_filter_value_new_none ();
@@ -793,6 +795,7 @@ gtk_css_filter_value_parse (GtkCssParser *parser)
goto fail;
filter.type = GTK_CSS_FILTER_BLUR;
computed = computed && gtk_css_value_is_computed (filter.blur.value);
}
else if (gtk_css_parser_has_function (parser, "brightness"))
{
@@ -800,6 +803,7 @@ gtk_css_filter_value_parse (GtkCssParser *parser)
goto fail;
filter.type = GTK_CSS_FILTER_BRIGHTNESS;
computed = computed && gtk_css_value_is_computed (filter.brightness.value);
}
else if (gtk_css_parser_has_function (parser, "contrast"))
{
@@ -807,6 +811,7 @@ gtk_css_filter_value_parse (GtkCssParser *parser)
goto fail;
filter.type = GTK_CSS_FILTER_CONTRAST;
computed = computed && gtk_css_value_is_computed (filter.contrast.value);
}
else if (gtk_css_parser_has_function (parser, "grayscale"))
{
@@ -814,13 +819,15 @@ gtk_css_filter_value_parse (GtkCssParser *parser)
goto fail;
filter.type = GTK_CSS_FILTER_GRAYSCALE;
computed = computed && gtk_css_value_is_computed (filter.grayscale.value);
}
else if (gtk_css_parser_has_function (parser, "hue-rotate"))
{
if (!gtk_css_parser_consume_function (parser, 1, 1, gtk_css_filter_parse_angle, &filter.blur.value))
if (!gtk_css_parser_consume_function (parser, 1, 1, gtk_css_filter_parse_angle, &filter.hue_rotate.value))
goto fail;
filter.type = GTK_CSS_FILTER_HUE_ROTATE;
computed = computed && gtk_css_value_is_computed (filter.hue_rotate.value);
}
else if (gtk_css_parser_has_function (parser, "invert"))
{
@@ -828,6 +835,7 @@ gtk_css_filter_value_parse (GtkCssParser *parser)
goto fail;
filter.type = GTK_CSS_FILTER_INVERT;
computed = computed && gtk_css_value_is_computed (filter.invert.value);
}
else if (gtk_css_parser_has_function (parser, "opacity"))
{
@@ -835,6 +843,7 @@ gtk_css_filter_value_parse (GtkCssParser *parser)
goto fail;
filter.type = GTK_CSS_FILTER_OPACITY;
computed = computed && gtk_css_value_is_computed (filter.opacity.value);
}
else if (gtk_css_parser_has_function (parser, "saturate"))
{
@@ -842,6 +851,7 @@ gtk_css_filter_value_parse (GtkCssParser *parser)
goto fail;
filter.type = GTK_CSS_FILTER_SATURATE;
computed = computed && gtk_css_value_is_computed (filter.saturate.value);
}
else if (gtk_css_parser_has_function (parser, "sepia"))
{
@@ -849,6 +859,7 @@ gtk_css_filter_value_parse (GtkCssParser *parser)
goto fail;
filter.type = GTK_CSS_FILTER_SEPIA;
computed = computed && gtk_css_value_is_computed (filter.sepia.value);
}
else
{
@@ -866,6 +877,7 @@ gtk_css_filter_value_parse (GtkCssParser *parser)
value = gtk_css_filter_value_alloc (array->len);
memcpy (value->filters, array->data, sizeof (GtkCssFilter) * array->len);
value->is_computed = computed;
g_array_free (array, TRUE);
+2
View File
@@ -154,6 +154,7 @@ gtk_css_value_font_features_print (const GtkCssValue *value,
}
static const GtkCssValueClass GTK_CSS_VALUE_FONT_FEATURES = {
"GtkCssFontFeaturesValue",
gtk_css_value_font_features_free,
gtk_css_value_font_features_compute,
gtk_css_value_font_features_equal,
@@ -172,6 +173,7 @@ gtk_css_font_features_value_new_empty (void)
result->features = g_hash_table_new_full (g_str_hash, g_str_equal,
g_free,
(GDestroyNotify) _gtk_css_value_unref);
result->is_computed = TRUE;
return result;
}
+2
View File
@@ -154,6 +154,7 @@ gtk_css_value_font_variations_print (const GtkCssValue *value,
}
static const GtkCssValueClass GTK_CSS_VALUE_FONT_VARIATIONS = {
"GtkCssFontVariationsValue",
gtk_css_value_font_variations_free,
gtk_css_value_font_variations_compute,
gtk_css_value_font_variations_equal,
@@ -172,6 +173,7 @@ gtk_css_font_variations_value_new_empty (void)
result->axes = g_hash_table_new_full (g_str_hash, g_str_equal,
g_free,
(GDestroyNotify) _gtk_css_value_unref);
result->is_computed = TRUE;
return result;
}
+16 -2
View File
@@ -91,7 +91,20 @@ static gboolean
gtk_css_value_icon_theme_equal (const GtkCssValue *value1,
const GtkCssValue *value2)
{
return FALSE;
GtkIconTheme *theme1 = value1->icontheme;
GtkIconTheme *theme2 = value2->icontheme;
GtkIconTheme *default_theme;
if (theme1 == theme2)
return TRUE;
if (theme1 && theme2)
return FALSE;
default_theme = gtk_icon_theme_get_default ();
return theme1 == default_theme ||
theme2 == default_theme;
}
static GtkCssValue *
@@ -111,6 +124,7 @@ gtk_css_value_icon_theme_print (const GtkCssValue *icon_theme,
}
static const GtkCssValueClass GTK_CSS_VALUE_ICON_THEME = {
"GtkCssIconThemeValue",
gtk_css_value_icon_theme_free,
gtk_css_value_icon_theme_compute,
gtk_css_value_icon_theme_equal,
@@ -120,7 +134,7 @@ static const GtkCssValueClass GTK_CSS_VALUE_ICON_THEME = {
gtk_css_value_icon_theme_print
};
static GtkCssValue default_icon_theme_value = { &GTK_CSS_VALUE_ICON_THEME, 1, NULL, 0 };
static GtkCssValue default_icon_theme_value = { &GTK_CSS_VALUE_ICON_THEME, 1, FALSE, NULL, 0 };
GtkCssValue *
gtk_css_icon_theme_value_new (GtkIconTheme *icontheme)
+13
View File
@@ -565,3 +565,16 @@ _gtk_css_image_new_parse (GtkCssParser *parser)
return image;
}
gboolean
gtk_css_image_is_computed (GtkCssImage *image)
{
GtkCssImageClass *klass = GTK_CSS_IMAGE_GET_CLASS (image);
if (!klass->is_computed)
return FALSE;
if (gtk_css_image_is_dynamic (image))
return FALSE;
return klass->is_computed (image);
}
+17
View File
@@ -414,6 +414,22 @@ gtk_css_image_cross_fade_dispose (GObject *object)
G_OBJECT_CLASS (gtk_css_image_cross_fade_parent_class)->dispose (object);
}
static gboolean
gtk_css_image_cross_fade_is_computed (GtkCssImage *image)
{
GtkCssImageCrossFade *cross_fade = GTK_CSS_IMAGE_CROSS_FADE (image);
guint i;
for (i = 0; i < cross_fade->images->len; i++)
{
const CrossFadeEntry *entry = &g_array_index (cross_fade->images, CrossFadeEntry, i);
if (!gtk_css_image_is_computed (entry->image))
return FALSE;
}
return TRUE;
}
static void
gtk_css_image_cross_fade_class_init (GtkCssImageCrossFadeClass *klass)
{
@@ -429,6 +445,7 @@ gtk_css_image_cross_fade_class_init (GtkCssImageCrossFadeClass *klass)
image_class->get_dynamic_image = gtk_css_image_cross_fade_get_dynamic_image;
image_class->parse = gtk_css_image_cross_fade_parse;
image_class->print = gtk_css_image_cross_fade_print;
image_class->is_computed = gtk_css_image_cross_fade_is_computed;
object_class->dispose = gtk_css_image_cross_fade_dispose;
}
+42 -10
View File
@@ -21,7 +21,7 @@
#include "gtkcssimagefallbackprivate.h"
#include "gtkcsscolorvalueprivate.h"
#include "gtkcssrgbavalueprivate.h"
#include "gtkcsscolorvalueprivate.h"
#include "gtkstyleproviderprivate.h"
@@ -74,7 +74,7 @@ gtk_css_image_fallback_snapshot (GtkCssImage *image,
const GdkRGBA *color;
if (fallback->color)
color = _gtk_css_rgba_value_get_rgba (fallback->color);
color = gtk_css_color_value_get_rgba (fallback->color);
else
color = &red;
@@ -142,6 +142,20 @@ gtk_css_image_fallback_compute (GtkCssImage *image,
if (fallback->used < 0)
{
GtkCssValue *computed_color = NULL;
if (fallback->color)
computed_color= _gtk_css_value_compute (fallback->color,
property_id,
provider,
style,
parent_style);
/* image($color) that didn't change */
if (computed_color && !fallback->images &&
computed_color == fallback->color)
return g_object_ref (image);
copy = g_object_new (_gtk_css_image_fallback_get_type (), NULL);
copy->n_images = fallback->n_images;
copy->images = g_new (GtkCssImage *, fallback->n_images);
@@ -160,14 +174,7 @@ gtk_css_image_fallback_compute (GtkCssImage *image,
copy->used = i;
}
if (fallback->color)
copy->color = _gtk_css_value_compute (fallback->color,
property_id,
provider,
style,
parent_style);
else
copy->color = NULL;
copy->color = computed_color;
return GTK_CSS_IMAGE (copy);
}
@@ -263,6 +270,30 @@ gtk_css_image_fallback_equal (GtkCssImage *image1,
fallback2->images[fallback2->used]);
}
static gboolean
gtk_css_image_fallback_is_computed (GtkCssImage *image)
{
GtkCssImageFallback *fallback = GTK_CSS_IMAGE_FALLBACK (image);
if (fallback->used < 0)
{
guint i;
if (fallback->color && !fallback->images)
return gtk_css_value_is_computed (fallback->color);
for (i = 0; i < fallback->n_images; i++)
{
if (!gtk_css_image_is_computed (fallback->images[i]))
{
return FALSE;
}
}
}
return TRUE;
}
static void
_gtk_css_image_fallback_class_init (GtkCssImageFallbackClass *klass)
{
@@ -277,6 +308,7 @@ _gtk_css_image_fallback_class_init (GtkCssImageFallbackClass *klass)
image_class->compute = gtk_css_image_fallback_compute;
image_class->print = gtk_css_image_fallback_print;
image_class->equal = gtk_css_image_fallback_equal;
image_class->is_computed = gtk_css_image_fallback_is_computed;
object_class->dispose = gtk_css_image_fallback_dispose;
}
-1
View File
@@ -24,7 +24,6 @@
#include <math.h>
#include "gtkcssiconthemevalueprivate.h"
#include "gtkcssrgbavalueprivate.h"
#include "gtksettingsprivate.h"
#include "gtksnapshot.h"
#include "gtkstyleproviderprivate.h"
+158 -90
View File
@@ -25,7 +25,7 @@
#include "gtkcsscolorvalueprivate.h"
#include "gtkcssnumbervalueprivate.h"
#include "gtkcssrgbavalueprivate.h"
#include "gtkcsscolorvalueprivate.h"
#include "gtkcssprovider.h"
G_DEFINE_TYPE (GtkCssImageLinear, _gtk_css_image_linear, GTK_TYPE_CSS_IMAGE)
@@ -36,13 +36,13 @@ gtk_css_image_linear_get_repeating_start_end (GtkCssImageLinear *linear,
double *start,
double *end)
{
GtkCssImageLinearColorStop *stop;
const GtkCssImageLinearColorStop *stop;
double pos;
guint i;
g_assert (linear->repeating);
stop = &g_array_index (linear->stops, GtkCssImageLinearColorStop, 0);
stop = &linear->color_stops[0];
if (stop->offset == NULL)
*start = 0;
else
@@ -50,9 +50,9 @@ gtk_css_image_linear_get_repeating_start_end (GtkCssImageLinear *linear,
*end = *start;
for (i = 0; i < linear->stops->len; i++)
for (i = 0; i < linear->n_stops; i++)
{
stop = &g_array_index (linear->stops, GtkCssImageLinearColorStop, i);
stop = &linear->color_stops[i];
if (stop->offset == NULL)
continue;
@@ -190,11 +190,10 @@ gtk_css_image_linear_snapshot (GtkCssImage *image,
{
/* repeating gradients with all color stops sharing the same offset
* get the color of the last color stop */
GtkCssImageLinearColorStop *stop = &g_array_index (linear->stops, GtkCssImageLinearColorStop,
linear->stops->len - 1);
const GtkCssImageLinearColorStop *stop = &linear->color_stops[linear->n_stops - 1];
gtk_snapshot_append_color (snapshot,
_gtk_css_rgba_value_get_rgba (stop->color),
gtk_css_color_value_get_rgba (stop->color),
&GRAPHENE_RECT_INIT (0, 0, width, height));
return;
}
@@ -207,20 +206,18 @@ gtk_css_image_linear_snapshot (GtkCssImage *image,
offset = start;
last = -1;
stops = g_newa (GskColorStop, linear->stops->len);
stops = g_newa (GskColorStop, linear->n_stops);
for (i = 0; i < linear->stops->len; i++)
for (i = 0; i < linear->n_stops; i++)
{
GtkCssImageLinearColorStop *stop;
const GtkCssImageLinearColorStop *stop = &linear->color_stops[i];
double pos, step;
stop = &g_array_index (linear->stops, GtkCssImageLinearColorStop, i);
if (stop->offset == NULL)
{
if (i == 0)
pos = 0.0;
else if (i + 1 == linear->stops->len)
else if (i + 1 == linear->n_stops)
pos = 1.0;
else
continue;
@@ -235,12 +232,12 @@ gtk_css_image_linear_snapshot (GtkCssImage *image,
step = (pos - offset) / (i - last);
for (last = last + 1; last <= i; last++)
{
stop = &g_array_index (linear->stops, GtkCssImageLinearColorStop, last);
stop = &linear->color_stops[last];
offset += step;
stops[last].offset = (offset - start) / (end - start);
stops[last].color = *_gtk_css_rgba_value_get_rgba (stop->color);
stops[last].color = *gtk_css_color_value_get_rgba (stop->color);
}
offset = pos;
@@ -255,7 +252,7 @@ gtk_css_image_linear_snapshot (GtkCssImage *image,
&GRAPHENE_POINT_INIT (width / 2 + x * (start - 0.5), height / 2 + y * (start - 0.5)),
&GRAPHENE_POINT_INIT (width / 2 + x * (end - 0.5), height / 2 + y * (end - 0.5)),
stops,
linear->stops->len);
linear->n_stops);
}
else
{
@@ -265,13 +262,14 @@ gtk_css_image_linear_snapshot (GtkCssImage *image,
&GRAPHENE_POINT_INIT (width / 2 + x * (start - 0.5), height / 2 + y * (start - 0.5)),
&GRAPHENE_POINT_INIT (width / 2 + x * (end - 0.5), height / 2 + y * (end - 0.5)),
stops,
linear->stops->len);
linear->n_stops);
}
}
static guint
gtk_css_image_linear_parse_color_stop (GtkCssImageLinear *self,
GtkCssParser *parser)
GtkCssParser *parser,
GArray *stop_array)
{
GtkCssImageLinearColorStop stop;
@@ -295,14 +293,15 @@ gtk_css_image_linear_parse_color_stop (GtkCssImageLinear *self,
stop.offset = NULL;
}
g_array_append_val (self->stops, stop);
g_array_append_val (stop_array, stop);
return 1;
}
static guint
gtk_css_image_linear_parse_first_arg (GtkCssImageLinear *linear,
GtkCssParser *parser)
GtkCssParser *parser,
GArray *stop_array)
{
guint i;
@@ -363,31 +362,37 @@ gtk_css_image_linear_parse_first_arg (GtkCssImageLinear *linear,
linear->angle = _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_ANGLE);
if (linear->angle == NULL)
return 0;
return 1;
}
else
{
linear->side = 1 << GTK_CSS_BOTTOM;
if (!gtk_css_image_linear_parse_color_stop (linear, parser))
if (!gtk_css_image_linear_parse_color_stop (linear, parser, stop_array))
return 0;
return 2;
}
}
typedef struct
{
GtkCssImageLinear *self;
GArray *stop_array;
} ParseData;
static guint
gtk_css_image_linear_parse_arg (GtkCssParser *parser,
guint arg,
gpointer data)
gpointer user_data)
{
GtkCssImageLinear *self = data;
ParseData *parse_data = user_data;
GtkCssImageLinear *self = parse_data->self;
if (arg == 0)
return gtk_css_image_linear_parse_first_arg (self, parser);
return gtk_css_image_linear_parse_first_arg (self, parser, parse_data->stop_array);
else
return gtk_css_image_linear_parse_color_stop (self, parser);
return gtk_css_image_linear_parse_color_stop (self, parser, parse_data->stop_array);
}
static gboolean
@@ -395,6 +400,8 @@ gtk_css_image_linear_parse (GtkCssImage *image,
GtkCssParser *parser)
{
GtkCssImageLinear *self = GTK_CSS_IMAGE_LINEAR (image);
ParseData parse_data;
gboolean success;
if (gtk_css_parser_has_function (parser, "repeating-linear-gradient"))
self->repeating = TRUE;
@@ -406,7 +413,22 @@ gtk_css_image_linear_parse (GtkCssImage *image,
return FALSE;
}
return gtk_css_parser_consume_function (parser, 3, G_MAXUINT, gtk_css_image_linear_parse_arg, self);
parse_data.self = self;
parse_data.stop_array = g_array_new (TRUE, FALSE, sizeof (GtkCssImageLinearColorStop));
success = gtk_css_parser_consume_function (parser, 3, G_MAXUINT, gtk_css_image_linear_parse_arg, &parse_data);
if (!success)
{
g_array_free (parse_data.stop_array, TRUE);
}
else
{
self->n_stops = parse_data.stop_array->len;
self->color_stops = (GtkCssImageLinearColorStop *)g_array_free (parse_data.stop_array, FALSE);
}
return success;
}
static void
@@ -446,15 +468,13 @@ gtk_css_image_linear_print (GtkCssImage *image,
g_string_append (string, ", ");
}
for (i = 0; i < linear->stops->len; i++)
for (i = 0; i < linear->n_stops; i++)
{
GtkCssImageLinearColorStop *stop;
const GtkCssImageLinearColorStop *stop = &linear->color_stops[i];
if (i > 0)
g_string_append (string, ", ");
stop = &g_array_index (linear->stops, GtkCssImageLinearColorStop, i);
_gtk_css_value_print (stop->color, string);
if (stop->offset)
@@ -463,7 +483,7 @@ gtk_css_image_linear_print (GtkCssImage *image,
_gtk_css_value_print (stop->offset, string);
}
}
g_string_append (string, ")");
}
@@ -475,26 +495,27 @@ gtk_css_image_linear_compute (GtkCssImage *image,
GtkCssStyle *parent_style)
{
GtkCssImageLinear *linear = GTK_CSS_IMAGE_LINEAR (image);
gboolean changed = FALSE;
GtkCssImageLinearColorStop *stops;
GtkCssValue *computed_angle = NULL;
GtkCssImageLinear *copy;
guint i;
copy = g_object_new (GTK_TYPE_CSS_IMAGE_LINEAR, NULL);
copy->repeating = linear->repeating;
copy->side = linear->side;
if (linear->angle)
copy->angle = _gtk_css_value_compute (linear->angle, property_id, provider, style, parent_style);
g_array_set_size (copy->stops, linear->stops->len);
for (i = 0; i < linear->stops->len; i++)
{
GtkCssImageLinearColorStop *stop, *scopy;
computed_angle = _gtk_css_value_compute (linear->angle, property_id, provider, style, parent_style);
changed |= (computed_angle != linear->angle);
}
stops = g_alloca (sizeof (GtkCssImageLinearColorStop) * linear->n_stops);
for (i = 0; i < linear->n_stops; i++)
{
const GtkCssImageLinearColorStop *stop = &linear->color_stops[i];
GtkCssImageLinearColorStop *scopy = &stops[i];
stop = &g_array_index (linear->stops, GtkCssImageLinearColorStop, i);
scopy = &g_array_index (copy->stops, GtkCssImageLinearColorStop, i);
scopy->color = _gtk_css_value_compute (stop->color, property_id, provider, style, parent_style);
changed |= (scopy->color != stop->color);
if (stop->offset)
{
scopy->offset = _gtk_css_value_compute (stop->offset, property_id, provider, style, parent_style);
@@ -505,6 +526,30 @@ gtk_css_image_linear_compute (GtkCssImage *image,
}
}
if (!changed)
{
if (computed_angle)
_gtk_css_value_unref (computed_angle);
for (i = 0; i < linear->n_stops; i ++)
{
_gtk_css_value_unref (stops[i].color);
if (stops[i].offset)
_gtk_css_value_unref (stops[i].offset);
}
return g_object_ref (image);
}
copy = g_object_new (GTK_TYPE_CSS_IMAGE_LINEAR, NULL);
copy->repeating = linear->repeating;
copy->side = linear->side;
copy->angle = computed_angle;
copy->n_stops = linear->n_stops;
copy->color_stops = g_malloc (sizeof (GtkCssImageLinearColorStop) * copy->n_stops);
memcpy (copy->color_stops, stops, sizeof (GtkCssImageLinearColorStop ) * linear->n_stops);
return GTK_CSS_IMAGE (copy);
}
@@ -528,7 +573,7 @@ gtk_css_image_linear_transition (GtkCssImage *start_image,
end = GTK_CSS_IMAGE_LINEAR (end_image);
if ((start->repeating != end->repeating)
|| (start->stops->len != end->stops->len))
|| (start->n_stops != end->n_stops))
return GTK_CSS_IMAGE_CLASS (_gtk_css_image_linear_parent_class)->transition (start_image, end_image, property_id, progress);
result = g_object_new (GTK_TYPE_CSS_IMAGE_LINEAR, NULL);
@@ -542,43 +587,45 @@ gtk_css_image_linear_transition (GtkCssImage *start_image,
result->angle = _gtk_css_value_transition (start->angle, end->angle, property_id, progress);
if (result->angle == NULL)
goto fail;
for (i = 0; i < start->stops->len; i++)
{
GtkCssImageLinearColorStop stop, *start_stop, *end_stop;
start_stop = &g_array_index (start->stops, GtkCssImageLinearColorStop, i);
end_stop = &g_array_index (end->stops, GtkCssImageLinearColorStop, i);
/* Maximum amountof stops */
result->color_stops = g_malloc (sizeof (GtkCssImageLinearColorStop) * start->n_stops);
result->n_stops = 0;
for (i = 0; i < start->n_stops; i++)
{
const GtkCssImageLinearColorStop *start_stop = &start->color_stops[i];
const GtkCssImageLinearColorStop *end_stop = &end->color_stops[i];
GtkCssImageLinearColorStop *stop = &result->color_stops[i];
if ((start_stop->offset != NULL) != (end_stop->offset != NULL))
goto fail;
if (start_stop->offset == NULL)
{
stop.offset = NULL;
stop->offset = NULL;
}
else
{
stop.offset = _gtk_css_value_transition (start_stop->offset,
end_stop->offset,
property_id,
progress);
if (stop.offset == NULL)
stop->offset = _gtk_css_value_transition (start_stop->offset,
end_stop->offset,
property_id,
progress);
if (stop->offset == NULL)
goto fail;
}
stop.color = _gtk_css_value_transition (start_stop->color,
end_stop->color,
property_id,
progress);
if (stop.color == NULL)
stop->color = _gtk_css_value_transition (start_stop->color,
end_stop->color,
property_id,
progress);
if (stop->color == NULL)
{
if (stop.offset)
_gtk_css_value_unref (stop.offset);
if (stop->offset)
_gtk_css_value_unref (stop->offset);
goto fail;
}
g_array_append_val (result->stops, stop);
result->n_stops ++;
}
return GTK_CSS_IMAGE (result);
@@ -599,15 +646,13 @@ gtk_css_image_linear_equal (GtkCssImage *image1,
if (linear1->repeating != linear2->repeating ||
linear1->side != linear2->side ||
(linear1->side == 0 && !_gtk_css_value_equal (linear1->angle, linear2->angle)) ||
linear1->stops->len != linear2->stops->len)
linear1->n_stops != linear2->n_stops)
return FALSE;
for (i = 0; i < linear1->stops->len; i++)
for (i = 0; i < linear1->n_stops; i++)
{
GtkCssImageLinearColorStop *stop1, *stop2;
stop1 = &g_array_index (linear1->stops, GtkCssImageLinearColorStop, i);
stop2 = &g_array_index (linear2->stops, GtkCssImageLinearColorStop, i);
const GtkCssImageLinearColorStop *stop1 = &linear1->color_stops[i];
const GtkCssImageLinearColorStop *stop2 = &linear2->color_stops[i];
if (!_gtk_css_value_equal0 (stop1->offset, stop2->offset) ||
!_gtk_css_value_equal (stop1->color, stop2->color))
@@ -621,12 +666,17 @@ static void
gtk_css_image_linear_dispose (GObject *object)
{
GtkCssImageLinear *linear = GTK_CSS_IMAGE_LINEAR (object);
guint i;
if (linear->stops)
for (i = 0; i < linear->n_stops; i ++)
{
g_array_free (linear->stops, TRUE);
linear->stops = NULL;
GtkCssImageLinearColorStop *stop = &linear->color_stops[i];
_gtk_css_value_unref (stop->color);
if (stop->offset)
_gtk_css_value_unref (stop->offset);
}
g_free (linear->color_stops);
linear->side = 0;
if (linear->angle)
@@ -638,6 +688,35 @@ gtk_css_image_linear_dispose (GObject *object)
G_OBJECT_CLASS (_gtk_css_image_linear_parent_class)->dispose (object);
}
static gboolean
gtk_css_image_linear_is_computed (GtkCssImage *image)
{
GtkCssImageLinear *linear = GTK_CSS_IMAGE_LINEAR (image);
guint i;
gboolean computed = TRUE;
computed = !linear->angle || gtk_css_value_is_computed (linear->angle);
for (i = 0; i < linear->n_stops; i ++)
{
const GtkCssImageLinearColorStop *stop = &linear->color_stops[i];
if (stop->offset && !gtk_css_value_is_computed (stop->offset))
{
computed = FALSE;
break;
}
if (!gtk_css_value_is_computed (stop->color))
{
computed = FALSE;
break;
}
}
return computed;
}
static void
_gtk_css_image_linear_class_init (GtkCssImageLinearClass *klass)
{
@@ -650,24 +729,13 @@ _gtk_css_image_linear_class_init (GtkCssImageLinearClass *klass)
image_class->compute = gtk_css_image_linear_compute;
image_class->equal = gtk_css_image_linear_equal;
image_class->transition = gtk_css_image_linear_transition;
image_class->is_computed = gtk_css_image_linear_is_computed;
object_class->dispose = gtk_css_image_linear_dispose;
}
static void
gtk_css_image_clear_color_stop (gpointer color_stop)
{
GtkCssImageLinearColorStop *stop = color_stop;
_gtk_css_value_unref (stop->color);
if (stop->offset)
_gtk_css_value_unref (stop->offset);
}
static void
_gtk_css_image_linear_init (GtkCssImageLinear *linear)
{
linear->stops = g_array_new (FALSE, FALSE, sizeof (GtkCssImageLinearColorStop));
g_array_set_clear_func (linear->stops, gtk_css_image_clear_color_stop);
}
+5 -3
View File
@@ -45,10 +45,12 @@ struct _GtkCssImageLinear
{
GtkCssImage parent;
guint side; /* side the gradient should go to or 0 for angle */
GtkCssValue *angle;
GArray *stops;
guint side; /* side the gradient should go to or 0 for angle */
guint repeating :1;
GtkCssValue *angle;
guint n_stops;
GtkCssImageLinearColorStop *color_stops;
};
struct _GtkCssImageLinearClass
+3
View File
@@ -89,6 +89,7 @@ struct _GtkCssImageClass
/* print to CSS */
void (* print) (GtkCssImage *image,
GString *string);
gboolean (* is_computed) (GtkCssImage *image);
};
GType _gtk_css_image_get_type (void) G_GNUC_CONST;
@@ -139,6 +140,8 @@ cairo_surface_t *
cairo_surface_t *target,
int surface_width,
int surface_height);
gboolean gtk_css_image_is_computed (GtkCssImage *image);
G_END_DECLS
+159 -81
View File
@@ -26,7 +26,7 @@
#include "gtkcsscolorvalueprivate.h"
#include "gtkcssnumbervalueprivate.h"
#include "gtkcsspositionvalueprivate.h"
#include "gtkcssrgbavalueprivate.h"
#include "gtkcsscolorvalueprivate.h"
#include "gtkcssprovider.h"
G_DEFINE_TYPE (GtkCssImageRadial, _gtk_css_image_radial, GTK_TYPE_CSS_IMAGE)
@@ -37,13 +37,13 @@ gtk_css_image_radial_get_start_end (GtkCssImageRadial *radial,
double *start,
double *end)
{
GtkCssImageRadialColorStop *stop;
const GtkCssImageRadialColorStop *stop;
double pos;
guint i;
if (radial->repeating)
{
stop = &g_array_index (radial->stops, GtkCssImageRadialColorStop, 0);
stop = &radial->color_stops[0];
if (stop->offset == NULL)
*start = 0;
else
@@ -51,9 +51,9 @@ gtk_css_image_radial_get_start_end (GtkCssImageRadial *radial,
*end = *start;
for (i = 0; i < radial->stops->len; i++)
for (i = 0; i < radial->n_stops; i++)
{
stop = &g_array_index (radial->stops, GtkCssImageRadialColorStop, i);
stop = &radial->color_stops[i];
if (stop->offset == NULL)
continue;
@@ -181,18 +181,16 @@ gtk_css_image_radial_snapshot (GtkCssImage *image,
offset = start;
last = -1;
for (i = 0; i < radial->stops->len; i++)
for (i = 0; i < radial->n_stops; i++)
{
GtkCssImageRadialColorStop *stop;
const GtkCssImageRadialColorStop *stop = &radial->color_stops[i];
double pos, step;
stop = &g_array_index (radial->stops, GtkCssImageRadialColorStop, i);
if (stop->offset == NULL)
{
if (i == 0)
pos = 0.0;
else if (i + 1 == radial->stops->len)
else if (i + 1 == radial->n_stops)
pos = 1.0;
else
continue;
@@ -206,9 +204,9 @@ gtk_css_image_radial_snapshot (GtkCssImage *image,
{
const GdkRGBA *rgba;
stop = &g_array_index (radial->stops, GtkCssImageRadialColorStop, last);
stop = &radial->color_stops[last];
rgba = _gtk_css_rgba_value_get_rgba (stop->color);
rgba = gtk_css_color_value_get_rgba (stop->color);
offset += step;
cairo_pattern_add_color_stop_rgba (pattern,
@@ -235,7 +233,8 @@ gtk_css_image_radial_snapshot (GtkCssImage *image,
static guint
gtk_css_image_radial_parse_color_stop (GtkCssImageRadial *radial,
GtkCssParser *parser)
GtkCssParser *parser,
GArray *stop_array)
{
GtkCssImageRadialColorStop stop;
@@ -259,14 +258,15 @@ gtk_css_image_radial_parse_color_stop (GtkCssImageRadial *radial,
stop.offset = NULL;
}
g_array_append_val (radial->stops, stop);
g_array_append_val (stop_array, stop);
return 1;
}
static guint
gtk_css_image_radial_parse_first_arg (GtkCssImageRadial *radial,
GtkCssParser *parser)
GtkCssParser *parser,
GArray *stop_array)
{
gboolean has_shape = FALSE;
gboolean has_size = FALSE;
@@ -379,23 +379,30 @@ gtk_css_image_radial_parse_first_arg (GtkCssImageRadial *radial,
if (found_one)
return 1;
if (!gtk_css_image_radial_parse_color_stop (radial, parser))
if (!gtk_css_image_radial_parse_color_stop (radial, parser, stop_array))
return 0;
return 2;
}
typedef struct
{
GtkCssImageRadial *self;
GArray *stop_array;
} ParseData;
static guint
gtk_css_image_radial_parse_arg (GtkCssParser *parser,
guint arg,
gpointer data)
gpointer user_data)
{
GtkCssImageRadial *self = data;
ParseData *parse_data = user_data;
GtkCssImageRadial *self = parse_data->self;
if (arg == 0)
return gtk_css_image_radial_parse_first_arg (self, parser);
return gtk_css_image_radial_parse_first_arg (self, parser, parse_data->stop_array);
else
return gtk_css_image_radial_parse_color_stop (self, parser);
return gtk_css_image_radial_parse_color_stop (self, parser, parse_data->stop_array);
}
@@ -404,6 +411,8 @@ gtk_css_image_radial_parse (GtkCssImage *image,
GtkCssParser *parser)
{
GtkCssImageRadial *self = GTK_CSS_IMAGE_RADIAL (image);
ParseData parse_data;
gboolean success;
if (gtk_css_parser_has_function (parser, "repeating-radial-gradient"))
self->repeating = TRUE;
@@ -415,7 +424,22 @@ gtk_css_image_radial_parse (GtkCssImage *image,
return FALSE;
}
return gtk_css_parser_consume_function (parser, 3, G_MAXUINT, gtk_css_image_radial_parse_arg, self);
parse_data.self = self;
parse_data.stop_array = g_array_new (TRUE, FALSE, sizeof (GtkCssImageRadialColorStop));
success = gtk_css_parser_consume_function (parser, 3, G_MAXUINT, gtk_css_image_radial_parse_arg, &parse_data);
if (!success)
{
g_array_free (parse_data.stop_array, TRUE);
}
else
{
self->n_stops = parse_data.stop_array->len;
self->color_stops = (GtkCssImageRadialColorStop *)g_array_free (parse_data.stop_array, FALSE);
}
return success;
}
static void
@@ -460,15 +484,13 @@ gtk_css_image_radial_print (GtkCssImage *image,
g_string_append (string, ", ");
for (i = 0; i < radial->stops->len; i++)
for (i = 0; i < radial->n_stops; i++)
{
GtkCssImageRadialColorStop *stop;
const GtkCssImageRadialColorStop *stop = &radial->color_stops[i];
if (i > 0)
g_string_append (string, ", ");
stop = &g_array_index (radial->stops, GtkCssImageRadialColorStop, i);
_gtk_css_value_print (stop->color, string);
if (stop->offset)
@@ -489,35 +511,41 @@ gtk_css_image_radial_compute (GtkCssImage *image,
GtkCssStyle *parent_style)
{
GtkCssImageRadial *radial = GTK_CSS_IMAGE_RADIAL (image);
GtkCssValue *computed_position, *computed_size1 = NULL, *computed_size2 = NULL;
gboolean changed = FALSE;
GtkCssImageRadialColorStop *stops;
GtkCssImageRadial *copy;
guint i;
copy = g_object_new (GTK_TYPE_CSS_IMAGE_RADIAL, NULL);
copy->repeating = radial->repeating;
copy->circle = radial->circle;
copy->size = radial->size;
copy->position = _gtk_css_value_compute (radial->position, property_id, provider, style, parent_style);
computed_position = _gtk_css_value_compute (radial->position, property_id, provider, style, parent_style);
changed |= (computed_position != radial->position);
if (radial->sizes[0])
copy->sizes[0] = _gtk_css_value_compute (radial->sizes[0], property_id, provider, style, parent_style);
{
computed_size1 = _gtk_css_value_compute (radial->sizes[0], property_id, provider, style, parent_style);
changed |= (computed_size1 != radial->sizes[0]);
}
if (radial->sizes[1])
copy->sizes[1] = _gtk_css_value_compute (radial->sizes[1], property_id, provider, style, parent_style);
g_array_set_size (copy->stops, radial->stops->len);
for (i = 0; i < radial->stops->len; i++)
{
GtkCssImageRadialColorStop *stop, *scopy;
computed_size2 = _gtk_css_value_compute (radial->sizes[1], property_id, provider, style, parent_style);
changed |= (computed_size2 != radial->sizes[1]);
}
stop = &g_array_index (radial->stops, GtkCssImageRadialColorStop, i);
scopy = &g_array_index (copy->stops, GtkCssImageRadialColorStop, i);
stops = g_alloca (sizeof (GtkCssImageRadialColorStop) * radial->n_stops);
for (i = 0; i < radial->n_stops; i++)
{
const GtkCssImageRadialColorStop *stop = &radial->color_stops[i];
GtkCssImageRadialColorStop *scopy = &stops[i];
scopy->color = _gtk_css_value_compute (stop->color, property_id, provider, style, parent_style);
changed |= (scopy->color != stop->color);
if (stop->offset)
{
scopy->offset = _gtk_css_value_compute (stop->offset, property_id, provider, style, parent_style);
changed |= (scopy->offset != stop->offset);
}
else
{
@@ -525,6 +553,33 @@ gtk_css_image_radial_compute (GtkCssImage *image,
}
}
if (!changed)
{
_gtk_css_value_unref (computed_position);
if (computed_size1)
_gtk_css_value_unref (computed_size1);
if (computed_size2)
_gtk_css_value_unref (computed_size2);
for (i = 0; i < radial->n_stops; i ++)
{
_gtk_css_value_unref (stops[i].color);
if (stops[i].offset)
_gtk_css_value_unref (stops[i].offset);
}
return g_object_ref (image);
}
copy = g_object_new (GTK_TYPE_CSS_IMAGE_RADIAL, NULL);
copy->repeating = radial->repeating;
copy->circle = radial->circle;
copy->size = radial->size;
copy->n_stops = radial->n_stops;
copy->color_stops = g_malloc (sizeof (GtkCssImageRadialColorStop) * copy->n_stops);
memcpy (copy->color_stops, stops, sizeof (GtkCssImageRadialColorStop ) * radial->n_stops);
return GTK_CSS_IMAGE (copy);
}
@@ -548,7 +603,7 @@ gtk_css_image_radial_transition (GtkCssImage *start_image,
end = GTK_CSS_IMAGE_RADIAL (end_image);
if (start->repeating != end->repeating ||
start->stops->len != end->stops->len ||
start->n_stops != end->n_stops ||
start->size != end->size ||
start->circle != end->circle)
return GTK_CSS_IMAGE_CLASS (_gtk_css_image_radial_parent_class)->transition (start_image, end_image, property_id, progress);
@@ -580,42 +635,43 @@ gtk_css_image_radial_transition (GtkCssImage *start_image,
else
result->sizes[1] = 0;
for (i = 0; i < start->stops->len; i++)
result->color_stops = g_malloc (sizeof (GtkCssImageRadialColorStop) * start->n_stops);
result->n_stops = 0;
for (i = 0; i < start->n_stops; i++)
{
GtkCssImageRadialColorStop stop, *start_stop, *end_stop;
start_stop = &g_array_index (start->stops, GtkCssImageRadialColorStop, i);
end_stop = &g_array_index (end->stops, GtkCssImageRadialColorStop, i);
const GtkCssImageRadialColorStop *start_stop = &start->color_stops[i];
const GtkCssImageRadialColorStop *end_stop = &end->color_stops[i];
GtkCssImageRadialColorStop *stop = &result->color_stops[i];
if ((start_stop->offset != NULL) != (end_stop->offset != NULL))
goto fail;
if (start_stop->offset == NULL)
{
stop.offset = NULL;
stop->offset = NULL;
}
else
{
stop.offset = _gtk_css_value_transition (start_stop->offset,
end_stop->offset,
property_id,
progress);
if (stop.offset == NULL)
stop->offset = _gtk_css_value_transition (start_stop->offset,
end_stop->offset,
property_id,
progress);
if (stop->offset == NULL)
goto fail;
}
stop.color = _gtk_css_value_transition (start_stop->color,
end_stop->color,
property_id,
progress);
if (stop.color == NULL)
stop->color = _gtk_css_value_transition (start_stop->color,
end_stop->color,
property_id,
progress);
if (stop->color == NULL)
{
if (stop.offset)
_gtk_css_value_unref (stop.offset);
if (stop->offset)
_gtk_css_value_unref (stop->offset);
goto fail;
}
g_array_append_val (result->stops, stop);
result->n_stops++;
}
return GTK_CSS_IMAGE (result);
@@ -640,15 +696,13 @@ gtk_css_image_radial_equal (GtkCssImage *image1,
(radial1->sizes[0] && radial2->sizes[0] && !_gtk_css_value_equal (radial1->sizes[0], radial2->sizes[0])) ||
((radial1->sizes[1] == NULL) != (radial2->sizes[1] == NULL)) ||
(radial1->sizes[1] && radial2->sizes[1] && !_gtk_css_value_equal (radial1->sizes[1], radial2->sizes[1])) ||
radial1->stops->len != radial2->stops->len)
radial1->n_stops != radial2->n_stops)
return FALSE;
for (i = 0; i < radial1->stops->len; i++)
for (i = 0; i < radial1->n_stops; i++)
{
GtkCssImageRadialColorStop *stop1, *stop2;
stop1 = &g_array_index (radial1->stops, GtkCssImageRadialColorStop, i);
stop2 = &g_array_index (radial2->stops, GtkCssImageRadialColorStop, i);
const GtkCssImageRadialColorStop *stop1 = &radial1->color_stops[i];
const GtkCssImageRadialColorStop *stop2 = &radial2->color_stops[i];
if (!_gtk_css_value_equal0 (stop1->offset, stop2->offset) ||
!_gtk_css_value_equal (stop1->color, stop2->color))
@@ -662,13 +716,17 @@ static void
gtk_css_image_radial_dispose (GObject *object)
{
GtkCssImageRadial *radial = GTK_CSS_IMAGE_RADIAL (object);
int i;
guint i;
if (radial->stops)
for (i = 0; i < radial->n_stops; i ++)
{
g_array_free (radial->stops, TRUE);
radial->stops = NULL;
GtkCssImageRadialColorStop *stop = &radial->color_stops[i];
_gtk_css_value_unref (stop->color);
if (stop->offset)
_gtk_css_value_unref (stop->offset);
}
g_free (radial->color_stops);
if (radial->position)
{
@@ -686,6 +744,37 @@ gtk_css_image_radial_dispose (GObject *object)
G_OBJECT_CLASS (_gtk_css_image_radial_parent_class)->dispose (object);
}
static gboolean
gtk_css_image_radial_is_computed (GtkCssImage *image)
{
GtkCssImageRadial *radial = GTK_CSS_IMAGE_RADIAL (image);
guint i;
gboolean computed = TRUE;
computed = computed && (!radial->position || gtk_css_value_is_computed (radial->position));
computed = computed && (!radial->sizes[0] || gtk_css_value_is_computed (radial->sizes[0]));
computed = computed && (!radial->sizes[1] || gtk_css_value_is_computed (radial->sizes[1]));
if (computed)
for (i = 0; i < radial->n_stops; i ++)
{
const GtkCssImageRadialColorStop *stop = &radial->color_stops[i];
if (stop->offset && !gtk_css_value_is_computed (stop->offset))
{
computed = FALSE;
break;
}
if (!gtk_css_value_is_computed (stop->color))
{
computed = FALSE;
break;
}
}
return computed;
}
static void
_gtk_css_image_radial_class_init (GtkCssImageRadialClass *klass)
{
@@ -698,24 +787,13 @@ _gtk_css_image_radial_class_init (GtkCssImageRadialClass *klass)
image_class->compute = gtk_css_image_radial_compute;
image_class->transition = gtk_css_image_radial_transition;
image_class->equal = gtk_css_image_radial_equal;
image_class->is_computed = gtk_css_image_radial_is_computed;
object_class->dispose = gtk_css_image_radial_dispose;
}
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_image_radial_init (GtkCssImageRadial *radial)
{
radial->stops = g_array_new (FALSE, FALSE, sizeof (GtkCssImageRadialColorStop));
g_array_set_clear_func (radial->stops, gtk_css_image_clear_color_stop);
}
+2 -1
View File
@@ -55,7 +55,8 @@ struct _GtkCssImageRadial
GtkCssValue *position;
GtkCssValue *sizes[2];
GArray *stops;
guint n_stops;
GtkCssImageRadialColorStop *color_stops;
GtkCssRadialSize size;
guint circle : 1;
guint repeating :1;
+2 -2
View File
@@ -22,7 +22,7 @@
#include "gtkcssimagerecolorprivate.h"
#include "gtkcssimageprivate.h"
#include "gtkcsspalettevalueprivate.h"
#include "gtkcssrgbavalueprivate.h"
#include "gtkcsscolorvalueprivate.h"
#include "gtkiconthemeprivate.h"
#include "gdkpixbufutilsprivate.h"
@@ -74,7 +74,7 @@ lookup_symbolic_colors (GtkCssStyle *style,
const GdkRGBA *lookup;
color = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_COLOR);
*color_out = *_gtk_css_rgba_value_get_rgba (color);
*color_out = *gtk_css_color_value_get_rgba (color);
lookup = gtk_css_palette_value_get_color (palette, "success");
if (lookup)
+3 -1
View File
@@ -123,6 +123,7 @@ gtk_css_value_image_print (const GtkCssValue *value,
}
static const GtkCssValueClass GTK_CSS_VALUE_IMAGE = {
"GtkCssImageValue",
gtk_css_value_image_free,
gtk_css_value_image_compute,
gtk_css_value_image_equal,
@@ -135,7 +136,7 @@ static const GtkCssValueClass GTK_CSS_VALUE_IMAGE = {
GtkCssValue *
_gtk_css_image_value_new (GtkCssImage *image)
{
static GtkCssValue none_singleton = { &GTK_CSS_VALUE_IMAGE, 1, NULL };
static GtkCssValue none_singleton = { &GTK_CSS_VALUE_IMAGE, 1, TRUE, NULL };
GtkCssValue *value;
if (image == NULL)
@@ -143,6 +144,7 @@ _gtk_css_image_value_new (GtkCssImage *image)
value = _gtk_css_value_new (GtkCssValue, &GTK_CSS_VALUE_IMAGE);
value->image = image;
value->is_computed = gtk_css_image_is_computed (image);
return value;
}
+1
View File
@@ -78,6 +78,7 @@ gtk_css_value_inherit_print (const GtkCssValue *value,
}
static const GtkCssValueClass GTK_CSS_VALUE_INHERIT = {
"GtkCssInheritValue",
gtk_css_value_inherit_free,
gtk_css_value_inherit_compute,
gtk_css_value_inherit_equal,
+4 -10
View File
@@ -51,20 +51,13 @@ gtk_css_value_initial_compute (GtkCssValue *value,
case GTK_CSS_PROPERTY_DPI:
settings = gtk_style_provider_get_settings (provider);
if (settings)
{
int dpi_int;
g_object_get (settings, "gtk-xft-dpi", &dpi_int, NULL);
if (dpi_int > 0.0)
return _gtk_css_number_value_new (dpi_int / 1024., GTK_CSS_NUMBER);
}
return gtk_css_value_ref (gtk_settings_get_dpi_css_value (settings));
break;
case GTK_CSS_PROPERTY_FONT_FAMILY:
settings = gtk_style_provider_get_settings (provider);
if (settings && gtk_settings_get_font_family (settings) != NULL)
return _gtk_css_array_value_new (_gtk_css_string_value_new (gtk_settings_get_font_family (settings)));
if (settings)
return gtk_css_value_ref (gtk_settings_get_font_family_css_value (settings));
break;
default:
@@ -102,6 +95,7 @@ gtk_css_value_initial_print (const GtkCssValue *value,
}
static const GtkCssValueClass GTK_CSS_VALUE_INITIAL = {
"GtkCssInitialValue",
gtk_css_value_initial_free,
gtk_css_value_initial_compute,
gtk_css_value_initial_equal,
+112 -32
View File
@@ -22,6 +22,7 @@
#include "gtkcssnodedeclarationprivate.h"
#include "gtkcssnodeprivate.h"
#include "gtkwidgetpath.h"
#include "gtkprivate.h"
/* GTK_CSS_MATCHER_WIDGET_PATH */
@@ -158,7 +159,17 @@ gtk_css_matcher_widget_path_has_position (const GtkCssMatcher *matcher,
return x / a >= 0;
}
static void
gtk_css_matcher_widget_path_print (const GtkCssMatcher *matcher,
GString *string)
{
char *s = gtk_widget_path_to_string (matcher->path.path);
g_string_append (string, s);
g_free (s);
}
static const GtkCssMatcherClass GTK_CSS_MATCHER_WIDGET_PATH = {
GTK_CSS_MATCHER_TYPE_WIDGET_PATH,
gtk_css_matcher_widget_path_get_parent,
gtk_css_matcher_widget_path_get_previous,
gtk_css_matcher_widget_path_get_state,
@@ -166,7 +177,7 @@ static const GtkCssMatcherClass GTK_CSS_MATCHER_WIDGET_PATH = {
gtk_css_matcher_widget_path_has_class,
gtk_css_matcher_widget_path_has_id,
gtk_css_matcher_widget_path_has_position,
FALSE
gtk_css_matcher_widget_path_print
};
gboolean
@@ -334,7 +345,15 @@ gtk_css_matcher_node_has_position (const GtkCssMatcher *matcher,
a, b);
}
static void
gtk_css_matcher_node_print (const GtkCssMatcher *matcher,
GString *string)
{
gtk_css_node_print (matcher->node.node, 0, string, 0);
}
static const GtkCssMatcherClass GTK_CSS_MATCHER_NODE = {
GTK_CSS_MATCHER_TYPE_NODE,
gtk_css_matcher_node_get_parent,
gtk_css_matcher_node_get_previous,
gtk_css_matcher_node_get_state,
@@ -342,7 +361,7 @@ static const GtkCssMatcherClass GTK_CSS_MATCHER_NODE = {
gtk_css_matcher_node_has_class,
gtk_css_matcher_node_has_id,
gtk_css_matcher_node_has_position,
FALSE
gtk_css_matcher_node_print
};
void
@@ -419,7 +438,15 @@ gtk_css_matcher_any_has_position (const GtkCssMatcher *matcher,
return TRUE;
}
static void
gtk_css_matcher_any_print (const GtkCssMatcher *matcher,
GString *string)
{
g_string_append (string, "ANY");
}
static const GtkCssMatcherClass GTK_CSS_MATCHER_ANY = {
GTK_CSS_MATCHER_TYPE_ANY,
gtk_css_matcher_any_get_parent,
gtk_css_matcher_any_get_previous,
gtk_css_matcher_any_get_state,
@@ -427,7 +454,7 @@ static const GtkCssMatcherClass GTK_CSS_MATCHER_ANY = {
gtk_css_matcher_any_has_class,
gtk_css_matcher_any_has_id,
gtk_css_matcher_any_has_position,
TRUE
gtk_css_matcher_any_print
};
void
@@ -442,29 +469,40 @@ static gboolean
gtk_css_matcher_superset_get_parent (GtkCssMatcher *matcher,
const GtkCssMatcher *child)
{
_gtk_css_matcher_any_init (matcher);
gboolean ret = TRUE;
return TRUE;
if (child->klass->type == GTK_CSS_MATCHER_TYPE_NODE)
{
ret = gtk_css_matcher_node_get_parent (matcher, child);
matcher->klass = child->klass;
}
else
_gtk_css_matcher_any_init (matcher);
return ret;
}
static gboolean
gtk_css_matcher_superset_get_previous (GtkCssMatcher *matcher,
const GtkCssMatcher *next)
{
_gtk_css_matcher_any_init (matcher);
gboolean ret = TRUE;
return TRUE;
if (next->klass->type == GTK_CSS_MATCHER_TYPE_NODE)
{
ret = gtk_css_matcher_node_get_previous (matcher, next);
matcher->klass = next->klass;
}
else
_gtk_css_matcher_any_init (matcher);
return ret;
}
static GtkStateFlags
gtk_css_matcher_superset_get_state (const GtkCssMatcher *matcher)
{
/* XXX: This gets tricky when we implement :not() */
if (matcher->superset.relevant & GTK_CSS_CHANGE_STATE)
return _gtk_css_matcher_get_state (matcher->superset.subset);
else
return GTK_STATE_FLAG_ACTIVE | GTK_STATE_FLAG_PRELIGHT | GTK_STATE_FLAG_SELECTED
return GTK_STATE_FLAG_ACTIVE | GTK_STATE_FLAG_PRELIGHT | GTK_STATE_FLAG_SELECTED
| GTK_STATE_FLAG_INSENSITIVE | GTK_STATE_FLAG_INCONSISTENT
| GTK_STATE_FLAG_FOCUSED | GTK_STATE_FLAG_BACKDROP | GTK_STATE_FLAG_LINK
| GTK_STATE_FLAG_VISITED;
@@ -474,30 +512,21 @@ static gboolean
gtk_css_matcher_superset_has_name (const GtkCssMatcher *matcher,
/*interned*/ const char *name)
{
if (matcher->superset.relevant & GTK_CSS_CHANGE_NAME)
return _gtk_css_matcher_has_name (matcher->superset.subset, name);
else
return TRUE;
return TRUE;
}
static gboolean
gtk_css_matcher_superset_has_class (const GtkCssMatcher *matcher,
GQuark class_name)
{
if (matcher->superset.relevant & GTK_CSS_CHANGE_CLASS)
return _gtk_css_matcher_has_class (matcher->superset.subset, class_name);
else
return TRUE;
return TRUE;
}
static gboolean
gtk_css_matcher_superset_has_id (const GtkCssMatcher *matcher,
const char *id)
{
if (matcher->superset.relevant & GTK_CSS_CHANGE_NAME)
return _gtk_css_matcher_has_id (matcher->superset.subset, id);
else
return TRUE;
return TRUE;
}
static gboolean
@@ -506,13 +535,23 @@ gtk_css_matcher_superset_has_position (const GtkCssMatcher *matcher,
int a,
int b)
{
if (matcher->superset.relevant & GTK_CSS_CHANGE_POSITION)
return _gtk_css_matcher_has_position (matcher->superset.subset, forward, a, b);
return TRUE;
}
static void
gtk_css_matcher_superset_print (const GtkCssMatcher *matcher,
GString *string)
{
g_string_append (string, "SUPERSET(");
if (matcher->klass->type == GTK_CSS_MATCHER_TYPE_NODE)
gtk_css_node_print (matcher->node.node, 0, string, 0);
else
return TRUE;
g_string_append (string, "...");
g_string_append (string, ")");
}
static const GtkCssMatcherClass GTK_CSS_MATCHER_SUPERSET = {
0,
gtk_css_matcher_superset_get_parent,
gtk_css_matcher_superset_get_previous,
gtk_css_matcher_superset_get_state,
@@ -520,19 +559,60 @@ static const GtkCssMatcherClass GTK_CSS_MATCHER_SUPERSET = {
gtk_css_matcher_superset_has_class,
gtk_css_matcher_superset_has_id,
gtk_css_matcher_superset_has_position,
FALSE
gtk_css_matcher_superset_print
};
void
_gtk_css_matcher_superset_init (GtkCssMatcher *matcher,
const GtkCssMatcher *subset,
GtkCssMatcherClass *klass,
GtkCssChange relevant)
{
g_return_if_fail (subset != NULL);
g_return_if_fail ((relevant & ~(GTK_CSS_CHANGE_CLASS | GTK_CSS_CHANGE_NAME | GTK_CSS_CHANGE_POSITION | GTK_CSS_CHANGE_STATE)) == 0);
matcher->superset.klass = &GTK_CSS_MATCHER_SUPERSET;
matcher->superset.subset = subset;
matcher->superset.relevant = relevant;
switch (subset->klass->type)
{
case GTK_CSS_MATCHER_TYPE_NODE:
matcher->node = subset->node;
break;
case GTK_CSS_MATCHER_TYPE_WIDGET_PATH:
matcher->path = subset->path;
break;
case GTK_CSS_MATCHER_TYPE_ANY:
break;
default:
g_assert_not_reached ();
break;
}
*klass = GTK_CSS_MATCHER_SUPERSET;
if (relevant & GTK_CSS_CHANGE_CLASS)
klass->has_class = subset->klass->has_class;
if (relevant & GTK_CSS_CHANGE_NAME)
klass->has_name = subset->klass->has_name;
if (relevant & GTK_CSS_CHANGE_NAME)
klass->has_id = subset->klass->has_id;
if (relevant & GTK_CSS_CHANGE_POSITION)
klass->has_position = subset->klass->has_position;
if (relevant & GTK_CSS_CHANGE_STATE)
klass->get_state = subset->klass->get_state;
matcher->klass = klass;
}
void
gtk_css_matcher_print (const GtkCssMatcher *matcher,
GString *string)
{
matcher->klass->print (matcher, string);
}
char *
gtk_css_matcher_to_string (const GtkCssMatcher *matcher)
{
GString *string = g_string_new ("");
gtk_css_matcher_print (matcher, string);
return g_string_free (string, FALSE);
}
+14 -9
View File
@@ -29,7 +29,14 @@ typedef struct _GtkCssMatcherSuperset GtkCssMatcherSuperset;
typedef struct _GtkCssMatcherWidgetPath GtkCssMatcherWidgetPath;
typedef struct _GtkCssMatcherClass GtkCssMatcherClass;
typedef enum {
GTK_CSS_MATCHER_TYPE_NODE,
GTK_CSS_MATCHER_TYPE_WIDGET_PATH,
GTK_CSS_MATCHER_TYPE_ANY
} GtkCssMatcherType;
struct _GtkCssMatcherClass {
GtkCssMatcherType type;
gboolean (* get_parent) (GtkCssMatcher *matcher,
const GtkCssMatcher *child);
gboolean (* get_previous) (GtkCssMatcher *matcher,
@@ -46,7 +53,8 @@ struct _GtkCssMatcherClass {
gboolean forward,
int a,
int b);
gboolean is_any;
void (* print) (const GtkCssMatcher *matcher,
GString *string);
};
struct _GtkCssMatcherWidgetPath {
@@ -67,17 +75,10 @@ struct _GtkCssMatcherNode {
guint n_classes;
};
struct _GtkCssMatcherSuperset {
const GtkCssMatcherClass *klass;
const GtkCssMatcher *subset;
GtkCssChange relevant;
};
union _GtkCssMatcher {
const GtkCssMatcherClass *klass;
GtkCssMatcherWidgetPath path;
GtkCssMatcherNode node;
GtkCssMatcherSuperset superset;
};
gboolean _gtk_css_matcher_init (GtkCssMatcher *matcher,
@@ -88,6 +89,7 @@ void _gtk_css_matcher_node_init (GtkCssMatcher *match
void _gtk_css_matcher_any_init (GtkCssMatcher *matcher);
void _gtk_css_matcher_superset_init (GtkCssMatcher *matcher,
const GtkCssMatcher *subset,
GtkCssMatcherClass *klass,
GtkCssChange relevant);
@@ -144,9 +146,12 @@ _gtk_css_matcher_has_position (const GtkCssMatcher *matcher,
static inline gboolean
_gtk_css_matcher_matches_any (const GtkCssMatcher *matcher)
{
return matcher->klass->is_any;
return matcher->klass->type == GTK_CSS_MATCHER_TYPE_ANY;
}
void gtk_css_matcher_print (const GtkCssMatcher *matcher,
GString *string);
char * gtk_css_matcher_to_string (const GtkCssMatcher *matcher);
G_END_DECLS
+32 -13
View File
@@ -19,6 +19,7 @@
#include "gtkcssnodeprivate.h"
#include "gtkcssstaticstyleprivate.h"
#include "gtkcssanimatedstyleprivate.h"
#include "gtkcssstylepropertyprivate.h"
#include "gtkintl.h"
@@ -348,12 +349,14 @@ store_in_global_parent_cache (GtkCssNode *node,
}
static GtkCssStyle *
gtk_css_node_create_style (GtkCssNode *cssnode)
gtk_css_node_create_style (GtkCssNode *cssnode,
GtkCssChange change)
{
const GtkCssNodeDeclaration *decl;
GtkCssMatcher matcher;
GtkCssStyle *parent;
GtkCssStyle *style;
gboolean compute_change;
decl = gtk_css_node_get_declaration (cssnode);
@@ -363,14 +366,24 @@ gtk_css_node_create_style (GtkCssNode *cssnode)
parent = cssnode->parent ? cssnode->parent->style : NULL;
compute_change = change & GTK_CSS_RADICAL_CHANGE;
if (gtk_css_node_init_matcher (cssnode, &matcher))
style = gtk_css_static_style_new_compute (gtk_css_node_get_style_provider (cssnode),
&matcher,
parent);
parent,
compute_change);
else
style = gtk_css_static_style_new_compute (gtk_css_node_get_style_provider (cssnode),
NULL,
parent);
parent,
compute_change);
if (!compute_change)
{
GtkCssStyle *old_style = gtk_css_style_get_static_style (cssnode->style);
((GtkCssStaticStyle *)style)->change = ((GtkCssStaticStyle *)old_style)->change;
}
store_in_global_parent_cache (cssnode, decl, style);
@@ -407,17 +420,10 @@ gtk_css_node_real_update_style (GtkCssNode *cssnode,
{
GtkCssStyle *static_style, *new_static_style, *new_style;
if (GTK_IS_CSS_ANIMATED_STYLE (style))
{
static_style = GTK_CSS_ANIMATED_STYLE (style)->style;
}
else
{
static_style = style;
}
static_style = gtk_css_style_get_static_style (style);
if (gtk_css_style_needs_recreation (static_style, change))
new_static_style = gtk_css_node_create_style (cssnode);
new_static_style = gtk_css_node_create_style (cssnode, change);
else
new_static_style = g_object_ref (static_style);
@@ -436,7 +442,7 @@ gtk_css_node_real_update_style (GtkCssNode *cssnode,
}
else if (static_style != style && (change & GTK_CSS_CHANGE_TIMESTAMP))
{
new_style = gtk_css_animated_style_new_advance (GTK_CSS_ANIMATED_STYLE (style),
new_style = gtk_css_animated_style_new_advance ((GtkCssAnimatedStyle *)style,
static_style,
timestamp);
}
@@ -1398,6 +1404,19 @@ gtk_css_node_print (GtkCssNode *cssnode,
if (!cssnode->visible)
g_string_append_c (string, ']');
if (flags & GTK_STYLE_CONTEXT_PRINT_SHOW_CHANGE)
{
GtkCssStyle *style = gtk_css_node_get_style (cssnode);
GtkCssChange change;
if (!GTK_IS_CSS_STATIC_STYLE (style))
style = GTK_CSS_ANIMATED_STYLE (style)->style;
change = gtk_css_static_style_get_change (GTK_CSS_STATIC_STYLE (style));
g_string_append (string, " ");
gtk_css_change_print (change, string);
}
g_string_append_c (string, '\n');
if (flags & GTK_STYLE_CONTEXT_PRINT_SHOW_STYLE)
+8 -2
View File
@@ -44,11 +44,14 @@ gtk_css_number_value_has_percent (const GtkCssValue *value)
}
GtkCssValue *
gtk_css_number_value_multiply (const GtkCssValue *value,
double factor)
gtk_css_number_value_multiply (GtkCssValue *value,
double factor)
{
GtkCssNumberValueClass *number_value_class = (GtkCssNumberValueClass *) value->class;
if (factor == 1)
return _gtk_css_value_ref (value);
return number_value_class->multiply (value, factor);
}
@@ -115,6 +118,9 @@ gtk_css_number_value_transition (GtkCssValue *start,
{
GtkCssValue *result, *mul_start, *mul_end;
if (start == end)
return _gtk_css_value_ref (start);
mul_start = gtk_css_number_value_multiply (start, 1 - progress);
mul_end = gtk_css_number_value_multiply (end, progress);
+2 -2
View File
@@ -44,7 +44,7 @@ struct _GtkCssNumberValueClass {
double one_hundred_percent);
GtkCssDimension (* get_dimension) (const GtkCssValue *value);
gboolean (* has_percent) (const GtkCssValue *value);
GtkCssValue * (* multiply) (const GtkCssValue *value,
GtkCssValue * (* multiply) (GtkCssValue *value,
double factor);
GtkCssValue * (* try_add) (GtkCssValue *value1,
GtkCssValue *value2);
@@ -63,7 +63,7 @@ GtkCssValue * _gtk_css_number_value_parse (GtkCssParser *par
GtkCssDimension gtk_css_number_value_get_dimension (const GtkCssValue *value) G_GNUC_PURE;
gboolean gtk_css_number_value_has_percent (const GtkCssValue *value) G_GNUC_PURE;
GtkCssValue * gtk_css_number_value_multiply (const GtkCssValue *value,
GtkCssValue * gtk_css_number_value_multiply (GtkCssValue *value,
double factor);
GtkCssValue * gtk_css_number_value_add (GtkCssValue *value1,
GtkCssValue *value2);
+5 -2
View File
@@ -21,7 +21,7 @@
#include "gtkcssiconthemevalueprivate.h"
#include "gtkcsscolorvalueprivate.h"
#include "gtkcssrgbavalueprivate.h"
#include "gtkcsscolorvalueprivate.h"
#include "gtkprivate.h"
struct _GtkCssValue {
@@ -244,6 +244,7 @@ gtk_css_value_palette_print (const GtkCssValue *value,
}
static const GtkCssValueClass GTK_CSS_VALUE_PALETTE = {
"GtkCssPaletteValue",
gtk_css_value_palette_free,
gtk_css_value_palette_compute,
gtk_css_value_palette_equal,
@@ -325,6 +326,8 @@ gtk_css_palette_value_parse (GtkCssParser *parser)
return NULL;
}
result->is_computed = result->is_computed && gtk_css_value_is_computed (color);
g_ptr_array_add (names, ident);
g_ptr_array_add (colors, color);
} while (gtk_css_parser_try_token (parser, GTK_CSS_TOKEN_COMMA));
@@ -348,7 +351,7 @@ gtk_css_palette_value_get_color (GtkCssValue *value,
for (i = 0; i < value->n_colors; i ++)
{
if (strcmp (value->color_names[i], name) == 0)
return _gtk_css_rgba_value_get_rgba (value->color_values[i]);
return gtk_css_color_value_get_rgba (value->color_values[i]);
}
return NULL;
+3
View File
@@ -150,6 +150,7 @@ done:
}
static const GtkCssValueClass GTK_CSS_VALUE_POSITION = {
"GtkCssPositionValue",
gtk_css_value_position_free,
gtk_css_value_position_compute,
gtk_css_value_position_equal,
@@ -168,6 +169,8 @@ _gtk_css_position_value_new (GtkCssValue *x,
result = _gtk_css_value_new (GtkCssValue, &GTK_CSS_VALUE_POSITION);
result->x = x;
result->y = y;
result->is_computed = gtk_css_value_is_computed (x) &&
gtk_css_value_is_computed (y);
return result;
}
+30 -16
View File
@@ -99,7 +99,6 @@ struct GtkCssRuleset
GtkCssSelector *selector;
GtkCssSelectorTree *selector_match;
PropertyValue *styles;
GtkBitmask *set_styles;
guint n_styles;
guint owns_styles : 1;
};
@@ -236,8 +235,6 @@ gtk_css_ruleset_init_copy (GtkCssRuleset *new,
/* First copy takes over ownership */
if (ruleset->owns_styles)
ruleset->owns_styles = FALSE;
if (new->set_styles)
new->set_styles = _gtk_bitmask_copy (new->set_styles);
}
static void
@@ -256,8 +253,6 @@ gtk_css_ruleset_clear (GtkCssRuleset *ruleset)
}
g_free (ruleset->styles);
}
if (ruleset->set_styles)
_gtk_bitmask_free (ruleset->set_styles);
if (ruleset->selector)
_gtk_css_selector_free (ruleset->selector);
@@ -274,13 +269,6 @@ gtk_css_ruleset_add (GtkCssRuleset *ruleset,
g_return_if_fail (ruleset->owns_styles || ruleset->n_styles == 0);
if (ruleset->set_styles == NULL)
ruleset->set_styles = _gtk_bitmask_new ();
ruleset->set_styles = _gtk_bitmask_set (ruleset->set_styles,
_gtk_css_style_property_get_id (property),
TRUE);
ruleset->owns_styles = TRUE;
for (i = 0; i < ruleset->n_styles; i++)
@@ -437,6 +425,33 @@ verify_tree_match_results (GtkCssProvider *provider,
#endif
}
static GtkCssChange
get_change (GtkCssProvider *provider,
const GtkCssMatcher *matcher)
{
GtkCssProviderPrivate *priv = gtk_css_provider_get_instance_private (provider);
GtkCssChange change = 0;
GPtrArray *tree_rules;
int i;
tree_rules = _gtk_css_selector_tree_match_all (priv->tree, matcher);
if (tree_rules)
{
for (i = tree_rules->len - 1; i >= 0; i--)
{
GtkCssRuleset *ruleset;
ruleset = tree_rules->pdata[i];
change |= _gtk_css_selector_get_change (ruleset->selector);
}
g_ptr_array_free (tree_rules, TRUE);
}
return change;
}
static void
verify_tree_get_change_results (GtkCssProvider *provider,
const GtkCssMatcher *matcher,
@@ -565,11 +580,11 @@ gtk_css_style_provider_lookup (GtkStyleProvider *provider,
if (change)
{
GtkCssMatcher change_matcher;
GtkCssMatcherClass matcher_class;
_gtk_css_matcher_superset_init (&change_matcher, matcher, GTK_CSS_CHANGE_NAME | GTK_CSS_CHANGE_CLASS);
_gtk_css_matcher_superset_init (&change_matcher, matcher, &matcher_class, GTK_CSS_CHANGE_CLASS | GTK_CSS_CHANGE_NAME);
*change = _gtk_css_selector_tree_get_change_all (priv->tree, &change_matcher);
verify_tree_get_change_results (css_provider, &change_matcher, *change);
*change = get_change (css_provider, &change_matcher);
}
}
@@ -756,7 +771,6 @@ parse_color_definition (GtkCssScanner *scanner)
GtkCssValue *color;
char *name;
if (!gtk_css_parser_try_at_keyword (scanner->parser, "define-color"))
return FALSE;
name = gtk_css_parser_consume_ident (scanner->parser);
+34 -32
View File
@@ -113,6 +113,7 @@ gtk_css_value_border_repeat_print (const GtkCssValue *repeat,
}
static const GtkCssValueClass GTK_CSS_VALUE_BACKGROUND_REPEAT = {
"GtkCssBackgroundRepeatValue",
gtk_css_value_repeat_free,
gtk_css_value_repeat_compute,
gtk_css_value_repeat_equal,
@@ -123,6 +124,7 @@ static const GtkCssValueClass GTK_CSS_VALUE_BACKGROUND_REPEAT = {
};
static const GtkCssValueClass GTK_CSS_VALUE_BORDER_REPEAT = {
"GtkCssBorderRepeatValue",
gtk_css_value_repeat_free,
gtk_css_value_repeat_compute,
gtk_css_value_repeat_equal,
@@ -138,28 +140,28 @@ static struct {
GtkCssValue values[4];
} background_repeat_values[4] = {
{ "no-repeat",
{ { &GTK_CSS_VALUE_BACKGROUND_REPEAT, 1, GTK_CSS_REPEAT_STYLE_NO_REPEAT, GTK_CSS_REPEAT_STYLE_NO_REPEAT },
{ &GTK_CSS_VALUE_BACKGROUND_REPEAT, 1, GTK_CSS_REPEAT_STYLE_NO_REPEAT, GTK_CSS_REPEAT_STYLE_REPEAT },
{ &GTK_CSS_VALUE_BACKGROUND_REPEAT, 1, GTK_CSS_REPEAT_STYLE_NO_REPEAT, GTK_CSS_REPEAT_STYLE_ROUND },
{ &GTK_CSS_VALUE_BACKGROUND_REPEAT, 1, GTK_CSS_REPEAT_STYLE_NO_REPEAT, GTK_CSS_REPEAT_STYLE_SPACE }
{ { &GTK_CSS_VALUE_BACKGROUND_REPEAT, 1, TRUE, GTK_CSS_REPEAT_STYLE_NO_REPEAT, GTK_CSS_REPEAT_STYLE_NO_REPEAT },
{ &GTK_CSS_VALUE_BACKGROUND_REPEAT, 1, TRUE, GTK_CSS_REPEAT_STYLE_NO_REPEAT, GTK_CSS_REPEAT_STYLE_REPEAT },
{ &GTK_CSS_VALUE_BACKGROUND_REPEAT, 1, TRUE, GTK_CSS_REPEAT_STYLE_NO_REPEAT, GTK_CSS_REPEAT_STYLE_ROUND },
{ &GTK_CSS_VALUE_BACKGROUND_REPEAT, 1, TRUE, GTK_CSS_REPEAT_STYLE_NO_REPEAT, GTK_CSS_REPEAT_STYLE_SPACE }
} },
{ "repeat",
{ { &GTK_CSS_VALUE_BACKGROUND_REPEAT, 1, GTK_CSS_REPEAT_STYLE_REPEAT, GTK_CSS_REPEAT_STYLE_NO_REPEAT },
{ &GTK_CSS_VALUE_BACKGROUND_REPEAT, 1, GTK_CSS_REPEAT_STYLE_REPEAT, GTK_CSS_REPEAT_STYLE_REPEAT },
{ &GTK_CSS_VALUE_BACKGROUND_REPEAT, 1, GTK_CSS_REPEAT_STYLE_REPEAT, GTK_CSS_REPEAT_STYLE_ROUND },
{ &GTK_CSS_VALUE_BACKGROUND_REPEAT, 1, GTK_CSS_REPEAT_STYLE_REPEAT, GTK_CSS_REPEAT_STYLE_SPACE }
{ { &GTK_CSS_VALUE_BACKGROUND_REPEAT, 1, TRUE, GTK_CSS_REPEAT_STYLE_REPEAT, GTK_CSS_REPEAT_STYLE_NO_REPEAT },
{ &GTK_CSS_VALUE_BACKGROUND_REPEAT, 1, TRUE, GTK_CSS_REPEAT_STYLE_REPEAT, GTK_CSS_REPEAT_STYLE_REPEAT },
{ &GTK_CSS_VALUE_BACKGROUND_REPEAT, 1, TRUE, GTK_CSS_REPEAT_STYLE_REPEAT, GTK_CSS_REPEAT_STYLE_ROUND },
{ &GTK_CSS_VALUE_BACKGROUND_REPEAT, 1, TRUE, GTK_CSS_REPEAT_STYLE_REPEAT, GTK_CSS_REPEAT_STYLE_SPACE }
} },
{ "round",
{ { &GTK_CSS_VALUE_BACKGROUND_REPEAT, 1, GTK_CSS_REPEAT_STYLE_ROUND, GTK_CSS_REPEAT_STYLE_NO_REPEAT },
{ &GTK_CSS_VALUE_BACKGROUND_REPEAT, 1, GTK_CSS_REPEAT_STYLE_ROUND, GTK_CSS_REPEAT_STYLE_REPEAT },
{ &GTK_CSS_VALUE_BACKGROUND_REPEAT, 1, GTK_CSS_REPEAT_STYLE_ROUND, GTK_CSS_REPEAT_STYLE_ROUND },
{ &GTK_CSS_VALUE_BACKGROUND_REPEAT, 1, GTK_CSS_REPEAT_STYLE_ROUND, GTK_CSS_REPEAT_STYLE_SPACE }
{ { &GTK_CSS_VALUE_BACKGROUND_REPEAT, 1, TRUE, GTK_CSS_REPEAT_STYLE_ROUND, GTK_CSS_REPEAT_STYLE_NO_REPEAT },
{ &GTK_CSS_VALUE_BACKGROUND_REPEAT, 1, TRUE, GTK_CSS_REPEAT_STYLE_ROUND, GTK_CSS_REPEAT_STYLE_REPEAT },
{ &GTK_CSS_VALUE_BACKGROUND_REPEAT, 1, TRUE, GTK_CSS_REPEAT_STYLE_ROUND, GTK_CSS_REPEAT_STYLE_ROUND },
{ &GTK_CSS_VALUE_BACKGROUND_REPEAT, 1, TRUE, GTK_CSS_REPEAT_STYLE_ROUND, GTK_CSS_REPEAT_STYLE_SPACE }
} },
{ "space",
{ { &GTK_CSS_VALUE_BACKGROUND_REPEAT, 1, GTK_CSS_REPEAT_STYLE_SPACE, GTK_CSS_REPEAT_STYLE_NO_REPEAT },
{ &GTK_CSS_VALUE_BACKGROUND_REPEAT, 1, GTK_CSS_REPEAT_STYLE_SPACE, GTK_CSS_REPEAT_STYLE_REPEAT },
{ &GTK_CSS_VALUE_BACKGROUND_REPEAT, 1, GTK_CSS_REPEAT_STYLE_SPACE, GTK_CSS_REPEAT_STYLE_ROUND },
{ &GTK_CSS_VALUE_BACKGROUND_REPEAT, 1, GTK_CSS_REPEAT_STYLE_SPACE, GTK_CSS_REPEAT_STYLE_SPACE }
{ { &GTK_CSS_VALUE_BACKGROUND_REPEAT, 1, TRUE, GTK_CSS_REPEAT_STYLE_SPACE, GTK_CSS_REPEAT_STYLE_NO_REPEAT },
{ &GTK_CSS_VALUE_BACKGROUND_REPEAT, 1, TRUE, GTK_CSS_REPEAT_STYLE_SPACE, GTK_CSS_REPEAT_STYLE_REPEAT },
{ &GTK_CSS_VALUE_BACKGROUND_REPEAT, 1, TRUE, GTK_CSS_REPEAT_STYLE_SPACE, GTK_CSS_REPEAT_STYLE_ROUND },
{ &GTK_CSS_VALUE_BACKGROUND_REPEAT, 1, TRUE, GTK_CSS_REPEAT_STYLE_SPACE, GTK_CSS_REPEAT_STYLE_SPACE }
} }
};
@@ -232,28 +234,28 @@ static struct {
GtkCssValue values[4];
} border_repeat_values[4] = {
{ "stretch",
{ { &GTK_CSS_VALUE_BORDER_REPEAT, 1, GTK_CSS_REPEAT_STYLE_STRETCH, GTK_CSS_REPEAT_STYLE_STRETCH },
{ &GTK_CSS_VALUE_BORDER_REPEAT, 1, GTK_CSS_REPEAT_STYLE_STRETCH, GTK_CSS_REPEAT_STYLE_REPEAT },
{ &GTK_CSS_VALUE_BORDER_REPEAT, 1, GTK_CSS_REPEAT_STYLE_STRETCH, GTK_CSS_REPEAT_STYLE_ROUND },
{ &GTK_CSS_VALUE_BORDER_REPEAT, 1, GTK_CSS_REPEAT_STYLE_STRETCH, GTK_CSS_REPEAT_STYLE_SPACE }
{ { &GTK_CSS_VALUE_BORDER_REPEAT, 1, TRUE, GTK_CSS_REPEAT_STYLE_STRETCH, GTK_CSS_REPEAT_STYLE_STRETCH },
{ &GTK_CSS_VALUE_BORDER_REPEAT, 1, TRUE, GTK_CSS_REPEAT_STYLE_STRETCH, GTK_CSS_REPEAT_STYLE_REPEAT },
{ &GTK_CSS_VALUE_BORDER_REPEAT, 1, TRUE, GTK_CSS_REPEAT_STYLE_STRETCH, GTK_CSS_REPEAT_STYLE_ROUND },
{ &GTK_CSS_VALUE_BORDER_REPEAT, 1, TRUE, GTK_CSS_REPEAT_STYLE_STRETCH, GTK_CSS_REPEAT_STYLE_SPACE }
} },
{ "repeat",
{ { &GTK_CSS_VALUE_BORDER_REPEAT, 1, GTK_CSS_REPEAT_STYLE_REPEAT, GTK_CSS_REPEAT_STYLE_STRETCH },
{ &GTK_CSS_VALUE_BORDER_REPEAT, 1, GTK_CSS_REPEAT_STYLE_REPEAT, GTK_CSS_REPEAT_STYLE_REPEAT },
{ &GTK_CSS_VALUE_BORDER_REPEAT, 1, GTK_CSS_REPEAT_STYLE_REPEAT, GTK_CSS_REPEAT_STYLE_ROUND },
{ &GTK_CSS_VALUE_BORDER_REPEAT, 1, GTK_CSS_REPEAT_STYLE_REPEAT, GTK_CSS_REPEAT_STYLE_SPACE }
{ { &GTK_CSS_VALUE_BORDER_REPEAT, 1, TRUE, GTK_CSS_REPEAT_STYLE_REPEAT, GTK_CSS_REPEAT_STYLE_STRETCH },
{ &GTK_CSS_VALUE_BORDER_REPEAT, 1, TRUE, GTK_CSS_REPEAT_STYLE_REPEAT, GTK_CSS_REPEAT_STYLE_REPEAT },
{ &GTK_CSS_VALUE_BORDER_REPEAT, 1, TRUE, GTK_CSS_REPEAT_STYLE_REPEAT, GTK_CSS_REPEAT_STYLE_ROUND },
{ &GTK_CSS_VALUE_BORDER_REPEAT, 1, TRUE, GTK_CSS_REPEAT_STYLE_REPEAT, GTK_CSS_REPEAT_STYLE_SPACE }
} },
{ "round",
{ { &GTK_CSS_VALUE_BORDER_REPEAT, 1, GTK_CSS_REPEAT_STYLE_ROUND, GTK_CSS_REPEAT_STYLE_STRETCH },
{ &GTK_CSS_VALUE_BORDER_REPEAT, 1, GTK_CSS_REPEAT_STYLE_ROUND, GTK_CSS_REPEAT_STYLE_REPEAT },
{ &GTK_CSS_VALUE_BORDER_REPEAT, 1, GTK_CSS_REPEAT_STYLE_ROUND, GTK_CSS_REPEAT_STYLE_ROUND },
{ &GTK_CSS_VALUE_BORDER_REPEAT, 1, GTK_CSS_REPEAT_STYLE_ROUND, GTK_CSS_REPEAT_STYLE_SPACE }
{ { &GTK_CSS_VALUE_BORDER_REPEAT, 1, TRUE, GTK_CSS_REPEAT_STYLE_ROUND, GTK_CSS_REPEAT_STYLE_STRETCH },
{ &GTK_CSS_VALUE_BORDER_REPEAT, 1, TRUE, GTK_CSS_REPEAT_STYLE_ROUND, GTK_CSS_REPEAT_STYLE_REPEAT },
{ &GTK_CSS_VALUE_BORDER_REPEAT, 1, TRUE, GTK_CSS_REPEAT_STYLE_ROUND, GTK_CSS_REPEAT_STYLE_ROUND },
{ &GTK_CSS_VALUE_BORDER_REPEAT, 1, TRUE, GTK_CSS_REPEAT_STYLE_ROUND, GTK_CSS_REPEAT_STYLE_SPACE }
} },
{ "space",
{ { &GTK_CSS_VALUE_BORDER_REPEAT, 1, GTK_CSS_REPEAT_STYLE_SPACE, GTK_CSS_REPEAT_STYLE_STRETCH },
{ &GTK_CSS_VALUE_BORDER_REPEAT, 1, GTK_CSS_REPEAT_STYLE_SPACE, GTK_CSS_REPEAT_STYLE_REPEAT },
{ &GTK_CSS_VALUE_BORDER_REPEAT, 1, GTK_CSS_REPEAT_STYLE_SPACE, GTK_CSS_REPEAT_STYLE_ROUND },
{ &GTK_CSS_VALUE_BORDER_REPEAT, 1, GTK_CSS_REPEAT_STYLE_SPACE, GTK_CSS_REPEAT_STYLE_SPACE }
{ { &GTK_CSS_VALUE_BORDER_REPEAT, 1, TRUE, GTK_CSS_REPEAT_STYLE_SPACE, GTK_CSS_REPEAT_STYLE_STRETCH },
{ &GTK_CSS_VALUE_BORDER_REPEAT, 1, TRUE, GTK_CSS_REPEAT_STYLE_SPACE, GTK_CSS_REPEAT_STYLE_REPEAT },
{ &GTK_CSS_VALUE_BORDER_REPEAT, 1, TRUE, GTK_CSS_REPEAT_STYLE_SPACE, GTK_CSS_REPEAT_STYLE_ROUND },
{ &GTK_CSS_VALUE_BORDER_REPEAT, 1, TRUE, GTK_CSS_REPEAT_STYLE_SPACE, GTK_CSS_REPEAT_STYLE_SPACE }
} }
};
-165
View File
@@ -1,165 +0,0 @@
/* GTK - The GIMP Toolkit
* Copyright (C) 2011 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 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/>.
*/
#include "config.h"
#include "gtkcssrgbavalueprivate.h"
#include "gtkcssstylepropertyprivate.h"
#include "gtkstylecontextprivate.h"
struct _GtkCssValue {
GTK_CSS_VALUE_BASE
GdkRGBA rgba;
};
static void
gtk_css_value_rgba_free (GtkCssValue *value)
{
g_slice_free (GtkCssValue, value);
}
static GtkCssValue *
gtk_css_value_rgba_compute (GtkCssValue *value,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style)
{
return _gtk_css_value_ref (value);
}
static gboolean
gtk_css_value_rgba_equal (const GtkCssValue *rgba1,
const GtkCssValue *rgba2)
{
return gdk_rgba_equal (&rgba1->rgba, &rgba2->rgba);
}
static inline double
transition (double start,
double end,
double progress)
{
return start + (end - start) * progress;
}
static GtkCssValue *
gtk_css_value_rgba_transition (GtkCssValue *start,
GtkCssValue *end,
guint property_id,
double progress)
{
GdkRGBA result;
progress = CLAMP (progress, 0, 1);
result.alpha = transition (start->rgba.alpha, end->rgba.alpha, progress);
if (result.alpha <= 0.0)
{
result.red = result.green = result.blue = 0.0;
}
else
{
result.red = transition (start->rgba.red * start->rgba.alpha,
end->rgba.red * end->rgba.alpha,
progress) / result.alpha;
result.green = transition (start->rgba.green * start->rgba.alpha,
end->rgba.green * end->rgba.alpha,
progress) / result.alpha;
result.blue = transition (start->rgba.blue * start->rgba.alpha,
end->rgba.blue * end->rgba.alpha,
progress) / result.alpha;
}
return _gtk_css_rgba_value_new_from_rgba (&result);
}
static void
gtk_css_value_rgba_print (const GtkCssValue *rgba,
GString *string)
{
char *s = gdk_rgba_to_string (&rgba->rgba);
g_string_append (string, s);
g_free (s);
}
static const GtkCssValueClass GTK_CSS_VALUE_RGBA = {
gtk_css_value_rgba_free,
gtk_css_value_rgba_compute,
gtk_css_value_rgba_equal,
gtk_css_value_rgba_transition,
NULL,
NULL,
gtk_css_value_rgba_print
};
static GtkCssValue transparent_black_singleton = { &GTK_CSS_VALUE_RGBA, 1, { 0, 0, 0, 0 }};
static GtkCssValue transparent_white_singleton = { &GTK_CSS_VALUE_RGBA, 1, { 1, 1, 1, 0 }};
static GtkCssValue opaque_white_singleton = { &GTK_CSS_VALUE_RGBA, 1, { 1, 1, 1, 1 }};
GtkCssValue *
_gtk_css_rgba_value_new_from_rgba (const GdkRGBA *rgba)
{
GtkCssValue *value;
g_return_val_if_fail (rgba != NULL, NULL);
if (gdk_rgba_is_clear (rgba))
{
if (rgba->red == 1 &&
rgba->green == 1 &&
rgba->blue == 1)
return _gtk_css_value_ref (&transparent_white_singleton);
if (rgba->red == 0 &&
rgba->green == 0 &&
rgba->blue == 0)
return _gtk_css_value_ref (&transparent_black_singleton);
}
else if (gdk_rgba_is_opaque (rgba))
{
if (rgba->red == 1 &&
rgba->green == 1 &&
rgba->blue == 1)
return _gtk_css_value_ref (&opaque_white_singleton);
}
value = _gtk_css_value_new (GtkCssValue, &GTK_CSS_VALUE_RGBA);
value->rgba = *rgba;
return value;
}
GtkCssValue *
_gtk_css_rgba_value_new_transparent (void)
{
return _gtk_css_value_ref (&transparent_black_singleton);
}
GtkCssValue *
_gtk_css_rgba_value_new_white (void)
{
return _gtk_css_value_ref (&opaque_white_singleton);
}
const GdkRGBA *
_gtk_css_rgba_value_get_rgba (const GtkCssValue *rgba)
{
g_return_val_if_fail (rgba->class == &GTK_CSS_VALUE_RGBA, NULL);
return &rgba->rgba;
}
-38
View File
@@ -1,38 +0,0 @@
/*
* 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: Alexander Larsson <alexl@gnome.org>
*/
#ifndef __GTK_CSS_RGBA_VALUE_PRIVATE_H__
#define __GTK_CSS_RGBA_VALUE_PRIVATE_H__
#include "gtkcssparserprivate.h"
#include "gtkcsstypesprivate.h"
#include "gtkcssvalueprivate.h"
G_BEGIN_DECLS
GtkCssValue * _gtk_css_rgba_value_new_from_rgba (const GdkRGBA *rgba);
GtkCssValue * _gtk_css_rgba_value_new_transparent (void);
GtkCssValue * _gtk_css_rgba_value_new_white (void);
const GdkRGBA * _gtk_css_rgba_value_get_rgba (const GtkCssValue *rgba) G_GNUC_PURE;
G_END_DECLS
#endif /* __GTK_CSS_RGBA_VALUE_PRIVATE_H__ */
+55 -4
View File
@@ -30,13 +30,15 @@
# include <intrin.h>
#endif
#define PRINT_TREE 1
typedef struct _GtkCssSelectorClass GtkCssSelectorClass;
typedef gboolean (* GtkCssSelectorForeachFunc) (const GtkCssSelector *selector,
const GtkCssMatcher *matcher,
gpointer data);
struct _GtkCssSelectorClass {
const char *name;
const char *name;
void (* print) (const GtkCssSelector *selector,
GString *string);
@@ -104,6 +106,7 @@ union _GtkCssSelector
struct _GtkCssSelectorTree
{
GtkCssSelector selector;
GtkCssChange change;
gint32 parent_offset;
gint32 previous_offset;
gint32 sibling_offset;
@@ -1874,7 +1877,7 @@ gtk_css_selector_tree_get_change (const GtkCssSelectorTree *tree,
return 0;
if (!tree->selector.class->is_simple)
return gtk_css_selector_tree_collect_change (tree) | GTK_CSS_CHANGE_GOT_MATCH;
return tree->change | GTK_CSS_CHANGE_GOT_MATCH;
for (prev = gtk_css_selector_tree_get_previous (tree);
prev != NULL;
@@ -1911,11 +1914,16 @@ _gtk_css_selector_tree_get_change_all (const GtkCssSelectorTree *tree,
}
#ifdef PRINT_TREE
static void
_gtk_css_selector_tree_print (const GtkCssSelectorTree *tree, GString *str, char *prefix)
_gtk_css_selector_tree_print_recurse (const GtkCssSelectorTree *tree,
GString *str,
const char *prefix,
GHashTable *counts)
{
gboolean first = TRUE;
int len, i;
int count;
for (; tree != NULL; tree = gtk_css_selector_tree_get_sibling (tree), first = FALSE)
{
@@ -1941,6 +1949,10 @@ _gtk_css_selector_tree_print (const GtkCssSelectorTree *tree, GString *str, char
tree->selector.class->print (&tree->selector, str);
len = str->len - len;
count = GPOINTER_TO_INT (g_hash_table_lookup (counts, (gpointer)tree->selector.class->name));
count++;
g_hash_table_insert (counts, (gpointer)tree->selector.class->name, GINT_TO_POINTER (count));
if (gtk_css_selector_tree_get_previous (tree))
{
GString *prefix2 = g_string_new (prefix);
@@ -1952,13 +1964,35 @@ _gtk_css_selector_tree_print (const GtkCssSelectorTree *tree, GString *str, char
for (i = 0; i < len; i++)
g_string_append_c (prefix2, ' ');
_gtk_css_selector_tree_print (gtk_css_selector_tree_get_previous (tree), str, prefix2->str);
_gtk_css_selector_tree_print_recurse (gtk_css_selector_tree_get_previous (tree), str, prefix2->str, counts);
g_string_free (prefix2, TRUE);
}
else
g_string_append (str, "\n");
}
}
static void
_gtk_css_selector_tree_print (const GtkCssSelectorTree *tree, GString *str, const char *prefix)
{
GHashTable *counts;
GHashTableIter iter;
const char *key;
gpointer value;
counts = g_hash_table_new (g_str_hash, g_str_equal);
_gtk_css_selector_tree_print_recurse (tree, str, prefix, counts);
g_string_append (str, "\n\nSelector counts:\n");
g_hash_table_iter_init (&iter, counts);
while (g_hash_table_iter_next (&iter, (gpointer *)&key, &value))
g_string_append_printf (str, "%-*s %4d\n", (int)strlen ("not_pseudoclass_position"), key, GPOINTER_TO_INT (value));
g_string_append (str, "\n");
g_hash_table_unref (counts);
}
#endif
void
@@ -2084,6 +2118,7 @@ subdivide_infos (GByteArray *array, GList *infos, gint32 parent_offset)
remaining = NULL;
tree = alloc_tree (array, &tree_offset);
tree->change = 0;
tree->parent_offset = parent_offset;
tree->selector = max_selector;
@@ -2193,6 +2228,20 @@ fixup_offsets (GtkCssSelectorTree *tree, guint8 *data)
}
}
static void
compute_change (GtkCssSelectorTree *tree)
{
for (; tree != NULL;
tree = (GtkCssSelectorTree *)gtk_css_selector_tree_get_sibling (tree))
{
GtkCssSelectorTree *prev = (GtkCssSelectorTree *)gtk_css_selector_tree_get_previous (tree);
tree->change = gtk_css_selector_tree_collect_change (tree);
compute_change (prev);
}
}
GtkCssSelectorTree *
_gtk_css_selector_tree_builder_build (GtkCssSelectorTreeBuilder *builder)
{
@@ -2216,6 +2265,8 @@ _gtk_css_selector_tree_builder_build (GtkCssSelectorTreeBuilder *builder)
fixup_offsets (tree, data);
compute_change (tree);
/* Convert offsets to final pointers */
for (l = builder->infos; l != NULL; l = l->next)
{
-378
View File
@@ -1,378 +0,0 @@
/* GTK - The GIMP Toolkit
* Copyright (C) 2011 Red Hat, Inc.
*
* Author: Cosimo Cecchi <cosimoc@gnome.org>
*
* 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 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/>.
*/
#include "config.h"
#include "gtkcssshadowsvalueprivate.h"
#include <math.h>
#include "gtkcssshadowvalueprivate.h"
#include "gtksnapshot.h"
#include <string.h>
struct _GtkCssValue {
GTK_CSS_VALUE_BASE
guint len;
GtkCssValue *values[1];
};
static GtkCssValue * gtk_css_shadows_value_new (GtkCssValue **values,
guint len);
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 GtkCssValue *
gtk_css_value_shadows_compute (GtkCssValue *value,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style)
{
GtkCssValue *result, *tmp;
guint i, j;
if (value->len == 0)
return _gtk_css_value_ref (value);
result = NULL;
for (i = 0; i < value->len; i++)
{
tmp = _gtk_css_value_compute (value->values[i], property_id, provider, style, parent_style);
if (result)
{
result->values[i] = tmp;
}
else if (tmp != value->values[i])
{
result = gtk_css_shadows_value_new (value->values, value->len);
for (j = 0; j < i; j++)
{
_gtk_css_value_ref (result->values[j]);
}
result->values[i] = tmp;
}
else
{
_gtk_css_value_unref (tmp);
}
}
if (result != NULL)
return result;
else
return _gtk_css_value_ref (value);
}
static gboolean
gtk_css_value_shadows_equal (const GtkCssValue *value1,
const GtkCssValue *value2)
{
guint i;
/* XXX: Should we fill up here? */
if (value1->len != value2->len)
return FALSE;
for (i = 0; i < value1->len; i++)
{
if (!_gtk_css_value_equal (value1->values[i],
value2->values[i]))
return FALSE;
}
return TRUE;
}
static GtkCssValue *
gtk_css_value_shadows_transition (GtkCssValue *start,
GtkCssValue *end,
guint property_id,
double progress)
{
guint i, len;
GtkCssValue **values;
/* catches the important case of 2 none values */
if (start == end)
return _gtk_css_value_ref (start);
if (start->len > end->len)
len = start->len;
else
len = end->len;
values = g_newa (GtkCssValue *, len);
for (i = 0; i < MIN (start->len, end->len); i++)
{
values[i] = _gtk_css_value_transition (start->values[i], end->values[i], property_id, progress);
if (values[i] == NULL)
{
while (i--)
_gtk_css_value_unref (values[i]);
return NULL;
}
}
if (start->len > end->len)
{
for (; i < len; i++)
{
GtkCssValue *fill = _gtk_css_shadow_value_new_for_transition (start->values[i]);
values[i] = _gtk_css_value_transition (start->values[i], fill, property_id, progress);
_gtk_css_value_unref (fill);
if (values[i] == NULL)
{
while (i--)
_gtk_css_value_unref (values[i]);
return NULL;
}
}
}
else
{
for (; i < len; i++)
{
GtkCssValue *fill = _gtk_css_shadow_value_new_for_transition (end->values[i]);
values[i] = _gtk_css_value_transition (fill, end->values[i], property_id, progress);
_gtk_css_value_unref (fill);
if (values[i] == NULL)
{
while (i--)
_gtk_css_value_unref (values[i]);
return NULL;
}
}
}
return gtk_css_shadows_value_new (values, len);
}
static void
gtk_css_value_shadows_print (const GtkCssValue *value,
GString *string)
{
guint i;
if (value->len == 0)
{
g_string_append (string, "none");
return;
}
for (i = 0; i < value->len; i++)
{
if (i > 0)
g_string_append (string, ", ");
_gtk_css_value_print (value->values[i], string);
}
}
static const GtkCssValueClass GTK_CSS_VALUE_SHADOWS = {
gtk_css_value_shadows_free,
gtk_css_value_shadows_compute,
gtk_css_value_shadows_equal,
gtk_css_value_shadows_transition,
NULL,
NULL,
gtk_css_value_shadows_print
};
static GtkCssValue none_singleton = { &GTK_CSS_VALUE_SHADOWS, 1, 0, { NULL } };
GtkCssValue *
_gtk_css_shadows_value_new_none (void)
{
return _gtk_css_value_ref (&none_singleton);
}
static GtkCssValue *
gtk_css_shadows_value_new (GtkCssValue **values,
guint len)
{
GtkCssValue *result;
g_return_val_if_fail (values != NULL, NULL);
g_return_val_if_fail (len > 0, NULL);
result = _gtk_css_value_alloc (&GTK_CSS_VALUE_SHADOWS, sizeof (GtkCssValue) + sizeof (GtkCssValue *) * (len - 1));
result->len = len;
memcpy (&result->values[0], values, sizeof (GtkCssValue *) * len);
return result;
}
GtkCssValue *
_gtk_css_shadows_value_parse (GtkCssParser *parser,
gboolean box_shadow_mode)
{
GtkCssValue *value, *result;
GPtrArray *values;
if (gtk_css_parser_try_ident (parser, "none"))
return _gtk_css_shadows_value_new_none ();
values = g_ptr_array_new ();
do {
value = _gtk_css_shadow_value_parse (parser, box_shadow_mode);
if (value == NULL)
{
g_ptr_array_set_free_func (values, (GDestroyNotify) _gtk_css_value_unref);
g_ptr_array_free (values, TRUE);
return NULL;
}
g_ptr_array_add (values, value);
} while (gtk_css_parser_try_token (parser, GTK_CSS_TOKEN_COMMA));
result = gtk_css_shadows_value_new ((GtkCssValue **) values->pdata, values->len);
g_ptr_array_free (values, TRUE);
return result;
}
gboolean
_gtk_css_shadows_value_is_none (const GtkCssValue *shadows)
{
g_return_val_if_fail (shadows->class == &GTK_CSS_VALUE_SHADOWS, TRUE);
return shadows->len == 0;
}
gsize
gtk_css_shadows_value_get_n_shadows (const GtkCssValue *shadows)
{
return shadows->len;
}
void
gtk_css_shadows_value_get_shadows (const GtkCssValue *shadows,
GskShadow *out_shadows)
{
guint i;
for (i = 0; i < shadows->len; i++)
gtk_css_shadow_value_get_shadow (shadows->values[i], &out_shadows[i]);
}
void
gtk_css_shadows_value_snapshot_outset (const GtkCssValue *shadows,
GtkSnapshot *snapshot,
const GskRoundedRect*border_box)
{
guint i;
g_return_if_fail (shadows->class == &GTK_CSS_VALUE_SHADOWS);
for (i = 0; i < shadows->len; i++)
{
if (_gtk_css_shadow_value_get_inset (shadows->values[i]))
continue;
gtk_css_shadow_value_snapshot_outset (shadows->values[i], snapshot, border_box);
}
}
void
gtk_css_shadows_value_snapshot_inset (const GtkCssValue *shadows,
GtkSnapshot *snapshot,
const GskRoundedRect*padding_box)
{
guint i;
g_return_if_fail (shadows->class == &GTK_CSS_VALUE_SHADOWS);
for (i = 0; i < shadows->len; i++)
{
if (!_gtk_css_shadow_value_get_inset (shadows->values[i]))
continue;
gtk_css_shadow_value_snapshot_inset (shadows->values[i], snapshot, padding_box);
}
}
void
_gtk_css_shadows_value_get_extents (const GtkCssValue *shadows,
GtkBorder *border)
{
guint i;
GtkBorder b = { 0 }, sb;
const GtkCssValue *shadow;
g_return_if_fail (shadows->class == &GTK_CSS_VALUE_SHADOWS);
for (i = 0; i < shadows->len; i++)
{
shadow = shadows->values[i];
if (_gtk_css_shadow_value_get_inset (shadow))
continue;
gtk_css_shadow_value_get_extents (shadow, &sb);
b.top = MAX (b.top, sb.top);
b.right = MAX (b.right, sb.right);
b.bottom = MAX (b.bottom, sb.bottom);
b.left = MAX (b.left, sb.left);
}
*border = b;
}
gboolean
gtk_css_shadows_value_push_snapshot (const GtkCssValue *value,
GtkSnapshot *snapshot)
{
gboolean need_shadow = FALSE;
int i;
for (i = 0; i < value->len; i++)
{
if (!gtk_css_shadow_value_is_clear (value->values[i]))
{
need_shadow = TRUE;
break;
}
}
if (need_shadow)
{
GskShadow *shadows = g_newa (GskShadow, value->len);
gtk_css_shadows_value_get_shadows (value, shadows);
gtk_snapshot_push_shadow (snapshot, shadows, value->len);
}
return need_shadow;
}
-59
View File
@@ -1,59 +0,0 @@
/* GTK - The GIMP Toolkit
* Copyright (C) 2011 Red Hat, Inc.
*
* Author: Cosimo Cecchi <cosimoc@gnome.org>
*
* 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 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/>.
*/
#ifndef __GTK_CSS_SHADOWS_VALUE_H__
#define __GTK_CSS_SHADOWS_VALUE_H__
#include <cairo.h>
#include <pango/pango.h>
#include "gtkborder.h"
#include "gtktypes.h"
#include "gtkcssparserprivate.h"
#include "gtkcssvalueprivate.h"
#include "gtkroundedboxprivate.h"
G_BEGIN_DECLS
GtkCssValue * _gtk_css_shadows_value_new_none (void);
GtkCssValue * _gtk_css_shadows_value_parse (GtkCssParser *parser,
gboolean box_shadow_mode);
gboolean _gtk_css_shadows_value_is_none (const GtkCssValue *shadows);
gsize gtk_css_shadows_value_get_n_shadows (const GtkCssValue *shadows);
void gtk_css_shadows_value_get_shadows (const GtkCssValue *shadows,
GskShadow *out_shadows);
void gtk_css_shadows_value_snapshot_outset (const GtkCssValue *shadows,
GtkSnapshot *snapshot,
const GskRoundedRect *border_box);
void gtk_css_shadows_value_snapshot_inset (const GtkCssValue *shadows,
GtkSnapshot *snapshot,
const GskRoundedRect *padding_box);
void _gtk_css_shadows_value_get_extents (const GtkCssValue *shadows,
GtkBorder *border);
gboolean gtk_css_shadows_value_push_snapshot (const GtkCssValue *shadows,
GtkSnapshot *snapshot);
G_END_DECLS
#endif /* __GTK_CSS_SHADOWS_VALUE_H__ */
+442 -197
View File
@@ -23,7 +23,7 @@
#include "gtkcsscolorvalueprivate.h"
#include "gtkcssnumbervalueprivate.h"
#include "gtkcssrgbavalueprivate.h"
#include "gtkcsscolorvalueprivate.h"
#include "gtksnapshotprivate.h"
#include "gtkstylecontextprivate.h"
#include "gtkpango.h"
@@ -33,80 +33,133 @@
#include <math.h>
struct _GtkCssValue {
GTK_CSS_VALUE_BASE
typedef struct {
guint inset :1;
GtkCssValue *hoffset;
GtkCssValue *voffset;
GtkCssValue *radius;
GtkCssValue *spread;
GtkCssValue *color;
} ShadowValue;
struct _GtkCssValue {
GTK_CSS_VALUE_BASE
guint n_shadows;
ShadowValue shadows[1];
};
static GtkCssValue * gtk_css_shadow_value_new (GtkCssValue *hoffset,
GtkCssValue *voffset,
GtkCssValue *radius,
GtkCssValue *spread,
gboolean inset,
GtkCssValue *color);
static GtkCssValue * gtk_css_shadow_value_new (ShadowValue *shadows,
guint n_shadows);
static void
gtk_css_value_shadow_free (GtkCssValue *shadow)
shadow_value_for_transition (ShadowValue *result,
gboolean inset)
{
result->inset = inset;
result->hoffset = _gtk_css_number_value_new (0, GTK_CSS_PX);
result->voffset = _gtk_css_number_value_new (0, GTK_CSS_PX);
result->radius = _gtk_css_number_value_new (0, GTK_CSS_PX);
result->spread = _gtk_css_number_value_new (0, GTK_CSS_PX);
result->color = gtk_css_color_value_new_transparent ();
}
static void
shadow_value_unref (const ShadowValue *shadow)
{
_gtk_css_value_unref (shadow->hoffset);
_gtk_css_value_unref (shadow->voffset);
_gtk_css_value_unref (shadow->radius);
_gtk_css_value_unref (shadow->spread);
_gtk_css_value_unref (shadow->radius);
_gtk_css_value_unref (shadow->color);
}
g_slice_free (GtkCssValue, shadow);
static gboolean
shadow_value_transition (const ShadowValue *start,
const ShadowValue *end,
guint property_id,
double progress,
ShadowValue *result)
{
if (start->inset != end->inset)
return FALSE;
result->inset = start->inset;
result->hoffset = _gtk_css_value_transition (start->hoffset, end->hoffset, property_id, progress);
result->voffset = _gtk_css_value_transition (start->voffset, end->voffset, property_id, progress);
result->radius = _gtk_css_value_transition (start->radius, end->radius, property_id, progress);
result->spread = _gtk_css_value_transition (start->spread, end->spread, property_id, progress);
result->color = _gtk_css_value_transition (start->color, end->color, property_id, progress);
return TRUE;
}
static void
gtk_css_value_shadow_free (GtkCssValue *value)
{
guint i;
for (i = 0; i < value->n_shadows; i ++)
{
const ShadowValue *shadow = &value->shadows[i];
shadow_value_unref (shadow);
}
g_slice_free1 (sizeof (GtkCssValue) + sizeof (ShadowValue) * (value->n_shadows - 1), value);
}
static GtkCssValue *
gtk_css_value_shadow_compute (GtkCssValue *shadow,
gtk_css_value_shadow_compute (GtkCssValue *value,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style)
{
GtkCssValue *hoffset, *voffset, *radius, *spread, *color;
guint i;
ShadowValue *shadows;
hoffset = _gtk_css_value_compute (shadow->hoffset, property_id, provider, style, parent_style);
voffset = _gtk_css_value_compute (shadow->voffset, property_id, provider, style, parent_style);
radius = _gtk_css_value_compute (shadow->radius, property_id, provider, style, parent_style);
spread = _gtk_css_value_compute (shadow->spread, property_id, provider, style, parent_style),
color = _gtk_css_value_compute (shadow->color, property_id, provider, style, parent_style);
shadows = g_alloca (sizeof (ShadowValue) * value->n_shadows);
if (hoffset == shadow->hoffset &&
voffset == shadow->voffset &&
radius == shadow->radius &&
spread == shadow->spread &&
color == shadow->color)
for (i = 0; i < value->n_shadows; i++)
{
_gtk_css_value_unref (hoffset);
_gtk_css_value_unref (voffset);
_gtk_css_value_unref (radius);
_gtk_css_value_unref (spread);
_gtk_css_value_unref (color);
const ShadowValue *shadow = &value->shadows[i];
return _gtk_css_value_ref (shadow);
shadows[i].hoffset = _gtk_css_value_compute (shadow->hoffset, property_id, provider, style, parent_style);
shadows[i].voffset = _gtk_css_value_compute (shadow->voffset, property_id, provider, style, parent_style);
shadows[i].radius = _gtk_css_value_compute (shadow->radius, property_id, provider, style, parent_style);
shadows[i].spread = _gtk_css_value_compute (shadow->spread, property_id, provider, style, parent_style),
shadows[i].color = _gtk_css_value_compute (shadow->color, property_id, provider, style, parent_style);
}
return gtk_css_shadow_value_new (hoffset, voffset, radius, spread, shadow->inset, color);
return gtk_css_shadow_value_new (shadows, value->n_shadows);
}
static gboolean
gtk_css_value_shadow_equal (const GtkCssValue *shadow1,
const GtkCssValue *shadow2)
gtk_css_value_shadow_equal (const GtkCssValue *value1,
const GtkCssValue *value2)
{
return shadow1->inset == shadow2->inset
&& _gtk_css_value_equal (shadow1->hoffset, shadow2->hoffset)
&& _gtk_css_value_equal (shadow1->voffset, shadow2->voffset)
&& _gtk_css_value_equal (shadow1->radius, shadow2->radius)
&& _gtk_css_value_equal (shadow1->spread, shadow2->spread)
&& _gtk_css_value_equal (shadow1->color, shadow2->color);
guint i;
if (value1->n_shadows != value2->n_shadows)
return FALSE;
for (i = 0; i < value1->n_shadows; i++)
{
const ShadowValue *shadow1 = &value1->shadows[i];
const ShadowValue *shadow2 = &value2->shadows[i];
if (shadow1->inset != shadow2->inset ||
_gtk_css_value_equal (shadow1->hoffset, shadow2->hoffset) ||
_gtk_css_value_equal (shadow1->voffset, shadow2->voffset) ||
_gtk_css_value_equal (shadow1->radius, shadow2->radius) ||
_gtk_css_value_equal (shadow1->spread, shadow2->spread) ||
_gtk_css_value_equal (shadow1->color, shadow2->color))
return FALSE;
}
return TRUE;
}
static GtkCssValue *
@@ -115,46 +168,126 @@ gtk_css_value_shadow_transition (GtkCssValue *start,
guint property_id,
double progress)
{
if (start->inset != end->inset)
guint i, len;
ShadowValue *shadows;
if (start == end)
return _gtk_css_value_ref (start);
if (start->n_shadows != end->n_shadows)
return NULL;
return gtk_css_shadow_value_new (_gtk_css_value_transition (start->hoffset, end->hoffset, property_id, progress),
_gtk_css_value_transition (start->voffset, end->voffset, property_id, progress),
_gtk_css_value_transition (start->radius, end->radius, property_id, progress),
_gtk_css_value_transition (start->spread, end->spread, property_id, progress),
start->inset,
_gtk_css_value_transition (start->color, end->color, property_id, progress));
/* catches the important case of 2 none shadows */
if (start == end)
return _gtk_css_value_ref (start);
if (start->n_shadows > end->n_shadows)
len = start->n_shadows;
else
len = end->n_shadows;
shadows = g_newa (ShadowValue, len);
for (i = 0; i < MIN (start->n_shadows, end->n_shadows); i++)
{
if (!shadow_value_transition (&start->shadows[i], &end->shadows[i],
property_id, progress,
&shadows[i]))
{
while (i--)
shadow_value_unref (&shadows[i]);
g_message ("NOPE. REturning NULL!");
return NULL;
}
}
if (start->n_shadows > end->n_shadows)
{
for (; i < len; i++)
{
ShadowValue fill;
shadow_value_for_transition (&fill, start->shadows[i].inset);
if (!shadow_value_transition (&start->shadows[i], &fill, property_id, progress, &shadows[i]))
{
while (i--)
shadow_value_unref (&shadows[i]);
shadow_value_unref (&fill);
g_message ("NOPE2. REturning NULL!");
return NULL;
}
shadow_value_unref (&fill);
}
}
else
{
for (; i < len; i++)
{
ShadowValue fill;
shadow_value_for_transition (&fill, end->shadows[i].inset);
if (!shadow_value_transition (&fill, &end->shadows[i], property_id, progress, &shadows[i]))
{
while (i--)
shadow_value_unref (&shadows[i]);
shadow_value_unref (&fill);
g_message ("NOPE3. REturning NULL!");
return NULL;
}
shadow_value_unref (&fill);
}
}
return gtk_css_shadow_value_new (shadows, len);
}
static void
gtk_css_value_shadow_print (const GtkCssValue *shadow,
gtk_css_value_shadow_print (const GtkCssValue *value,
GString *string)
{
_gtk_css_value_print (shadow->hoffset, string);
g_string_append_c (string, ' ');
_gtk_css_value_print (shadow->voffset, string);
g_string_append_c (string, ' ');
if (_gtk_css_number_value_get (shadow->radius, 100) != 0 ||
_gtk_css_number_value_get (shadow->spread, 100) != 0)
guint i;
if (value->n_shadows == 0)
{
_gtk_css_value_print (shadow->radius, string);
g_string_append_c (string, ' ');
g_string_append (string, "none");
return;
}
if (_gtk_css_number_value_get (shadow->spread, 100) != 0)
for (i = 0; i < value->n_shadows; i ++)
{
_gtk_css_value_print (shadow->spread, string);
const ShadowValue *shadow = &value->shadows[i];
if (i > 0)
g_string_append (string, ", ");
_gtk_css_value_print (shadow->hoffset, string);
g_string_append_c (string, ' ');
_gtk_css_value_print (shadow->voffset, string);
g_string_append_c (string, ' ');
if (_gtk_css_number_value_get (shadow->radius, 100) != 0 ||
_gtk_css_number_value_get (shadow->spread, 100) != 0)
{
_gtk_css_value_print (shadow->radius, string);
g_string_append_c (string, ' ');
}
if (_gtk_css_number_value_get (shadow->spread, 100) != 0)
{
_gtk_css_value_print (shadow->spread, string);
g_string_append_c (string, ' ');
}
_gtk_css_value_print (shadow->color, string);
if (shadow->inset)
g_string_append (string, " inset");
}
_gtk_css_value_print (shadow->color, string);
if (shadow->inset)
g_string_append (string, " inset");
}
static const GtkCssValueClass GTK_CSS_VALUE_SHADOW = {
"GtkCssShadowValue",
gtk_css_value_shadow_free,
gtk_css_value_shadow_compute,
gtk_css_value_shadow_equal,
@@ -164,39 +297,44 @@ static const GtkCssValueClass GTK_CSS_VALUE_SHADOW = {
gtk_css_value_shadow_print
};
static GtkCssValue *
gtk_css_shadow_value_new (GtkCssValue *hoffset,
GtkCssValue *voffset,
GtkCssValue *radius,
GtkCssValue *spread,
gboolean inset,
GtkCssValue *color)
gtk_css_shadow_value_new (ShadowValue *shadows,
guint n_shadows)
{
GtkCssValue *retval;
guint i;
retval = _gtk_css_value_new (GtkCssValue, &GTK_CSS_VALUE_SHADOW);
retval = _gtk_css_value_alloc (&GTK_CSS_VALUE_SHADOW, sizeof (GtkCssValue) + sizeof (ShadowValue) * (n_shadows - 1));
retval->n_shadows = n_shadows;
retval->hoffset = hoffset;
retval->voffset = voffset;
retval->radius = radius;
retval->spread = spread;
retval->inset = inset;
retval->color = color;
memcpy (retval->shadows, shadows, sizeof (ShadowValue) * n_shadows);
retval->is_computed = TRUE;
for (i = 0; i < n_shadows; i++)
{
const ShadowValue *shadow = &retval->shadows[i];
if (!gtk_css_value_is_computed (shadow->hoffset) ||
!gtk_css_value_is_computed (shadow->voffset) ||
!gtk_css_value_is_computed (shadow->spread) ||
!gtk_css_value_is_computed (shadow->radius) ||
!gtk_css_value_is_computed (shadow->color))
{
retval->is_computed = FALSE;
break;
}
}
return retval;
}
GtkCssValue *
_gtk_css_shadow_value_new_for_transition (GtkCssValue *target)
{
g_return_val_if_fail (target->class == &GTK_CSS_VALUE_SHADOW, NULL);
static GtkCssValue none_singleton = { &GTK_CSS_VALUE_SHADOW, 1, TRUE, 0 };
return gtk_css_shadow_value_new (_gtk_css_number_value_new (0, GTK_CSS_PX),
_gtk_css_number_value_new (0, GTK_CSS_PX),
_gtk_css_number_value_new (0, GTK_CSS_PX),
_gtk_css_number_value_new (0, GTK_CSS_PX),
target->inset,
_gtk_css_rgba_value_new_transparent ());
GtkCssValue *
gtk_css_shadow_value_new_none (void)
{
return _gtk_css_value_ref (&none_singleton);
}
enum {
@@ -288,9 +426,10 @@ parse_color (GtkCssParser *parser,
return TRUE;
}
GtkCssValue *
_gtk_css_shadow_value_parse (GtkCssParser *parser,
gboolean box_shadow_mode)
static gboolean
_gtk_css_shadow_value_parse_one (GtkCssParser *parser,
gboolean box_shadow_mode,
ShadowValue *result)
{
GtkCssValue *values[N_VALUES] = { NULL, };
GtkCssValue *color = NULL;
@@ -315,9 +454,14 @@ _gtk_css_shadow_value_parse (GtkCssParser *parser,
if (color == NULL)
color = _gtk_css_color_value_new_current_color ();
return gtk_css_shadow_value_new (values[HOFFSET], values[VOFFSET],
values[RADIUS], values[SPREAD],
inset, color);
result->hoffset = values[HOFFSET];
result->voffset = values[VOFFSET];
result->spread = values[SPREAD];
result->radius = values[RADIUS];
result->color = color;
result->inset = inset;
return TRUE;
fail:
for (i = 0; i < N_VALUES; i++)
@@ -326,149 +470,250 @@ fail:
}
g_clear_pointer (&color, gtk_css_value_unref);
return FALSE;
}
#define MAX_SHADOWS 64
GtkCssValue *
_gtk_css_shadow_value_parse (GtkCssParser *parser,
gboolean box_shadow_mode)
{
ShadowValue shadows[MAX_SHADOWS];
int n_shadows = 0;
int i;
if (gtk_css_parser_try_ident (parser, "none"))
return gtk_css_shadow_value_new_none ();
do {
if (_gtk_css_shadow_value_parse_one (parser, box_shadow_mode, &shadows[n_shadows]))
n_shadows++;
if (n_shadows > MAX_SHADOWS)
{
gtk_css_parser_error_syntax (parser, "Not more than 64 shadows supported");
goto fail;
}
} while (gtk_css_parser_try_token (parser, GTK_CSS_TOKEN_COMMA));
return gtk_css_shadow_value_new (shadows, n_shadows);
fail:
for (i = 0; i < n_shadows; i++)
{
const ShadowValue *shadow = &shadows[i];
shadow_value_unref (shadow);
}
return NULL;
}
gboolean
_gtk_css_shadow_value_get_inset (const GtkCssValue *shadow)
{
g_return_val_if_fail (shadow->class == &GTK_CSS_VALUE_SHADOW, FALSE);
return shadow->inset;
}
void
gtk_css_shadow_value_get_extents (const GtkCssValue *shadow,
gtk_css_shadow_value_get_extents (const GtkCssValue *value,
GtkBorder *border)
{
gdouble hoffset, voffset, spread, radius, clip_radius;
guint i;
spread = _gtk_css_number_value_get (shadow->spread, 0);
radius = _gtk_css_number_value_get (shadow->radius, 0);
clip_radius = gsk_cairo_blur_compute_pixels (radius);
hoffset = _gtk_css_number_value_get (shadow->hoffset, 0);
voffset = _gtk_css_number_value_get (shadow->voffset, 0);
memset (border, 0, sizeof (GtkBorder));
border->top = MAX (0, ceil (clip_radius + spread - voffset));
border->right = MAX (0, ceil (clip_radius + spread + hoffset));
border->bottom = MAX (0, ceil (clip_radius + spread + voffset));
border->left = MAX (0, ceil (clip_radius + spread - hoffset));
for (i = 0; i < value->n_shadows; i ++)
{
const ShadowValue *shadow = &value->shadows[i];
double hoffset, voffset, spread, radius, clip_radius;
spread = _gtk_css_number_value_get (shadow->spread, 0);
radius = _gtk_css_number_value_get (shadow->radius, 0);
clip_radius = gsk_cairo_blur_compute_pixels (radius);
hoffset = _gtk_css_number_value_get (shadow->hoffset, 0);
voffset = _gtk_css_number_value_get (shadow->voffset, 0);
border->top = MAX (border->top, ceil (clip_radius + spread - voffset));
border->right = MAX (border->right, ceil (clip_radius + spread + hoffset));
border->bottom = MAX (border->bottom, ceil (clip_radius + spread + voffset));
border->left = MAX (border->left, ceil (clip_radius + spread - hoffset));
}
}
void
gtk_css_shadow_value_get_shadow (const GtkCssValue *value,
GskShadow *shadow)
{
shadow->color = *_gtk_css_rgba_value_get_rgba (value->color);
shadow->dx = _gtk_css_number_value_get (value->hoffset, 0);
shadow->dy = _gtk_css_number_value_get (value->voffset, 0);
shadow->radius = _gtk_css_number_value_get (value->radius, 0);
}
void
gtk_css_shadow_value_snapshot_outset (const GtkCssValue *shadow,
gtk_css_shadow_value_snapshot_outset (const GtkCssValue *value,
GtkSnapshot *snapshot,
const GskRoundedRect *border_box)
{
g_return_if_fail (shadow->class == &GTK_CSS_VALUE_SHADOW);
guint i;
/* We don't need to draw invisible shadows */
if (gdk_rgba_is_clear (_gtk_css_rgba_value_get_rgba (shadow->color)))
return;
g_return_if_fail (value->class == &GTK_CSS_VALUE_SHADOW);
gtk_snapshot_append_outset_shadow (snapshot,
border_box,
_gtk_css_rgba_value_get_rgba (shadow->color),
_gtk_css_number_value_get (shadow->hoffset, 0),
_gtk_css_number_value_get (shadow->voffset, 0),
_gtk_css_number_value_get (shadow->spread, 0),
_gtk_css_number_value_get (shadow->radius, 0));
for (i = 0; i < value->n_shadows; i ++)
{
const ShadowValue *shadow = &value->shadows[i];
if (shadow->inset)
continue;
/* We don't need to draw invisible shadows */
if (gdk_rgba_is_clear (gtk_css_color_value_get_rgba (shadow->color)))
continue;
gtk_snapshot_append_outset_shadow (snapshot,
border_box,
gtk_css_color_value_get_rgba (shadow->color),
_gtk_css_number_value_get (shadow->hoffset, 0),
_gtk_css_number_value_get (shadow->voffset, 0),
_gtk_css_number_value_get (shadow->spread, 0),
_gtk_css_number_value_get (shadow->radius, 0));
}
}
void
gtk_css_shadow_value_snapshot_inset (const GtkCssValue *shadow,
gtk_css_shadow_value_snapshot_inset (const GtkCssValue *value,
GtkSnapshot *snapshot,
const GskRoundedRect *padding_box)
{
guint i;
double dx, dy, spread, radius;
const GdkRGBA *color;
g_return_if_fail (shadow->class == &GTK_CSS_VALUE_SHADOW);
g_return_if_fail (value->class == &GTK_CSS_VALUE_SHADOW);
/* We don't need to draw invisible shadows */
if (gdk_rgba_is_clear (_gtk_css_rgba_value_get_rgba (shadow->color)))
return;
dx = _gtk_css_number_value_get (shadow->hoffset, 0);
dy = _gtk_css_number_value_get (shadow->voffset, 0);
spread = _gtk_css_number_value_get (shadow->spread, 0);
radius = _gtk_css_number_value_get (shadow->radius, 0);
color = _gtk_css_rgba_value_get_rgba (shadow->color);
/* These are trivial to do with a color node */
if (spread == 0 && radius == 0 &&
gsk_rounded_rect_is_rectilinear (padding_box))
for (i = 0; i < value->n_shadows; i ++)
{
const graphene_rect_t *padding_bounds = &padding_box->bounds;
const ShadowValue *shadow = &value->shadows[i];
if (dx > 0)
{
const float y = dy > 0 ? dy : 0;
if (!shadow->inset)
continue;
gtk_snapshot_append_color (snapshot, color,
&GRAPHENE_RECT_INIT (
padding_bounds->origin.x,
padding_bounds->origin.y + y,
dx,
padding_bounds->size.height - ABS (dy)
));
}
else if (dx < 0)
{
const float y = dy > 0 ? dy : 0;
/* We don't need to draw invisible shadows */
if (gdk_rgba_is_clear (gtk_css_color_value_get_rgba (shadow->color)))
continue;
gtk_snapshot_append_color (snapshot, color,
&GRAPHENE_RECT_INIT (
padding_bounds->origin.x + padding_bounds->size.width + dx,
padding_bounds->origin.y + y,
- dx,
padding_bounds->size.height - ABS (dy)
));
}
dx = _gtk_css_number_value_get (shadow->hoffset, 0);
dy = _gtk_css_number_value_get (shadow->voffset, 0);
spread = _gtk_css_number_value_get (shadow->spread, 0);
radius = _gtk_css_number_value_get (shadow->radius, 0);
color = gtk_css_color_value_get_rgba (shadow->color);
if (dy > 0)
/* These are trivial to do with a color node */
if (spread == 0 && radius == 0 &&
gsk_rounded_rect_is_rectilinear (padding_box))
{
gtk_snapshot_append_color (snapshot, color,
&GRAPHENE_RECT_INIT (
padding_bounds->origin.x,
padding_bounds->origin.y,
padding_bounds->size.width,
dy
));
const graphene_rect_t *padding_bounds = &padding_box->bounds;
if (dx > 0)
{
const float y = dy > 0 ? dy : 0;
gtk_snapshot_append_color (snapshot, color,
&GRAPHENE_RECT_INIT (
padding_bounds->origin.x,
padding_bounds->origin.y + y,
dx,
padding_bounds->size.height - ABS (dy)
));
}
else if (dx < 0)
{
const float y = dy > 0 ? dy : 0;
gtk_snapshot_append_color (snapshot, color,
&GRAPHENE_RECT_INIT (
padding_bounds->origin.x + padding_bounds->size.width + dx,
padding_bounds->origin.y + y,
- dx,
padding_bounds->size.height - ABS (dy)
));
}
if (dy > 0)
{
gtk_snapshot_append_color (snapshot, color,
&GRAPHENE_RECT_INIT (
padding_bounds->origin.x,
padding_bounds->origin.y,
padding_bounds->size.width,
dy
));
}
else if (dy < 0)
{
gtk_snapshot_append_color (snapshot, color,
&GRAPHENE_RECT_INIT (
padding_bounds->origin.x,
padding_bounds->origin.y + padding_bounds->size.height + dy,
padding_bounds->size.width,
- dy
));
}
}
else if (dy < 0)
else
{
gtk_snapshot_append_color (snapshot, color,
&GRAPHENE_RECT_INIT (
padding_bounds->origin.x,
padding_bounds->origin.y + padding_bounds->size.height + dy,
padding_bounds->size.width,
- dy
));
gtk_snapshot_append_inset_shadow (snapshot,
padding_box,
color,
dx, dy, spread, radius);
}
}
else
{
gtk_snapshot_append_inset_shadow (snapshot,
padding_box,
color,
dx, dy, spread, radius);
}
}
gboolean
gtk_css_shadow_value_is_clear (const GtkCssValue *shadow)
gtk_css_shadow_value_is_clear (const GtkCssValue *value)
{
return gdk_rgba_is_clear (_gtk_css_rgba_value_get_rgba (shadow->color));
guint i;
if (!value)
return TRUE;
for (i = 0; i < value->n_shadows; i++)
{
const ShadowValue *shadow = &value->shadows[i];
if (!gdk_rgba_is_clear (gtk_css_color_value_get_rgba (shadow->color)))
return FALSE;
}
return TRUE;
}
gboolean
gtk_css_shadow_value_is_none (const GtkCssValue *shadow)
{
return !shadow || shadow->n_shadows == 0;
}
gboolean
gtk_css_shadow_value_push_snapshot (const GtkCssValue *value,
GtkSnapshot *snapshot)
{
gboolean need_shadow = FALSE;
guint i;
/* TODO: We can save this as a flag once and then reuse it */
for (i = 0; i < value->n_shadows; i++)
{
const ShadowValue *shadow = &value->shadows[i];
if (!gdk_rgba_is_clear (gtk_css_color_value_get_rgba (shadow->color)))
{
need_shadow = TRUE;
break;
}
}
if (need_shadow)
{
GskShadow *shadows = g_newa (GskShadow, value->n_shadows);
for (i = 0; i < value->n_shadows; i++)
{
const ShadowValue *shadow = &value->shadows[i];
shadows[i].dx = _gtk_css_number_value_get (shadow->hoffset, 0);
shadows[i].dy = _gtk_css_number_value_get (shadow->voffset, 0);
shadows[i].color = *gtk_css_color_value_get_rgba (shadow->color);
shadows[i].radius = _gtk_css_number_value_get (shadow->radius, 0);
}
gtk_snapshot_push_shadow (snapshot, shadows, value->n_shadows);
}
return need_shadow;
}
+6 -9
View File
@@ -28,24 +28,17 @@
#include "gtkcssparserprivate.h"
#include "gtkcssvalueprivate.h"
#include "gtkroundedboxprivate.h"
#include "gtksnapshot.h"
G_BEGIN_DECLS
GtkCssValue * _gtk_css_shadow_value_new_for_transition (GtkCssValue *target);
GtkCssValue * gtk_css_shadow_value_new_none (void);
GtkCssValue * _gtk_css_shadow_value_parse (GtkCssParser *parser,
gboolean box_shadow_mode);
gboolean _gtk_css_shadow_value_get_inset (const GtkCssValue *shadow);
void gtk_css_shadow_value_get_extents (const GtkCssValue *shadow,
GtkBorder *border);
void gtk_css_shadow_value_get_shadow (const GtkCssValue *value,
GskShadow *shadow);
void _gtk_css_shadow_value_paint_icon (const GtkCssValue *shadow,
cairo_t *cr);
void gtk_css_shadow_value_snapshot_outset (const GtkCssValue *shadow,
GtkSnapshot *snapshot,
const GskRoundedRect *border_box);
@@ -54,6 +47,10 @@ void gtk_css_shadow_value_snapshot_inset (const GtkCssValue
const GskRoundedRect *padding_box);
gboolean gtk_css_shadow_value_is_clear (const GtkCssValue *shadow);
gboolean gtk_css_shadow_value_is_none (const GtkCssValue *shadow);
gboolean gtk_css_shadow_value_push_snapshot (const GtkCssValue *value,
GtkSnapshot *snapshot);
G_END_DECLS
+42 -16
View File
@@ -37,6 +37,7 @@
#include "gtkstyleanimationprivate.h"
#include "gtkstylepropertyprivate.h"
#include "gtkstyleproviderprivate.h"
#include "gtkcssdimensionvalueprivate.h"
G_DEFINE_TYPE (GtkCssStaticStyle, gtk_css_static_style, GTK_TYPE_CSS_STYLE)
@@ -158,7 +159,8 @@ gtk_css_static_style_get_default (void)
settings = gtk_settings_get_default ();
default_style = gtk_css_static_style_new_compute (GTK_STYLE_PROVIDER (settings),
NULL,
NULL);
NULL,
TRUE);
g_object_set_data_full (G_OBJECT (settings), I_("gtk-default-style"),
default_style, clear_default_style);
}
@@ -169,7 +171,8 @@ gtk_css_static_style_get_default (void)
GtkCssStyle *
gtk_css_static_style_new_compute (GtkStyleProvider *provider,
const GtkCssMatcher *matcher,
GtkCssStyle *parent)
GtkCssStyle *parent,
gboolean compute_change)
{
GtkCssStaticStyle *result;
GtkCssLookup lookup;
@@ -181,7 +184,7 @@ gtk_css_static_style_new_compute (GtkStyleProvider *provider,
gtk_style_provider_lookup (provider,
matcher,
&lookup,
&change);
compute_change ? &change : NULL);
result = g_object_new (GTK_TYPE_CSS_STATIC_STYLE, NULL);
@@ -206,31 +209,54 @@ gtk_css_static_style_compute_value (GtkCssStaticStyle *style,
GtkCssSection *section)
{
GtkCssValue *value;
GtkBorderStyle border_style;
gtk_internal_return_if_fail (id < GTK_CSS_PROPERTY_N_PROPERTIES);
/* special case according to http://dev.w3.org/csswg/css-backgrounds/#the-border-width */
switch (id)
{
/* We have them ordered in gtkcssstylepropertyimpl.c accordingly, so the
* border styles are already computed when we compute the border widths.
*
* Note that we rely on ..._STYLE == ..._WIDTH - 1 here.
*/
case GTK_CSS_PROPERTY_BORDER_TOP_WIDTH:
case GTK_CSS_PROPERTY_BORDER_RIGHT_WIDTH:
case GTK_CSS_PROPERTY_BORDER_BOTTOM_WIDTH:
case GTK_CSS_PROPERTY_BORDER_LEFT_WIDTH:
case GTK_CSS_PROPERTY_OUTLINE_WIDTH:
border_style = _gtk_css_border_style_value_get (gtk_css_style_get_value ((GtkCssStyle *)style, id - 1));
if (border_style == GTK_BORDER_STYLE_NONE || border_style == GTK_BORDER_STYLE_HIDDEN)
{
gtk_css_static_style_set_value (style, id, gtk_css_dimension_value_new (0, GTK_CSS_NUMBER), section);
return;
}
break;
default:
/* Go ahead */
break;
}
/* 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)
if (specified)
{
GtkCssStyleProperty *prop = _gtk_css_style_property_lookup_by_id (id);
if (parent_style && _gtk_css_style_property_is_inherit (prop))
{
/* Just take the style from the parent */
value = _gtk_css_value_ref (gtk_css_style_get_value (parent_style, id));
}
else
{
value = _gtk_css_initial_value_new_compute (id, provider, (GtkCssStyle *)style, parent_style);
}
value = _gtk_css_value_compute (specified, id, provider, (GtkCssStyle *)style, parent_style);
}
else if (parent_style && _gtk_css_style_property_is_inherit (_gtk_css_style_property_lookup_by_id (id)))
{
/* Just take the style from the parent */
value = _gtk_css_value_ref (gtk_css_style_get_value (parent_style, id));
}
else
{
value = _gtk_css_value_compute (specified, id, provider, (GtkCssStyle *)style, parent_style);
value = _gtk_css_initial_value_new_compute (id, provider, (GtkCssStyle *)style, parent_style);
}
gtk_css_static_style_set_value (style, id, value, section);
+2 -1
View File
@@ -55,7 +55,8 @@ GType gtk_css_static_style_get_type (void) G_GNUC_CO
GtkCssStyle * gtk_css_static_style_get_default (void);
GtkCssStyle * gtk_css_static_style_new_compute (GtkStyleProvider *provider,
const GtkCssMatcher *matcher,
GtkCssStyle *parent);
GtkCssStyle *parent,
gboolean compute_change);
void gtk_css_static_style_compute_value (GtkCssStaticStyle *style,
GtkStyleProvider *provider,
+4
View File
@@ -117,6 +117,7 @@ out:
}
static const GtkCssValueClass GTK_CSS_VALUE_STRING = {
"GtkCssStringValue",
gtk_css_value_string_free,
gtk_css_value_string_compute,
gtk_css_value_string_equal,
@@ -127,6 +128,7 @@ static const GtkCssValueClass GTK_CSS_VALUE_STRING = {
};
static const GtkCssValueClass GTK_CSS_VALUE_IDENT = {
"GtkCssIdentValue",
gtk_css_value_string_free,
gtk_css_value_string_compute,
gtk_css_value_string_equal,
@@ -149,6 +151,7 @@ _gtk_css_string_value_new_take (char *string)
result = _gtk_css_value_new (GtkCssValue, &GTK_CSS_VALUE_STRING);
result->string = string;
result->is_computed = TRUE;
return result;
}
@@ -189,6 +192,7 @@ _gtk_css_ident_value_new_take (char *ident)
result = _gtk_css_value_new (GtkCssValue, &GTK_CSS_VALUE_IDENT);
result->string = ident;
result->is_computed = TRUE;
return result;
}
+41 -9
View File
@@ -28,7 +28,7 @@
#include "gtkcssinheritvalueprivate.h"
#include "gtkcssinitialvalueprivate.h"
#include "gtkcssnumbervalueprivate.h"
#include "gtkcssrgbavalueprivate.h"
#include "gtkcsscolorvalueprivate.h"
#include "gtkcssshorthandpropertyprivate.h"
#include "gtkcssstringvalueprivate.h"
#include "gtkcssfontfeaturesvalueprivate.h"
@@ -37,6 +37,7 @@
#include "gtkstyleanimationprivate.h"
#include "gtkstylepropertyprivate.h"
#include "gtkstyleproviderprivate.h"
#include "gtksettings.h"
G_DEFINE_ABSTRACT_TYPE (GtkCssStyle, gtk_css_style, G_TYPE_OBJECT)
@@ -53,11 +54,18 @@ gtk_css_style_real_is_static (GtkCssStyle *style)
return TRUE;
}
static GtkCssStyle *
gtk_css_style_real_get_static_style (GtkCssStyle *style)
{
return style;
}
static void
gtk_css_style_class_init (GtkCssStyleClass *klass)
{
klass->get_section = gtk_css_style_real_get_section;
klass->is_static = gtk_css_style_real_is_static;
klass->get_static_style = gtk_css_style_real_get_static_style;
}
static void
@@ -89,6 +97,14 @@ gtk_css_style_is_static (GtkCssStyle *style)
return GTK_CSS_STYLE_GET_CLASS (style)->is_static (style);
}
GtkCssStyle *
gtk_css_style_get_static_style (GtkCssStyle *style)
{
gtk_internal_return_val_if_fail (GTK_IS_CSS_STYLE (style), NULL);
return GTK_CSS_STYLE_GET_CLASS (style)->get_static_style (style);
}
/*
* gtk_css_style_print:
* @style: a #GtkCssStyle
@@ -110,11 +126,17 @@ gtk_css_style_print (GtkCssStyle *style,
gboolean skip_initial)
{
guint i;
GtkCssStyle *default_style;
gboolean retval = FALSE;
g_return_val_if_fail (GTK_IS_CSS_STYLE (style), FALSE);
g_return_val_if_fail (string != NULL, FALSE);
default_style = gtk_css_static_style_get_default ();
if (style == default_style)
g_string_append_printf (string, "%*sDEFAULT STYLE\n", indent, "");
for (i = 0; i < _gtk_css_style_property_get_n_properties (); i++)
{
GtkCssSection *section;
@@ -122,13 +144,23 @@ gtk_css_style_print (GtkCssStyle *style,
GtkCssValue *value;
const char *name;
section = gtk_css_style_get_section (style, i);
if (!section && skip_initial)
continue;
prop = _gtk_css_style_property_lookup_by_id (i);
name = _gtk_style_property_get_name (GTK_STYLE_PROPERTY (prop));
value = gtk_css_style_get_value (style, i);
prop = _gtk_css_style_property_lookup_by_id (i);
if (skip_initial)
{
GtkCssValue *initial = _gtk_css_style_property_get_initial_value (prop);
GtkCssValue *computed = _gtk_css_value_compute (initial, i,
GTK_STYLE_PROVIDER (gtk_settings_get_default ()),
default_style,
default_style);
gboolean is_initial = _gtk_css_value_equal (value, computed);
gtk_css_value_unref (computed);
if (is_initial)
continue;
}
section = gtk_css_style_get_section (style, i);
name = _gtk_style_property_get_name (GTK_STYLE_PROPERTY (prop));
g_string_append_printf (string, "%*s%s: ", indent, "", name);
_gtk_css_value_print (value, string);
@@ -219,8 +251,8 @@ gtk_css_style_get_pango_attributes (GtkCssStyle *style)
/* text-decoration */
decoration_line = _gtk_css_text_decoration_line_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_TEXT_DECORATION_LINE));
decoration_style = _gtk_css_text_decoration_style_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_TEXT_DECORATION_STYLE));
color = _gtk_css_rgba_value_get_rgba (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_COLOR));
decoration_color = _gtk_css_rgba_value_get_rgba (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_TEXT_DECORATION_COLOR));
color = gtk_css_color_value_get_rgba (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_COLOR));
decoration_color = gtk_css_color_value_get_rgba (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_TEXT_DECORATION_COLOR));
switch (decoration_line)
{
+3
View File
@@ -56,6 +56,8 @@ struct _GtkCssStyleClass
guint id);
/* TRUE if this style will require changes based on timestamp */
gboolean (* is_static) (GtkCssStyle *style);
GtkCssStyle * (* get_static_style) (GtkCssStyle *style);
};
GType gtk_css_style_get_type (void) G_GNUC_CONST;
@@ -74,6 +76,7 @@ gboolean gtk_css_style_print (GtkCssStyle
PangoAttrList * gtk_css_style_get_pango_attributes (GtkCssStyle *style);
PangoFontDescription * gtk_css_style_get_pango_font (GtkCssStyle *style);
GtkCssStyle * gtk_css_style_get_static_style (GtkCssStyle *style);
G_END_DECLS
-30
View File
@@ -372,33 +372,3 @@ _gtk_css_style_property_get_initial_value (GtkCssStyleProperty *property)
return property->initial_value;
}
/**
* _gtk_css_style_property_get_mask_affecting:
* @flags: the flags that are affected
*
* Computes a bitmask for all properties that have at least one of @flags
* set.
*
* Returns: (transfer full): A #GtkBitmask with the bit set for every
* property that has at least one of @flags set.
*/
GtkBitmask *
_gtk_css_style_property_get_mask_affecting (GtkCssAffects affects)
{
GtkBitmask *result;
guint i;
result = _gtk_bitmask_new ();
for (i = 0; i < _gtk_css_style_property_get_n_properties (); i++)
{
GtkCssStyleProperty *prop = _gtk_css_style_property_lookup_by_id (i);
if (_gtk_css_style_property_get_affects (prop) & affects)
result = _gtk_bitmask_set (result, i, TRUE);
}
return result;
}
+49 -60
View File
@@ -53,8 +53,7 @@
#include "gtkcsspalettevalueprivate.h"
#include "gtkcsspositionvalueprivate.h"
#include "gtkcssrepeatvalueprivate.h"
#include "gtkcssrgbavalueprivate.h"
#include "gtkcssshadowsvalueprivate.h"
#include "gtkcssshadowvalueprivate.h"
#include "gtkcssstringvalueprivate.h"
#include "gtkcsstransformvalueprivate.h"
#include "gtkcssfontvariationsvalueprivate.h"
@@ -104,7 +103,7 @@ gtk_css_style_property_register (const char * name,
static void
query_length_as_int (GtkCssStyleProperty *property,
const GtkCssValue *css_value,
GtkCssValue *css_value,
GValue *value)
{
g_value_init (value, G_TYPE_INT);
@@ -113,7 +112,7 @@ query_length_as_int (GtkCssStyleProperty *property,
static void
query_font_size (GtkCssStyleProperty *property,
const GtkCssValue *css_value,
GtkCssValue *css_value,
GValue *value)
{
g_value_init (value, G_TYPE_DOUBLE);
@@ -122,7 +121,7 @@ query_font_size (GtkCssStyleProperty *property,
static void
query_border (GtkCssStyleProperty *property,
const GtkCssValue *css_value,
GtkCssValue *css_value,
GValue *value)
{
GtkBorder border;
@@ -146,11 +145,11 @@ color_parse (GtkCssStyleProperty *property,
static void
color_query (GtkCssStyleProperty *property,
const GtkCssValue *css_value,
GtkCssValue *css_value,
GValue *value)
{
g_value_init (value, GDK_TYPE_RGBA);
g_value_set_boxed (value, _gtk_css_rgba_value_get_rgba (css_value));
g_value_set_boxed (value, gtk_css_color_value_get_rgba (css_value));
}
static GtkCssValue *
@@ -199,7 +198,7 @@ font_family_parse (GtkCssStyleProperty *property,
static void
font_family_query (GtkCssStyleProperty *property,
const GtkCssValue *css_value,
GtkCssValue *css_value,
GValue *value)
{
GPtrArray *array;
@@ -233,7 +232,7 @@ font_style_parse (GtkCssStyleProperty *property,
static void
font_style_query (GtkCssStyleProperty *property,
const GtkCssValue *css_value,
GtkCssValue *css_value,
GValue *value)
{
g_value_init (value, PANGO_TYPE_STYLE);
@@ -266,7 +265,7 @@ font_weight_parse (GtkCssStyleProperty *property,
static void
font_weight_query (GtkCssStyleProperty *property,
const GtkCssValue *css_value,
GtkCssValue *css_value,
GValue *value)
{
g_value_init (value, PANGO_TYPE_WEIGHT);
@@ -287,7 +286,7 @@ font_stretch_parse (GtkCssStyleProperty *property,
static void
font_stretch_query (GtkCssStyleProperty *property,
const GtkCssValue *css_value,
GtkCssValue *css_value,
GValue *value)
{
g_value_init (value, PANGO_TYPE_STRETCH);
@@ -308,7 +307,7 @@ parse_border_style (GtkCssStyleProperty *property,
static void
query_border_style (GtkCssStyleProperty *property,
const GtkCssValue *css_value,
GtkCssValue *css_value,
GValue *value)
{
g_value_init (value, GTK_TYPE_BORDER_STYLE);
@@ -360,7 +359,7 @@ opacity_parse (GtkCssStyleProperty *property,
static void
opacity_query (GtkCssStyleProperty *property,
const GtkCssValue *css_value,
GtkCssValue *css_value,
GValue *value)
{
g_value_init (value, G_TYPE_DOUBLE);
@@ -620,14 +619,14 @@ static GtkCssValue *
box_shadow_value_parse (GtkCssStyleProperty *property,
GtkCssParser *parser)
{
return _gtk_css_shadows_value_parse (parser, TRUE);
return _gtk_css_shadow_value_parse (parser, TRUE);
}
static GtkCssValue *
shadow_value_parse (GtkCssStyleProperty *property,
GtkCssParser *parser)
{
return _gtk_css_shadows_value_parse (parser, FALSE);
return _gtk_css_shadow_value_parse (parser, FALSE);
}
static GtkCssValue *
@@ -936,7 +935,7 @@ _gtk_css_style_property_init_properties (void)
GTK_CSS_AFFECTS_CONTENT | GTK_CSS_AFFECTS_SYMBOLIC_ICON,
color_parse,
color_query,
_gtk_css_rgba_value_new_white ());
gtk_css_color_value_new_white ());
gtk_css_style_property_register ("-gtk-dpi",
GTK_CSS_PROPERTY_DPI,
G_TYPE_NONE,
@@ -980,7 +979,7 @@ _gtk_css_style_property_init_properties (void)
GTK_CSS_AFFECTS_BACKGROUND,
color_parse,
color_query,
_gtk_css_rgba_value_new_transparent ());
gtk_css_color_value_new_transparent ());
gtk_css_style_property_register ("font-family",
GTK_CSS_PROPERTY_FONT_FAMILY,
@@ -989,7 +988,7 @@ _gtk_css_style_property_init_properties (void)
GTK_CSS_AFFECTS_TEXT_SIZE,
font_family_parse,
font_family_query,
_gtk_css_array_value_new (_gtk_css_string_value_new ("Sans")));
_gtk_css_string_value_new ("Sans"));
gtk_css_style_property_register ("font-style",
GTK_CSS_PROPERTY_FONT_STYLE,
PANGO_TYPE_STYLE,
@@ -1111,7 +1110,7 @@ _gtk_css_style_property_init_properties (void)
GTK_CSS_AFFECTS_TEXT_CONTENT,
shadow_value_parse,
NULL,
_gtk_css_shadows_value_new_none ());
gtk_css_shadow_value_new_none ());
gtk_css_style_property_register ("box-shadow",
GTK_CSS_PROPERTY_BOX_SHADOW,
@@ -1120,7 +1119,7 @@ _gtk_css_style_property_init_properties (void)
GTK_CSS_AFFECTS_BACKGROUND,
box_shadow_value_parse,
NULL,
_gtk_css_shadows_value_new_none ());
gtk_css_shadow_value_new_none ());
gtk_css_style_property_register ("margin-top",
GTK_CSS_PROPERTY_MARGIN_TOP,
@@ -1261,8 +1260,7 @@ _gtk_css_style_property_init_properties (void)
GTK_CSS_AFFECTS_BACKGROUND | GTK_CSS_AFFECTS_BORDER,
border_corner_radius_value_parse,
NULL,
_gtk_css_corner_value_new (_gtk_css_number_value_new (0, GTK_CSS_PX),
_gtk_css_number_value_new (0, GTK_CSS_PX)));
_gtk_css_number_value_new (0, GTK_CSS_PX));
gtk_css_style_property_register ("border-top-right-radius",
GTK_CSS_PROPERTY_BORDER_TOP_RIGHT_RADIUS,
G_TYPE_NONE,
@@ -1270,8 +1268,7 @@ _gtk_css_style_property_init_properties (void)
GTK_CSS_AFFECTS_BACKGROUND | GTK_CSS_AFFECTS_BORDER,
border_corner_radius_value_parse,
NULL,
_gtk_css_corner_value_new (_gtk_css_number_value_new (0, GTK_CSS_PX),
_gtk_css_number_value_new (0, GTK_CSS_PX)));
_gtk_css_number_value_new (0, GTK_CSS_PX));
gtk_css_style_property_register ("border-bottom-right-radius",
GTK_CSS_PROPERTY_BORDER_BOTTOM_RIGHT_RADIUS,
G_TYPE_NONE,
@@ -1279,8 +1276,7 @@ _gtk_css_style_property_init_properties (void)
GTK_CSS_AFFECTS_BACKGROUND | GTK_CSS_AFFECTS_BORDER,
border_corner_radius_value_parse,
NULL,
_gtk_css_corner_value_new (_gtk_css_number_value_new (0, GTK_CSS_PX),
_gtk_css_number_value_new (0, GTK_CSS_PX)));
_gtk_css_number_value_new (0, GTK_CSS_PX));
gtk_css_style_property_register ("border-bottom-left-radius",
GTK_CSS_PROPERTY_BORDER_BOTTOM_LEFT_RADIUS,
G_TYPE_NONE,
@@ -1288,8 +1284,7 @@ _gtk_css_style_property_init_properties (void)
GTK_CSS_AFFECTS_BACKGROUND | GTK_CSS_AFFECTS_BORDER,
border_corner_radius_value_parse,
NULL,
_gtk_css_corner_value_new (_gtk_css_number_value_new (0, GTK_CSS_PX),
_gtk_css_number_value_new (0, GTK_CSS_PX)));
_gtk_css_number_value_new (0, GTK_CSS_PX));
gtk_css_style_property_register ("outline-style",
GTK_CSS_PROPERTY_OUTLINE_STYLE,
@@ -1323,8 +1318,7 @@ _gtk_css_style_property_init_properties (void)
GTK_CSS_AFFECTS_OUTLINE,
border_corner_radius_value_parse,
NULL,
_gtk_css_corner_value_new (_gtk_css_number_value_new (0, GTK_CSS_PX),
_gtk_css_number_value_new (0, GTK_CSS_PX)));
_gtk_css_number_value_new (0, GTK_CSS_PX));
gtk_css_style_property_register ("-gtk-outline-top-right-radius",
GTK_CSS_PROPERTY_OUTLINE_TOP_RIGHT_RADIUS,
G_TYPE_NONE,
@@ -1332,8 +1326,7 @@ _gtk_css_style_property_init_properties (void)
GTK_CSS_AFFECTS_OUTLINE,
border_corner_radius_value_parse,
NULL,
_gtk_css_corner_value_new (_gtk_css_number_value_new (0, GTK_CSS_PX),
_gtk_css_number_value_new (0, GTK_CSS_PX)));
_gtk_css_number_value_new (0, GTK_CSS_PX));
gtk_css_style_property_register ("-gtk-outline-bottom-right-radius",
GTK_CSS_PROPERTY_OUTLINE_BOTTOM_RIGHT_RADIUS,
G_TYPE_NONE,
@@ -1341,8 +1334,7 @@ _gtk_css_style_property_init_properties (void)
GTK_CSS_AFFECTS_OUTLINE,
border_corner_radius_value_parse,
NULL,
_gtk_css_corner_value_new (_gtk_css_number_value_new (0, GTK_CSS_PX),
_gtk_css_number_value_new (0, GTK_CSS_PX)));
_gtk_css_number_value_new (0, GTK_CSS_PX));
gtk_css_style_property_register ("-gtk-outline-bottom-left-radius",
GTK_CSS_PROPERTY_OUTLINE_BOTTOM_LEFT_RADIUS,
G_TYPE_NONE,
@@ -1350,8 +1342,7 @@ _gtk_css_style_property_init_properties (void)
GTK_CSS_AFFECTS_OUTLINE,
border_corner_radius_value_parse,
NULL,
_gtk_css_corner_value_new (_gtk_css_number_value_new (0, GTK_CSS_PX),
_gtk_css_number_value_new (0, GTK_CSS_PX)));
_gtk_css_number_value_new (0, GTK_CSS_PX));
gtk_css_style_property_register ("background-clip",
GTK_CSS_PROPERTY_BACKGROUND_CLIP,
@@ -1360,7 +1351,7 @@ _gtk_css_style_property_init_properties (void)
GTK_CSS_AFFECTS_BACKGROUND,
parse_css_area,
NULL,
_gtk_css_array_value_new (_gtk_css_area_value_new (GTK_CSS_AREA_BORDER_BOX)));
_gtk_css_area_value_new (GTK_CSS_AREA_BORDER_BOX));
gtk_css_style_property_register ("background-origin",
GTK_CSS_PROPERTY_BACKGROUND_ORIGIN,
G_TYPE_NONE,
@@ -1368,7 +1359,7 @@ _gtk_css_style_property_init_properties (void)
GTK_CSS_AFFECTS_BACKGROUND,
parse_css_area,
NULL,
_gtk_css_array_value_new (_gtk_css_area_value_new (GTK_CSS_AREA_PADDING_BOX)));
_gtk_css_area_value_new (GTK_CSS_AREA_PADDING_BOX));
gtk_css_style_property_register ("background-size",
GTK_CSS_PROPERTY_BACKGROUND_SIZE,
G_TYPE_NONE,
@@ -1376,7 +1367,7 @@ _gtk_css_style_property_init_properties (void)
GTK_CSS_AFFECTS_BACKGROUND,
background_size_parse,
NULL,
_gtk_css_array_value_new (_gtk_css_bg_size_value_new (NULL, NULL)));
_gtk_css_bg_size_value_new (NULL, NULL));
gtk_css_style_property_register ("background-position",
GTK_CSS_PROPERTY_BACKGROUND_POSITION,
G_TYPE_NONE,
@@ -1384,8 +1375,8 @@ _gtk_css_style_property_init_properties (void)
GTK_CSS_AFFECTS_BACKGROUND,
background_position_parse,
NULL,
_gtk_css_array_value_new (_gtk_css_position_value_new (_gtk_css_number_value_new (0, GTK_CSS_PERCENT),
_gtk_css_number_value_new (0, GTK_CSS_PERCENT))));
_gtk_css_position_value_new (_gtk_css_number_value_new (0, GTK_CSS_PERCENT),
_gtk_css_number_value_new (0, GTK_CSS_PERCENT)));
gtk_css_style_property_register ("border-top-color",
GTK_CSS_PROPERTY_BORDER_TOP_COLOR,
@@ -1435,8 +1426,8 @@ _gtk_css_style_property_init_properties (void)
GTK_CSS_AFFECTS_BACKGROUND,
background_repeat_value_parse,
NULL,
_gtk_css_array_value_new (_gtk_css_background_repeat_value_new (GTK_CSS_REPEAT_STYLE_REPEAT,
GTK_CSS_REPEAT_STYLE_REPEAT)));
_gtk_css_background_repeat_value_new (GTK_CSS_REPEAT_STYLE_REPEAT,
GTK_CSS_REPEAT_STYLE_REPEAT));
gtk_css_style_property_register ("background-image",
GTK_CSS_PROPERTY_BACKGROUND_IMAGE,
G_TYPE_NONE,
@@ -1444,7 +1435,7 @@ _gtk_css_style_property_init_properties (void)
GTK_CSS_AFFECTS_BACKGROUND,
background_image_value_parse,
NULL,
_gtk_css_array_value_new (_gtk_css_image_value_new (NULL)));
_gtk_css_image_value_new (NULL));
gtk_css_style_property_register ("background-blend-mode",
GTK_CSS_PROPERTY_BACKGROUND_BLEND_MODE,
@@ -1453,7 +1444,7 @@ _gtk_css_style_property_init_properties (void)
GTK_CSS_AFFECTS_BACKGROUND,
blend_mode_value_parse,
NULL,
_gtk_css_array_value_new (_gtk_css_blend_mode_value_new (GSK_BLEND_MODE_DEFAULT)));
_gtk_css_blend_mode_value_new (GSK_BLEND_MODE_DEFAULT));
gtk_css_style_property_register ("border-image-source",
GTK_CSS_PROPERTY_BORDER_IMAGE_SOURCE,
@@ -1519,7 +1510,7 @@ _gtk_css_style_property_init_properties (void)
GTK_CSS_AFFECTS_ICON | GTK_CSS_AFFECTS_SYMBOLIC_ICON,
shadow_value_parse,
NULL,
_gtk_css_shadows_value_new_none ());
gtk_css_shadow_value_new_none ());
gtk_css_style_property_register ("-gtk-icon-style",
GTK_CSS_PROPERTY_ICON_STYLE,
G_TYPE_NONE,
@@ -1586,7 +1577,7 @@ _gtk_css_style_property_init_properties (void)
0,
transition_property_parse,
NULL,
_gtk_css_array_value_new (_gtk_css_ident_value_new ("all")));
_gtk_css_ident_value_new ("all"));
gtk_css_style_property_register ("transition-duration",
GTK_CSS_PROPERTY_TRANSITION_DURATION,
G_TYPE_NONE,
@@ -1594,7 +1585,7 @@ _gtk_css_style_property_init_properties (void)
0,
transition_time_parse,
NULL,
_gtk_css_array_value_new (_gtk_css_number_value_new (0, GTK_CSS_S)));
_gtk_css_number_value_new (0, GTK_CSS_S));
gtk_css_style_property_register ("transition-timing-function",
GTK_CSS_PROPERTY_TRANSITION_TIMING_FUNCTION,
G_TYPE_NONE,
@@ -1602,8 +1593,7 @@ _gtk_css_style_property_init_properties (void)
0,
transition_timing_function_parse,
NULL,
_gtk_css_array_value_new (
_gtk_css_ease_value_new_cubic_bezier (0.25, 0.1, 0.25, 1.0)));
_gtk_css_ease_value_new_cubic_bezier (0.25, 0.1, 0.25, 1.0));
gtk_css_style_property_register ("transition-delay",
GTK_CSS_PROPERTY_TRANSITION_DELAY,
G_TYPE_NONE,
@@ -1611,7 +1601,7 @@ _gtk_css_style_property_init_properties (void)
0,
transition_time_parse,
NULL,
_gtk_css_array_value_new (_gtk_css_number_value_new (0, GTK_CSS_S)));
_gtk_css_number_value_new (0, GTK_CSS_S));
gtk_css_style_property_register ("animation-name",
GTK_CSS_PROPERTY_ANIMATION_NAME,
@@ -1620,7 +1610,7 @@ _gtk_css_style_property_init_properties (void)
0,
transition_property_parse,
NULL,
_gtk_css_array_value_new (_gtk_css_ident_value_new ("none")));
_gtk_css_ident_value_new ("none"));
gtk_css_style_property_register ("animation-duration",
GTK_CSS_PROPERTY_ANIMATION_DURATION,
G_TYPE_NONE,
@@ -1628,7 +1618,7 @@ _gtk_css_style_property_init_properties (void)
0,
transition_time_parse,
NULL,
_gtk_css_array_value_new (_gtk_css_number_value_new (0, GTK_CSS_S)));
_gtk_css_number_value_new (0, GTK_CSS_S));
gtk_css_style_property_register ("animation-timing-function",
GTK_CSS_PROPERTY_ANIMATION_TIMING_FUNCTION,
G_TYPE_NONE,
@@ -1636,8 +1626,7 @@ _gtk_css_style_property_init_properties (void)
0,
transition_timing_function_parse,
NULL,
_gtk_css_array_value_new (
_gtk_css_ease_value_new_cubic_bezier (0.25, 0.1, 0.25, 1.0)));
_gtk_css_ease_value_new_cubic_bezier (0.25, 0.1, 0.25, 1.0));
gtk_css_style_property_register ("animation-iteration-count",
GTK_CSS_PROPERTY_ANIMATION_ITERATION_COUNT,
G_TYPE_NONE,
@@ -1645,7 +1634,7 @@ _gtk_css_style_property_init_properties (void)
0,
iteration_count_parse,
NULL,
_gtk_css_array_value_new (_gtk_css_number_value_new (1, GTK_CSS_NUMBER)));
_gtk_css_number_value_new (1, GTK_CSS_NUMBER));
gtk_css_style_property_register ("animation-direction",
GTK_CSS_PROPERTY_ANIMATION_DIRECTION,
G_TYPE_NONE,
@@ -1653,7 +1642,7 @@ _gtk_css_style_property_init_properties (void)
0,
parse_css_direction,
NULL,
_gtk_css_array_value_new (_gtk_css_direction_value_new (GTK_CSS_DIRECTION_NORMAL)));
_gtk_css_direction_value_new (GTK_CSS_DIRECTION_NORMAL));
gtk_css_style_property_register ("animation-play-state",
GTK_CSS_PROPERTY_ANIMATION_PLAY_STATE,
G_TYPE_NONE,
@@ -1661,7 +1650,7 @@ _gtk_css_style_property_init_properties (void)
0,
parse_css_play_state,
NULL,
_gtk_css_array_value_new (_gtk_css_play_state_value_new (GTK_CSS_PLAY_STATE_RUNNING)));
_gtk_css_play_state_value_new (GTK_CSS_PLAY_STATE_RUNNING));
gtk_css_style_property_register ("animation-delay",
GTK_CSS_PROPERTY_ANIMATION_DELAY,
G_TYPE_NONE,
@@ -1669,7 +1658,7 @@ _gtk_css_style_property_init_properties (void)
0,
transition_time_parse,
NULL,
_gtk_css_array_value_new (_gtk_css_number_value_new (0, GTK_CSS_S)));
_gtk_css_number_value_new (0, GTK_CSS_S));
gtk_css_style_property_register ("animation-fill-mode",
GTK_CSS_PROPERTY_ANIMATION_FILL_MODE,
G_TYPE_NONE,
@@ -1677,7 +1666,7 @@ _gtk_css_style_property_init_properties (void)
0,
parse_css_fill_mode,
NULL,
_gtk_css_array_value_new (_gtk_css_fill_mode_value_new (GTK_CSS_FILL_NONE)));
_gtk_css_fill_mode_value_new (GTK_CSS_FILL_NONE));
gtk_css_style_property_register ("opacity",
GTK_CSS_PROPERTY_OPACITY,
+1 -4
View File
@@ -37,7 +37,7 @@ typedef struct _GtkCssStylePropertyClass GtkCssStylePropertyClass;
typedef GtkCssValue * (* GtkCssStylePropertyParseFunc) (GtkCssStyleProperty *property,
GtkCssParser *parser);
typedef void (* GtkCssStylePropertyQueryFunc) (GtkCssStyleProperty *property,
const GtkCssValue *cssvalue,
GtkCssValue *cssvalue,
GValue *value);
struct _GtkCssStyleProperty
{
@@ -80,9 +80,6 @@ void _gtk_css_style_property_print_value (GtkCssStyleProp
GtkCssValue *value,
GString *string);
GtkBitmask * _gtk_css_style_property_get_mask_affecting
(GtkCssAffects affects);
/* XXX - find a better place for these */
GtkCssValue * gtk_css_font_family_value_parse (GtkCssParser *parser);
GtkCssValue * gtk_css_font_size_value_parse (GtkCssParser *parser);
+32 -1
View File
@@ -790,6 +790,7 @@ gtk_css_value_transform_print (const GtkCssValue *value,
}
static const GtkCssValueClass GTK_CSS_VALUE_TRANSFORM = {
"GtkCssTransformValue",
gtk_css_value_transform_free,
gtk_css_value_transform_compute,
gtk_css_value_transform_equal,
@@ -799,7 +800,7 @@ static const GtkCssValueClass GTK_CSS_VALUE_TRANSFORM = {
gtk_css_value_transform_print
};
static GtkCssValue none_singleton = { &GTK_CSS_VALUE_TRANSFORM, 1, 0, { { GTK_CSS_TRANSFORM_NONE } } };
static GtkCssValue none_singleton = { &GTK_CSS_VALUE_TRANSFORM, 1, TRUE, 0, { { GTK_CSS_TRANSFORM_NONE } } };
static GtkCssValue *
gtk_css_transform_value_alloc (guint n_transforms)
@@ -930,6 +931,7 @@ _gtk_css_transform_value_parse (GtkCssParser *parser)
GtkCssValue *value;
GArray *array;
guint i;
gboolean computed = TRUE;
if (gtk_css_parser_try_ident (parser, "none"))
return _gtk_css_transform_value_new_none ();
@@ -966,6 +968,7 @@ _gtk_css_transform_value_parse (GtkCssParser *parser)
goto fail;
transform.type = GTK_CSS_TRANSFORM_PERSPECTIVE;
computed = computed && gtk_css_value_is_computed (transform.perspective.depth);
}
else if (gtk_css_parser_has_function (parser, "rotate") ||
gtk_css_parser_has_function (parser, "rotateZ"))
@@ -977,6 +980,7 @@ _gtk_css_transform_value_parse (GtkCssParser *parser)
transform.rotate.x = _gtk_css_number_value_new (0, GTK_CSS_NUMBER);
transform.rotate.y = _gtk_css_number_value_new (0, GTK_CSS_NUMBER);
transform.rotate.z = _gtk_css_number_value_new (1, GTK_CSS_NUMBER);
computed = computed && gtk_css_value_is_computed (transform.rotate.angle);
}
else if (gtk_css_parser_has_function (parser, "rotate3d"))
{
@@ -990,6 +994,10 @@ _gtk_css_transform_value_parse (GtkCssParser *parser)
}
transform.type = GTK_CSS_TRANSFORM_ROTATE;
computed = computed && gtk_css_value_is_computed (transform.rotate.angle) &&
gtk_css_value_is_computed (transform.rotate.x) &&
gtk_css_value_is_computed (transform.rotate.y) &&
gtk_css_value_is_computed (transform.rotate.z);
}
else if (gtk_css_parser_has_function (parser, "rotateX"))
{
@@ -1000,6 +1008,7 @@ _gtk_css_transform_value_parse (GtkCssParser *parser)
transform.rotate.x = _gtk_css_number_value_new (1, GTK_CSS_NUMBER);
transform.rotate.y = _gtk_css_number_value_new (0, GTK_CSS_NUMBER);
transform.rotate.z = _gtk_css_number_value_new (0, GTK_CSS_NUMBER);
computed = computed && gtk_css_value_is_computed (transform.rotate.angle);
}
else if (gtk_css_parser_has_function (parser, "rotateY"))
{
@@ -1010,6 +1019,7 @@ _gtk_css_transform_value_parse (GtkCssParser *parser)
transform.rotate.x = _gtk_css_number_value_new (0, GTK_CSS_NUMBER);
transform.rotate.y = _gtk_css_number_value_new (1, GTK_CSS_NUMBER);
transform.rotate.z = _gtk_css_number_value_new (0, GTK_CSS_NUMBER);
computed = computed && gtk_css_value_is_computed (transform.rotate.angle);
}
else if (gtk_css_parser_has_function (parser, "scale"))
{
@@ -1029,6 +1039,8 @@ _gtk_css_transform_value_parse (GtkCssParser *parser)
else
transform.scale.y = gtk_css_value_ref (values[0]);
transform.scale.z = _gtk_css_number_value_new (1, GTK_CSS_NUMBER);
computed = computed && gtk_css_value_is_computed (transform.scale.x) &&
gtk_css_value_is_computed (transform.scale.y);
}
else if (gtk_css_parser_has_function (parser, "scale3d"))
{
@@ -1046,6 +1058,9 @@ _gtk_css_transform_value_parse (GtkCssParser *parser)
transform.scale.x = values[0];
transform.scale.y = values[1];
transform.scale.z = values[2];
computed = computed && gtk_css_value_is_computed (transform.scale.x) &&
gtk_css_value_is_computed (transform.scale.y) &&
gtk_css_value_is_computed (transform.scale.z);
}
else if (gtk_css_parser_has_function (parser, "scaleX"))
{
@@ -1055,6 +1070,7 @@ _gtk_css_transform_value_parse (GtkCssParser *parser)
transform.type = GTK_CSS_TRANSFORM_SCALE;
transform.scale.y = _gtk_css_number_value_new (1, GTK_CSS_NUMBER);
transform.scale.z = _gtk_css_number_value_new (1, GTK_CSS_NUMBER);
computed = computed && gtk_css_value_is_computed (transform.scale.x);
}
else if (gtk_css_parser_has_function (parser, "scaleY"))
{
@@ -1064,6 +1080,7 @@ _gtk_css_transform_value_parse (GtkCssParser *parser)
transform.type = GTK_CSS_TRANSFORM_SCALE;
transform.scale.x = _gtk_css_number_value_new (1, GTK_CSS_NUMBER);
transform.scale.z = _gtk_css_number_value_new (1, GTK_CSS_NUMBER);
computed = computed && gtk_css_value_is_computed (transform.scale.y);
}
else if (gtk_css_parser_has_function (parser, "scaleZ"))
{
@@ -1073,6 +1090,7 @@ _gtk_css_transform_value_parse (GtkCssParser *parser)
transform.type = GTK_CSS_TRANSFORM_SCALE;
transform.scale.x = _gtk_css_number_value_new (1, GTK_CSS_NUMBER);
transform.scale.y = _gtk_css_number_value_new (1, GTK_CSS_NUMBER);
computed = computed && gtk_css_value_is_computed (transform.scale.z);
}
else if (gtk_css_parser_has_function (parser, "skew"))
{
@@ -1088,6 +1106,8 @@ _gtk_css_transform_value_parse (GtkCssParser *parser)
transform.type = GTK_CSS_TRANSFORM_SKEW;
transform.skew.x = values[0];
transform.skew.y = values[1];
computed = computed && gtk_css_value_is_computed (transform.skew.x) &&
gtk_css_value_is_computed (transform.skew.y);
}
else if (gtk_css_parser_has_function (parser, "skewX"))
{
@@ -1095,6 +1115,7 @@ _gtk_css_transform_value_parse (GtkCssParser *parser)
goto fail;
transform.type = GTK_CSS_TRANSFORM_SKEW_X;
computed = computed && gtk_css_value_is_computed (transform.skew_x.skew);
}
else if (gtk_css_parser_has_function (parser, "skewY"))
{
@@ -1102,6 +1123,7 @@ _gtk_css_transform_value_parse (GtkCssParser *parser)
goto fail;
transform.type = GTK_CSS_TRANSFORM_SKEW_Y;
computed = computed && gtk_css_value_is_computed (transform.skew_y.skew);
}
else if (gtk_css_parser_has_function (parser, "translate"))
{
@@ -1121,6 +1143,8 @@ _gtk_css_transform_value_parse (GtkCssParser *parser)
else
transform.translate.y = _gtk_css_number_value_new (0, GTK_CSS_PX);
transform.translate.z = _gtk_css_number_value_new (0, GTK_CSS_PX);
computed = computed && gtk_css_value_is_computed (transform.translate.x) &&
gtk_css_value_is_computed (transform.translate.y);
}
else if (gtk_css_parser_has_function (parser, "translate3d"))
{
@@ -1138,6 +1162,9 @@ _gtk_css_transform_value_parse (GtkCssParser *parser)
transform.translate.x = values[0];
transform.translate.y = values[1];
transform.translate.z = values[2];
computed = computed && gtk_css_value_is_computed (transform.translate.x) &&
gtk_css_value_is_computed (transform.translate.y) &&
gtk_css_value_is_computed (transform.translate.z);
}
else if (gtk_css_parser_has_function (parser, "translateX"))
{
@@ -1147,6 +1174,7 @@ _gtk_css_transform_value_parse (GtkCssParser *parser)
transform.type = GTK_CSS_TRANSFORM_TRANSLATE;
transform.translate.y = _gtk_css_number_value_new (0, GTK_CSS_PX);
transform.translate.z = _gtk_css_number_value_new (0, GTK_CSS_PX);
computed = computed && gtk_css_value_is_computed (transform.translate.x);
}
else if (gtk_css_parser_has_function (parser, "translateY"))
{
@@ -1156,6 +1184,7 @@ _gtk_css_transform_value_parse (GtkCssParser *parser)
transform.type = GTK_CSS_TRANSFORM_TRANSLATE;
transform.translate.x = _gtk_css_number_value_new (0, GTK_CSS_PX);
transform.translate.z = _gtk_css_number_value_new (0, GTK_CSS_PX);
computed = computed && gtk_css_value_is_computed (transform.translate.y);
}
else if (gtk_css_parser_has_function (parser, "translateZ"))
{
@@ -1165,6 +1194,7 @@ _gtk_css_transform_value_parse (GtkCssParser *parser)
transform.type = GTK_CSS_TRANSFORM_TRANSLATE;
transform.translate.x = _gtk_css_number_value_new (0, GTK_CSS_PX);
transform.translate.y = _gtk_css_number_value_new (0, GTK_CSS_PX);
computed = computed && gtk_css_value_is_computed (transform.translate.z);
}
else
{
@@ -1181,6 +1211,7 @@ _gtk_css_transform_value_parse (GtkCssParser *parser)
}
value = gtk_css_transform_value_alloc (array->len);
value->is_computed = computed;
memcpy (value->transforms, array->data, sizeof (GtkCssTransform) * array->len);
g_array_free (array, TRUE);
+1
View File
@@ -82,6 +82,7 @@ gtk_css_value_unset_print (const GtkCssValue *value,
}
static const GtkCssValueClass GTK_CSS_VALUE_UNSET = {
"GtkCssUnsetValue",
gtk_css_value_unset_free,
gtk_css_value_unset_compute,
gtk_css_value_unset_equal,
+144
View File
@@ -29,17 +29,128 @@ struct _GtkCssValue {
G_DEFINE_BOXED_TYPE (GtkCssValue, _gtk_css_value, _gtk_css_value_ref, _gtk_css_value_unref)
#define CSS_VALUE_ACCOUNTING 1
static GHashTable *counters;
typedef struct
{
guint all;
guint alive;
guint computed;
guint transitioned;
} ValueAccounting;
static void
dump_value_counts (void)
{
int col_widths[5] = { 0, strlen ("all"), strlen ("alive"), strlen ("computed"), strlen("transitioned") };
GHashTableIter iter;
gpointer key;
gpointer value;
int sum_all = 0, sum_alive = 0, sum_computed = 0, sum_transitioned = 0;
g_hash_table_iter_init (&iter, counters);
while (g_hash_table_iter_next (&iter, &key, &value))
{
const char *class = key;
const ValueAccounting *c = value;
char *str;
sum_all += c->all;
sum_alive += c->alive;
sum_computed += c->computed;
sum_transitioned += c->transitioned;
col_widths[0] = MAX (col_widths[0], strlen (class));
str = g_strdup_printf ("%'d", sum_all);
col_widths[1] = MAX (col_widths[1], strlen (str));
g_free (str);
str = g_strdup_printf ("%'d", sum_alive);
col_widths[2] = MAX (col_widths[2], strlen (str));
g_free (str);
str = g_strdup_printf ("%'d", sum_computed);
col_widths[3] = MAX (col_widths[3], strlen (str));
g_free (str);
str = g_strdup_printf ("%'d", sum_transitioned);
col_widths[4] = MAX (col_widths[4], strlen (str));
g_free (str);
}
/* Some spacing */
col_widths[0] += 4;
col_widths[1] += 4;
col_widths[2] += 4;
col_widths[3] += 4;
col_widths[4] += 4;
g_print("%*s%*s%*s%*s%*s\n", col_widths[0] + 1, " ",
col_widths[1] + 1, "All",
col_widths[2] + 1, "Alive",
col_widths[3] + 1, "Computed",
col_widths[4] + 1, "Transitioned");
g_hash_table_iter_init (&iter, counters);
while (g_hash_table_iter_next (&iter, &key, &value))
{
const char *class = key;
const ValueAccounting *c = value;
g_print ("%*s:", col_widths[0], class);
g_print (" %'*d", col_widths[1], c->all);
g_print (" %'*d", col_widths[2], c->alive);
g_print (" %'*d", col_widths[3], c->computed);
g_print (" %'*d", col_widths[4], c->transitioned);
g_print("\n");
}
g_print("%*s%'*d%'*d%'*d%'*d\n", col_widths[0] + 1, " ",
col_widths[1] + 1, sum_all,
col_widths[2] + 1, sum_alive,
col_widths[3] + 1, sum_computed,
col_widths[4] + 1, sum_transitioned);
}
static ValueAccounting *
get_accounting_data (const char *class)
{
ValueAccounting *c;
if (!counters)
{
counters = g_hash_table_new (g_str_hash, g_str_equal);
atexit (dump_value_counts);
}
c = g_hash_table_lookup (counters, class);
if (!c)
{
c = g_malloc0 (sizeof (ValueAccounting));
g_hash_table_insert (counters, (gpointer)class, c);
}
return c;
}
GtkCssValue *
_gtk_css_value_alloc (const GtkCssValueClass *klass,
gsize size)
{
GtkCssValue *value;
ValueAccounting *c;
value = g_slice_alloc0 (size);
value->class = klass;
value->ref_count = 1;
#ifdef CSS_VALUE_ACCOUNTING
c = get_accounting_data (klass->type_name);
c->all++;
c->alive++;
#endif
return value;
}
@@ -56,6 +167,8 @@ gtk_css_value_ref (GtkCssValue *value)
void
gtk_css_value_unref (GtkCssValue *value)
{
ValueAccounting *c;
if (value == NULL)
return;
@@ -63,6 +176,11 @@ gtk_css_value_unref (GtkCssValue *value)
if (value->ref_count > 0)
return;
#ifdef CSS_VALUE_ACCOUNTING
c = get_accounting_data (value->class->type_name);
c->alive--;
#endif
value->class->free (value);
}
@@ -88,6 +206,13 @@ _gtk_css_value_compute (GtkCssValue *value,
GtkCssStyle *style,
GtkCssStyle *parent_style)
{
if (gtk_css_value_is_computed (value))
return _gtk_css_value_ref (value);
#ifdef CSS_VALUE_ACCOUNTING
get_accounting_data (value->class->type_name)->computed++;
#endif
return value->class->compute (value, property_id, provider, style, parent_style);
}
@@ -135,6 +260,19 @@ _gtk_css_value_transition (GtkCssValue *start,
if (start->class->transition != end->class->transition)
return NULL;
if (progress == 0)
return _gtk_css_value_ref (start);
if (progress == 1)
return _gtk_css_value_ref (end);
if (start == end)
return _gtk_css_value_ref (start);
#ifdef CSS_VALUE_ACCOUNTING
get_accounting_data (start->class->type_name)->transitioned++;
#endif
return start->class->transition (start, end, property_id, progress);
}
@@ -217,3 +355,9 @@ gtk_css_value_get_dynamic_value (GtkCssValue *value,
return value->class->get_dynamic_value (value, monotonic_time);
}
gboolean
gtk_css_value_is_computed (const GtkCssValue *value)
{
return value->is_computed;
}
+4 -1
View File
@@ -37,9 +37,11 @@ typedef struct _GtkCssValueClass GtkCssValueClass;
/* using define instead of struct here so compilers get the packing right */
#define GTK_CSS_VALUE_BASE \
const GtkCssValueClass *class; \
gint ref_count;
gint ref_count; \
guint is_computed: 1;
struct _GtkCssValueClass {
const char *type_name;
void (* free) (GtkCssValue *value);
GtkCssValue * (* compute) (GtkCssValue *value,
@@ -91,6 +93,7 @@ GtkCssValue * gtk_css_value_get_dynamic_value (GtkCssValue
char * _gtk_css_value_to_string (const GtkCssValue *value);
void _gtk_css_value_print (const GtkCssValue *value,
GString *string);
gboolean gtk_css_value_is_computed (const GtkCssValue *value) G_GNUC_PURE;
G_END_DECLS
+6 -8
View File
@@ -40,7 +40,7 @@
#include "gtkiconthemeprivate.h"
#include "gtkcsspalettevalueprivate.h"
#include "gtkcssrgbavalueprivate.h"
#include "gtkcsscolorvalueprivate.h"
#include "gtkdebug.h"
#include "gtkiconcacheprivate.h"
#include "gtkintl.h"
@@ -3638,7 +3638,6 @@ gtk_icon_info_load_symbolic_svg (GtkIconInfo *icon_info,
gchar *width;
gchar *height;
char *escaped_file_data;
gint symbolic_size;
double alpha;
gchar alphastr[G_ASCII_DTOSTR_BUF_SIZE];
@@ -3707,9 +3706,8 @@ gtk_icon_info_load_symbolic_svg (GtkIconInfo *icon_info,
g_object_unref (pixbuf);
}
symbolic_size = MAX (icon_info->symbolic_width, icon_info->symbolic_height);
GTK_NOTE (ICONTHEME,
GTK_NOTE (ICONTHEME, {
int symbolic_size = MAX (icon_info->symbolic_width, icon_info->symbolic_height);
if (icon_info->dir_type == ICON_THEME_DIR_UNTHEMED)
g_message ("Symbolic icon %s is not in an icon theme directory",
icon_info->key.icon_names ? icon_info->key.icon_names[0] : icon_info->filename);
@@ -3717,8 +3715,8 @@ gtk_icon_info_load_symbolic_svg (GtkIconInfo *icon_info,
g_message ("Symbolic icon %s of size %d is in an icon theme directory of size %d",
icon_info->key.icon_names ? icon_info->key.icon_names[0] : icon_info->filename,
symbolic_size,
icon_info->dir_size * icon_info->dir_scale)
);
icon_info->dir_size * icon_info->dir_scale);
});
width = g_strdup_printf ("%d", icon_info->symbolic_width);
height = g_strdup_printf ("%d", icon_info->symbolic_height);
@@ -3870,7 +3868,7 @@ gtk_icon_theme_lookup_symbolic_colors (GtkCssStyle *style,
color = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_COLOR);
palette = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_ICON_PALETTE);
*color_out = *_gtk_css_rgba_value_get_rgba (color);
*color_out = *gtk_css_color_value_get_rgba (color);
lookup = gtk_css_palette_value_get_color (palette, "success");
if (lookup)
-1
View File
@@ -30,7 +30,6 @@
#include "gtkbuildable.h"
#include "gtkbuilderprivate.h"
#include "gtkcssnodeprivate.h"
#include "gtkcssshadowsvalueprivate.h"
#include "gtkcssstylepropertyprivate.h"
#include "gtkeventcontrollermotion.h"
#include "gtkgesturedrag.h"
-1
View File
@@ -28,7 +28,6 @@
#include "gtkcssnodeprivate.h"
#include "gtkcssnumbervalueprivate.h"
#include "gtkcssshadowsvalueprivate.h"
#include "gtkcssstylepropertyprivate.h"
#include "gtkgizmoprivate.h"
#include "gtkintl.h"
+4 -4
View File
@@ -24,8 +24,8 @@
#include "gtkcsscornervalueprivate.h"
#include "gtkcssimagevalueprivate.h"
#include "gtkcssnumbervalueprivate.h"
#include "gtkcssrgbavalueprivate.h"
#include "gtkcssshadowsvalueprivate.h"
#include "gtkcsscolorvalueprivate.h"
#include "gtkcssshadowvalueprivate.h"
#include "gtkcsstransformvalueprivate.h"
#include "gtkhslaprivate.h"
#include "gtkrendericonprivate.h"
@@ -232,7 +232,7 @@ gtk_render_background_get_clip (GtkStyleContext *context,
{
GtkBorder shadow;
_gtk_css_shadows_value_get_extents (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BOX_SHADOW), &shadow);
gtk_css_shadow_value_get_extents (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BOX_SHADOW), &shadow);
out_clip->x = floor (x) - shadow.left;
out_clip->y = floor (y) - shadow.top;
@@ -414,7 +414,7 @@ gtk_do_render_line (GtkStyleContext *context,
cairo_save (cr);
color = _gtk_css_rgba_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_COLOR));
color = gtk_css_color_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_COLOR));
cairo_set_line_cap (cr, CAIRO_LINE_CAP_SQUARE);
cairo_set_line_width (cr, 1);
+10 -10
View File
@@ -30,10 +30,10 @@
#include "gtkcssenumvalueprivate.h"
#include "gtkcssimagevalueprivate.h"
#include "gtkcssnumbervalueprivate.h"
#include "gtkcssshadowsvalueprivate.h"
#include "gtkcssshadowvalueprivate.h"
#include "gtkcsspositionvalueprivate.h"
#include "gtkcssrepeatvalueprivate.h"
#include "gtkcssrgbavalueprivate.h"
#include "gtkcsscolorvalueprivate.h"
#include "gtkcssstyleprivate.h"
#include "gtkcsstypesprivate.h"
@@ -278,21 +278,21 @@ gtk_css_style_snapshot_background (GtkCssBoxes *boxes,
GskBlendMode *blend_mode_values;
background_image = gtk_css_style_get_value (boxes->style, GTK_CSS_PROPERTY_BACKGROUND_IMAGE);
bg_color = _gtk_css_rgba_value_get_rgba (gtk_css_style_get_value (boxes->style, GTK_CSS_PROPERTY_BACKGROUND_COLOR));
bg_color = gtk_css_color_value_get_rgba (gtk_css_style_get_value (boxes->style, GTK_CSS_PROPERTY_BACKGROUND_COLOR));
box_shadow = gtk_css_style_get_value (boxes->style, GTK_CSS_PROPERTY_BOX_SHADOW);
/* This is the common default case of no background */
if (gdk_rgba_is_clear (bg_color) &&
_gtk_css_array_value_get_n_values (background_image) == 1 &&
_gtk_css_image_value_get_image (_gtk_css_array_value_get_nth (background_image, 0)) == NULL &&
_gtk_css_shadows_value_is_none (box_shadow))
gtk_css_shadow_value_is_none (box_shadow))
return;
gtk_snapshot_push_debug (snapshot, "CSS background");
gtk_css_shadows_value_snapshot_outset (box_shadow,
snapshot,
gtk_css_boxes_get_border_box (boxes));
gtk_css_shadow_value_snapshot_outset (box_shadow,
snapshot,
gtk_css_boxes_get_border_box (boxes));
blend_modes = gtk_css_style_get_value (boxes->style, GTK_CSS_PROPERTY_BACKGROUND_BLEND_MODE);
number_of_layers = _gtk_css_array_value_get_n_values (background_image);
@@ -323,9 +323,9 @@ gtk_css_style_snapshot_background (GtkCssBoxes *boxes,
}
}
gtk_css_shadows_value_snapshot_inset (box_shadow,
snapshot,
gtk_css_boxes_get_padding_box (boxes));
gtk_css_shadow_value_snapshot_inset (box_shadow,
snapshot,
gtk_css_boxes_get_padding_box (boxes));
gtk_snapshot_pop (snapshot);
}
+6 -6
View File
@@ -31,7 +31,7 @@
#include "gtkcssimagevalueprivate.h"
#include "gtkcssnumbervalueprivate.h"
#include "gtkcssrepeatvalueprivate.h"
#include "gtkcssrgbavalueprivate.h"
#include "gtkcsscolorvalueprivate.h"
#include "gtkcssstyleprivate.h"
#include "gtkhslaprivate.h"
#include "gtkroundedboxprivate.h"
@@ -683,10 +683,10 @@ gtk_css_style_snapshot_border (GtkCssBoxes *boxes,
gtk_css_boxes_get_padding_rect (boxes)))
return;
colors[0] = *_gtk_css_rgba_value_get_rgba (gtk_css_style_get_value (boxes->style, GTK_CSS_PROPERTY_BORDER_TOP_COLOR));
colors[1] = *_gtk_css_rgba_value_get_rgba (gtk_css_style_get_value (boxes->style, GTK_CSS_PROPERTY_BORDER_RIGHT_COLOR));
colors[2] = *_gtk_css_rgba_value_get_rgba (gtk_css_style_get_value (boxes->style, GTK_CSS_PROPERTY_BORDER_BOTTOM_COLOR));
colors[3] = *_gtk_css_rgba_value_get_rgba (gtk_css_style_get_value (boxes->style, GTK_CSS_PROPERTY_BORDER_LEFT_COLOR));
colors[0] = *gtk_css_color_value_get_rgba (gtk_css_style_get_value (boxes->style, GTK_CSS_PROPERTY_BORDER_TOP_COLOR));
colors[1] = *gtk_css_color_value_get_rgba (gtk_css_style_get_value (boxes->style, GTK_CSS_PROPERTY_BORDER_RIGHT_COLOR));
colors[2] = *gtk_css_color_value_get_rgba (gtk_css_style_get_value (boxes->style, GTK_CSS_PROPERTY_BORDER_BOTTOM_COLOR));
colors[3] = *gtk_css_color_value_get_rgba (gtk_css_style_get_value (boxes->style, GTK_CSS_PROPERTY_BORDER_LEFT_COLOR));
alpha_test_vector = graphene_simd4f_init (colors[0].alpha, colors[1].alpha, colors[2].alpha, colors[3].alpha);
if (graphene_simd4f_is_zero4 (alpha_test_vector))
@@ -726,7 +726,7 @@ gtk_css_style_snapshot_outline (GtkCssBoxes *boxes,
border_style[1] = border_style[2] = border_style[3] = border_style[0];
border_width[0] = _gtk_css_number_value_get (gtk_css_style_get_value (boxes->style, GTK_CSS_PROPERTY_OUTLINE_WIDTH), 100);
border_width[3] = border_width[2] = border_width[1] = border_width[0];
colors[0] = *_gtk_css_rgba_value_get_rgba (gtk_css_style_get_value (boxes->style, GTK_CSS_PROPERTY_OUTLINE_COLOR));
colors[0] = *gtk_css_color_value_get_rgba (gtk_css_style_get_value (boxes->style, GTK_CSS_PROPERTY_OUTLINE_COLOR));
colors[3] = colors[2] = colors[1] = colors[0];
snapshot_border (snapshot,
+3 -3
View File
@@ -23,7 +23,7 @@
#include "gtkcssfiltervalueprivate.h"
#include "gtkcssimagevalueprivate.h"
#include "gtkcssshadowsvalueprivate.h"
#include "gtkcssshadowvalueprivate.h"
#include "gtkcssstyleprivate.h"
#include "gtkcsstransformvalueprivate.h"
#include "gtkiconthemeprivate.h"
@@ -63,7 +63,7 @@ gtk_css_style_snapshot_icon (GtkCssStyle *style,
gtk_css_filter_value_push_snapshot (filter_value, snapshot);
has_shadow = gtk_css_shadows_value_push_snapshot (shadows_value, snapshot);
has_shadow = gtk_css_shadow_value_push_snapshot (shadows_value, snapshot);
if (transform == NULL)
{
@@ -119,7 +119,7 @@ gtk_css_style_snapshot_icon_paintable (GtkCssStyle *style,
gtk_css_filter_value_push_snapshot (filter_value, snapshot);
has_shadow = gtk_css_shadows_value_push_snapshot (shadows_value, snapshot);
has_shadow = gtk_css_shadow_value_push_snapshot (shadows_value, snapshot);
if (recolor)
{
+37
View File
@@ -30,6 +30,8 @@
#include "gtktypebuiltins.h"
#include "gtkversion.h"
#include "gtkwidget.h"
#include "gtkcssnumbervalueprivate.h"
#include "gtkcssstringvalueprivate.h"
#include "gdk/gdk-private.h"
@@ -129,6 +131,8 @@ struct _GtkSettingsPrivate
gboolean font_size_absolute;
gchar *font_family;
cairo_font_options_t *font_options;
GtkCssValue *css_dpi_value;
GtkCssValue *css_font_family_value;
};
struct _GtkSettingsValuePrivate
@@ -1002,6 +1006,9 @@ gtk_settings_finalize (GObject *object)
g_free (priv->font_family);
g_clear_pointer (&priv->css_dpi_value, gtk_css_value_unref);
g_clear_pointer (&priv->css_font_family_value, gtk_css_value_unref);
G_OBJECT_CLASS (gtk_settings_parent_class)->finalize (object);
}
@@ -1234,6 +1241,8 @@ settings_update_font_values (GtkSettings *settings)
if (desc)
pango_font_description_free (desc);
g_clear_pointer (&priv->css_font_family_value, gtk_css_value_unref);
}
static void
@@ -1267,6 +1276,7 @@ gtk_settings_notify (GObject *object,
* widgets with gtk_widget_style_set(), and also causes more
* recomputation than necessary.
*/
g_clear_pointer (&priv->css_dpi_value, gtk_css_value_unref);
gtk_style_context_reset_widgets (priv->display);
break;
case PROP_XFT_ANTIALIAS:
@@ -2079,3 +2089,30 @@ gtk_settings_get_font_size_is_absolute (GtkSettings *settings)
return priv->font_size_absolute;
}
GtkCssValue *
gtk_settings_get_dpi_css_value (GtkSettings *settings)
{
GtkSettingsPrivate *priv = gtk_settings_get_instance_private (settings);
if (!priv->css_dpi_value)
{
int dpi;
g_object_get (settings, "gtk-xft-dpi", &dpi, NULL);
priv->css_dpi_value = _gtk_css_number_value_new (dpi / 1024., GTK_CSS_NUMBER);
}
return priv->css_dpi_value;
}
GtkCssValue *
gtk_settings_get_font_family_css_value (GtkSettings *settings)
{
GtkSettingsPrivate *priv = gtk_settings_get_instance_private (settings);
if (!priv->css_font_family_value)
priv->css_font_family_value = _gtk_css_string_value_new (priv->font_family);
return priv->css_font_family_value;
}
+3
View File
@@ -20,6 +20,7 @@
#include <gtk/gtksettings.h>
#include "gtkstylecascadeprivate.h"
#include "gtkcssvalueprivate.h"
G_BEGIN_DECLS
@@ -48,6 +49,8 @@ gint gtk_settings_get_dnd_drag_threshold (GtkSettings *settings);
const gchar *gtk_settings_get_font_family (GtkSettings *settings);
gint gtk_settings_get_font_size (GtkSettings *settings);
gboolean gtk_settings_get_font_size_is_absolute (GtkSettings *settings);
GtkCssValue *gtk_settings_get_dpi_css_value (GtkSettings *settings);
GtkCssValue *gtk_settings_get_font_family_css_value (GtkSettings *settings);
G_END_DECLS
+4 -4
View File
@@ -20,8 +20,8 @@
#include "gtksnapshot.h"
#include "gtksnapshotprivate.h"
#include "gtkcssrgbavalueprivate.h"
#include "gtkcssshadowsvalueprivate.h"
#include "gtkcsscolorvalueprivate.h"
#include "gtkcssshadowvalueprivate.h"
#include "gtkdebug.h"
#include "gtkrenderbackgroundprivate.h"
#include "gtkrenderborderprivate.h"
@@ -1732,10 +1732,10 @@ gtk_snapshot_render_layout (GtkSnapshot *snapshot,
gtk_snapshot_save (snapshot);
gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (x, y));
fg_color = _gtk_css_rgba_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_COLOR));
fg_color = gtk_css_color_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_COLOR));
shadows_value = _gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_TEXT_SHADOW);
has_shadow = gtk_css_shadows_value_push_snapshot (shadows_value, snapshot);
has_shadow = gtk_css_shadow_value_push_snapshot (shadows_value, snapshot);
gtk_snapshot_append_layout (snapshot, layout, fg_color);
+2 -2
View File
@@ -31,7 +31,7 @@
#include "gtkcssnodeprivate.h"
#include "gtkcssnumbervalueprivate.h"
#include "gtkcsspathnodeprivate.h"
#include "gtkcssrgbavalueprivate.h"
#include "gtkcsscolorvalueprivate.h"
#include "gtkcsscolorvalueprivate.h"
#include "gtkcssstylepropertyprivate.h"
#include "gtkcsstransientnodeprivate.h"
@@ -1346,7 +1346,7 @@ gtk_style_context_resolve_color (GtkStyleContext *context,
if (val == NULL)
return FALSE;
*result = *_gtk_css_rgba_value_get_rgba (val);
*result = *gtk_css_color_value_get_rgba (val);
_gtk_css_value_unref (val);
return TRUE;
}
+2 -1
View File
@@ -1053,7 +1053,8 @@ void gtk_render_insertion_cursor
typedef enum {
GTK_STYLE_CONTEXT_PRINT_NONE = 0,
GTK_STYLE_CONTEXT_PRINT_RECURSE = 1 << 0,
GTK_STYLE_CONTEXT_PRINT_SHOW_STYLE = 1 << 1
GTK_STYLE_CONTEXT_PRINT_SHOW_STYLE = 1 << 1,
GTK_STYLE_CONTEXT_PRINT_SHOW_CHANGE = 1 << 2
} GtkStyleContextPrintFlags;
GDK_AVAILABLE_IN_ALL
+3 -3
View File
@@ -29,7 +29,7 @@
#include "gtkcellrenderer.h"
#include "gtkcontainer.h"
#include "gtkcssnumbervalueprivate.h"
#include "gtkcssrgbavalueprivate.h"
#include "gtkcsscolorvalueprivate.h"
#include "gtkcssstylepropertyprivate.h"
#include "gtkdragdest.h"
#include "gtkdragsource.h"
@@ -4216,7 +4216,7 @@ gtk_tree_view_snapshot_grid_line (GtkTreeView *tree_view,
const GdkRGBA *grid_line_color;
context = gtk_widget_get_style_context (GTK_WIDGET (tree_view));
grid_line_color = _gtk_css_rgba_value_get_rgba (_gtk_style_context_peek_property (context,
grid_line_color = gtk_css_color_value_get_rgba (_gtk_style_context_peek_property (context,
GTK_CSS_PROPERTY_BORDER_TOP_COLOR));
if (!gdk_rgba_equal (grid_line_color, &tree_view->grid_line_color) ||
@@ -4290,7 +4290,7 @@ gtk_tree_view_snapshot_tree_line (GtkTreeView *tree_view,
const GdkRGBA *tree_line_color;
context = gtk_widget_get_style_context (GTK_WIDGET (tree_view));
tree_line_color = _gtk_css_rgba_value_get_rgba (_gtk_style_context_peek_property (context,
tree_line_color = gtk_css_color_value_get_rgba (_gtk_style_context_peek_property (context,
GTK_CSS_PROPERTY_BORDER_LEFT_COLOR));
if (!gdk_rgba_equal (tree_line_color, &tree_view->tree_line_color) ||
+29 -27
View File
@@ -39,7 +39,6 @@
#include "gtkcsstransformvalueprivate.h"
#include "gtkcssfontvariationsvalueprivate.h"
#include "gtkcssnumbervalueprivate.h"
#include "gtkcssshadowsvalueprivate.h"
#include "gtkcssstylepropertyprivate.h"
#include "gtkcsswidgetnodeprivate.h"
#include "gtkdebug.h"
@@ -10476,6 +10475,25 @@ gtk_widget_contains (GtkWidget *widget,
return GTK_WIDGET_GET_CLASS (widget)->contains (widget, x, y);
}
/* do the checks for gtk_widget_pick that do not depend on position */
static gboolean
gtk_widget_can_be_picked (GtkWidget *widget,
GtkPickFlags flags)
{
if (!_gtk_widget_is_drawable (widget))
return FALSE;
if (!(flags & GTK_PICK_NON_TARGETABLE) &&
!gtk_widget_get_can_target (widget))
return FALSE;
if (!(flags & GTK_PICK_INSENSITIVE) &&
!_gtk_widget_is_sensitive (widget))
return FALSE;
return TRUE;
}
/**
* gtk_widget_pick:
* @widget: the widget to query
@@ -10507,37 +10525,18 @@ gtk_widget_pick (GtkWidget *widget,
{
GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
GtkWidget *child;
GtkCssBoxes boxes;
g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
if (!_gtk_widget_is_drawable (widget))
if (!gtk_widget_can_be_picked (widget, flags))
return NULL;
if (!(flags & GTK_PICK_NON_TARGETABLE) &&
!gtk_widget_get_can_target (widget))
return NULL;
if (!(flags & GTK_PICK_INSENSITIVE) &&
!_gtk_widget_is_sensitive (widget))
return NULL;
switch (priv->overflow)
if (priv->overflow == GTK_OVERFLOW_HIDDEN)
{
default:
case GTK_OVERFLOW_VISIBLE:
break;
gtk_css_boxes_init (&boxes, widget);
case GTK_OVERFLOW_HIDDEN:
{
GtkCssBoxes boxes;
gtk_css_boxes_init (&boxes, widget);
if (!gsk_rounded_rect_contains_point (gtk_css_boxes_get_padding_box (&boxes),
&GRAPHENE_POINT_INIT (x, y)))
return NULL;
}
break;
if (!gsk_rounded_rect_contains_point (gtk_css_boxes_get_padding_box (&boxes),
&GRAPHENE_POINT_INIT (x, y)))
return NULL;
}
if (GTK_IS_WINDOW (widget))
@@ -10559,6 +10558,9 @@ gtk_widget_pick (GtkWidget *widget,
GtkWidget *picked;
graphene_point3d_t p0, p1, res;
if (!gtk_widget_can_be_picked (child, flags))
continue;
if (GTK_IS_NATIVE (child))
continue;
+4 -4
View File
@@ -37,8 +37,8 @@
#include "gtkcontainerprivate.h"
#include "gtkcsscornervalueprivate.h"
#include "gtkcssiconthemevalueprivate.h"
#include "gtkcssrgbavalueprivate.h"
#include "gtkcssshadowsvalueprivate.h"
#include "gtkcsscolorvalueprivate.h"
#include "gtkcssshadowvalueprivate.h"
#include "gtkcssstylepropertyprivate.h"
#include "gtkdragdest.h"
#include "gtkeventcontrollerkey.h"
@@ -5322,7 +5322,7 @@ get_shadow_width (GtkWindow *window,
/* Calculate the size of the drop shadows ... */
shadows = _gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BOX_SHADOW);
_gtk_css_shadows_value_get_extents (shadows, &border);
gtk_css_shadow_value_get_extents (shadows, &border);
if (priv->type != GTK_WINDOW_POPUP)
{
@@ -5459,7 +5459,7 @@ update_opaque_region (GtkWindow *window,
context = gtk_widget_get_style_context (widget);
is_opaque = gdk_rgba_is_opaque (_gtk_css_rgba_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BACKGROUND_COLOR)));
is_opaque = gdk_rgba_is_opaque (gtk_css_color_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BACKGROUND_COLOR)));
if (gtk_widget_get_opacity (widget) < 1.0)
is_opaque = FALSE;
+11
View File
@@ -52,6 +52,7 @@ enum {
COLUMN_NODE_CLASSES,
COLUMN_NODE_ID,
COLUMN_NODE_STATE,
COLUMN_NODE_CHANGE,
/* add more */
N_NODE_COLUMNS
};
@@ -337,6 +338,15 @@ gtk_inspector_css_node_tree_get_node_value (GtkTreeModelCssNode *model,
g_value_take_string (value, format_state_flags (gtk_css_node_get_state (node)));
break;
case COLUMN_NODE_CHANGE:
{
GtkCssStyle *style = gtk_css_node_get_style (node);
GtkCssStaticStyle *static_style = GTK_CSS_STATIC_STYLE (gtk_css_style_get_static_style (style));
GtkCssChange change = gtk_css_static_style_get_change (static_style);
g_value_take_string (value, gtk_css_change_to_string (change));
}
break;
default:
g_assert_not_reached ();
break;
@@ -359,6 +369,7 @@ gtk_inspector_css_node_tree_init (GtkInspectorCssNodeTree *cnt)
G_TYPE_BOOLEAN,
G_TYPE_STRING,
G_TYPE_STRING,
G_TYPE_STRING,
G_TYPE_STRING);
gtk_tree_view_set_model (GTK_TREE_VIEW (priv->node_tree), priv->node_model);
g_object_unref (priv->node_model);
+14
View File
@@ -5,6 +5,7 @@
<column type="gchararray"/>
<column type="gchararray"/>
<column type="gint"/>
<column type="gchararray"/>
</columns>
</object>
<template class="GtkInspectorCssNodeTree" parent="GtkBox">
@@ -80,6 +81,19 @@
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="node_change_column">
<property name="resizable">1</property>
<property name="title" translatable="yes">Change</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">5</attribute>
<attribute name="sensitive">1</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
</object>
-2
View File
@@ -82,9 +82,7 @@ gtk_private_sources = files([
'gtkcsspathnode.c',
'gtkcsspositionvalue.c',
'gtkcssrepeatvalue.c',
'gtkcssrgbavalue.c',
'gtkcssselector.c',
'gtkcssshadowsvalue.c',
'gtkcssshadowvalue.c',
'gtkcssshorthandproperty.c',
'gtkcssshorthandpropertyimpl.c',
+1 -1
View File
@@ -1 +1 @@
@define-color color shade(rgb(249,160,57), 1.3);
@define-color color rgb(255,203,143);
+1 -1
View File
@@ -1 +1 @@
@define-color color mix(shade(rgb(18,18,18), 0.5), mix(rgb(26,51,255), @blue, 0.5), 0.20000000000000001);
@define-color color mix(rgb(9,9,9), mix(rgb(26,51,255), @blue, 0.5), 0.20000000000000001);
@@ -80,7 +80,7 @@ h {
i {
background-clip: padding-box, content-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: none /* FIXME */, none;
background-origin: padding-box, content-box;
background-position: left top, left top;
@@ -90,7 +90,7 @@ i {
j {
background-clip: padding-box, border-box, border-box, border-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: linear-gradient(rgb(255,192,203), rgb(128,0,128)), linear-gradient(rgb(255,192,203), rgb(128,0,128)), none /* FIXME */, none;
background-origin: padding-box, border-box, padding-box, padding-box;
background-position: left top, left top, left top, left top;
@@ -190,7 +190,7 @@ s {
t {
background-clip: padding-box, border-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: none /* FIXME */, none;
background-origin: padding-box, padding-box;
background-position: 5px bottom, left top;
@@ -230,7 +230,7 @@ w {
x {
background-clip: content-box, border-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: none, none;
background-origin: content-box, padding-box;
background-position: 10%, left top;
@@ -270,7 +270,7 @@ ab {
bb {
background-clip: content-box, padding-box, border-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: none, none, linear-gradient(rgb(255,192,203), rgb(128,0,128));
background-origin: content-box, border-box, padding-box;
background-position: 5px bottom, center, 5px bottom;
@@ -370,7 +370,7 @@ kb {
lb {
background-clip: content-box, border-box, padding-box, border-box, border-box, content-box, border-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: none, none /* FIXME */, linear-gradient(rgb(255,192,203), rgb(128,0,128)), linear-gradient(rgb(255,192,203), rgb(128,0,128)), none, linear-gradient(rgb(255,192,203), rgb(128,0,128)), none /* FIXME */;
background-origin: content-box, border-box, content-box, padding-box, border-box, content-box, padding-box;
background-position: 5px bottom, left top, center, left top, 10%, center, left top;
@@ -420,7 +420,7 @@ pb {
qb {
background-clip: border-box, content-box, content-box, border-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: none, none /* FIXME */, linear-gradient(rgb(255,192,203), rgb(128,0,128)), none;
background-origin: padding-box, border-box, border-box, border-box;
background-position: left top, center, left top, left top;
@@ -450,7 +450,7 @@ sb {
tb {
background-clip: border-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: none;
background-origin: padding-box;
background-position: 10%;
@@ -460,7 +460,7 @@ tb {
ub {
background-clip: padding-box, border-box, border-box, border-box, content-box, content-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: none, none, linear-gradient(rgb(255,192,203), rgb(128,0,128)), none, none, none /* FIXME */;
background-origin: padding-box, padding-box, border-box, padding-box, content-box, content-box;
background-position: left top, center, 10%, left top, left top, 5px bottom;
@@ -660,7 +660,7 @@ nc {
oc {
background-clip: padding-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: none;
background-origin: padding-box;
background-position: center;
@@ -720,7 +720,7 @@ tc {
uc {
background-clip: content-box, padding-box, padding-box, border-box, padding-box, content-box, border-box, border-box, border-box, border-box, border-box, border-box, border-box, border-box, padding-box, border-box, border-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: none /* FIXME */, linear-gradient(rgb(255,192,203), rgb(128,0,128)), none /* FIXME */, none, none /* FIXME */, none, linear-gradient(rgb(255,192,203), rgb(128,0,128)), none /* FIXME */, none, none /* FIXME */, none, none, none, linear-gradient(rgb(255,192,203), rgb(128,0,128)), linear-gradient(rgb(255,192,203), rgb(128,0,128)), none, none /* FIXME */;
background-origin: content-box, padding-box, content-box, padding-box, padding-box, content-box, padding-box, padding-box, padding-box, padding-box, border-box, padding-box, padding-box, padding-box, padding-box, padding-box, border-box;
background-position: center, 10%, left top, left top, 10%, left top, center, 10%, left top, 5px bottom, 5px bottom, left top, 10%, left top, 10%, center, center;
@@ -740,7 +740,7 @@ vc {
wc {
background-clip: padding-box, border-box, border-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: linear-gradient(rgb(255,192,203), rgb(128,0,128)), linear-gradient(rgb(255,192,203), rgb(128,0,128)), none;
background-origin: border-box, padding-box, border-box;
background-position: left top, left top, 5px bottom;
@@ -820,7 +820,7 @@ dd {
ed {
background-clip: content-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: none;
background-origin: content-box;
background-position: center;
@@ -850,7 +850,7 @@ gd {
hd {
background-clip: content-box, padding-box, padding-box, padding-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: linear-gradient(rgb(255,192,203), rgb(128,0,128)), none, none /* FIXME */, none /* FIXME */;
background-origin: content-box, padding-box, padding-box, content-box;
background-position: left top, 5px bottom, 5px bottom, left top;
@@ -920,7 +920,7 @@ nd {
od {
background-clip: border-box, padding-box, border-box, border-box, border-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: linear-gradient(rgb(255,192,203), rgb(128,0,128)), none, none, none, none /* FIXME */;
background-origin: padding-box, padding-box, padding-box, padding-box, padding-box;
background-position: center, left top, left top, 5px bottom, left top;
@@ -1020,7 +1020,7 @@ xd {
yd {
background-clip: content-box, padding-box, border-box, padding-box, border-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: linear-gradient(rgb(255,192,203), rgb(128,0,128)), none, none /* FIXME */, none /* FIXME */, none /* FIXME */;
background-origin: padding-box, padding-box, border-box, padding-box, content-box;
background-position: left top, 10%, 10%, 10%, left top;
@@ -1320,7 +1320,7 @@ bf {
cf {
background-clip: border-box, content-box, border-box, border-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: linear-gradient(rgb(255,192,203), rgb(128,0,128)), none, linear-gradient(rgb(255,192,203), rgb(128,0,128)), none /* FIXME */;
background-origin: padding-box, content-box, border-box, border-box;
background-position: left top, left top, 5px bottom, left top;
@@ -1410,7 +1410,7 @@ kf {
lf {
background-clip: content-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: none;
background-origin: content-box;
background-position: center;
@@ -1480,7 +1480,7 @@ rf {
sf {
background-clip: padding-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: linear-gradient(rgb(255,192,203), rgb(128,0,128));
background-origin: padding-box;
background-position: left top;
@@ -1490,7 +1490,7 @@ sf {
tf {
background-clip: padding-box, content-box, padding-box, border-box, border-box, content-box, content-box, padding-box, border-box, padding-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: none, none, none, linear-gradient(rgb(255,192,203), rgb(128,0,128)), none /* FIXME */, linear-gradient(rgb(255,192,203), rgb(128,0,128)), none, none /* FIXME */, none, none;
background-origin: content-box, content-box, padding-box, padding-box, padding-box, content-box, padding-box, border-box, border-box, border-box;
background-position: center, 5px bottom, left top, left top, center, 10%, 10%, 5px bottom, 10%, left top;
@@ -1560,7 +1560,7 @@ zf {
ag {
background-clip: border-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: none;
background-origin: padding-box;
background-position: left top;
@@ -1740,7 +1740,7 @@ rg {
sg {
background-clip: border-box, padding-box, content-box, content-box, border-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: none, none, none, none, none;
background-origin: border-box, content-box, border-box, content-box, padding-box;
background-position: left top, 5px bottom, 10%, left top, left top;
@@ -1810,7 +1810,7 @@ yg {
zg {
background-clip: content-box, content-box, content-box, content-box, border-box, padding-box, content-box, border-box, border-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: none /* FIXME */, none, none /* FIXME */, none, none, none /* FIXME */, none /* FIXME */, none /* FIXME */, none;
background-origin: content-box, content-box, border-box, content-box, padding-box, padding-box, content-box, padding-box, border-box;
background-position: 10%, left top, center, 5px bottom, center, left top, left top, center, left top;
@@ -2000,7 +2000,7 @@ rh {
sh {
background-clip: padding-box, border-box, border-box, padding-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: none, none, linear-gradient(rgb(255,192,203), rgb(128,0,128)), none /* FIXME */;
background-origin: padding-box, border-box, padding-box, padding-box;
background-position: center, left top, 10%, 10%;
@@ -2050,7 +2050,7 @@ wh {
xh {
background-clip: border-box, border-box, border-box, padding-box, padding-box, border-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: linear-gradient(rgb(255,192,203), rgb(128,0,128)), none, none, none, none /* FIXME */, none;
background-origin: border-box, content-box, padding-box, border-box, padding-box, padding-box;
background-position: center, 5px bottom, left top, left top, 10%, center;
@@ -2210,7 +2210,7 @@ mi {
ni {
background-clip: border-box, border-box, padding-box, border-box, padding-box, padding-box, border-box, content-box, border-box, padding-box, border-box, padding-box, border-box, padding-box, border-box, padding-box, content-box, border-box, border-box, padding-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: none, linear-gradient(rgb(255,192,203), rgb(128,0,128)), none /* FIXME */, none /* FIXME */, none, none /* FIXME */, none, none, linear-gradient(rgb(255,192,203), rgb(128,0,128)), none, none, none, none, none, none, none, none, none, none /* FIXME */, linear-gradient(rgb(255,192,203), rgb(128,0,128));
background-origin: padding-box, border-box, content-box, padding-box, padding-box, padding-box, padding-box, content-box, padding-box, content-box, padding-box, padding-box, padding-box, padding-box, border-box, border-box, padding-box, content-box, padding-box, padding-box;
background-position: left top, center, 5px bottom, left top, center, left top, center, left top, left top, left top, 10%, left top, left top, center, left top, 5px bottom, left top, center, left top, left top;
@@ -2280,7 +2280,7 @@ ti {
ui {
background-clip: border-box, border-box, content-box, padding-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: linear-gradient(rgb(255,192,203), rgb(128,0,128)), none /* FIXME */, none, none;
background-origin: border-box, content-box, content-box, content-box;
background-position: left top, 5px bottom, 10%, 5px bottom;
@@ -2380,7 +2380,7 @@ dj {
ej {
background-clip: border-box, border-box, border-box, content-box, border-box, border-box, border-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: none, none, none, linear-gradient(rgb(255,192,203), rgb(128,0,128)), none, none, none;
background-origin: padding-box, border-box, padding-box, content-box, padding-box, padding-box, border-box;
background-position: 5px bottom, center, 10%, center, left top, center, 10%;
@@ -2390,7 +2390,7 @@ ej {
fj {
background-clip: content-box, padding-box, padding-box, content-box, content-box, content-box, content-box, padding-box, padding-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: none, none /* FIXME */, none, none /* FIXME */, none, none /* FIXME */, none /* FIXME */, none /* FIXME */, none;
background-origin: content-box, padding-box, content-box, content-box, content-box, content-box, content-box, padding-box, padding-box;
background-position: 10%, center, left top, 10%, left top, left top, center, center, center;
@@ -2430,7 +2430,7 @@ ij {
jj {
background-clip: content-box, padding-box, border-box, content-box, content-box, content-box, border-box, border-box, border-box, border-box, content-box, border-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: none, linear-gradient(rgb(255,192,203), rgb(128,0,128)), none /* FIXME */, none /* FIXME */, none, none /* FIXME */, linear-gradient(rgb(255,192,203), rgb(128,0,128)), none, none, linear-gradient(rgb(255,192,203), rgb(128,0,128)), none, linear-gradient(rgb(255,192,203), rgb(128,0,128));
background-origin: border-box, padding-box, padding-box, content-box, content-box, content-box, padding-box, border-box, padding-box, padding-box, content-box, padding-box;
background-position: 10%, center, left top, left top, left top, left top, left top, left top, 5px bottom, center, left top, left top;
@@ -2510,7 +2510,7 @@ qj {
rj {
background-clip: padding-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: none;
background-origin: padding-box;
background-position: 10%;
@@ -2600,7 +2600,7 @@ zj {
ak {
background-clip: content-box, padding-box, padding-box, content-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: linear-gradient(rgb(255,192,203), rgb(128,0,128)), linear-gradient(rgb(255,192,203), rgb(128,0,128)), none, none;
background-origin: content-box, padding-box, padding-box, border-box;
background-position: 10%, left top, 5px bottom, 10%;
@@ -2620,7 +2620,7 @@ bk {
ck {
background-clip: content-box, content-box, border-box, padding-box, border-box, content-box, border-box, border-box, content-box, border-box, border-box, border-box, border-box, padding-box, border-box, padding-box, content-box, border-box, padding-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: linear-gradient(rgb(255,192,203), rgb(128,0,128)), none /* FIXME */, none, none /* FIXME */, none, none /* FIXME */, none /* FIXME */, none /* FIXME */, none, none /* FIXME */, none, linear-gradient(rgb(255,192,203), rgb(128,0,128)), none /* FIXME */, none, linear-gradient(rgb(255,192,203), rgb(128,0,128)), none, linear-gradient(rgb(255,192,203), rgb(128,0,128)), linear-gradient(rgb(255,192,203), rgb(128,0,128)), none;
background-origin: content-box, content-box, border-box, padding-box, border-box, content-box, border-box, content-box, padding-box, padding-box, border-box, padding-box, padding-box, padding-box, padding-box, padding-box, content-box, content-box, padding-box;
background-position: left top, 5px bottom, center, 10%, center, 5px bottom, left top, left top, left top, 5px bottom, 10%, left top, left top, left top, center, left top, 5px bottom, 10%, left top;
@@ -2650,7 +2650,7 @@ ek {
fk {
background-clip: padding-box, content-box, padding-box, border-box, border-box, border-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: none, none, none /* FIXME */, linear-gradient(rgb(255,192,203), rgb(128,0,128)), none, none;
background-origin: padding-box, content-box, border-box, padding-box, border-box, padding-box;
background-position: left top, 5px bottom, center, 10%, 5px bottom, 10%;
@@ -2660,7 +2660,7 @@ fk {
gk {
background-clip: padding-box, padding-box, border-box, content-box, padding-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: none /* FIXME */, none /* FIXME */, none, none, none /* FIXME */;
background-origin: padding-box, padding-box, padding-box, border-box, border-box;
background-position: 5px bottom, 10%, left top, left top, left top;
@@ -2750,7 +2750,7 @@ ok {
pk {
background-clip: padding-box, border-box, content-box, content-box, padding-box, padding-box, border-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: none /* FIXME */, none /* FIXME */, none, none, none, none, linear-gradient(rgb(255,192,203), rgb(128,0,128));
background-origin: padding-box, border-box, content-box, border-box, padding-box, content-box, padding-box;
background-position: center, left top, left top, left top, 5px bottom, left top, center;
@@ -2760,7 +2760,7 @@ pk {
qk {
background-clip: border-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: none;
background-origin: padding-box;
background-position: left top;
@@ -2790,7 +2790,7 @@ sk {
tk {
background-clip: border-box, content-box, border-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: none /* FIXME */, none, none /* FIXME */;
background-origin: padding-box, content-box, padding-box;
background-position: 5px bottom, 10%, left top;
@@ -2850,7 +2850,7 @@ yk {
zk {
background-clip: border-box, border-box, padding-box, padding-box, content-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: none, none, none /* FIXME */, none, none;
background-origin: padding-box, border-box, padding-box, padding-box, content-box;
background-position: 5px bottom, 5px bottom, 10%, left top, left top;
@@ -2940,7 +2940,7 @@ hl {
il {
background-clip: border-box, padding-box, content-box, border-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: none, none, linear-gradient(rgb(255,192,203), rgb(128,0,128)), none;
background-origin: border-box, padding-box, content-box, border-box;
background-position: center, 5px bottom, center, 10%;
@@ -3090,7 +3090,7 @@ wl {
xl {
background-clip: border-box, padding-box, padding-box, border-box, padding-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: none /* FIXME */, none, none /* FIXME */, linear-gradient(rgb(255,192,203), rgb(128,0,128)), linear-gradient(rgb(255,192,203), rgb(128,0,128));
background-origin: padding-box, padding-box, border-box, border-box, padding-box;
background-position: 5px bottom, center, left top, 10%, center;
@@ -3180,7 +3180,7 @@ fm {
gm {
background-clip: border-box, padding-box, content-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: none, none, none;
background-origin: border-box, padding-box, content-box;
background-position: left top, 10%, left top;
@@ -3210,7 +3210,7 @@ im {
jm {
background-clip: border-box, border-box, border-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: none /* FIXME */, none, none;
background-origin: border-box, padding-box, padding-box;
background-position: left top, center, center;
@@ -3290,7 +3290,7 @@ qm {
rm {
background-clip: content-box, padding-box, content-box, content-box, content-box, border-box, padding-box, content-box, border-box, border-box, padding-box, border-box, border-box, content-box, border-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: none /* FIXME */, none, none, none, none /* FIXME */, none, none /* FIXME */, none /* FIXME */, none, linear-gradient(rgb(255,192,203), rgb(128,0,128)), none, none, none, none, none;
background-origin: content-box, border-box, content-box, content-box, border-box, border-box, content-box, content-box, padding-box, border-box, padding-box, padding-box, padding-box, content-box, padding-box;
background-position: 5px bottom, left top, left top, left top, left top, 10%, center, left top, left top, center, 10%, left top, left top, left top, left top;
@@ -3330,7 +3330,7 @@ um {
vm {
background-clip: content-box, content-box, padding-box, content-box, padding-box, padding-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: none, none, none, linear-gradient(rgb(255,192,203), rgb(128,0,128)), none, none;
background-origin: content-box, content-box, border-box, content-box, padding-box, padding-box;
background-position: 10%, 10%, left top, center, left top, left top;
@@ -3370,7 +3370,7 @@ ym {
zm {
background-clip: border-box, border-box, padding-box, border-box, padding-box, content-box, border-box, content-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: linear-gradient(rgb(255,192,203), rgb(128,0,128)), linear-gradient(rgb(255,192,203), rgb(128,0,128)), none, none, none, linear-gradient(rgb(255,192,203), rgb(128,0,128)), none, none;
background-origin: padding-box, padding-box, padding-box, border-box, padding-box, content-box, border-box, content-box;
background-position: 10%, 10%, left top, left top, center, left top, center, 10%;
@@ -3440,7 +3440,7 @@ fn {
gn {
background-clip: content-box, padding-box, padding-box, border-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: none, none, linear-gradient(rgb(255,192,203), rgb(128,0,128)), none;
background-origin: content-box, padding-box, padding-box, border-box;
background-position: center, center, center, 10%;
@@ -3600,7 +3600,7 @@ vn {
wn {
background-clip: padding-box, border-box, border-box, border-box, padding-box, padding-box, border-box, border-box, border-box, content-box, border-box, padding-box, border-box, content-box, padding-box, padding-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: none, none /* FIXME */, none, none, none, none /* FIXME */, none, none, linear-gradient(rgb(255,192,203), rgb(128,0,128)), none, none, none, none, none, linear-gradient(rgb(255,192,203), rgb(128,0,128)), none;
background-origin: content-box, border-box, content-box, border-box, padding-box, padding-box, padding-box, padding-box, padding-box, content-box, padding-box, content-box, border-box, content-box, padding-box, border-box;
background-position: center, center, 5px bottom, 5px bottom, left top, 10%, left top, center, center, 10%, 10%, 10%, left top, 5px bottom, center, left top;
@@ -3760,7 +3760,7 @@ lo {
mo {
background-clip: border-box, padding-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: linear-gradient(rgb(255,192,203), rgb(128,0,128)), none;
background-origin: padding-box, padding-box;
background-position: left top, 10%;
@@ -3950,7 +3950,7 @@ ep {
fp {
background-clip: border-box, border-box, border-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: none /* FIXME */, none /* FIXME */, none /* FIXME */;
background-origin: border-box, border-box, padding-box;
background-position: left top, center, left top;
@@ -3960,7 +3960,7 @@ fp {
gp {
background-clip: content-box, content-box, border-box, padding-box, border-box, content-box, padding-box, border-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: none /* FIXME */, none, none, none, none, none /* FIXME */, none, none /* FIXME */;
background-origin: content-box, padding-box, padding-box, padding-box, border-box, content-box, padding-box, padding-box;
background-position: left top, 10%, 5px bottom, 10%, 10%, 5px bottom, center, left top;
@@ -4010,7 +4010,7 @@ kp {
lp {
background-clip: padding-box, border-box, border-box, padding-box, padding-box, border-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: none /* FIXME */, linear-gradient(rgb(255,192,203), rgb(128,0,128)), linear-gradient(rgb(255,192,203), rgb(128,0,128)), none, none /* FIXME */, none;
background-origin: padding-box, padding-box, padding-box, padding-box, border-box, padding-box;
background-position: left top, 5px bottom, center, 10%, left top, 5px bottom;
@@ -4040,7 +4040,7 @@ np {
op {
background-clip: content-box, border-box, padding-box, padding-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: linear-gradient(rgb(255,192,203), rgb(128,0,128)), linear-gradient(rgb(255,192,203), rgb(128,0,128)), linear-gradient(rgb(255,192,203), rgb(128,0,128)), none;
background-origin: content-box, border-box, padding-box, border-box;
background-position: 5px bottom, left top, left top, center;
@@ -4110,7 +4110,7 @@ up {
vp {
background-clip: border-box, content-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: none, none;
background-origin: padding-box, content-box;
background-position: left top, 10%;
@@ -4290,7 +4290,7 @@ mq {
nq {
background-clip: border-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: none;
background-origin: padding-box;
background-position: left top;
@@ -4420,7 +4420,7 @@ zq {
ar {
background-clip: border-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: none;
background-origin: border-box;
background-position: left top;
@@ -4440,7 +4440,7 @@ br {
cr {
background-clip: border-box, padding-box, content-box, padding-box, padding-box, padding-box, border-box, padding-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: none, none /* FIXME */, none, linear-gradient(rgb(255,192,203), rgb(128,0,128)), none, linear-gradient(rgb(255,192,203), rgb(128,0,128)), none, none;
background-origin: padding-box, padding-box, content-box, padding-box, padding-box, content-box, border-box, padding-box;
background-position: left top, 10%, 5px bottom, 10%, left top, 5px bottom, left top, 5px bottom;
@@ -4490,7 +4490,7 @@ gr {
hr {
background-clip: border-box, border-box, content-box, content-box, border-box, border-box, border-box, border-box, content-box, border-box, border-box, padding-box, content-box, border-box, padding-box, content-box, padding-box, content-box, padding-box, border-box, border-box, content-box, border-box, border-box, border-box, border-box, padding-box, border-box, border-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: none, none, none, none, none /* FIXME */, linear-gradient(rgb(255,192,203), rgb(128,0,128)), none, none, none, none, none, none, none, none, none /* FIXME */, none, none, none, none, none, linear-gradient(rgb(255,192,203), rgb(128,0,128)), none /* FIXME */, linear-gradient(rgb(255,192,203), rgb(128,0,128)), none, none, none /* FIXME */, linear-gradient(rgb(255,192,203), rgb(128,0,128)), none, none /* FIXME */;
background-origin: border-box, padding-box, padding-box, content-box, padding-box, border-box, padding-box, border-box, content-box, border-box, padding-box, border-box, content-box, border-box, content-box, border-box, padding-box, padding-box, padding-box, border-box, border-box, padding-box, padding-box, border-box, border-box, border-box, padding-box, padding-box, content-box;
background-position: center, left top, left top, left top, left top, 5px bottom, center, 5px bottom, left top, 5px bottom, 5px bottom, left top, 5px bottom, left top, 5px bottom, 5px bottom, center, left top, left top, left top, left top, left top, 10%, left top, left top, 10%, left top, left top, left top;
@@ -4710,7 +4710,7 @@ cs {
ds {
background-clip: content-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: none /* FIXME */;
background-origin: padding-box;
background-position: 10%;
@@ -4770,7 +4770,7 @@ is {
js {
background-clip: padding-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: none;
background-origin: border-box;
background-position: left top;
@@ -4940,7 +4940,7 @@ zs {
at {
background-clip: border-box, border-box, border-box, border-box, border-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: linear-gradient(rgb(255,192,203), rgb(128,0,128)), none, none, linear-gradient(rgb(255,192,203), rgb(128,0,128)), none;
background-origin: border-box, padding-box, padding-box, padding-box, border-box;
background-position: center, left top, center, center, left top;
@@ -5030,7 +5030,7 @@ it {
jt {
background-clip: border-box, border-box, border-box, padding-box, border-box, content-box, border-box, border-box, padding-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: none, linear-gradient(rgb(255,192,203), rgb(128,0,128)), linear-gradient(rgb(255,192,203), rgb(128,0,128)), none, none, none, none /* FIXME */, none, none /* FIXME */;
background-origin: padding-box, padding-box, padding-box, padding-box, padding-box, content-box, padding-box, padding-box, padding-box;
background-position: 10%, left top, left top, left top, 10%, 5px bottom, 10%, left top, left top;
@@ -5070,7 +5070,7 @@ mt {
nt {
background-clip: content-box, border-box, border-box, border-box, content-box, content-box, border-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: none /* FIXME */, none /* FIXME */, none, linear-gradient(rgb(255,192,203), rgb(128,0,128)), none, none, none;
background-origin: content-box, border-box, padding-box, border-box, padding-box, content-box, padding-box;
background-position: left top, 5px bottom, left top, left top, left top, left top, left top;
@@ -5120,7 +5120,7 @@ rt {
st {
background-clip: content-box, padding-box, border-box, content-box, content-box, padding-box, border-box, content-box, padding-box, border-box, padding-box, border-box, border-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: none /* FIXME */, none, none, linear-gradient(rgb(255,192,203), rgb(128,0,128)), none /* FIXME */, none /* FIXME */, linear-gradient(rgb(255,192,203), rgb(128,0,128)), none, none /* FIXME */, none, none, none /* FIXME */, none;
background-origin: padding-box, padding-box, border-box, content-box, content-box, padding-box, padding-box, content-box, padding-box, border-box, padding-box, border-box, padding-box;
background-position: center, 10%, 5px bottom, left top, 10%, left top, left top, left top, left top, left top, left top, 5px bottom, left top;
@@ -5200,7 +5200,7 @@ zt {
au {
background-clip: padding-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: none;
background-origin: padding-box;
background-position: left top;
@@ -5250,7 +5250,7 @@ eu {
fu {
background-clip: padding-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: none /* FIXME */;
background-origin: padding-box;
background-position: 5px bottom;
@@ -5360,7 +5360,7 @@ pu {
qu {
background-clip: border-box, border-box, padding-box, border-box, padding-box, border-box, border-box, border-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: none /* FIXME */, none, none, none, none, none, none /* FIXME */, linear-gradient(rgb(255,192,203), rgb(128,0,128));
background-origin: padding-box, padding-box, padding-box, padding-box, padding-box, border-box, border-box, padding-box;
background-position: left top, 5px bottom, center, 5px bottom, left top, center, 10%, 5px bottom;
@@ -5400,7 +5400,7 @@ tu {
uu {
background-clip: border-box, padding-box, border-box, border-box, border-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: none, linear-gradient(rgb(255,192,203), rgb(128,0,128)), none, linear-gradient(rgb(255,192,203), rgb(128,0,128)), none /* FIXME */;
background-origin: padding-box, padding-box, padding-box, content-box, padding-box;
background-position: center, 5px bottom, 5px bottom, left top, 10%;
@@ -5490,7 +5490,7 @@ cv {
dv {
background-clip: content-box, border-box, padding-box, border-box, padding-box, content-box, content-box, padding-box, padding-box, padding-box, border-box, padding-box, border-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: none, linear-gradient(rgb(255,192,203), rgb(128,0,128)), none, none /* FIXME */, none, none /* FIXME */, linear-gradient(rgb(255,192,203), rgb(128,0,128)), none /* FIXME */, none, none, none, none, none;
background-origin: content-box, border-box, border-box, border-box, padding-box, content-box, content-box, padding-box, padding-box, padding-box, padding-box, padding-box, border-box;
background-position: left top, 5px bottom, 5px bottom, 10%, 5px bottom, center, left top, left top, 10%, 5px bottom, center, left top, 10%;
@@ -5540,7 +5540,7 @@ hv {
iv {
background-clip: border-box, content-box, padding-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: none, none, linear-gradient(rgb(255,192,203), rgb(128,0,128));
background-origin: border-box, padding-box, padding-box;
background-position: left top, center, left top;
@@ -5560,7 +5560,7 @@ jv {
kv {
background-clip: border-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: none;
background-origin: padding-box;
background-position: left top;
@@ -5670,7 +5670,7 @@ uv {
vv {
background-clip: padding-box, border-box, padding-box, border-box, border-box, border-box, content-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: none /* FIXME */, none, none /* FIXME */, none, none, none /* FIXME */, none;
background-origin: border-box, padding-box, padding-box, padding-box, content-box, padding-box, content-box;
background-position: left top, 5px bottom, left top, center, center, 5px bottom, left top;
@@ -5730,7 +5730,7 @@ aw {
bw {
background-clip: padding-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: linear-gradient(rgb(255,192,203), rgb(128,0,128));
background-origin: padding-box;
background-position: center;
@@ -5910,7 +5910,7 @@ sw {
tw {
background-clip: border-box, padding-box, border-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: none, none, linear-gradient(rgb(255,192,203), rgb(128,0,128));
background-origin: border-box, padding-box, padding-box;
background-position: left top, center, center;
@@ -5940,7 +5940,7 @@ vw {
ww {
background-clip: padding-box, padding-box, border-box, content-box, content-box, content-box, border-box, content-box, border-box, padding-box, padding-box, content-box, border-box, border-box, padding-box, content-box, border-box, padding-box, border-box, border-box, padding-box, border-box, border-box, padding-box, content-box, border-box, border-box, border-box, border-box, padding-box, padding-box, border-box, padding-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: none, none, none, none, none, none, linear-gradient(rgb(255,192,203), rgb(128,0,128)), none /* FIXME */, none, none /* FIXME */, linear-gradient(rgb(255,192,203), rgb(128,0,128)), none, none /* FIXME */, linear-gradient(rgb(255,192,203), rgb(128,0,128)), none /* FIXME */, none, linear-gradient(rgb(255,192,203), rgb(128,0,128)), none, none /* FIXME */, none, none, none /* FIXME */, none /* FIXME */, none, none, none /* FIXME */, none, none, none, none /* FIXME */, none /* FIXME */, none, none;
background-origin: padding-box, padding-box, padding-box, content-box, content-box, border-box, border-box, content-box, border-box, padding-box, padding-box, content-box, border-box, padding-box, border-box, content-box, border-box, padding-box, border-box, border-box, padding-box, padding-box, padding-box, padding-box, content-box, border-box, padding-box, border-box, border-box, padding-box, padding-box, padding-box, padding-box;
background-position: 5px bottom, 10%, 10%, 10%, left top, 10%, 5px bottom, left top, 5px bottom, 5px bottom, left top, 10%, 10%, left top, 10%, left top, left top, left top, 5px bottom, 10%, left top, 10%, center, 5px bottom, center, left top, left top, left top, 5px bottom, left top, left top, 10%, 5px bottom;
@@ -6040,7 +6040,7 @@ fx {
gx {
background-clip: padding-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: none;
background-origin: content-box;
background-position: left top;
@@ -6190,7 +6190,7 @@ ux {
vx {
background-clip: border-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: linear-gradient(rgb(255,192,203), rgb(128,0,128));
background-origin: border-box;
background-position: center;
@@ -6280,7 +6280,7 @@ dy {
ey {
background-clip: border-box, padding-box, content-box, border-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: linear-gradient(rgb(255,192,203), rgb(128,0,128)), none /* FIXME */, none, linear-gradient(rgb(255,192,203), rgb(128,0,128));
background-origin: border-box, padding-box, content-box, padding-box;
background-position: left top, 10%, left top, left top;
@@ -6340,7 +6340,7 @@ jy {
ky {
background-clip: content-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: none /* FIXME */;
background-origin: content-box;
background-position: left top;
@@ -6370,7 +6370,7 @@ my {
ny {
background-clip: border-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: linear-gradient(rgb(255,192,203), rgb(128,0,128));
background-origin: border-box;
background-position: left top;
@@ -6590,7 +6590,7 @@ iz {
jz {
background-clip: content-box, content-box, border-box;
background-color: alpha(rgb(255,192,203), 0.5);
background-color: rgba(255,192,203,0.5);
background-image: none /* FIXME */, none /* FIXME */, none;
background-origin: padding-box, content-box, padding-box;
background-position: left top, 5px bottom, center;
+5 -5
View File
@@ -49,23 +49,23 @@ l {
}
m {
color: shade(rgb(255,0,0), 1.3);
color: rgb(255,77,77);
}
n {
color: shade(rgb(255,0,0), 0.69999999999999996);
color: rgb(152,27,27);
}
o {
color: shade(rgb(0,128,0), 0.5);
color: rgb(16,48,16);
}
p {
color: alpha(rgb(0,128,0), 0.5);
color: rgba(0,128,0,0.5);
}
q {
color: mix(rgb(255,0,0), rgb(0,0,255), 0.25);
color: rgb(191,0,64);
}
r {
-3
View File
@@ -426,9 +426,6 @@ test_data = [
'text-decoration-style.css',
'text-decoration-style.ref.css',
'text-shadow.css',
'text-shadow-invalid-but-worked-in-3.12.css',
'text-shadow-invalid-but-worked-in-3.12.errors',
'text-shadow-invalid-but-worked-in-3.12.ref.css',
'text-shadow.ref.css',
'transition.css',
'transition-delay.css',
@@ -1,7 +0,0 @@
a {
text-shadow: inset 1px 1px;
}
b {
text-shadow: 0 0 0 0;
}
@@ -1,2 +0,0 @@
text-shadow-invalid-but-worked-in-3.12.css:2:16-21: error: GTK_CSS_PARSER_ERROR_SYNTAX
text-shadow-invalid-but-worked-in-3.12.css:6:22-23: error: GTK_CSS_PARSER_ERROR_SYNTAX
+11 -11
View File
@@ -1,13 +1,13 @@
[window.background:dir(ltr)]
decoration:dir(ltr)
box.horizontal:dir(ltr)
box.horizontal:dir(ltr)
checkbutton:dir(ltr):checked
check:dir(ltr):checked
label#label1:dir(ltr)
[window.background:dir(ltr)] class|name|id|first-child|last-child|nth-child|nth-last-child|state|sibling-class|sibling-name|sibling-id|sibling-first-child|sibling-last-child|sibling-nth-child|sibling-nth-last-child|sibling-state|parent-class|parent-name|parent-id|parent-first-child|parent-last-child|parent-nth-child|parent-nth-last-child|parent-state|parent-sibling-|parent-sibling-name|parent-sibling-id|parent-sibling-first-child|parent-sibling-last-child|parent-sibling-nth-child|parent-sibling-nth-last-child|parent-sibling-state
decoration:dir(ltr) class|name|id|first-child|last-child|nth-child|nth-last-child|state|sibling-class|sibling-name|sibling-id|sibling-first-child|sibling-last-child|sibling-nth-child|sibling-nth-last-child|sibling-state|parent-class|parent-name|parent-id|parent-first-child|parent-last-child|parent-nth-child|parent-nth-last-child|parent-state|parent-sibling-|parent-sibling-name|parent-sibling-id|parent-sibling-first-child|parent-sibling-last-child|parent-sibling-nth-child|parent-sibling-nth-last-child|parent-sibling-state
box.horizontal:dir(ltr) class|name|id|first-child|last-child|nth-child|nth-last-child|state|sibling-class|sibling-name|sibling-id|sibling-first-child|sibling-last-child|sibling-nth-child|sibling-nth-last-child|sibling-state|parent-class|parent-name|parent-id|parent-first-child|parent-last-child|parent-nth-child|parent-nth-last-child|parent-state|parent-sibling-|parent-sibling-name|parent-sibling-id|parent-sibling-first-child|parent-sibling-last-child|parent-sibling-nth-child|parent-sibling-nth-last-child|parent-sibling-state
box.horizontal:dir(ltr) class|name|id|first-child|last-child|nth-child|nth-last-child|state|sibling-class|sibling-name|sibling-id|sibling-first-child|sibling-last-child|sibling-nth-child|sibling-nth-last-child|sibling-state|parent-class|parent-name|parent-id|parent-first-child|parent-last-child|parent-nth-child|parent-nth-last-child|parent-state|parent-sibling-|parent-sibling-name|parent-sibling-id|parent-sibling-first-child|parent-sibling-last-child|parent-sibling-nth-child|parent-sibling-nth-last-child|parent-sibling-state
checkbutton:dir(ltr):checked class|name|id|first-child|last-child|nth-child|nth-last-child|state|sibling-class|sibling-name|sibling-id|sibling-first-child|sibling-last-child|sibling-nth-child|sibling-nth-last-child|sibling-state|parent-class|parent-name|parent-id|parent-first-child|parent-last-child|parent-nth-child|parent-nth-last-child|parent-state|parent-sibling-|parent-sibling-name|parent-sibling-id|parent-sibling-first-child|parent-sibling-last-child|parent-sibling-nth-child|parent-sibling-nth-last-child|parent-sibling-state
check:dir(ltr):checked class|name|id|first-child|last-child|nth-child|nth-last-child|state|sibling-class|sibling-name|sibling-id|sibling-first-child|sibling-last-child|sibling-nth-child|sibling-nth-last-child|sibling-state|parent-class|parent-name|parent-id|parent-first-child|parent-last-child|parent-nth-child|parent-nth-last-child|parent-state|parent-sibling-|parent-sibling-name|parent-sibling-id|parent-sibling-first-child|parent-sibling-last-child|parent-sibling-nth-child|parent-sibling-nth-last-child|parent-sibling-state
label#label1:dir(ltr) name|sibling-name|sibling-state
color: rgb(255,0,0); /* adjacent-states.css:2:3-14 */
box.horizontal:dir(ltr)
checkbutton:dir(ltr)
check:dir(ltr)
label#label2:dir(ltr)
box.horizontal:dir(ltr) class|name|id|first-child|last-child|nth-child|nth-last-child|state|sibling-class|sibling-name|sibling-id|sibling-first-child|sibling-last-child|sibling-nth-child|sibling-nth-last-child|sibling-state|parent-class|parent-name|parent-id|parent-first-child|parent-last-child|parent-nth-child|parent-nth-last-child|parent-state|parent-sibling-|parent-sibling-name|parent-sibling-id|parent-sibling-first-child|parent-sibling-last-child|parent-sibling-nth-child|parent-sibling-nth-last-child|parent-sibling-state
checkbutton:dir(ltr) class|name|id|first-child|last-child|nth-child|nth-last-child|state|sibling-class|sibling-name|sibling-id|sibling-first-child|sibling-last-child|sibling-nth-child|sibling-nth-last-child|sibling-state|parent-class|parent-name|parent-id|parent-first-child|parent-last-child|parent-nth-child|parent-nth-last-child|parent-state|parent-sibling-|parent-sibling-name|parent-sibling-id|parent-sibling-first-child|parent-sibling-last-child|parent-sibling-nth-child|parent-sibling-nth-last-child|parent-sibling-state
check:dir(ltr) class|name|id|first-child|last-child|nth-child|nth-last-child|state|sibling-class|sibling-name|sibling-id|sibling-first-child|sibling-last-child|sibling-nth-child|sibling-nth-last-child|sibling-state|parent-class|parent-name|parent-id|parent-first-child|parent-last-child|parent-nth-child|parent-nth-last-child|parent-state|parent-sibling-|parent-sibling-name|parent-sibling-id|parent-sibling-first-child|parent-sibling-last-child|parent-sibling-nth-child|parent-sibling-nth-last-child|parent-sibling-state
label#label2:dir(ltr) name|sibling-name|sibling-state
color: rgb(0,0,255); /* adjacent-states.css:6:3-15 */
+172
View File
@@ -0,0 +1,172 @@
color {
bounds: 0 60 171 22;
color: rgb(0,255,0);
}
transform {
child: container {
blend {
bottom: blend {
bottom: color {
bounds: 0 0 149 0;
color: rgb(255,0,0);
}
mode: multiply;
top: color {
bounds: 0 0 149 0;
color: rgba(0,0,0,0);
}
}
mode: multiply;
top: color {
bounds: -10 -10 84.5 20;
color: rgb(255,255,0);
}
}
border {
colors: rgb(0,0,255);
outline: -11 -11 171 22;
}
}
transform: translate(11, 71);
}
container {
transform {
child: container {
blend {
bottom: blend {
bottom: color {
bounds: 0 0 0 38;
color: rgb(255,0,0);
}
mode: multiply;
top: color {
bounds: 0 0 0 38;
color: rgba(0,0,0,0);
}
}
mode: multiply;
top: color {
bounds: -10 -10 10 58;
color: rgb(255,255,0);
}
}
border {
colors: rgb(0,0,255);
outline: -11 -11 22 60;
}
}
transform: translate(11, 11);
}
transform {
child: container {
blend {
bottom: blend {
bottom: color {
bounds: 0 0 67 18;
color: rgb(255,0,0);
}
mode: multiply;
top: clip {
child: color {
bounds: -10 -10 87 19;
color: rgb(255,255,255);
}
clip: 0 0 67 18;
}
}
mode: multiply;
top: color {
bounds: -10 -10 43.5 38;
color: rgb(255,255,0);
}
}
border {
colors: rgb(0,0,255);
outline: -11 -11 89 40;
}
container {
text {
color: rgb(255,255,255);
font: "Cantarell 11";
glyphs: 312 8, 430 5, 345 7, 828 7, 272 8, 438 8, 324 4, 349 4;
offset: 3 14.418;
}
text {
color: rgb(255,255,255);
font: "Cantarell 11";
glyphs: 809 10;
offset: 54 14.418;
}
}
}
transform: translate(33, 21);
}
transform {
child: container {
blend {
bottom: blend {
bottom: color {
bounds: 0 0 38 38;
color: rgb(255,0,0);
}
mode: multiply;
top: clip {
child: color {
bounds: -10 -10 58 29;
color: rgb(255,255,255);
}
clip: 0 0 38 38;
}
}
mode: multiply;
top: color {
bounds: -10 -10 29 58;
color: rgb(255,255,0);
}
}
border {
colors: rgb(0,0,255);
outline: -11 -11 60 60;
}
transform {
child: container {
blend {
bottom: blend {
bottom: color {
bounds: 0 0 16 16;
color: rgb(255,0,0);
}
mode: multiply;
top: clip {
child: color {
bounds: -10 -10 36 18;
color: rgb(255,255,255);
}
clip: 0 0 16 16;
}
}
mode: multiply;
top: color {
bounds: -10 -10 18 36;
color: rgb(255,255,0);
}
}
border {
colors: rgb(0,0,255);
outline: -11 -11 38 38;
}
color-matrix {
child: texture {
bounds: 0 0 16 16;
texture: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAAfUlEQVQ4je3RMQoCMRBG4Q+voEIKC/H+d7Cwd1GULSzEUyg2azOyQ1gxB9gHgcnknxdCmJliwAHr1FtiH2d/uUTwHJIVuuj1LYINbklyivqObYuglgx4YDcVXPwQvPFM+1esJgquxjf3qS4tgmM1UJKkaxF8g/m2YvyJmYoPk2IlW2Wofj0AAAAASUVORK5CYII=");
}
matrix: matrix3d(-0.8, -0.180392, -0.521569, 0, -0.0392157, -0.52549, -1, 0, -0.2, -1, -1, 0, 0, 0, 0, 1);
offset: 1 1 1 0;
}
}
transform: translate(11, 11);
}
}
transform: translate(122, 11);
}
}
+151 -151
View File
@@ -1,298 +1,298 @@
[window.background:dir(ltr)]
decoration:dir(ltr)
box.horizontal:dir(ltr)
label#aliceblue:dir(ltr)
[window.background:dir(ltr)] class|name|id|first-child|last-child|nth-child|nth-last-child|state|sibling-class|sibling-name|sibling-id|sibling-first-child|sibling-last-child|sibling-nth-child|sibling-nth-last-child|sibling-state|parent-class|parent-name|parent-id|parent-first-child|parent-last-child|parent-nth-child|parent-nth-last-child|parent-state|parent-sibling-|parent-sibling-name|parent-sibling-id|parent-sibling-first-child|parent-sibling-last-child|parent-sibling-nth-child|parent-sibling-nth-last-child|parent-sibling-state
decoration:dir(ltr) class|name|id|first-child|last-child|nth-child|nth-last-child|state|sibling-class|sibling-name|sibling-id|sibling-first-child|sibling-last-child|sibling-nth-child|sibling-nth-last-child|sibling-state|parent-class|parent-name|parent-id|parent-first-child|parent-last-child|parent-nth-child|parent-nth-last-child|parent-state|parent-sibling-|parent-sibling-name|parent-sibling-id|parent-sibling-first-child|parent-sibling-last-child|parent-sibling-nth-child|parent-sibling-nth-last-child|parent-sibling-state
box.horizontal:dir(ltr) class|name|id|first-child|last-child|nth-child|nth-last-child|state|sibling-class|sibling-name|sibling-id|sibling-first-child|sibling-last-child|sibling-nth-child|sibling-nth-last-child|sibling-state|parent-class|parent-name|parent-id|parent-first-child|parent-last-child|parent-nth-child|parent-nth-last-child|parent-state|parent-sibling-|parent-sibling-name|parent-sibling-id|parent-sibling-first-child|parent-sibling-last-child|parent-sibling-nth-child|parent-sibling-nth-last-child|parent-sibling-state
label#aliceblue:dir(ltr) name|id
color: rgb(240,248,255); /* colornames.css:1:19-36 */
label#antiquewhite:dir(ltr)
label#antiquewhite:dir(ltr) name|id
color: rgb(250,235,215); /* colornames.css:2:22-42 */
label#aqua:dir(ltr)
label#aqua:dir(ltr) name|id
color: rgb(0,255,255); /* colornames.css:3:14-26 */
label#aquamarine:dir(ltr)
label#aquamarine:dir(ltr) name|id
color: rgb(127,255,212); /* colornames.css:4:20-38 */
label#azure:dir(ltr)
label#azure:dir(ltr) name|id
color: rgb(240,255,255); /* colornames.css:5:15-28 */
label#beige:dir(ltr)
label#beige:dir(ltr) name|id
color: rgb(245,245,220); /* colornames.css:6:15-28 */
label#bisque:dir(ltr)
label#bisque:dir(ltr) name|id
color: rgb(255,228,196); /* colornames.css:7:16-30 */
label#black:dir(ltr)
label#black:dir(ltr) name|id
color: rgb(0,0,0); /* colornames.css:8:15-28 */
label#blanchedalmond:dir(ltr)
label#blanchedalmond:dir(ltr) name|id
color: rgb(255,235,205); /* colornames.css:9:24-46 */
label#blue:dir(ltr)
label#blue:dir(ltr) name|id
color: rgb(0,0,255); /* colornames.css:10:14-26 */
label#blueviolet:dir(ltr)
label#blueviolet:dir(ltr) name|id
color: rgb(138,43,226); /* colornames.css:11:20-38 */
label#brown:dir(ltr)
label#brown:dir(ltr) name|id
color: rgb(165,42,42); /* colornames.css:12:15-28 */
label#burlywood:dir(ltr)
label#burlywood:dir(ltr) name|id
color: rgb(222,184,135); /* colornames.css:13:19-36 */
label#cadetblue:dir(ltr)
label#cadetblue:dir(ltr) name|id
color: rgb(95,158,160); /* colornames.css:14:19-36 */
label#chartreuse:dir(ltr)
label#chartreuse:dir(ltr) name|id
color: rgb(127,255,0); /* colornames.css:15:20-38 */
label#chocolate:dir(ltr)
label#chocolate:dir(ltr) name|id
color: rgb(210,105,30); /* colornames.css:16:19-36 */
label#coral:dir(ltr)
label#coral:dir(ltr) name|id
color: rgb(255,127,80); /* colornames.css:17:15-28 */
label#cornflowerblue:dir(ltr)
label#cornflowerblue:dir(ltr) name|id
color: rgb(100,149,237); /* colornames.css:18:24-46 */
label#cornsilk:dir(ltr)
label#cornsilk:dir(ltr) name|id
color: rgb(255,248,220); /* colornames.css:19:18-34 */
label#crimson:dir(ltr)
label#crimson:dir(ltr) name|id
color: rgb(220,20,60); /* colornames.css:20:17-32 */
label#cyan:dir(ltr)
label#cyan:dir(ltr) name|id
color: rgb(0,255,255); /* colornames.css:21:14-26 */
label#darkblue:dir(ltr)
label#darkblue:dir(ltr) name|id
color: rgb(0,0,139); /* colornames.css:22:18-34 */
label#darkcyan:dir(ltr)
label#darkcyan:dir(ltr) name|id
color: rgb(0,139,139); /* colornames.css:23:18-34 */
label#darkgoldenrod:dir(ltr)
label#darkgoldenrod:dir(ltr) name|id
color: rgb(184,134,11); /* colornames.css:24:23-44 */
label#darkgray:dir(ltr)
label#darkgray:dir(ltr) name|id
color: rgb(169,169,169); /* colornames.css:25:18-34 */
label#darkgreen:dir(ltr)
label#darkgreen:dir(ltr) name|id
color: rgb(0,100,0); /* colornames.css:26:19-36 */
label#darkgrey:dir(ltr)
label#darkgrey:dir(ltr) name|id
color: rgb(169,169,169); /* colornames.css:27:18-34 */
label#darkkhaki:dir(ltr)
label#darkkhaki:dir(ltr) name|id
color: rgb(189,183,107); /* colornames.css:28:19-36 */
label#darkmagenta:dir(ltr)
label#darkmagenta:dir(ltr) name|id
color: rgb(139,0,139); /* colornames.css:29:21-40 */
label#darkolivegreen:dir(ltr)
label#darkolivegreen:dir(ltr) name|id
color: rgb(85,107,47); /* colornames.css:30:24-46 */
label#darkorange:dir(ltr)
label#darkorange:dir(ltr) name|id
color: rgb(255,140,0); /* colornames.css:31:20-38 */
label#darkorchid:dir(ltr)
label#darkorchid:dir(ltr) name|id
color: rgb(153,50,204); /* colornames.css:32:20-38 */
label#darkred:dir(ltr)
label#darkred:dir(ltr) name|id
color: rgb(139,0,0); /* colornames.css:33:17-32 */
label#darksalmon:dir(ltr)
label#darksalmon:dir(ltr) name|id
color: rgb(233,150,122); /* colornames.css:34:20-38 */
label#darkseagreen:dir(ltr)
label#darkseagreen:dir(ltr) name|id
color: rgb(143,188,143); /* colornames.css:35:22-42 */
label#darkslateblue:dir(ltr)
label#darkslateblue:dir(ltr) name|id
color: rgb(72,61,139); /* colornames.css:36:23-44 */
label#darkslategray:dir(ltr)
label#darkslategray:dir(ltr) name|id
color: rgb(47,79,79); /* colornames.css:37:23-44 */
label#darkslategrey:dir(ltr)
label#darkslategrey:dir(ltr) name|id
color: rgb(47,79,79); /* colornames.css:38:23-44 */
label#darkturquoise:dir(ltr)
label#darkturquoise:dir(ltr) name|id
color: rgb(0,206,209); /* colornames.css:39:23-44 */
label#darkviolet:dir(ltr)
label#darkviolet:dir(ltr) name|id
color: rgb(148,0,211); /* colornames.css:40:20-38 */
label#deeppink:dir(ltr)
label#deeppink:dir(ltr) name|id
color: rgb(255,20,147); /* colornames.css:41:18-34 */
label#deepskyblue:dir(ltr)
label#deepskyblue:dir(ltr) name|id
color: rgb(0,191,255); /* colornames.css:42:21-40 */
label#dimgray:dir(ltr)
label#dimgray:dir(ltr) name|id
color: rgb(105,105,105); /* colornames.css:43:17-32 */
label#dimgrey:dir(ltr)
label#dimgrey:dir(ltr) name|id
color: rgb(105,105,105); /* colornames.css:44:17-32 */
label#dodgerblue:dir(ltr)
label#dodgerblue:dir(ltr) name|id
color: rgb(30,144,255); /* colornames.css:45:20-38 */
label#firebrick:dir(ltr)
label#firebrick:dir(ltr) name|id
color: rgb(178,34,34); /* colornames.css:46:19-36 */
label#floralwhite:dir(ltr)
label#floralwhite:dir(ltr) name|id
color: rgb(255,250,240); /* colornames.css:47:21-40 */
label#forestgreen:dir(ltr)
label#forestgreen:dir(ltr) name|id
color: rgb(34,139,34); /* colornames.css:48:21-40 */
label#fuchsia:dir(ltr)
label#fuchsia:dir(ltr) name|id
color: rgb(255,0,255); /* colornames.css:49:17-32 */
label#gainsboro:dir(ltr)
label#gainsboro:dir(ltr) name|id
color: rgb(220,220,220); /* colornames.css:50:19-36 */
label#ghostwhite:dir(ltr)
label#ghostwhite:dir(ltr) name|id
color: rgb(248,248,255); /* colornames.css:51:20-38 */
label#gold:dir(ltr)
label#gold:dir(ltr) name|id
color: rgb(255,215,0); /* colornames.css:52:14-26 */
label#goldenrod:dir(ltr)
label#goldenrod:dir(ltr) name|id
color: rgb(218,165,32); /* colornames.css:53:19-36 */
label#gray:dir(ltr)
label#gray:dir(ltr) name|id
color: rgb(128,128,128); /* colornames.css:54:14-26 */
label#green:dir(ltr)
label#green:dir(ltr) name|id
color: rgb(0,128,0); /* colornames.css:55:15-28 */
label#greenyellow:dir(ltr)
label#greenyellow:dir(ltr) name|id
color: rgb(173,255,47); /* colornames.css:56:21-40 */
label#grey:dir(ltr)
label#grey:dir(ltr) name|id
color: rgb(128,128,128); /* colornames.css:57:14-26 */
label#honeydew:dir(ltr)
label#honeydew:dir(ltr) name|id
color: rgb(240,255,240); /* colornames.css:58:18-34 */
label#hotpink:dir(ltr)
label#hotpink:dir(ltr) name|id
color: rgb(255,105,180); /* colornames.css:59:17-32 */
label#indianred:dir(ltr)
label#indianred:dir(ltr) name|id
color: rgb(205,92,92); /* colornames.css:60:19-36 */
label#indigo:dir(ltr)
label#indigo:dir(ltr) name|id
color: rgb(75,0,130); /* colornames.css:61:16-30 */
label#ivory:dir(ltr)
label#ivory:dir(ltr) name|id
color: rgb(255,255,240); /* colornames.css:62:15-28 */
label#khaki:dir(ltr)
label#khaki:dir(ltr) name|id
color: rgb(240,230,140); /* colornames.css:63:15-28 */
label#lavender:dir(ltr)
label#lavender:dir(ltr) name|id
color: rgb(230,230,250); /* colornames.css:64:18-34 */
label#lavenderblush:dir(ltr)
label#lavenderblush:dir(ltr) name|id
color: rgb(255,240,245); /* colornames.css:65:23-44 */
label#lawngreen:dir(ltr)
label#lawngreen:dir(ltr) name|id
color: rgb(124,252,0); /* colornames.css:66:19-36 */
label#lemonchiffon:dir(ltr)
label#lemonchiffon:dir(ltr) name|id
color: rgb(255,250,205); /* colornames.css:67:22-42 */
label#lightblue:dir(ltr)
label#lightblue:dir(ltr) name|id
color: rgb(173,216,230); /* colornames.css:68:19-36 */
label#lightcoral:dir(ltr)
label#lightcoral:dir(ltr) name|id
color: rgb(240,128,128); /* colornames.css:69:20-38 */
label#lightcyan:dir(ltr)
label#lightcyan:dir(ltr) name|id
color: rgb(224,255,255); /* colornames.css:70:19-36 */
label#lightgoldenrodyellow:dir(ltr)
label#lightgoldenrodyellow:dir(ltr) name|id
color: rgb(250,250,210); /* colornames.css:71:30-58 */
label#lightgray:dir(ltr)
label#lightgray:dir(ltr) name|id
color: rgb(211,211,211); /* colornames.css:72:19-36 */
label#lightgreen:dir(ltr)
label#lightgreen:dir(ltr) name|id
color: rgb(144,238,144); /* colornames.css:73:20-38 */
label#lightgrey:dir(ltr)
label#lightgrey:dir(ltr) name|id
color: rgb(211,211,211); /* colornames.css:74:19-36 */
label#lightpink:dir(ltr)
label#lightpink:dir(ltr) name|id
color: rgb(255,182,193); /* colornames.css:75:19-36 */
label#lightsalmon:dir(ltr)
label#lightsalmon:dir(ltr) name|id
color: rgb(255,160,122); /* colornames.css:76:21-40 */
label#lightseagreen:dir(ltr)
label#lightseagreen:dir(ltr) name|id
color: rgb(32,178,170); /* colornames.css:77:23-44 */
label#lightskyblue:dir(ltr)
label#lightskyblue:dir(ltr) name|id
color: rgb(135,206,250); /* colornames.css:78:22-42 */
label#lightslategray:dir(ltr)
label#lightslategray:dir(ltr) name|id
color: rgb(119,136,153); /* colornames.css:79:24-46 */
label#lightslategrey:dir(ltr)
label#lightslategrey:dir(ltr) name|id
color: rgb(119,136,153); /* colornames.css:80:24-46 */
label#lightsteelblue:dir(ltr)
label#lightsteelblue:dir(ltr) name|id
color: rgb(176,196,222); /* colornames.css:81:24-46 */
label#lightyellow:dir(ltr)
label#lightyellow:dir(ltr) name|id
color: rgb(255,255,224); /* colornames.css:82:21-40 */
label#lime:dir(ltr)
label#lime:dir(ltr) name|id
color: rgb(0,255,0); /* colornames.css:83:14-26 */
label#limegreen:dir(ltr)
label#limegreen:dir(ltr) name|id
color: rgb(50,205,50); /* colornames.css:84:19-36 */
label#linen:dir(ltr)
label#linen:dir(ltr) name|id
color: rgb(250,240,230); /* colornames.css:85:15-28 */
label#magenta:dir(ltr)
label#magenta:dir(ltr) name|id
color: rgb(255,0,255); /* colornames.css:86:17-32 */
label#maroon:dir(ltr)
label#maroon:dir(ltr) name|id
color: rgb(128,0,0); /* colornames.css:87:16-30 */
label#mediumaquamarine:dir(ltr)
label#mediumaquamarine:dir(ltr) name|id
color: rgb(102,205,170); /* colornames.css:88:26-50 */
label#mediumblue:dir(ltr)
label#mediumblue:dir(ltr) name|id
color: rgb(0,0,205); /* colornames.css:89:20-38 */
label#mediumorchid:dir(ltr)
label#mediumorchid:dir(ltr) name|id
color: rgb(186,85,211); /* colornames.css:90:22-42 */
label#mediumpurple:dir(ltr)
label#mediumpurple:dir(ltr) name|id
color: rgb(147,112,219); /* colornames.css:91:22-42 */
label#mediumseagreen:dir(ltr)
label#mediumseagreen:dir(ltr) name|id
color: rgb(60,179,113); /* colornames.css:92:24-46 */
label#mediumslateblue:dir(ltr)
label#mediumslateblue:dir(ltr) name|id
color: rgb(123,104,238); /* colornames.css:93:25-48 */
label#mediumspringgreen:dir(ltr)
label#mediumspringgreen:dir(ltr) name|id
color: rgb(0,250,154); /* colornames.css:94:27-52 */
label#mediumturquoise:dir(ltr)
label#mediumturquoise:dir(ltr) name|id
color: rgb(72,209,204); /* colornames.css:95:25-48 */
label#mediumvioletred:dir(ltr)
label#mediumvioletred:dir(ltr) name|id
color: rgb(199,21,133); /* colornames.css:96:25-48 */
label#midnightblue:dir(ltr)
label#midnightblue:dir(ltr) name|id
color: rgb(25,25,112); /* colornames.css:97:22-42 */
label#mintcream:dir(ltr)
label#mintcream:dir(ltr) name|id
color: rgb(245,255,250); /* colornames.css:98:19-36 */
label#mistyrose:dir(ltr)
label#mistyrose:dir(ltr) name|id
color: rgb(255,228,225); /* colornames.css:99:19-36 */
label#moccasin:dir(ltr)
label#moccasin:dir(ltr) name|id
color: rgb(255,228,181); /* colornames.css:100:18-34 */
label#navajowhite:dir(ltr)
label#navajowhite:dir(ltr) name|id
color: rgb(255,222,173); /* colornames.css:101:21-40 */
label#navy:dir(ltr)
label#navy:dir(ltr) name|id
color: rgb(0,0,128); /* colornames.css:102:14-26 */
label#oldlace:dir(ltr)
label#oldlace:dir(ltr) name|id
color: rgb(253,245,230); /* colornames.css:103:17-32 */
label#olive:dir(ltr)
label#olive:dir(ltr) name|id
color: rgb(128,128,0); /* colornames.css:104:15-28 */
label#olivedrab:dir(ltr)
label#olivedrab:dir(ltr) name|id
color: rgb(107,142,35); /* colornames.css:105:19-36 */
label#orange:dir(ltr)
label#orange:dir(ltr) name|id
color: rgb(255,165,0); /* colornames.css:106:16-30 */
label#orangered:dir(ltr)
label#orangered:dir(ltr) name|id
color: rgb(255,69,0); /* colornames.css:107:19-36 */
label#orchid:dir(ltr)
label#orchid:dir(ltr) name|id
color: rgb(218,112,214); /* colornames.css:108:16-30 */
label#palegoldenrod:dir(ltr)
label#palegoldenrod:dir(ltr) name|id
color: rgb(238,232,170); /* colornames.css:109:23-44 */
label#palegreen:dir(ltr)
label#palegreen:dir(ltr) name|id
color: rgb(152,251,152); /* colornames.css:110:19-36 */
label#paleturquoise:dir(ltr)
label#paleturquoise:dir(ltr) name|id
color: rgb(175,238,238); /* colornames.css:111:23-44 */
label#palevioletred:dir(ltr)
label#palevioletred:dir(ltr) name|id
color: rgb(219,112,147); /* colornames.css:112:23-44 */
label#papayawhip:dir(ltr)
label#papayawhip:dir(ltr) name|id
color: rgb(255,239,213); /* colornames.css:113:20-38 */
label#peachpuff:dir(ltr)
label#peachpuff:dir(ltr) name|id
color: rgb(255,218,185); /* colornames.css:114:19-36 */
label#peru:dir(ltr)
label#peru:dir(ltr) name|id
color: rgb(205,133,63); /* colornames.css:115:14-26 */
label#pink:dir(ltr)
label#pink:dir(ltr) name|id
color: rgb(255,192,203); /* colornames.css:116:14-26 */
label#plum:dir(ltr)
label#plum:dir(ltr) name|id
color: rgb(221,160,221); /* colornames.css:117:14-26 */
label#powderblue:dir(ltr)
label#powderblue:dir(ltr) name|id
color: rgb(176,224,230); /* colornames.css:118:20-38 */
label#purple:dir(ltr)
label#purple:dir(ltr) name|id
color: rgb(128,0,128); /* colornames.css:119:16-30 */
label#rebeccapurple:dir(ltr)
label#rebeccapurple:dir(ltr) name|id
color: rgb(102,51,153); /* colornames.css:120:23-44 */
label#red:dir(ltr)
label#red:dir(ltr) name|id
color: rgb(255,0,0); /* colornames.css:121:13-24 */
label#rosybrown:dir(ltr)
label#rosybrown:dir(ltr) name|id
color: rgb(188,143,143); /* colornames.css:122:19-36 */
label#royalblue:dir(ltr)
label#royalblue:dir(ltr) name|id
color: rgb(65,105,225); /* colornames.css:123:19-36 */
label#saddlebrown:dir(ltr)
label#saddlebrown:dir(ltr) name|id
color: rgb(139,69,19); /* colornames.css:124:21-40 */
label#salmon:dir(ltr)
label#salmon:dir(ltr) name|id
color: rgb(250,128,114); /* colornames.css:125:16-30 */
label#sandybrown:dir(ltr)
label#sandybrown:dir(ltr) name|id
color: rgb(244,164,96); /* colornames.css:126:20-38 */
label#seagreen:dir(ltr)
label#seagreen:dir(ltr) name|id
color: rgb(46,139,87); /* colornames.css:127:18-34 */
label#seashell:dir(ltr)
label#seashell:dir(ltr) name|id
color: rgb(255,245,238); /* colornames.css:128:18-34 */
label#sienna:dir(ltr)
label#sienna:dir(ltr) name|id
color: rgb(160,82,45); /* colornames.css:129:16-30 */
label#silver:dir(ltr)
label#silver:dir(ltr) name|id
color: rgb(192,192,192); /* colornames.css:130:16-30 */
label#skyblue:dir(ltr)
label#skyblue:dir(ltr) name|id
color: rgb(135,206,235); /* colornames.css:131:17-32 */
label#slateblue:dir(ltr)
label#slateblue:dir(ltr) name|id
color: rgb(106,90,205); /* colornames.css:132:19-36 */
label#slategray:dir(ltr)
label#slategray:dir(ltr) name|id
color: rgb(112,128,144); /* colornames.css:133:19-36 */
label#slategrey:dir(ltr)
label#slategrey:dir(ltr) name|id
color: rgb(112,128,144); /* colornames.css:134:19-36 */
label#snow:dir(ltr)
label#snow:dir(ltr) name|id
color: rgb(255,250,250); /* colornames.css:135:14-26 */
label#springgreen:dir(ltr)
label#springgreen:dir(ltr) name|id
color: rgb(0,255,127); /* colornames.css:136:21-40 */
label#steelblue:dir(ltr)
label#steelblue:dir(ltr) name|id
color: rgb(70,130,180); /* colornames.css:137:19-36 */
label#tan:dir(ltr)
label#tan:dir(ltr) name|id
color: rgb(210,180,140); /* colornames.css:138:13-24 */
label#teal:dir(ltr)
label#teal:dir(ltr) name|id
color: rgb(0,128,128); /* colornames.css:139:14-26 */
label#thistle:dir(ltr)
label#thistle:dir(ltr) name|id
color: rgb(216,191,216); /* colornames.css:140:17-32 */
label#tomato:dir(ltr)
label#tomato:dir(ltr) name|id
color: rgb(255,99,71); /* colornames.css:141:16-30 */
label#turquoise:dir(ltr)
label#turquoise:dir(ltr) name|id
color: rgb(64,224,208); /* colornames.css:142:19-36 */
label#violet:dir(ltr)
label#violet:dir(ltr) name|id
color: rgb(238,130,238); /* colornames.css:143:16-30 */
label#wheat:dir(ltr)
label#wheat:dir(ltr) name|id
color: rgb(245,222,179); /* colornames.css:144:15-28 */
label#white:dir(ltr)
label#whitesmoke:dir(ltr)
label#white:dir(ltr) class|name|id|first-child|last-child|nth-child|nth-last-child|state|sibling-class|sibling-name|sibling-id|sibling-first-child|sibling-last-child|sibling-nth-child|sibling-nth-last-child|sibling-state|parent-class|parent-name|parent-id|parent-first-child|parent-last-child|parent-nth-child|parent-nth-last-child|parent-state|parent-sibling-|parent-sibling-name|parent-sibling-id|parent-sibling-first-child|parent-sibling-last-child|parent-sibling-nth-child|parent-sibling-nth-last-child|parent-sibling-state
label#whitesmoke:dir(ltr) name|id
color: rgb(245,245,245); /* colornames.css:146:20-38 */
label#yellow:dir(ltr)
label#yellow:dir(ltr) name|id
color: rgb(255,255,0); /* colornames.css:147:16-30 */
label#yellowgreen:dir(ltr)
label#yellowgreen:dir(ltr) name|id
color: rgb(154,205,50); /* colornames.css:148:21-40 */
+4 -4
View File
@@ -1,7 +1,7 @@
[window.background:dir(ltr)]
decoration:dir(ltr)
box.horizontal:dir(ltr)
[window.background:dir(ltr)] class|name|id|first-child|last-child|nth-child|nth-last-child|state|sibling-class|sibling-name|sibling-id|sibling-first-child|sibling-last-child|sibling-nth-child|sibling-nth-last-child|sibling-state|parent-class|parent-name|parent-id|parent-first-child|parent-last-child|parent-nth-child|parent-nth-last-child|parent-state|parent-sibling-|parent-sibling-name|parent-sibling-id|parent-sibling-first-child|parent-sibling-last-child|parent-sibling-nth-child|parent-sibling-nth-last-child|parent-sibling-state
decoration:dir(ltr) class|name|id|first-child|last-child|nth-child|nth-last-child|state|sibling-class|sibling-name|sibling-id|sibling-first-child|sibling-last-child|sibling-nth-child|sibling-nth-last-child|sibling-state|parent-class|parent-name|parent-id|parent-first-child|parent-last-child|parent-nth-child|parent-nth-last-child|parent-state|parent-sibling-|parent-sibling-name|parent-sibling-id|parent-sibling-first-child|parent-sibling-last-child|parent-sibling-nth-child|parent-sibling-nth-last-child|parent-sibling-state
box.horizontal:dir(ltr) name
color: rgb(255,0,0); /* currentcolor.css:2:3-14 */
label:dir(ltr)
label:dir(ltr) name
background-color: rgb(255,0,0); /* currentcolor.css:6:3-34 */
+8 -8
View File
@@ -1,6 +1,6 @@
[window.background:dir(ltr)]
decoration:dir(ltr)
box.horizontal:dir(ltr)
[window.background:dir(ltr)] class|name|id|first-child|last-child|nth-child|nth-last-child|state|sibling-class|sibling-name|sibling-id|sibling-first-child|sibling-last-child|sibling-nth-child|sibling-nth-last-child|sibling-state|parent-class|parent-name|parent-id|parent-first-child|parent-last-child|parent-nth-child|parent-nth-last-child|parent-state|parent-sibling-|parent-sibling-name|parent-sibling-id|parent-sibling-first-child|parent-sibling-last-child|parent-sibling-nth-child|parent-sibling-nth-last-child|parent-sibling-state
decoration:dir(ltr) class|name|id|first-child|last-child|nth-child|nth-last-child|state|sibling-class|sibling-name|sibling-id|sibling-first-child|sibling-last-child|sibling-nth-child|sibling-nth-last-child|sibling-state|parent-class|parent-name|parent-id|parent-first-child|parent-last-child|parent-nth-child|parent-nth-last-child|parent-state|parent-sibling-|parent-sibling-name|parent-sibling-id|parent-sibling-first-child|parent-sibling-last-child|parent-sibling-nth-child|parent-sibling-nth-last-child|parent-sibling-state
box.horizontal:dir(ltr) name
font-size: 10px; /* font.css:2:3-27 */
font-family: "Comic Sans"; /* font.css:2:3-27 */
font-style: normal; /* font.css:2:3-27 */
@@ -8,30 +8,30 @@
font-stretch: normal; /* font.css:2:3-27 */
font-variant-caps: normal; /* font.css:2:3-27 */
label#label1:dir(ltr)
label#label1:dir(ltr) id
font-size: 8.3333333333333339px; /* font.css:6:3-22 */
label#label2:dir(ltr)
label#label2:dir(ltr) id
font-size: 13.333333333333334px; /* font.css:10:3-36 */
font-family: "Cantarell", "sans-serif"; /* font.css:10:3-36 */
font-style: normal; /* font.css:10:3-36 */
font-weight: 400; /* font.css:10:3-36 */
font-stretch: normal; /* font.css:10:3-36 */
font-variant-caps: normal; /* font.css:10:3-36 */
label#label3:dir(ltr)
label#label3:dir(ltr) id
font-size: 8px; /* font.css:14:3-35 */
font-family: "monospace"; /* font.css:14:3-35 */
font-style: italic; /* font.css:14:3-35 */
font-weight: 700; /* font.css:14:3-35 */
font-stretch: normal; /* font.css:14:3-35 */
font-variant-caps: normal; /* font.css:14:3-35 */
label#label4:dir(ltr)
label#label4:dir(ltr) id
font-size: 8px; /* font.css:18:3-41 */
font-family: "serif"; /* font.css:18:3-41 */
font-style: oblique; /* font.css:18:3-41 */
font-weight: 400; /* font.css:18:3-41 */
font-stretch: expanded; /* font.css:18:3-41 */
font-variant-caps: normal; /* font.css:18:3-41 */
label#label5:dir(ltr)
label#label5:dir(ltr) id
font-size: 75.590551181102356px; /* font.css:22:3-29 */
font-family: "21st Century"; /* font.css:22:3-29 */
font-style: normal; /* font.css:22:3-29 */
+4 -4
View File
@@ -1,9 +1,9 @@
[window.background:dir(ltr)]
[window.background:dir(ltr)] name
background-image: linear-gradient(75deg, rgb(255,0,0), rgb(0,128,0) 20%, rgb(0,0,255) 40px); /* gradient.css:2:3-71 */
decoration:dir(ltr)
box.horizontal:dir(ltr)
decoration:dir(ltr) class|name|id|first-child|last-child|nth-child|nth-last-child|state|sibling-class|sibling-name|sibling-id|sibling-first-child|sibling-last-child|sibling-nth-child|sibling-nth-last-child|sibling-state|parent-class|parent-name|parent-id|parent-first-child|parent-last-child|parent-nth-child|parent-nth-last-child|parent-state|parent-sibling-|parent-sibling-name|parent-sibling-id|parent-sibling-first-child|parent-sibling-last-child|parent-sibling-nth-child|parent-sibling-nth-last-child|parent-sibling-state
box.horizontal:dir(ltr) name
background-image: repeating-linear-gradient(to top right, rgba(255,100,60,0.5), rgb(255,0,255) 100%); /* gradient.css:6:3-97 */
label:dir(ltr)
label:dir(ltr) name
background-image: radial-gradient(ellipse farthest-corner at center 30px, rgb(255,255,0), rgb(255,0,0) 30%, rgb(0,0,255)); /* gradient.css:10:3-89 */
+5 -5
View File
@@ -1,10 +1,10 @@
[window.background:dir(ltr)]
decoration:dir(ltr)
box.horizontal:dir(ltr)
[window.background:dir(ltr)] class|name|id|first-child|last-child|nth-child|nth-last-child|state|sibling-class|sibling-name|sibling-id|sibling-first-child|sibling-last-child|sibling-nth-child|sibling-nth-last-child|sibling-state|parent-class|parent-name|parent-id|parent-first-child|parent-last-child|parent-nth-child|parent-nth-last-child|parent-state|parent-sibling-|parent-sibling-name|parent-sibling-id|parent-sibling-first-child|parent-sibling-last-child|parent-sibling-nth-child|parent-sibling-nth-last-child|parent-sibling-state
decoration:dir(ltr) class|name|id|first-child|last-child|nth-child|nth-last-child|state|sibling-class|sibling-name|sibling-id|sibling-first-child|sibling-last-child|sibling-nth-child|sibling-nth-last-child|sibling-state|parent-class|parent-name|parent-id|parent-first-child|parent-last-child|parent-nth-child|parent-nth-last-child|parent-state|parent-sibling-|parent-sibling-name|parent-sibling-id|parent-sibling-first-child|parent-sibling-last-child|parent-sibling-nth-child|parent-sibling-nth-last-child|parent-sibling-state
box.horizontal:dir(ltr) name
color: rgb(255,0,0); /* inherit.css:2:3-14 */
opacity: 0.5; /* inherit.css:3:3-16 */
label#label1:dir(ltr)
label#label1:dir(ltr) name|id
color: rgb(255,255,255); /* inherit.css:7:3-18 */
opacity: 0.5; /* inherit.css:8:3-20 */
label#label2:dir(ltr)
label#label2:dir(ltr)
+4 -4
View File
@@ -1,7 +1,7 @@
[window.background:dir(ltr)]
decoration:dir(ltr)
box.horizontal:dir(ltr)
[window.background:dir(ltr)] class|name|id|first-child|last-child|nth-child|nth-last-child|state|sibling-class|sibling-name|sibling-id|sibling-first-child|sibling-last-child|sibling-nth-child|sibling-nth-last-child|sibling-state|parent-class|parent-name|parent-id|parent-first-child|parent-last-child|parent-nth-child|parent-nth-last-child|parent-state|parent-sibling-|parent-sibling-name|parent-sibling-id|parent-sibling-first-child|parent-sibling-last-child|parent-sibling-nth-child|parent-sibling-nth-last-child|parent-sibling-state
decoration:dir(ltr) class|name|id|first-child|last-child|nth-child|nth-last-child|state|sibling-class|sibling-name|sibling-id|sibling-first-child|sibling-last-child|sibling-nth-child|sibling-nth-last-child|sibling-state|parent-class|parent-name|parent-id|parent-first-child|parent-last-child|parent-nth-child|parent-nth-last-child|parent-state|parent-sibling-|parent-sibling-name|parent-sibling-id|parent-sibling-first-child|parent-sibling-last-child|parent-sibling-nth-child|parent-sibling-nth-last-child|parent-sibling-state
box.horizontal:dir(ltr) name
font-size: 10px; /* label.css:3:3-19 */
font-family: "Comic Sans"; /* label.css:2:3-29 */
label:dir(ltr)
label:dir(ltr)
+3
View File
@@ -52,6 +52,9 @@ test_data = [
'nth-child.css',
'nth-child.nodes',
'nth-child.ui',
'simple-selectors.css',
'simple-selectors.nodes',
'simple-selectors.ui'
]
if get_option('install-tests')
+9 -9
View File
@@ -1,13 +1,13 @@
[window.background:dir(ltr)]
decoration:dir(ltr)
box.horizontal:dir(ltr)
box.horizontal:dir(ltr)
label:dir(ltr)
[window.background:dir(ltr)] class|name|id|first-child|last-child|nth-child|nth-last-child|state|sibling-class|sibling-name|sibling-id|sibling-first-child|sibling-last-child|sibling-nth-child|sibling-nth-last-child|sibling-state|parent-class|parent-name|parent-id|parent-first-child|parent-last-child|parent-nth-child|parent-nth-last-child|parent-state|parent-sibling-|parent-sibling-name|parent-sibling-id|parent-sibling-first-child|parent-sibling-last-child|parent-sibling-nth-child|parent-sibling-nth-last-child|parent-sibling-state
decoration:dir(ltr) class|name|id|first-child|last-child|nth-child|nth-last-child|state|sibling-class|sibling-name|sibling-id|sibling-first-child|sibling-last-child|sibling-nth-child|sibling-nth-last-child|sibling-state|parent-class|parent-name|parent-id|parent-first-child|parent-last-child|parent-nth-child|parent-nth-last-child|parent-state|parent-sibling-|parent-sibling-name|parent-sibling-id|parent-sibling-first-child|parent-sibling-last-child|parent-sibling-nth-child|parent-sibling-nth-last-child|parent-sibling-state
box.horizontal:dir(ltr) class|name|id|first-child|last-child|nth-child|nth-last-child|state|sibling-class|sibling-name|sibling-id|sibling-first-child|sibling-last-child|sibling-nth-child|sibling-nth-last-child|sibling-state|parent-class|parent-name|parent-id|parent-first-child|parent-last-child|parent-nth-child|parent-nth-last-child|parent-state|parent-sibling-|parent-sibling-name|parent-sibling-id|parent-sibling-first-child|parent-sibling-last-child|parent-sibling-nth-child|parent-sibling-nth-last-child|parent-sibling-state
box.horizontal:dir(ltr) class|name|id|first-child|last-child|nth-child|nth-last-child|state|sibling-class|sibling-name|sibling-id|sibling-first-child|sibling-last-child|sibling-nth-child|sibling-nth-last-child|sibling-state|parent-class|parent-name|parent-id|parent-first-child|parent-last-child|parent-nth-child|parent-nth-last-child|parent-state|parent-sibling-|parent-sibling-name|parent-sibling-id|parent-sibling-first-child|parent-sibling-last-child|parent-sibling-nth-child|parent-sibling-nth-last-child|parent-sibling-state
label:dir(ltr) name|first-child|last-child
font-size: 20px; /* nth-child.css:2:3-19 */
label:dir(ltr)
label:dir(ltr) name|first-child|last-child
font-size: 30px; /* nth-child.css:5:3-19 */
label:dir(ltr)
label:dir(ltr) name|first-child|last-child
font-size: 40px; /* nth-child.css:8:3-19 */
box.horizontal:dir(ltr)
label:dir(ltr)
box.horizontal:dir(ltr) class|name|id|first-child|last-child|nth-child|nth-last-child|state|sibling-class|sibling-name|sibling-id|sibling-first-child|sibling-last-child|sibling-nth-child|sibling-nth-last-child|sibling-state|parent-class|parent-name|parent-id|parent-first-child|parent-last-child|parent-nth-child|parent-nth-last-child|parent-state|parent-sibling-|parent-sibling-name|parent-sibling-id|parent-sibling-first-child|parent-sibling-last-child|parent-sibling-nth-child|parent-sibling-nth-last-child|parent-sibling-state
label:dir(ltr) name|first-child|last-child
font-size: 50px; /* nth-child.css:11:3-19 */
+23
View File
@@ -0,0 +1,23 @@
label {
color: red;
}
*:not(label) {
background-color: red;
}
.normal-icons {
color: green;
}
*:not(.normal-icons) {
background-color: green;
}
*:disabled {
color: blue;
}
*:not(:disabled) {
background-color: blue;
}
@@ -0,0 +1,17 @@
[window.background:dir(ltr)] class|name|state
background-color: rgb(0,0,255); /* simple-selectors.css:22:3-26 */
decoration:dir(ltr) class|name|state
background-color: rgb(0,0,255); /* simple-selectors.css:22:3-26 */
box.horizontal:dir(ltr) class|name|state
background-color: rgb(0,0,255); /* simple-selectors.css:22:3-26 */
label:dir(ltr) class|name|state
color: rgb(255,0,0); /* simple-selectors.css:2:3-14 */
background-color: rgb(0,0,255); /* simple-selectors.css:22:3-26 */
image.normal-icons:dir(ltr) class|name|state
color: rgb(0,128,0); /* simple-selectors.css:10:3-16 */
background-color: rgb(0,0,255); /* simple-selectors.css:22:3-26 */
spinner:disabled:dir(ltr) class|name|state
color: rgb(0,0,255); /* simple-selectors.css:18:3-15 */
background-color: rgb(0,128,0); /* simple-selectors.css:14:3-27 */
+30
View File
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkWindow" id="window1">
<property name="can_focus">False</property>
<property name="type">popup</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
</object>
</child>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="icon-size">normal</property>
</object>
</child>
<child>
<object class="GtkSpinner">
<property name="visible">True</property>
<property name="sensitive">0</property>
</object>
</child>
</object>
</child>
</object>
</interface>
+25 -5
View File
@@ -98,12 +98,25 @@ done:
return diff;
}
static void
style_context_changed (GtkWidget *window, const char **output)
{
GtkStyleContext *context;
g_print ("style updated\n");
context = gtk_widget_get_style_context (window);
*output = gtk_style_context_to_string (context, GTK_STYLE_CONTEXT_PRINT_RECURSE |
GTK_STYLE_CONTEXT_PRINT_SHOW_CHANGE |
GTK_STYLE_CONTEXT_PRINT_SHOW_STYLE);
g_main_context_wakeup (NULL);
}
static void
load_ui_file (GFile *file, gboolean generate)
{
GtkBuilder *builder;
GtkWidget *window;
GtkStyleContext *context;
char *output, *diff;
char *ui_file, *css_file, *reference_file;
GtkCssProvider *provider;
@@ -125,10 +138,13 @@ load_ui_file (GFile *file, gboolean generate)
g_assert (window != NULL);
context = gtk_widget_get_style_context (window);
output = NULL;
g_signal_connect (window, "map", G_CALLBACK (style_context_changed), &output);
output = gtk_style_context_to_string (context, GTK_STYLE_CONTEXT_PRINT_RECURSE |
GTK_STYLE_CONTEXT_PRINT_SHOW_STYLE);
gtk_widget_show (window);
while (!output)
g_main_context_iteration (NULL, FALSE);
if (generate)
{
@@ -244,7 +260,10 @@ main (int argc, char **argv)
{
g_setenv ("GTK_CSS_DEBUG", "1", TRUE);
gtk_test_init (&argc, &argv);
if (argc >= 2 && strcmp (argv[1], "--generate") == 0)
gtk_init ();
else
gtk_test_init (&argc, &argv);
g_object_set (gtk_settings_get_default (),
"gtk-font-name", "Sans",
@@ -270,6 +289,7 @@ main (int argc, char **argv)
load_ui_file (file, TRUE);
g_object_unref (file);
return 0;
}
}
else