Compare commits
10 Commits
wip/matthi
...
wip/css-op
Author | SHA1 | Date | |
---|---|---|---|
|
21ff39ba8a | ||
|
0cf03dd13b | ||
|
8751b59b3c | ||
|
340c7f9419 | ||
|
cdc5053fd9 | ||
|
ab7e332296 | ||
|
28283e645f | ||
|
39d94a73e3 | ||
|
5952707d87 | ||
|
f0b09f6366 |
@@ -51,32 +51,51 @@ gtk_css_value_array_compute (GtkCssValue *value,
|
|||||||
GtkCssDependencies *dependencies)
|
GtkCssDependencies *dependencies)
|
||||||
{
|
{
|
||||||
GtkCssValue *result;
|
GtkCssValue *result;
|
||||||
gboolean changed = FALSE;
|
GtkCssValue *i_value;
|
||||||
guint i;
|
guint i, j;
|
||||||
GtkCssDependencies child_deps;
|
GtkCssDependencies child_deps;
|
||||||
|
|
||||||
if (value->n_values == 0)
|
result = NULL;
|
||||||
return _gtk_css_value_ref (value);
|
|
||||||
|
|
||||||
result = _gtk_css_array_value_new_from_array (value->values, value->n_values);
|
|
||||||
for (i = 0; i < value->n_values; i++)
|
for (i = 0; i < value->n_values; i++)
|
||||||
{
|
{
|
||||||
result->values[i] = _gtk_css_value_compute (value->values[i], property_id, provider, values, parent_values, &child_deps);
|
i_value = _gtk_css_value_compute (value->values[i], property_id, provider, values, parent_values, &child_deps);
|
||||||
|
|
||||||
*dependencies = _gtk_css_dependencies_union (*dependencies, child_deps);
|
*dependencies = _gtk_css_dependencies_union (*dependencies, child_deps);
|
||||||
|
|
||||||
changed |= (result->values[i] != value->values[i]);
|
if (result == NULL &&
|
||||||
|
i_value != value->values[i])
|
||||||
|
{
|
||||||
|
result = _gtk_css_array_value_new_from_array (value->values, value->n_values);
|
||||||
|
for (j = 0; j < i; j++)
|
||||||
|
_gtk_css_value_ref (result->values[j]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result != NULL)
|
||||||
|
result->values[i] = i_value;
|
||||||
|
else
|
||||||
|
_gtk_css_value_unref (i_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!changed)
|
if (result == NULL)
|
||||||
{
|
return _gtk_css_value_ref (value);
|
||||||
_gtk_css_value_unref (result);
|
|
||||||
return _gtk_css_value_ref (value);
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gtk_css_value_array_needs_compute (const GtkCssValue *value)
|
||||||
|
{
|
||||||
|
guint i;
|
||||||
|
|
||||||
|
for (i = 0; i < value->n_values; i++)
|
||||||
|
{
|
||||||
|
if (_gtk_css_value_needs_compute (value->values[i]))
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gtk_css_value_array_equal (const GtkCssValue *value1,
|
gtk_css_value_array_equal (const GtkCssValue *value1,
|
||||||
const GtkCssValue *value2)
|
const GtkCssValue *value2)
|
||||||
@@ -318,6 +337,7 @@ gtk_css_value_array_print (const GtkCssValue *value,
|
|||||||
static const GtkCssValueClass GTK_CSS_VALUE_ARRAY = {
|
static const GtkCssValueClass GTK_CSS_VALUE_ARRAY = {
|
||||||
gtk_css_value_array_free,
|
gtk_css_value_array_free,
|
||||||
gtk_css_value_array_compute,
|
gtk_css_value_array_compute,
|
||||||
|
gtk_css_value_array_needs_compute,
|
||||||
gtk_css_value_array_equal,
|
gtk_css_value_array_equal,
|
||||||
gtk_css_value_array_transition,
|
gtk_css_value_array_transition,
|
||||||
gtk_css_value_array_print
|
gtk_css_value_array_print
|
||||||
|
@@ -69,6 +69,14 @@ gtk_css_value_bg_size_compute (GtkCssValue *value,
|
|||||||
value->y ? y : NULL);
|
value->y ? y : NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gtk_css_value_bg_size_needs_compute (const GtkCssValue *value)
|
||||||
|
{
|
||||||
|
return
|
||||||
|
_gtk_css_value_needs_compute (value->x) ||
|
||||||
|
_gtk_css_value_needs_compute (value->y);
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gtk_css_value_bg_size_equal (const GtkCssValue *value1,
|
gtk_css_value_bg_size_equal (const GtkCssValue *value1,
|
||||||
const GtkCssValue *value2)
|
const GtkCssValue *value2)
|
||||||
@@ -150,6 +158,7 @@ gtk_css_value_bg_size_print (const GtkCssValue *value,
|
|||||||
static const GtkCssValueClass GTK_CSS_VALUE_BG_SIZE = {
|
static const GtkCssValueClass GTK_CSS_VALUE_BG_SIZE = {
|
||||||
gtk_css_value_bg_size_free,
|
gtk_css_value_bg_size_free,
|
||||||
gtk_css_value_bg_size_compute,
|
gtk_css_value_bg_size_compute,
|
||||||
|
gtk_css_value_bg_size_needs_compute,
|
||||||
gtk_css_value_bg_size_equal,
|
gtk_css_value_bg_size_equal,
|
||||||
gtk_css_value_bg_size_transition,
|
gtk_css_value_bg_size_transition,
|
||||||
gtk_css_value_bg_size_print
|
gtk_css_value_bg_size_print
|
||||||
|
@@ -76,6 +76,20 @@ gtk_css_value_border_compute (GtkCssValue *value,
|
|||||||
return computed;
|
return computed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gtk_css_value_border_needs_compute (const GtkCssValue *value)
|
||||||
|
{
|
||||||
|
guint i;
|
||||||
|
|
||||||
|
for (i = 0; i < 4; i++)
|
||||||
|
{
|
||||||
|
if (_gtk_css_value_needs_compute (value->values[i]))
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gtk_css_value_border_equal (const GtkCssValue *value1,
|
gtk_css_value_border_equal (const GtkCssValue *value1,
|
||||||
const GtkCssValue *value2)
|
const GtkCssValue *value2)
|
||||||
@@ -136,6 +150,7 @@ gtk_css_value_border_print (const GtkCssValue *value,
|
|||||||
static const GtkCssValueClass GTK_CSS_VALUE_BORDER = {
|
static const GtkCssValueClass GTK_CSS_VALUE_BORDER = {
|
||||||
gtk_css_value_border_free,
|
gtk_css_value_border_free,
|
||||||
gtk_css_value_border_compute,
|
gtk_css_value_border_compute,
|
||||||
|
gtk_css_value_border_needs_compute,
|
||||||
gtk_css_value_border_equal,
|
gtk_css_value_border_equal,
|
||||||
gtk_css_value_border_transition,
|
gtk_css_value_border_transition,
|
||||||
gtk_css_value_border_print
|
gtk_css_value_border_print
|
||||||
|
@@ -334,6 +334,12 @@ gtk_css_value_color_compute (GtkCssValue *value,
|
|||||||
return resolved;
|
return resolved;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gtk_css_value_color_needs_compute (const GtkCssValue *value)
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gtk_css_value_color_equal (const GtkCssValue *value1,
|
gtk_css_value_color_equal (const GtkCssValue *value1,
|
||||||
const GtkCssValue *value2)
|
const GtkCssValue *value2)
|
||||||
@@ -449,6 +455,7 @@ gtk_css_value_color_print (const GtkCssValue *value,
|
|||||||
static const GtkCssValueClass GTK_CSS_VALUE_COLOR = {
|
static const GtkCssValueClass GTK_CSS_VALUE_COLOR = {
|
||||||
gtk_css_value_color_free,
|
gtk_css_value_color_free,
|
||||||
gtk_css_value_color_compute,
|
gtk_css_value_color_compute,
|
||||||
|
gtk_css_value_color_needs_compute,
|
||||||
gtk_css_value_color_equal,
|
gtk_css_value_color_equal,
|
||||||
gtk_css_value_color_transition,
|
gtk_css_value_color_transition,
|
||||||
gtk_css_value_color_print
|
gtk_css_value_color_print
|
||||||
|
@@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
#include "gtkprivate.h"
|
||||||
#include "gtkcsscomputedvaluesprivate.h"
|
#include "gtkcsscomputedvaluesprivate.h"
|
||||||
|
|
||||||
#include "gtkcssanimationprivate.h"
|
#include "gtkcssanimationprivate.h"
|
||||||
@@ -120,9 +121,9 @@ _gtk_css_computed_values_compute_value (GtkCssComputedValues *values,
|
|||||||
GtkCssDependencies dependencies;
|
GtkCssDependencies dependencies;
|
||||||
GtkCssValue *value;
|
GtkCssValue *value;
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values));
|
gtk_internal_return_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values));
|
||||||
g_return_if_fail (GTK_IS_STYLE_PROVIDER_PRIVATE (provider));
|
gtk_internal_return_if_fail (GTK_IS_STYLE_PROVIDER_PRIVATE (provider));
|
||||||
g_return_if_fail (parent_values == NULL || GTK_IS_CSS_COMPUTED_VALUES (parent_values));
|
gtk_internal_return_if_fail (parent_values == NULL || GTK_IS_CSS_COMPUTED_VALUES (parent_values));
|
||||||
|
|
||||||
/* http://www.w3.org/TR/css3-cascade/#cascade
|
/* http://www.w3.org/TR/css3-cascade/#cascade
|
||||||
* Then, for every element, the value for each property can be found
|
* Then, for every element, the value for each property can be found
|
||||||
@@ -136,7 +137,7 @@ _gtk_css_computed_values_compute_value (GtkCssComputedValues *values,
|
|||||||
if (_gtk_css_style_property_is_inherit (prop))
|
if (_gtk_css_style_property_is_inherit (prop))
|
||||||
specified = _gtk_css_inherit_value_new ();
|
specified = _gtk_css_inherit_value_new ();
|
||||||
else
|
else
|
||||||
specified = _gtk_css_initial_value_new ();
|
specified = _gtk_css_initial_value_new (prop);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
_gtk_css_value_ref (specified);
|
_gtk_css_value_ref (specified);
|
||||||
@@ -154,8 +155,8 @@ _gtk_css_computed_values_set_animated_value (GtkCssComputedValues *values,
|
|||||||
guint id,
|
guint id,
|
||||||
GtkCssValue *value)
|
GtkCssValue *value)
|
||||||
{
|
{
|
||||||
g_return_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values));
|
gtk_internal_return_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values));
|
||||||
g_return_if_fail (value != NULL);
|
gtk_internal_return_if_fail (value != NULL);
|
||||||
|
|
||||||
if (values->animated_values == NULL)
|
if (values->animated_values == NULL)
|
||||||
values->animated_values = g_ptr_array_new_with_free_func ((GDestroyNotify)_gtk_css_value_unref);
|
values->animated_values = g_ptr_array_new_with_free_func ((GDestroyNotify)_gtk_css_value_unref);
|
||||||
@@ -175,10 +176,11 @@ _gtk_css_computed_values_set_value (GtkCssComputedValues *values,
|
|||||||
GtkCssDependencies dependencies,
|
GtkCssDependencies dependencies,
|
||||||
GtkCssSection *section)
|
GtkCssSection *section)
|
||||||
{
|
{
|
||||||
g_return_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values));
|
gtk_internal_return_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values));
|
||||||
|
|
||||||
if (values->values == NULL)
|
if (values->values == NULL)
|
||||||
values->values = g_ptr_array_new_with_free_func ((GDestroyNotify)_gtk_css_value_unref);
|
values->values = g_ptr_array_new_full (_gtk_css_style_property_get_n_properties (),
|
||||||
|
(GDestroyNotify)_gtk_css_value_unref);
|
||||||
if (id >= values->values->len)
|
if (id >= values->values->len)
|
||||||
g_ptr_array_set_size (values->values, id + 1);
|
g_ptr_array_set_size (values->values, id + 1);
|
||||||
|
|
||||||
@@ -216,7 +218,7 @@ GtkCssValue *
|
|||||||
_gtk_css_computed_values_get_value (GtkCssComputedValues *values,
|
_gtk_css_computed_values_get_value (GtkCssComputedValues *values,
|
||||||
guint id)
|
guint id)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values), NULL);
|
gtk_internal_return_val_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values), NULL);
|
||||||
|
|
||||||
if (values->animated_values &&
|
if (values->animated_values &&
|
||||||
id < values->animated_values->len &&
|
id < values->animated_values->len &&
|
||||||
@@ -230,7 +232,7 @@ GtkCssValue *
|
|||||||
_gtk_css_computed_values_get_intrinsic_value (GtkCssComputedValues *values,
|
_gtk_css_computed_values_get_intrinsic_value (GtkCssComputedValues *values,
|
||||||
guint id)
|
guint id)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values), NULL);
|
gtk_internal_return_val_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values), NULL);
|
||||||
|
|
||||||
if (values->values == NULL ||
|
if (values->values == NULL ||
|
||||||
id >= values->values->len)
|
id >= values->values->len)
|
||||||
@@ -243,7 +245,7 @@ GtkCssSection *
|
|||||||
_gtk_css_computed_values_get_section (GtkCssComputedValues *values,
|
_gtk_css_computed_values_get_section (GtkCssComputedValues *values,
|
||||||
guint id)
|
guint id)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values), NULL);
|
gtk_internal_return_val_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values), NULL);
|
||||||
|
|
||||||
if (values->sections == NULL ||
|
if (values->sections == NULL ||
|
||||||
id >= values->sections->len)
|
id >= values->sections->len)
|
||||||
@@ -528,8 +530,8 @@ _gtk_css_computed_values_advance (GtkCssComputedValues *values,
|
|||||||
GSList *list;
|
GSList *list;
|
||||||
guint i;
|
guint i;
|
||||||
|
|
||||||
g_return_val_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values), NULL);
|
gtk_internal_return_val_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values), NULL);
|
||||||
g_return_val_if_fail (timestamp >= values->current_time, NULL);
|
gtk_internal_return_val_if_fail (timestamp >= values->current_time, NULL);
|
||||||
|
|
||||||
values->current_time = timestamp;
|
values->current_time = timestamp;
|
||||||
old_computed_values = values->animated_values;
|
old_computed_values = values->animated_values;
|
||||||
@@ -578,7 +580,7 @@ _gtk_css_computed_values_is_static (GtkCssComputedValues *values)
|
|||||||
{
|
{
|
||||||
GSList *list;
|
GSList *list;
|
||||||
|
|
||||||
g_return_val_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values), TRUE);
|
gtk_internal_return_val_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values), TRUE);
|
||||||
|
|
||||||
for (list = values->animations; list; list = list->next)
|
for (list = values->animations; list; list = list->next)
|
||||||
{
|
{
|
||||||
@@ -592,7 +594,7 @@ _gtk_css_computed_values_is_static (GtkCssComputedValues *values)
|
|||||||
void
|
void
|
||||||
_gtk_css_computed_values_cancel_animations (GtkCssComputedValues *values)
|
_gtk_css_computed_values_cancel_animations (GtkCssComputedValues *values)
|
||||||
{
|
{
|
||||||
g_return_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values));
|
gtk_internal_return_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values));
|
||||||
|
|
||||||
if (values->animated_values)
|
if (values->animated_values)
|
||||||
{
|
{
|
||||||
@@ -610,7 +612,7 @@ _gtk_css_computed_values_compute_dependencies (GtkCssComputedValues *values,
|
|||||||
{
|
{
|
||||||
GtkBitmask *changes;
|
GtkBitmask *changes;
|
||||||
|
|
||||||
g_return_val_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values), _gtk_bitmask_new ());
|
gtk_internal_return_val_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values), _gtk_bitmask_new ());
|
||||||
|
|
||||||
changes = _gtk_bitmask_copy (parent_changes);
|
changes = _gtk_bitmask_copy (parent_changes);
|
||||||
changes = _gtk_bitmask_intersect (changes, values->depends_on_parent);
|
changes = _gtk_bitmask_intersect (changes, values->depends_on_parent);
|
||||||
|
@@ -60,6 +60,14 @@ gtk_css_value_corner_compute (GtkCssValue *corner,
|
|||||||
return _gtk_css_corner_value_new (x, y);
|
return _gtk_css_corner_value_new (x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gtk_css_value_corner_needs_compute (const GtkCssValue *corner)
|
||||||
|
{
|
||||||
|
return
|
||||||
|
_gtk_css_value_needs_compute (corner->x) ||
|
||||||
|
_gtk_css_value_needs_compute (corner->y);
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gtk_css_value_corner_equal (const GtkCssValue *corner1,
|
gtk_css_value_corner_equal (const GtkCssValue *corner1,
|
||||||
const GtkCssValue *corner2)
|
const GtkCssValue *corner2)
|
||||||
@@ -104,6 +112,7 @@ gtk_css_value_corner_print (const GtkCssValue *corner,
|
|||||||
static const GtkCssValueClass GTK_CSS_VALUE_CORNER = {
|
static const GtkCssValueClass GTK_CSS_VALUE_CORNER = {
|
||||||
gtk_css_value_corner_free,
|
gtk_css_value_corner_free,
|
||||||
gtk_css_value_corner_compute,
|
gtk_css_value_corner_compute,
|
||||||
|
gtk_css_value_corner_needs_compute,
|
||||||
gtk_css_value_corner_equal,
|
gtk_css_value_corner_equal,
|
||||||
gtk_css_value_corner_transition,
|
gtk_css_value_corner_transition,
|
||||||
gtk_css_value_corner_print
|
gtk_css_value_corner_print
|
||||||
|
@@ -60,6 +60,12 @@ gtk_css_value_ease_compute (GtkCssValue *value,
|
|||||||
return _gtk_css_value_ref (value);
|
return _gtk_css_value_ref (value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gtk_css_value_ease_needs_compute (const GtkCssValue *value)
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gtk_css_value_ease_equal (const GtkCssValue *ease1,
|
gtk_css_value_ease_equal (const GtkCssValue *ease1,
|
||||||
const GtkCssValue *ease2)
|
const GtkCssValue *ease2)
|
||||||
@@ -138,6 +144,7 @@ gtk_css_value_ease_print (const GtkCssValue *ease,
|
|||||||
static const GtkCssValueClass GTK_CSS_VALUE_EASE = {
|
static const GtkCssValueClass GTK_CSS_VALUE_EASE = {
|
||||||
gtk_css_value_ease_free,
|
gtk_css_value_ease_free,
|
||||||
gtk_css_value_ease_compute,
|
gtk_css_value_ease_compute,
|
||||||
|
gtk_css_value_ease_needs_compute,
|
||||||
gtk_css_value_ease_equal,
|
gtk_css_value_ease_equal,
|
||||||
gtk_css_value_ease_transition,
|
gtk_css_value_ease_transition,
|
||||||
gtk_css_value_ease_print
|
gtk_css_value_ease_print
|
||||||
|
@@ -45,6 +45,12 @@ gtk_css_value_engine_compute (GtkCssValue *value,
|
|||||||
return _gtk_css_value_ref (value);
|
return _gtk_css_value_ref (value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gtk_css_value_engine_needs_compute (const GtkCssValue *value)
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gtk_css_value_engine_equal (const GtkCssValue *value1,
|
gtk_css_value_engine_equal (const GtkCssValue *value1,
|
||||||
const GtkCssValue *value2)
|
const GtkCssValue *value2)
|
||||||
@@ -80,6 +86,7 @@ gtk_css_value_engine_print (const GtkCssValue *value,
|
|||||||
static const GtkCssValueClass GTK_CSS_VALUE_ENGINE = {
|
static const GtkCssValueClass GTK_CSS_VALUE_ENGINE = {
|
||||||
gtk_css_value_engine_free,
|
gtk_css_value_engine_free,
|
||||||
gtk_css_value_engine_compute,
|
gtk_css_value_engine_compute,
|
||||||
|
gtk_css_value_engine_needs_compute,
|
||||||
gtk_css_value_engine_equal,
|
gtk_css_value_engine_equal,
|
||||||
gtk_css_value_engine_transition,
|
gtk_css_value_engine_transition,
|
||||||
gtk_css_value_engine_print
|
gtk_css_value_engine_print
|
||||||
|
@@ -48,6 +48,12 @@ gtk_css_value_enum_compute (GtkCssValue *value,
|
|||||||
return _gtk_css_value_ref (value);
|
return _gtk_css_value_ref (value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gtk_css_value_enum_needs_compute (const GtkCssValue *value)
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gtk_css_value_enum_equal (const GtkCssValue *enum1,
|
gtk_css_value_enum_equal (const GtkCssValue *enum1,
|
||||||
const GtkCssValue *enum2)
|
const GtkCssValue *enum2)
|
||||||
@@ -76,6 +82,7 @@ gtk_css_value_enum_print (const GtkCssValue *value,
|
|||||||
static const GtkCssValueClass GTK_CSS_VALUE_BORDER_STYLE = {
|
static const GtkCssValueClass GTK_CSS_VALUE_BORDER_STYLE = {
|
||||||
gtk_css_value_enum_free,
|
gtk_css_value_enum_free,
|
||||||
gtk_css_value_enum_compute,
|
gtk_css_value_enum_compute,
|
||||||
|
gtk_css_value_enum_needs_compute,
|
||||||
gtk_css_value_enum_equal,
|
gtk_css_value_enum_equal,
|
||||||
gtk_css_value_enum_transition,
|
gtk_css_value_enum_transition,
|
||||||
gtk_css_value_enum_print
|
gtk_css_value_enum_print
|
||||||
@@ -219,9 +226,17 @@ gtk_css_value_font_size_compute (GtkCssValue *value,
|
|||||||
return _gtk_css_number_value_new (font_size, GTK_CSS_PX);
|
return _gtk_css_number_value_new (font_size, GTK_CSS_PX);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gtk_css_value_font_size_needs_compute (const GtkCssValue *value)
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static const GtkCssValueClass GTK_CSS_VALUE_FONT_SIZE = {
|
static const GtkCssValueClass GTK_CSS_VALUE_FONT_SIZE = {
|
||||||
gtk_css_value_enum_free,
|
gtk_css_value_enum_free,
|
||||||
gtk_css_value_font_size_compute,
|
gtk_css_value_font_size_compute,
|
||||||
|
gtk_css_value_font_size_needs_compute,
|
||||||
gtk_css_value_enum_equal,
|
gtk_css_value_enum_equal,
|
||||||
gtk_css_value_enum_transition,
|
gtk_css_value_enum_transition,
|
||||||
gtk_css_value_enum_print
|
gtk_css_value_enum_print
|
||||||
@@ -276,6 +291,7 @@ _gtk_css_font_size_value_get (const GtkCssValue *value)
|
|||||||
static const GtkCssValueClass GTK_CSS_VALUE_FONT_STYLE = {
|
static const GtkCssValueClass GTK_CSS_VALUE_FONT_STYLE = {
|
||||||
gtk_css_value_enum_free,
|
gtk_css_value_enum_free,
|
||||||
gtk_css_value_enum_compute,
|
gtk_css_value_enum_compute,
|
||||||
|
gtk_css_value_enum_needs_compute,
|
||||||
gtk_css_value_enum_equal,
|
gtk_css_value_enum_equal,
|
||||||
gtk_css_value_enum_transition,
|
gtk_css_value_enum_transition,
|
||||||
gtk_css_value_enum_print
|
gtk_css_value_enum_print
|
||||||
@@ -324,6 +340,7 @@ _gtk_css_font_style_value_get (const GtkCssValue *value)
|
|||||||
static const GtkCssValueClass GTK_CSS_VALUE_FONT_VARIANT = {
|
static const GtkCssValueClass GTK_CSS_VALUE_FONT_VARIANT = {
|
||||||
gtk_css_value_enum_free,
|
gtk_css_value_enum_free,
|
||||||
gtk_css_value_enum_compute,
|
gtk_css_value_enum_compute,
|
||||||
|
gtk_css_value_enum_needs_compute,
|
||||||
gtk_css_value_enum_equal,
|
gtk_css_value_enum_equal,
|
||||||
gtk_css_value_enum_transition,
|
gtk_css_value_enum_transition,
|
||||||
gtk_css_value_enum_print
|
gtk_css_value_enum_print
|
||||||
@@ -371,6 +388,7 @@ _gtk_css_font_variant_value_get (const GtkCssValue *value)
|
|||||||
static const GtkCssValueClass GTK_CSS_VALUE_FONT_WEIGHT = {
|
static const GtkCssValueClass GTK_CSS_VALUE_FONT_WEIGHT = {
|
||||||
gtk_css_value_enum_free,
|
gtk_css_value_enum_free,
|
||||||
gtk_css_value_enum_compute,
|
gtk_css_value_enum_compute,
|
||||||
|
gtk_css_value_enum_needs_compute,
|
||||||
gtk_css_value_enum_equal,
|
gtk_css_value_enum_equal,
|
||||||
gtk_css_value_enum_transition,
|
gtk_css_value_enum_transition,
|
||||||
gtk_css_value_enum_print
|
gtk_css_value_enum_print
|
||||||
@@ -439,6 +457,7 @@ _gtk_css_font_weight_value_get (const GtkCssValue *value)
|
|||||||
static const GtkCssValueClass GTK_CSS_VALUE_AREA = {
|
static const GtkCssValueClass GTK_CSS_VALUE_AREA = {
|
||||||
gtk_css_value_enum_free,
|
gtk_css_value_enum_free,
|
||||||
gtk_css_value_enum_compute,
|
gtk_css_value_enum_compute,
|
||||||
|
gtk_css_value_enum_needs_compute,
|
||||||
gtk_css_value_enum_equal,
|
gtk_css_value_enum_equal,
|
||||||
gtk_css_value_enum_transition,
|
gtk_css_value_enum_transition,
|
||||||
gtk_css_value_enum_print
|
gtk_css_value_enum_print
|
||||||
@@ -493,6 +512,7 @@ _gtk_css_area_value_get (const GtkCssValue *value)
|
|||||||
static const GtkCssValueClass GTK_CSS_VALUE_DIRECTION = {
|
static const GtkCssValueClass GTK_CSS_VALUE_DIRECTION = {
|
||||||
gtk_css_value_enum_free,
|
gtk_css_value_enum_free,
|
||||||
gtk_css_value_enum_compute,
|
gtk_css_value_enum_compute,
|
||||||
|
gtk_css_value_enum_needs_compute,
|
||||||
gtk_css_value_enum_equal,
|
gtk_css_value_enum_equal,
|
||||||
gtk_css_value_enum_transition,
|
gtk_css_value_enum_transition,
|
||||||
gtk_css_value_enum_print
|
gtk_css_value_enum_print
|
||||||
@@ -548,6 +568,7 @@ _gtk_css_direction_value_get (const GtkCssValue *value)
|
|||||||
static const GtkCssValueClass GTK_CSS_VALUE_PLAY_STATE = {
|
static const GtkCssValueClass GTK_CSS_VALUE_PLAY_STATE = {
|
||||||
gtk_css_value_enum_free,
|
gtk_css_value_enum_free,
|
||||||
gtk_css_value_enum_compute,
|
gtk_css_value_enum_compute,
|
||||||
|
gtk_css_value_enum_needs_compute,
|
||||||
gtk_css_value_enum_equal,
|
gtk_css_value_enum_equal,
|
||||||
gtk_css_value_enum_transition,
|
gtk_css_value_enum_transition,
|
||||||
gtk_css_value_enum_print
|
gtk_css_value_enum_print
|
||||||
@@ -601,6 +622,7 @@ _gtk_css_play_state_value_get (const GtkCssValue *value)
|
|||||||
static const GtkCssValueClass GTK_CSS_VALUE_FILL_MODE = {
|
static const GtkCssValueClass GTK_CSS_VALUE_FILL_MODE = {
|
||||||
gtk_css_value_enum_free,
|
gtk_css_value_enum_free,
|
||||||
gtk_css_value_enum_compute,
|
gtk_css_value_enum_compute,
|
||||||
|
gtk_css_value_enum_needs_compute,
|
||||||
gtk_css_value_enum_equal,
|
gtk_css_value_enum_equal,
|
||||||
gtk_css_value_enum_transition,
|
gtk_css_value_enum_transition,
|
||||||
gtk_css_value_enum_print
|
gtk_css_value_enum_print
|
||||||
|
@@ -59,6 +59,12 @@ gtk_css_value_image_compute (GtkCssValue *value,
|
|||||||
return _gtk_css_image_value_new (computed);
|
return _gtk_css_image_value_new (computed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gtk_css_value_image_needs_compute (const GtkCssValue *value)
|
||||||
|
{
|
||||||
|
return _gtk_css_image_value_get_image (value) != NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gtk_css_value_image_equal (const GtkCssValue *value1,
|
gtk_css_value_image_equal (const GtkCssValue *value1,
|
||||||
const GtkCssValue *value2)
|
const GtkCssValue *value2)
|
||||||
@@ -95,6 +101,7 @@ gtk_css_value_image_print (const GtkCssValue *value,
|
|||||||
static const GtkCssValueClass GTK_CSS_VALUE_IMAGE = {
|
static const GtkCssValueClass GTK_CSS_VALUE_IMAGE = {
|
||||||
gtk_css_value_image_free,
|
gtk_css_value_image_free,
|
||||||
gtk_css_value_image_compute,
|
gtk_css_value_image_compute,
|
||||||
|
gtk_css_value_image_needs_compute,
|
||||||
gtk_css_value_image_equal,
|
gtk_css_value_image_equal,
|
||||||
gtk_css_value_image_transition,
|
gtk_css_value_image_transition,
|
||||||
gtk_css_value_image_print
|
gtk_css_value_image_print
|
||||||
|
@@ -48,7 +48,7 @@ gtk_css_value_inherit_compute (GtkCssValue *value,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return _gtk_css_value_compute (_gtk_css_initial_value_get (),
|
return _gtk_css_value_compute (_gtk_css_initial_value_get (_gtk_css_style_property_lookup_by_id (property_id)),
|
||||||
property_id,
|
property_id,
|
||||||
provider,
|
provider,
|
||||||
values,
|
values,
|
||||||
@@ -57,6 +57,12 @@ gtk_css_value_inherit_compute (GtkCssValue *value,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gtk_css_value_inherit_needs_compute (const GtkCssValue *value)
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gtk_css_value_inherit_equal (const GtkCssValue *value1,
|
gtk_css_value_inherit_equal (const GtkCssValue *value1,
|
||||||
const GtkCssValue *value2)
|
const GtkCssValue *value2)
|
||||||
@@ -83,6 +89,7 @@ gtk_css_value_inherit_print (const GtkCssValue *value,
|
|||||||
static const GtkCssValueClass GTK_CSS_VALUE_INHERIT = {
|
static const GtkCssValueClass GTK_CSS_VALUE_INHERIT = {
|
||||||
gtk_css_value_inherit_free,
|
gtk_css_value_inherit_free,
|
||||||
gtk_css_value_inherit_compute,
|
gtk_css_value_inherit_compute,
|
||||||
|
gtk_css_value_inherit_needs_compute,
|
||||||
gtk_css_value_inherit_equal,
|
gtk_css_value_inherit_equal,
|
||||||
gtk_css_value_inherit_transition,
|
gtk_css_value_inherit_transition,
|
||||||
gtk_css_value_inherit_print
|
gtk_css_value_inherit_print
|
||||||
|
@@ -27,6 +27,8 @@
|
|||||||
|
|
||||||
struct _GtkCssValue {
|
struct _GtkCssValue {
|
||||||
GTK_CSS_VALUE_BASE
|
GTK_CSS_VALUE_BASE
|
||||||
|
GtkCssStyleProperty *property;
|
||||||
|
gboolean needs_compute;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -46,6 +48,9 @@ gtk_css_value_initial_compute (GtkCssValue *value,
|
|||||||
{
|
{
|
||||||
GtkSettings *settings;
|
GtkSettings *settings;
|
||||||
|
|
||||||
|
if (!value->needs_compute)
|
||||||
|
return _gtk_css_value_ref (_gtk_css_style_property_get_initial_value (value->property));
|
||||||
|
|
||||||
switch (property_id)
|
switch (property_id)
|
||||||
{
|
{
|
||||||
case GTK_CSS_PROPERTY_FONT_FAMILY:
|
case GTK_CSS_PROPERTY_FONT_FAMILY:
|
||||||
@@ -77,7 +82,7 @@ gtk_css_value_initial_compute (GtkCssValue *value,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return _gtk_css_value_compute (_gtk_css_style_property_get_initial_value (_gtk_css_style_property_lookup_by_id (property_id)),
|
return _gtk_css_value_compute (_gtk_css_style_property_get_initial_value (value->property),
|
||||||
property_id,
|
property_id,
|
||||||
provider,
|
provider,
|
||||||
values,
|
values,
|
||||||
@@ -85,6 +90,12 @@ gtk_css_value_initial_compute (GtkCssValue *value,
|
|||||||
dependencies);
|
dependencies);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gtk_css_value_initial_needs_compute (const GtkCssValue *value)
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gtk_css_value_initial_equal (const GtkCssValue *value1,
|
gtk_css_value_initial_equal (const GtkCssValue *value1,
|
||||||
const GtkCssValue *value2)
|
const GtkCssValue *value2)
|
||||||
@@ -111,6 +122,7 @@ gtk_css_value_initial_print (const GtkCssValue *value,
|
|||||||
static const GtkCssValueClass GTK_CSS_VALUE_INITIAL = {
|
static const GtkCssValueClass GTK_CSS_VALUE_INITIAL = {
|
||||||
gtk_css_value_initial_free,
|
gtk_css_value_initial_free,
|
||||||
gtk_css_value_initial_compute,
|
gtk_css_value_initial_compute,
|
||||||
|
gtk_css_value_initial_needs_compute,
|
||||||
gtk_css_value_initial_equal,
|
gtk_css_value_initial_equal,
|
||||||
gtk_css_value_initial_transition,
|
gtk_css_value_initial_transition,
|
||||||
gtk_css_value_initial_print
|
gtk_css_value_initial_print
|
||||||
@@ -119,13 +131,21 @@ static const GtkCssValueClass GTK_CSS_VALUE_INITIAL = {
|
|||||||
static GtkCssValue initial = { >K_CSS_VALUE_INITIAL, 1 };
|
static GtkCssValue initial = { >K_CSS_VALUE_INITIAL, 1 };
|
||||||
|
|
||||||
GtkCssValue *
|
GtkCssValue *
|
||||||
_gtk_css_initial_value_new (void)
|
_gtk_css_initial_value_new (GtkCssStyleProperty *property)
|
||||||
{
|
{
|
||||||
return _gtk_css_value_ref (&initial);
|
return _gtk_css_value_ref (_gtk_css_initial_value_get (property));
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkCssValue *
|
GtkCssValue *
|
||||||
_gtk_css_initial_value_get (void)
|
_gtk_css_initial_value_get (GtkCssStyleProperty *property)
|
||||||
{
|
{
|
||||||
return &initial;
|
if (property->css_initial_value == NULL)
|
||||||
|
{
|
||||||
|
property->css_initial_value = g_new0 (GtkCssValue, 1);
|
||||||
|
*property->css_initial_value = initial;
|
||||||
|
property->css_initial_value->property = property;
|
||||||
|
property->css_initial_value->needs_compute =
|
||||||
|
_gtk_css_value_needs_compute (_gtk_css_style_property_get_initial_value (property));
|
||||||
|
}
|
||||||
|
return property->css_initial_value;
|
||||||
}
|
}
|
||||||
|
@@ -21,11 +21,11 @@
|
|||||||
#define __GTK_CSS_INITIAL_VALUE_PRIVATE_H__
|
#define __GTK_CSS_INITIAL_VALUE_PRIVATE_H__
|
||||||
|
|
||||||
#include "gtkcssvalueprivate.h"
|
#include "gtkcssvalueprivate.h"
|
||||||
|
#include "gtkcssstylepropertyprivate.h"
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
GtkCssValue * _gtk_css_initial_value_new (void);
|
GtkCssValue * _gtk_css_initial_value_new (GtkCssStyleProperty *property);
|
||||||
GtkCssValue * _gtk_css_initial_value_get (void);
|
GtkCssValue * _gtk_css_initial_value_get (GtkCssStyleProperty *property);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
@@ -123,6 +123,38 @@ gtk_css_value_number_compute (GtkCssValue *number,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gtk_css_value_number_needs_compute (const GtkCssValue *number)
|
||||||
|
{
|
||||||
|
switch (number->unit)
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
g_assert_not_reached();
|
||||||
|
/* fall through */
|
||||||
|
case GTK_CSS_PERCENT:
|
||||||
|
/* percentages for font sizes are computed, other percentages aren't */
|
||||||
|
return TRUE;
|
||||||
|
case GTK_CSS_NUMBER:
|
||||||
|
case GTK_CSS_PX:
|
||||||
|
case GTK_CSS_DEG:
|
||||||
|
case GTK_CSS_S:
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
case GTK_CSS_PT:
|
||||||
|
case GTK_CSS_PC:
|
||||||
|
case GTK_CSS_IN:
|
||||||
|
case GTK_CSS_CM:
|
||||||
|
case GTK_CSS_MM:
|
||||||
|
case GTK_CSS_EM:
|
||||||
|
case GTK_CSS_EX:
|
||||||
|
case GTK_CSS_RAD:
|
||||||
|
case GTK_CSS_GRAD:
|
||||||
|
case GTK_CSS_TURN:
|
||||||
|
case GTK_CSS_MS:
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gtk_css_value_number_equal (const GtkCssValue *number1,
|
gtk_css_value_number_equal (const GtkCssValue *number1,
|
||||||
const GtkCssValue *number2)
|
const GtkCssValue *number2)
|
||||||
@@ -180,6 +212,7 @@ gtk_css_value_number_print (const GtkCssValue *number,
|
|||||||
static const GtkCssValueClass GTK_CSS_VALUE_NUMBER = {
|
static const GtkCssValueClass GTK_CSS_VALUE_NUMBER = {
|
||||||
gtk_css_value_number_free,
|
gtk_css_value_number_free,
|
||||||
gtk_css_value_number_compute,
|
gtk_css_value_number_compute,
|
||||||
|
gtk_css_value_number_needs_compute,
|
||||||
gtk_css_value_number_equal,
|
gtk_css_value_number_equal,
|
||||||
gtk_css_value_number_transition,
|
gtk_css_value_number_transition,
|
||||||
gtk_css_value_number_print
|
gtk_css_value_number_print
|
||||||
|
@@ -60,6 +60,14 @@ gtk_css_value_position_compute (GtkCssValue *position,
|
|||||||
return _gtk_css_position_value_new (x, y);
|
return _gtk_css_position_value_new (x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gtk_css_value_position_needs_compute (const GtkCssValue *position)
|
||||||
|
{
|
||||||
|
return
|
||||||
|
_gtk_css_value_needs_compute (position->x) ||
|
||||||
|
_gtk_css_value_needs_compute (position->y);
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gtk_css_value_position_equal (const GtkCssValue *position1,
|
gtk_css_value_position_equal (const GtkCssValue *position1,
|
||||||
const GtkCssValue *position2)
|
const GtkCssValue *position2)
|
||||||
@@ -155,6 +163,7 @@ done:
|
|||||||
static const GtkCssValueClass GTK_CSS_VALUE_POSITION = {
|
static const GtkCssValueClass GTK_CSS_VALUE_POSITION = {
|
||||||
gtk_css_value_position_free,
|
gtk_css_value_position_free,
|
||||||
gtk_css_value_position_compute,
|
gtk_css_value_position_compute,
|
||||||
|
gtk_css_value_position_needs_compute,
|
||||||
gtk_css_value_position_equal,
|
gtk_css_value_position_equal,
|
||||||
gtk_css_value_position_transition,
|
gtk_css_value_position_transition,
|
||||||
gtk_css_value_position_print
|
gtk_css_value_position_print
|
||||||
|
@@ -44,6 +44,12 @@ gtk_css_value_repeat_compute (GtkCssValue *value,
|
|||||||
return _gtk_css_value_ref (value);
|
return _gtk_css_value_ref (value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gtk_css_value_repeat_needs_compute (const GtkCssValue *value)
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gtk_css_value_repeat_equal (const GtkCssValue *repeat1,
|
gtk_css_value_repeat_equal (const GtkCssValue *repeat1,
|
||||||
const GtkCssValue *repeat2)
|
const GtkCssValue *repeat2)
|
||||||
@@ -116,6 +122,7 @@ gtk_css_value_border_repeat_print (const GtkCssValue *repeat,
|
|||||||
static const GtkCssValueClass GTK_CSS_VALUE_BACKGROUND_REPEAT = {
|
static const GtkCssValueClass GTK_CSS_VALUE_BACKGROUND_REPEAT = {
|
||||||
gtk_css_value_repeat_free,
|
gtk_css_value_repeat_free,
|
||||||
gtk_css_value_repeat_compute,
|
gtk_css_value_repeat_compute,
|
||||||
|
gtk_css_value_repeat_needs_compute,
|
||||||
gtk_css_value_repeat_equal,
|
gtk_css_value_repeat_equal,
|
||||||
gtk_css_value_repeat_transition,
|
gtk_css_value_repeat_transition,
|
||||||
gtk_css_value_background_repeat_print
|
gtk_css_value_background_repeat_print
|
||||||
@@ -124,6 +131,7 @@ static const GtkCssValueClass GTK_CSS_VALUE_BACKGROUND_REPEAT = {
|
|||||||
static const GtkCssValueClass GTK_CSS_VALUE_BORDER_REPEAT = {
|
static const GtkCssValueClass GTK_CSS_VALUE_BORDER_REPEAT = {
|
||||||
gtk_css_value_repeat_free,
|
gtk_css_value_repeat_free,
|
||||||
gtk_css_value_repeat_compute,
|
gtk_css_value_repeat_compute,
|
||||||
|
gtk_css_value_repeat_needs_compute,
|
||||||
gtk_css_value_repeat_equal,
|
gtk_css_value_repeat_equal,
|
||||||
gtk_css_value_repeat_transition,
|
gtk_css_value_repeat_transition,
|
||||||
gtk_css_value_border_repeat_print
|
gtk_css_value_border_repeat_print
|
||||||
|
@@ -44,6 +44,12 @@ gtk_css_value_rgba_compute (GtkCssValue *value,
|
|||||||
return _gtk_css_value_ref (value);
|
return _gtk_css_value_ref (value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gtk_css_value_rgba_needs_compute (const GtkCssValue *value)
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gtk_css_value_rgba_equal (const GtkCssValue *rgba1,
|
gtk_css_value_rgba_equal (const GtkCssValue *rgba1,
|
||||||
const GtkCssValue *rgba2)
|
const GtkCssValue *rgba2)
|
||||||
@@ -80,6 +86,7 @@ gtk_css_value_rgba_print (const GtkCssValue *rgba,
|
|||||||
static const GtkCssValueClass GTK_CSS_VALUE_RGBA = {
|
static const GtkCssValueClass GTK_CSS_VALUE_RGBA = {
|
||||||
gtk_css_value_rgba_free,
|
gtk_css_value_rgba_free,
|
||||||
gtk_css_value_rgba_compute,
|
gtk_css_value_rgba_compute,
|
||||||
|
gtk_css_value_rgba_needs_compute,
|
||||||
gtk_css_value_rgba_equal,
|
gtk_css_value_rgba_equal,
|
||||||
gtk_css_value_rgba_transition,
|
gtk_css_value_rgba_transition,
|
||||||
gtk_css_value_rgba_print
|
gtk_css_value_rgba_print
|
||||||
|
@@ -72,6 +72,20 @@ gtk_css_value_shadows_compute (GtkCssValue *value,
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gtk_css_value_shadows_needs_compute (const GtkCssValue *value)
|
||||||
|
{
|
||||||
|
guint i;
|
||||||
|
|
||||||
|
for (i = 0; i < value->len; i++)
|
||||||
|
{
|
||||||
|
if (_gtk_css_value_needs_compute (value->values[i]))
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gtk_css_value_shadows_equal (const GtkCssValue *value1,
|
gtk_css_value_shadows_equal (const GtkCssValue *value1,
|
||||||
const GtkCssValue *value2)
|
const GtkCssValue *value2)
|
||||||
@@ -181,6 +195,7 @@ gtk_css_value_shadows_print (const GtkCssValue *value,
|
|||||||
static const GtkCssValueClass GTK_CSS_VALUE_SHADOWS = {
|
static const GtkCssValueClass GTK_CSS_VALUE_SHADOWS = {
|
||||||
gtk_css_value_shadows_free,
|
gtk_css_value_shadows_free,
|
||||||
gtk_css_value_shadows_compute,
|
gtk_css_value_shadows_compute,
|
||||||
|
gtk_css_value_shadows_needs_compute,
|
||||||
gtk_css_value_shadows_equal,
|
gtk_css_value_shadows_equal,
|
||||||
gtk_css_value_shadows_transition,
|
gtk_css_value_shadows_transition,
|
||||||
gtk_css_value_shadows_print
|
gtk_css_value_shadows_print
|
||||||
|
@@ -94,6 +94,18 @@ gtk_css_value_shadow_compute (GtkCssValue *shadow,
|
|||||||
return gtk_css_shadow_value_new (hoffset, voffset, radius, spread, shadow->inset, color);
|
return gtk_css_shadow_value_new (hoffset, voffset, radius, spread, shadow->inset, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gtk_css_value_shadow_needs_compute (const GtkCssValue *shadow)
|
||||||
|
{
|
||||||
|
return
|
||||||
|
_gtk_css_value_needs_compute (shadow->hoffset) ||
|
||||||
|
_gtk_css_value_needs_compute (shadow->voffset) ||
|
||||||
|
_gtk_css_value_needs_compute (shadow->radius) ||
|
||||||
|
_gtk_css_value_needs_compute (shadow->spread) ||
|
||||||
|
_gtk_css_value_needs_compute (shadow->color);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gtk_css_value_shadow_equal (const GtkCssValue *shadow1,
|
gtk_css_value_shadow_equal (const GtkCssValue *shadow1,
|
||||||
const GtkCssValue *shadow2)
|
const GtkCssValue *shadow2)
|
||||||
@@ -154,6 +166,7 @@ gtk_css_value_shadow_print (const GtkCssValue *shadow,
|
|||||||
static const GtkCssValueClass GTK_CSS_VALUE_SHADOW = {
|
static const GtkCssValueClass GTK_CSS_VALUE_SHADOW = {
|
||||||
gtk_css_value_shadow_free,
|
gtk_css_value_shadow_free,
|
||||||
gtk_css_value_shadow_compute,
|
gtk_css_value_shadow_compute,
|
||||||
|
gtk_css_value_shadow_needs_compute,
|
||||||
gtk_css_value_shadow_equal,
|
gtk_css_value_shadow_equal,
|
||||||
gtk_css_value_shadow_transition,
|
gtk_css_value_shadow_transition,
|
||||||
gtk_css_value_shadow_print
|
gtk_css_value_shadow_print
|
||||||
|
@@ -102,7 +102,7 @@ gtk_css_shorthand_property_parse_value (GtkStyleProperty *property,
|
|||||||
*/
|
*/
|
||||||
for (i = 0; i < shorthand->subproperties->len; i++)
|
for (i = 0; i < shorthand->subproperties->len; i++)
|
||||||
{
|
{
|
||||||
data[i] = _gtk_css_initial_value_new ();
|
data[i] = _gtk_css_initial_value_new (shorthand->subproperties->pdata[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (_gtk_css_parser_try (parser, "inherit", TRUE))
|
else if (_gtk_css_parser_try (parser, "inherit", TRUE))
|
||||||
@@ -135,7 +135,7 @@ gtk_css_shorthand_property_parse_value (GtkStyleProperty *property,
|
|||||||
for (i = 0; i < shorthand->subproperties->len; i++)
|
for (i = 0; i < shorthand->subproperties->len; i++)
|
||||||
{
|
{
|
||||||
if (data[i] == NULL)
|
if (data[i] == NULL)
|
||||||
data[i] = _gtk_css_initial_value_new ();
|
data[i] = _gtk_css_initial_value_new (shorthand->subproperties->pdata[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
result = _gtk_css_array_value_new_from_array (data, shorthand->subproperties->len);
|
result = _gtk_css_array_value_new_from_array (data, shorthand->subproperties->len);
|
||||||
|
@@ -44,6 +44,12 @@ gtk_css_value_string_compute (GtkCssValue *value,
|
|||||||
return _gtk_css_value_ref (value);
|
return _gtk_css_value_ref (value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gtk_css_value_string_needs_compute (const GtkCssValue *value)
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gtk_css_value_string_equal (const GtkCssValue *value1,
|
gtk_css_value_string_equal (const GtkCssValue *value1,
|
||||||
const GtkCssValue *value2)
|
const GtkCssValue *value2)
|
||||||
@@ -150,6 +156,7 @@ gtk_css_value_ident_print (const GtkCssValue *value,
|
|||||||
static const GtkCssValueClass GTK_CSS_VALUE_STRING = {
|
static const GtkCssValueClass GTK_CSS_VALUE_STRING = {
|
||||||
gtk_css_value_string_free,
|
gtk_css_value_string_free,
|
||||||
gtk_css_value_string_compute,
|
gtk_css_value_string_compute,
|
||||||
|
gtk_css_value_string_needs_compute,
|
||||||
gtk_css_value_string_equal,
|
gtk_css_value_string_equal,
|
||||||
gtk_css_value_string_transition,
|
gtk_css_value_string_transition,
|
||||||
gtk_css_value_string_print
|
gtk_css_value_string_print
|
||||||
@@ -158,6 +165,7 @@ static const GtkCssValueClass GTK_CSS_VALUE_STRING = {
|
|||||||
static const GtkCssValueClass GTK_CSS_VALUE_IDENT = {
|
static const GtkCssValueClass GTK_CSS_VALUE_IDENT = {
|
||||||
gtk_css_value_string_free,
|
gtk_css_value_string_free,
|
||||||
gtk_css_value_string_compute,
|
gtk_css_value_string_compute,
|
||||||
|
gtk_css_value_string_needs_compute,
|
||||||
gtk_css_value_string_equal,
|
gtk_css_value_string_equal,
|
||||||
gtk_css_value_string_transition,
|
gtk_css_value_string_transition,
|
||||||
gtk_css_value_ident_print
|
gtk_css_value_ident_print
|
||||||
|
@@ -230,7 +230,7 @@ gtk_css_style_property_parse_value (GtkStyleProperty *property,
|
|||||||
/* the initial value can be explicitly specified with the
|
/* the initial value can be explicitly specified with the
|
||||||
* ‘initial’ keyword which all properties accept.
|
* ‘initial’ keyword which all properties accept.
|
||||||
*/
|
*/
|
||||||
return _gtk_css_initial_value_new ();
|
return _gtk_css_initial_value_new (style_property);
|
||||||
}
|
}
|
||||||
else if (_gtk_css_parser_try (parser, "inherit", TRUE))
|
else if (_gtk_css_parser_try (parser, "inherit", TRUE))
|
||||||
{
|
{
|
||||||
|
@@ -162,7 +162,7 @@ assign_border (GtkCssStyleProperty *property,
|
|||||||
const GtkBorder *border = g_value_get_boxed (value);
|
const GtkBorder *border = g_value_get_boxed (value);
|
||||||
|
|
||||||
if (border == NULL)
|
if (border == NULL)
|
||||||
return _gtk_css_initial_value_new ();
|
return _gtk_css_initial_value_new (property);
|
||||||
else
|
else
|
||||||
return _gtk_css_border_value_new (_gtk_css_number_value_new (border->top, GTK_CSS_PX),
|
return _gtk_css_border_value_new (_gtk_css_number_value_new (border->top, GTK_CSS_PX),
|
||||||
_gtk_css_number_value_new (border->right, GTK_CSS_PX),
|
_gtk_css_number_value_new (border->right, GTK_CSS_PX),
|
||||||
|
@@ -51,6 +51,8 @@ struct _GtkCssStyleProperty
|
|||||||
guint animated :1;
|
guint animated :1;
|
||||||
guint affects_size :1;
|
guint affects_size :1;
|
||||||
|
|
||||||
|
GtkCssValue *css_initial_value; /* Used to quickly find the GCssInitialValue for a property */
|
||||||
|
|
||||||
GtkCssStylePropertyParseFunc parse_value;
|
GtkCssStylePropertyParseFunc parse_value;
|
||||||
GtkCssStylePropertyQueryFunc query_value;
|
GtkCssStylePropertyQueryFunc query_value;
|
||||||
GtkCssStylePropertyAssignFunc assign_value;
|
GtkCssStylePropertyAssignFunc assign_value;
|
||||||
|
@@ -47,6 +47,12 @@ gtk_css_value_typed_compute (GtkCssValue *value,
|
|||||||
return _gtk_css_style_compute_value (provider, values, parent_values, custom->pspec->value_type, value, dependencies);
|
return _gtk_css_style_compute_value (provider, values, parent_values, custom->pspec->value_type, value, dependencies);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gtk_css_value_typed_needs_compute (const GtkCssValue *value)
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gtk_css_value_typed_equal (const GtkCssValue *value1,
|
gtk_css_value_typed_equal (const GtkCssValue *value1,
|
||||||
const GtkCssValue *value2)
|
const GtkCssValue *value2)
|
||||||
@@ -73,6 +79,7 @@ gtk_css_value_typed_print (const GtkCssValue *value,
|
|||||||
static const GtkCssValueClass GTK_CSS_VALUE_TYPED = {
|
static const GtkCssValueClass GTK_CSS_VALUE_TYPED = {
|
||||||
gtk_css_value_typed_free,
|
gtk_css_value_typed_free,
|
||||||
gtk_css_value_typed_compute,
|
gtk_css_value_typed_compute,
|
||||||
|
gtk_css_value_typed_needs_compute,
|
||||||
gtk_css_value_typed_equal,
|
gtk_css_value_typed_equal,
|
||||||
gtk_css_value_typed_transition,
|
gtk_css_value_typed_transition,
|
||||||
gtk_css_value_typed_print
|
gtk_css_value_typed_print
|
||||||
|
@@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
#include "gtkprivate.h"
|
||||||
#include "gtkcssvalueprivate.h"
|
#include "gtkcssvalueprivate.h"
|
||||||
|
|
||||||
#include "gtkcsscomputedvaluesprivate.h"
|
#include "gtkcsscomputedvaluesprivate.h"
|
||||||
@@ -45,7 +46,7 @@ _gtk_css_value_alloc (const GtkCssValueClass *klass,
|
|||||||
GtkCssValue *
|
GtkCssValue *
|
||||||
_gtk_css_value_ref (GtkCssValue *value)
|
_gtk_css_value_ref (GtkCssValue *value)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (value != NULL, NULL);
|
gtk_internal_return_val_if_fail (value != NULL, NULL);
|
||||||
|
|
||||||
g_atomic_int_add (&value->ref_count, 1);
|
g_atomic_int_add (&value->ref_count, 1);
|
||||||
|
|
||||||
@@ -93,10 +94,10 @@ _gtk_css_value_compute (GtkCssValue *value,
|
|||||||
{
|
{
|
||||||
GtkCssDependencies fallback;
|
GtkCssDependencies fallback;
|
||||||
|
|
||||||
g_return_val_if_fail (value != NULL, NULL);
|
gtk_internal_return_val_if_fail (value != NULL, NULL);
|
||||||
g_return_val_if_fail (GTK_IS_STYLE_PROVIDER_PRIVATE (provider), NULL);
|
gtk_internal_return_val_if_fail (GTK_IS_STYLE_PROVIDER_PRIVATE (provider), NULL);
|
||||||
g_return_val_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values), NULL);
|
gtk_internal_return_val_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values), NULL);
|
||||||
g_return_val_if_fail (parent_values == NULL || GTK_IS_CSS_COMPUTED_VALUES (parent_values), NULL);
|
gtk_internal_return_val_if_fail (parent_values == NULL || GTK_IS_CSS_COMPUTED_VALUES (parent_values), NULL);
|
||||||
|
|
||||||
if (dependencies == NULL)
|
if (dependencies == NULL)
|
||||||
dependencies = &fallback;
|
dependencies = &fallback;
|
||||||
@@ -105,12 +106,33 @@ _gtk_css_value_compute (GtkCssValue *value,
|
|||||||
return value->class->compute (value, property_id, provider, values, parent_values, dependencies);
|
return value->class->compute (value, property_id, provider, values, parent_values, dependencies);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* _gtk_css_value_needs_compute:
|
||||||
|
* @value: the value to check or %null
|
||||||
|
*
|
||||||
|
* Checks whether a particular css value *really* needs computation.
|
||||||
|
* A lot of css values are "absolute" (like say "10 px") and never need
|
||||||
|
* any computation done. Such a value would always just return itself
|
||||||
|
* as the computed value. This can be used in some cases to avoid
|
||||||
|
* repeated computations.
|
||||||
|
*
|
||||||
|
* Returns: %false if computing this value always returns itself, %false otherwise
|
||||||
|
**/
|
||||||
|
gboolean
|
||||||
|
_gtk_css_value_needs_compute (GtkCssValue *value)
|
||||||
|
{
|
||||||
|
if (value == NULL)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
return value->class->needs_compute (value);
|
||||||
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
_gtk_css_value_equal (const GtkCssValue *value1,
|
_gtk_css_value_equal (const GtkCssValue *value1,
|
||||||
const GtkCssValue *value2)
|
const GtkCssValue *value2)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (value1 != NULL, FALSE);
|
gtk_internal_return_val_if_fail (value1 != NULL, FALSE);
|
||||||
g_return_val_if_fail (value2 != NULL, FALSE);
|
gtk_internal_return_val_if_fail (value2 != NULL, FALSE);
|
||||||
|
|
||||||
if (value1 == value2)
|
if (value1 == value2)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -141,8 +163,8 @@ _gtk_css_value_transition (GtkCssValue *start,
|
|||||||
guint property_id,
|
guint property_id,
|
||||||
double progress)
|
double progress)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (start != NULL, FALSE);
|
gtk_internal_return_val_if_fail (start != NULL, FALSE);
|
||||||
g_return_val_if_fail (end != NULL, FALSE);
|
gtk_internal_return_val_if_fail (end != NULL, FALSE);
|
||||||
|
|
||||||
if (start->class != end->class)
|
if (start->class != end->class)
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -155,7 +177,7 @@ _gtk_css_value_to_string (const GtkCssValue *value)
|
|||||||
{
|
{
|
||||||
GString *string;
|
GString *string;
|
||||||
|
|
||||||
g_return_val_if_fail (value != NULL, NULL);
|
gtk_internal_return_val_if_fail (value != NULL, NULL);
|
||||||
|
|
||||||
string = g_string_new (NULL);
|
string = g_string_new (NULL);
|
||||||
_gtk_css_value_print (value, string);
|
_gtk_css_value_print (value, string);
|
||||||
@@ -175,8 +197,8 @@ void
|
|||||||
_gtk_css_value_print (const GtkCssValue *value,
|
_gtk_css_value_print (const GtkCssValue *value,
|
||||||
GString *string)
|
GString *string)
|
||||||
{
|
{
|
||||||
g_return_if_fail (value != NULL);
|
gtk_internal_return_if_fail (value != NULL);
|
||||||
g_return_if_fail (string != NULL);
|
gtk_internal_return_if_fail (string != NULL);
|
||||||
|
|
||||||
value->class->print (value, string);
|
value->class->print (value, string);
|
||||||
}
|
}
|
||||||
|
@@ -46,6 +46,7 @@ struct _GtkCssValueClass {
|
|||||||
GtkCssComputedValues *values,
|
GtkCssComputedValues *values,
|
||||||
GtkCssComputedValues *parent_values,
|
GtkCssComputedValues *parent_values,
|
||||||
GtkCssDependencies *dependencies);
|
GtkCssDependencies *dependencies);
|
||||||
|
gboolean (* needs_compute) (const GtkCssValue *value);
|
||||||
gboolean (* equal) (const GtkCssValue *value1,
|
gboolean (* equal) (const GtkCssValue *value1,
|
||||||
const GtkCssValue *value2);
|
const GtkCssValue *value2);
|
||||||
GtkCssValue * (* transition) (GtkCssValue *start,
|
GtkCssValue * (* transition) (GtkCssValue *start,
|
||||||
@@ -71,6 +72,7 @@ GtkCssValue *_gtk_css_value_compute (GtkCssValue
|
|||||||
GtkCssComputedValues *values,
|
GtkCssComputedValues *values,
|
||||||
GtkCssComputedValues *parent_values,
|
GtkCssComputedValues *parent_values,
|
||||||
GtkCssDependencies *dependencies);
|
GtkCssDependencies *dependencies);
|
||||||
|
gboolean _gtk_css_value_needs_compute (GtkCssValue *value);
|
||||||
gboolean _gtk_css_value_equal (const GtkCssValue *value1,
|
gboolean _gtk_css_value_equal (const GtkCssValue *value1,
|
||||||
const GtkCssValue *value2);
|
const GtkCssValue *value2);
|
||||||
gboolean _gtk_css_value_equal0 (const GtkCssValue *value1,
|
gboolean _gtk_css_value_equal0 (const GtkCssValue *value1,
|
||||||
|
@@ -37,6 +37,16 @@ G_BEGIN_DECLS
|
|||||||
#define GTK_PARAM_WRITABLE G_PARAM_WRITABLE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB
|
#define GTK_PARAM_WRITABLE G_PARAM_WRITABLE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB
|
||||||
#define GTK_PARAM_READWRITE G_PARAM_READWRITE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB
|
#define GTK_PARAM_READWRITE G_PARAM_READWRITE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB
|
||||||
|
|
||||||
|
#ifdef G_DISABLE_CAST_CHECKS
|
||||||
|
/* This is true for debug no and minimum */
|
||||||
|
#define gtk_internal_return_if_fail(__expr) G_STMT_START{ (void)0; }G_STMT_END
|
||||||
|
#define gtk_internal_return_val_if_fail(__expr, __val) G_STMT_START{ (void)0; }G_STMT_END
|
||||||
|
#else
|
||||||
|
/* This is true for debug yes */
|
||||||
|
#define gtk_internal_return_if_fail(__expr) g_return_if_fail(__expr)
|
||||||
|
#define gtk_internal_return_val_if_fail(__expr, __val) g_return_val_if_fail(__expr, __val)
|
||||||
|
#endif
|
||||||
|
|
||||||
const gchar * _gtk_get_datadir (void);
|
const gchar * _gtk_get_datadir (void);
|
||||||
const gchar * _gtk_get_libdir (void);
|
const gchar * _gtk_get_libdir (void);
|
||||||
const gchar * _gtk_get_sysconfdir (void);
|
const gchar * _gtk_get_sysconfdir (void);
|
||||||
|
@@ -4654,7 +4654,9 @@ gtk_widget_queue_resize (GtkWidget *widget)
|
|||||||
if (gtk_widget_get_realized (widget))
|
if (gtk_widget_get_realized (widget))
|
||||||
gtk_widget_queue_draw (widget);
|
gtk_widget_queue_draw (widget);
|
||||||
|
|
||||||
_gtk_size_group_queue_resize (widget, 0);
|
if (gtk_widget_get_visible (widget) ||
|
||||||
|
widget->priv->have_size_groups)
|
||||||
|
_gtk_size_group_queue_resize (widget, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -13965,9 +13967,6 @@ _gtk_widget_style_context_invalidated (GtkWidget *widget)
|
|||||||
*/
|
*/
|
||||||
widget->priv->style_update_pending = TRUE;
|
widget->priv->style_update_pending = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (widget->priv->anchored)
|
|
||||||
gtk_widget_queue_resize (widget);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -5735,7 +5735,6 @@ gtk_window_style_updated (GtkWidget *widget)
|
|||||||
rect.width, rect.height);
|
rect.width, rect.height);
|
||||||
|
|
||||||
set_grip_shape (window);
|
set_grip_shape (window);
|
||||||
gtk_widget_queue_resize (widget);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user