diff options
author | Robert Staudinger <robsta@gnome.org> | 2009-08-10 17:46:53 +0200 |
---|---|---|
committer | Robert Staudinger <robsta@gnome.org> | 2009-08-10 17:46:53 +0200 |
commit | 1cbe0728d9a52a03ec3ee39b3021f017e2f3834f (patch) | |
tree | 955f27393fa8ec49d749e16871bf09d920945d39 | |
parent | 7a25d5ba06cf4f55aa5ce4d9614eeb6a57376d66 (diff) |
[property] Drop "property_" prefix from vtable members.
-rw-r--r-- | TODO | 5 | ||||
-rw-r--r-- | ccss-cairo/ccss-cairo-appearance-parser.c | 10 | ||||
-rw-r--r-- | ccss-cairo/ccss-cairo-style.c | 46 | ||||
-rw-r--r-- | ccss-gtk/ccss-gtk-property.c | 18 | ||||
-rw-r--r-- | ccss/ccss-background-parser.c | 70 | ||||
-rw-r--r-- | ccss/ccss-block.c | 4 | ||||
-rw-r--r-- | ccss/ccss-border-image-parser.c | 10 | ||||
-rw-r--r-- | ccss/ccss-border-parser.c | 260 | ||||
-rw-r--r-- | ccss/ccss-color-parser.c | 10 | ||||
-rw-r--r-- | ccss/ccss-grammar-parse.c | 16 | ||||
-rw-r--r-- | ccss/ccss-padding-parser.c | 50 | ||||
-rw-r--r-- | ccss/ccss-property-parser.c | 10 | ||||
-rw-r--r-- | ccss/ccss-property.c | 4 | ||||
-rw-r--r-- | ccss/ccss-property.h | 44 | ||||
-rw-r--r-- | ccss/ccss-style.c | 24 | ||||
-rw-r--r-- | ccss/ccss-stylesheet.c | 7 | ||||
-rw-r--r-- | examples/example-4.c | 8 |
17 files changed, 305 insertions, 291 deletions
@@ -7,9 +7,8 @@ Also see gtk-css-engine's TODO for now. 0.5 --- -* Ship clearlooks' gtkrc hacks as a separate file and include it in the themes. -* Move over gce-node, separate them. -* Improve test suite. Libxml backend for cascading tests? +* Move over gce-node, separate them? +* Improve test suite. Libxml backend for cascading tests. * Cairo-style error handling? Or something else? * "char * foo_serialize()" API instead of _dump(). * _serialize() property class method, serializing should fall back to _convert() diff --git a/ccss-cairo/ccss-cairo-appearance-parser.c b/ccss-cairo/ccss-cairo-appearance-parser.c index 6f99976..2cfa44f 100644 --- a/ccss-cairo/ccss-cairo-appearance-parser.c +++ b/ccss-cairo/ccss-cairo-appearance-parser.c @@ -214,11 +214,11 @@ appearance_destroy (ccss_cairo_appearance_t *self) static ccss_property_class_t const _ptable[] = { { .name = "ccss-appearance", - .property_create = NULL, - .property_destroy = (ccss_property_destroy_f) appearance_destroy, - .property_convert = (ccss_property_convert_f) appearance_convert, - .property_factory = appearance_factory, - .property_inherit = NULL + .create = NULL, + .destroy = (ccss_property_destroy_f) appearance_destroy, + .convert = (ccss_property_convert_f) appearance_convert, + .factory = appearance_factory, + .inherit = NULL }, { .name = NULL } diff --git a/ccss-cairo/ccss-cairo-style.c b/ccss-cairo/ccss-cairo-style.c index 384a380..877bfe5 100644 --- a/ccss-cairo/ccss-cairo-style.c +++ b/ccss-cairo/ccss-cairo-style.c @@ -689,13 +689,13 @@ ccss_cairo_style_get_double (ccss_style_t const *self, /* Have conversion function? */ g_return_val_if_fail (property->property_class, false); - if (NULL == property->property_class->property_convert) { + if (NULL == property->property_class->convert) { return false; } - return property->property_class->property_convert (property, - CCSS_PROPERTY_TYPE_DOUBLE, - value); + return property->property_class->convert (property, + CCSS_PROPERTY_TYPE_DOUBLE, + value); } /** @@ -723,13 +723,13 @@ ccss_cairo_style_get_string (ccss_style_t const *self, /* Have conversion function? */ g_return_val_if_fail (property->property_class, false); - if (NULL == property->property_class->property_convert) { + if (NULL == property->property_class->convert) { return false; } - return property->property_class->property_convert (property, - CCSS_PROPERTY_TYPE_STRING, - value); + return property->property_class->convert (property, + CCSS_PROPERTY_TYPE_STRING, + value); } /** @@ -835,25 +835,25 @@ gap_width_convert (gap_width_t const *property, static ccss_property_class_t const _ptable[] = { { .name = "ccss-gap-side", - .property_create = NULL, - .property_destroy = (ccss_property_destroy_f) gap_destroy_nop, - .property_convert = (ccss_property_convert_f) gap_side_convert, - .property_factory = NULL, - .property_inherit = NULL + .create = NULL, + .destroy = (ccss_property_destroy_f) gap_destroy_nop, + .convert = (ccss_property_convert_f) gap_side_convert, + .factory = NULL, + .inherit = NULL }, { .name = "ccss-gap-start", - .property_create = NULL, - .property_destroy = (ccss_property_destroy_f) gap_destroy_nop, - .property_convert = (ccss_property_convert_f) gap_start_convert, - .property_factory = NULL, - .property_inherit = NULL + .create = NULL, + .destroy = (ccss_property_destroy_f) gap_destroy_nop, + .convert = (ccss_property_convert_f) gap_start_convert, + .factory = NULL, + .inherit = NULL }, { .name = "ccss-gap-width", - .property_create = NULL, - .property_destroy = (ccss_property_destroy_f) gap_destroy_nop, - .property_convert = (ccss_property_convert_f) gap_width_convert, - .property_factory = NULL, - .property_inherit = NULL + .create = NULL, + .destroy = (ccss_property_destroy_f) gap_destroy_nop, + .convert = (ccss_property_convert_f) gap_width_convert, + .factory = NULL, + .inherit = NULL }, { .name = NULL } diff --git a/ccss-gtk/ccss-gtk-property.c b/ccss-gtk/ccss-gtk-property.c index 7b91398..f9ca73e 100644 --- a/ccss-gtk/ccss-gtk-property.c +++ b/ccss-gtk/ccss-gtk-property.c @@ -525,19 +525,19 @@ property_factory (ccss_grammar_t const *grammar, /* Fall back. */ g_return_val_if_fail (_fallback_property_class, false); - g_return_val_if_fail (_fallback_property_class->property_factory, false); - return _fallback_property_class->property_factory (grammar, block, name, - values, user_data); + g_return_val_if_fail (_fallback_property_class->factory, false); + return _fallback_property_class->factory (grammar, block, name, + values, user_data); } static ccss_property_class_t const _properties[] = { { .name = "*", - .property_create = NULL, - .property_destroy = (ccss_property_destroy_f) property_destroy, - .property_convert = (ccss_property_convert_f) property_convert, - .property_factory = property_factory, - .property_inherit = NULL + .create = NULL, + .destroy = (ccss_property_destroy_f) property_destroy, + .convert = (ccss_property_convert_f) property_convert, + .factory = property_factory, + .inherit = NULL }, { .name = NULL } @@ -566,7 +566,7 @@ ccss_gtk_property_set_fallback_class (ccss_property_class_t const *property_clas bool ccss_gtk_property_is_style_property (ccss_property_base_t const *self) { - return self->property_class->property_destroy == + return self->property_class->destroy == (ccss_property_destroy_f) property_destroy; } diff --git a/ccss/ccss-background-parser.c b/ccss/ccss-background-parser.c index 43de786..6014f23 100644 --- a/ccss/ccss-background-parser.c +++ b/ccss/ccss-background-parser.c @@ -629,53 +629,53 @@ background_size_convert (ccss_background_size_t const *property, static ccss_property_class_t const _ptable[] = { { .name = "background-attachment", - .property_create = background_attachment_create, - .property_destroy = (ccss_property_destroy_f) g_free, - .property_convert = (ccss_property_convert_f) background_attachment_convert, - .property_factory = NULL, - .property_inherit = NULL + .create = background_attachment_create, + .destroy = (ccss_property_destroy_f) g_free, + .convert = (ccss_property_convert_f) background_attachment_convert, + .factory = NULL, + .inherit = NULL }, { .name = "background-color", - .property_create = NULL, - .property_destroy = (ccss_property_destroy_f) g_free, - .property_convert = (ccss_property_convert_f) ccss_color_convert, - .property_factory = ccss_color_factory, - .property_inherit = NULL + .create = NULL, + .destroy = (ccss_property_destroy_f) g_free, + .convert = (ccss_property_convert_f) ccss_color_convert, + .factory = ccss_color_factory, + .inherit = NULL }, { .name = "background-image", - .property_create = background_image_create, - .property_destroy = (ccss_property_destroy_f) background_image_destroy, - .property_convert = (ccss_property_convert_f) background_image_convert, - .property_factory = NULL, - .property_inherit = NULL + .create = background_image_create, + .destroy = (ccss_property_destroy_f) background_image_destroy, + .convert = (ccss_property_convert_f) background_image_convert, + .factory = NULL, + .inherit = NULL }, { .name = "background-position", - .property_create = background_position_create, - .property_destroy = (ccss_property_destroy_f) g_free, - .property_convert = (ccss_property_convert_f) background_position_convert, - .property_factory = NULL, - .property_inherit = NULL + .create = background_position_create, + .destroy = (ccss_property_destroy_f) g_free, + .convert = (ccss_property_convert_f) background_position_convert, + .factory = NULL, + .inherit = NULL }, { .name = "background-repeat", - .property_create = background_repeat_create, - .property_destroy = (ccss_property_destroy_f) g_free, - .property_convert = (ccss_property_convert_f) background_repeat_convert, - .property_factory = NULL, - .property_inherit = NULL + .create = background_repeat_create, + .destroy = (ccss_property_destroy_f) g_free, + .convert = (ccss_property_convert_f) background_repeat_convert, + .factory = NULL, + .inherit = NULL }, { .name = "background-size", - .property_create = background_size_create, - .property_destroy = (ccss_property_destroy_f) g_free, - .property_convert = (ccss_property_convert_f) background_size_convert, - .property_factory = NULL, - .property_inherit = NULL + .create = background_size_create, + .destroy = (ccss_property_destroy_f) g_free, + .convert = (ccss_property_convert_f) background_size_convert, + .factory = NULL, + .inherit = NULL }, { .name = "background", - .property_create = NULL, - .property_destroy = (ccss_property_destroy_f) g_free, - .property_convert = NULL, - .property_factory = background_factory, - .property_inherit = background_inherit + .create = NULL, + .destroy = (ccss_property_destroy_f) g_free, + .convert = NULL, + .factory = background_factory, + .inherit = background_inherit }, { .name = NULL } diff --git a/ccss/ccss-block.c b/ccss/ccss-block.c index 2be2244..5d40290 100644 --- a/ccss/ccss-block.c +++ b/ccss/ccss-block.c @@ -106,9 +106,9 @@ ccss_block_dump (ccss_block_t const *self) strval = g_strdup (ccss_property_state_serialize (property->state)); } else if (property->property_class && - property->property_class->property_convert) { + property->property_class->convert) { - property->property_class->property_convert (property, + property->property_class->convert (property, CCSS_PROPERTY_TYPE_STRING, &strval); } diff --git a/ccss/ccss-border-image-parser.c b/ccss/ccss-border-image-parser.c index 583f8b7..43d2dbc 100644 --- a/ccss/ccss-border-image-parser.c +++ b/ccss/ccss-border-image-parser.c @@ -251,11 +251,11 @@ border_image_convert (ccss_border_image_t const *property, static ccss_property_class_t const _ptable[] = { { .name = "border-image", - .property_create = border_image_create, - .property_destroy = (ccss_property_destroy_f) border_image_destroy, - .property_convert = (ccss_property_convert_f) border_image_convert, - .property_factory = NULL, - .property_inherit = NULL + .create = border_image_create, + .destroy = (ccss_property_destroy_f) border_image_destroy, + .convert = (ccss_property_convert_f) border_image_convert, + .factory = NULL, + .inherit = NULL }, { .name = NULL } diff --git a/ccss/ccss-border-parser.c b/ccss/ccss-border-parser.c index aac8882..c4e5734 100644 --- a/ccss/ccss-border-parser.c +++ b/ccss/ccss-border-parser.c @@ -1121,186 +1121,186 @@ border_spacing_convert (ccss_border_spacing_t const *property, static ccss_property_class_t const _ptable[] = { { .name = "border-top-right-radius", - .property_create = border_radius_create, - .property_destroy = (ccss_property_destroy_f) g_free, - .property_convert = (ccss_property_convert_f) border_radius_convert, - .property_factory = NULL, - .property_inherit = NULL + .create = border_radius_create, + .destroy = (ccss_property_destroy_f) g_free, + .convert = (ccss_property_convert_f) border_radius_convert, + .factory = NULL, + .inherit = NULL }, { .name = "border-bottom-right-radius", - .property_create = border_radius_create, - .property_destroy = (ccss_property_destroy_f) g_free, - .property_convert = (ccss_property_convert_f) border_radius_convert, - .property_factory = NULL, - .property_inherit = NULL + .create = border_radius_create, + .destroy = (ccss_property_destroy_f) g_free, + .convert = (ccss_property_convert_f) border_radius_convert, + .factory = NULL, + .inherit = NULL }, { .name = "border-bottom-left-radius", - .property_create = border_radius_create, - .property_destroy = (ccss_property_destroy_f) g_free, - .property_convert = (ccss_property_convert_f) border_radius_convert, - .property_factory = NULL, - .property_inherit = NULL + .create = border_radius_create, + .destroy = (ccss_property_destroy_f) g_free, + .convert = (ccss_property_convert_f) border_radius_convert, + .factory = NULL, + .inherit = NULL }, { .name = "border-top-left-radius", - .property_create = border_radius_create, - .property_destroy = (ccss_property_destroy_f) g_free, - .property_convert = (ccss_property_convert_f) border_radius_convert, - .property_factory = NULL, - .property_inherit = NULL + .create = border_radius_create, + .destroy = (ccss_property_destroy_f) g_free, + .convert = (ccss_property_convert_f) border_radius_convert, + .factory = NULL, + .inherit = NULL }, { .name = "border-radius", - .property_create = NULL, - .property_destroy = (ccss_property_destroy_f) g_free, - .property_convert = (ccss_property_convert_f) border_radius_convert, - .property_factory = border_radius_factory, - .property_inherit = border_radius_inherit + .create = NULL, + .destroy = (ccss_property_destroy_f) g_free, + .convert = (ccss_property_convert_f) border_radius_convert, + .factory = border_radius_factory, + .inherit = border_radius_inherit }, { .name = "border-left-color", - .property_create = NULL, - .property_destroy = (ccss_property_destroy_f) g_free, - .property_convert = (ccss_property_convert_f) ccss_color_convert, - .property_factory = ccss_color_factory, - .property_inherit = NULL + .create = NULL, + .destroy = (ccss_property_destroy_f) g_free, + .convert = (ccss_property_convert_f) ccss_color_convert, + .factory = ccss_color_factory, + .inherit = NULL }, { .name = "border-left-style", - .property_create = border_style_create, - .property_destroy = (ccss_property_destroy_f) g_free, - .property_convert = (ccss_property_convert_f) border_style_convert, - .property_factory = NULL, - .property_inherit = NULL + .create = border_style_create, + .destroy = (ccss_property_destroy_f) g_free, + .convert = (ccss_property_convert_f) border_style_convert, + .factory = NULL, + .inherit = NULL }, { .name = "border-left-width", - .property_create = border_width_create, - .property_destroy = (ccss_property_destroy_f) g_free, - .property_convert = (ccss_property_convert_f) border_width_convert, - .property_factory = NULL, - .property_inherit = NULL + .create = border_width_create, + .destroy = (ccss_property_destroy_f) g_free, + .convert = (ccss_property_convert_f) border_width_convert, + .factory = NULL, + .inherit = NULL }, { .name = "border-top-color", - .property_create = NULL, - .property_destroy = (ccss_property_destroy_f) g_free, - .property_convert = (ccss_property_convert_f) ccss_color_convert, - .property_factory = ccss_color_factory, - .property_inherit = NULL + .create = NULL, + .destroy = (ccss_property_destroy_f) g_free, + .convert = (ccss_property_convert_f) ccss_color_convert, + .factory = ccss_color_factory, + .inherit = NULL }, { .name = "border-top-style", - .property_create = border_style_create, - .property_destroy = (ccss_property_destroy_f) g_free, - .property_convert = (ccss_property_convert_f) border_style_convert, - .property_factory = NULL, - .property_inherit = NULL + .create = border_style_create, + .destroy = (ccss_property_destroy_f) g_free, + .convert = (ccss_property_convert_f) border_style_convert, + .factory = NULL, + .inherit = NULL }, { .name = "border-top-width", - .property_create = border_width_create, - .property_destroy = (ccss_property_destroy_f) g_free, - .property_convert = (ccss_property_convert_f) border_width_convert, - .property_factory = NULL, - .property_inherit = NULL + .create = border_width_create, + .destroy = (ccss_property_destroy_f) g_free, + .convert = (ccss_property_convert_f) border_width_convert, + .factory = NULL, + .inherit = NULL }, { .name = "border-right-color", - .property_create = NULL, - .property_destroy = (ccss_property_destroy_f) g_free, - .property_convert = (ccss_property_convert_f) ccss_color_convert, - .property_factory = ccss_color_factory, - .property_inherit = NULL + .create = NULL, + .destroy = (ccss_property_destroy_f) g_free, + .convert = (ccss_property_convert_f) ccss_color_convert, + .factory = ccss_color_factory, + .inherit = NULL }, { .name = "border-right-style", - .property_create = border_style_create, - .property_destroy = (ccss_property_destroy_f) g_free, - .property_convert = (ccss_property_convert_f) border_style_convert, - .property_factory = NULL, - .property_inherit = NULL + .create = border_style_create, + .destroy = (ccss_property_destroy_f) g_free, + .convert = (ccss_property_convert_f) border_style_convert, + .factory = NULL, + .inherit = NULL }, { .name = "border-right-width", - .property_create = border_width_create, - .property_destroy = (ccss_property_destroy_f) g_free, - .property_convert = (ccss_property_convert_f) border_width_convert, - .property_factory = NULL, - .property_inherit = NULL + .create = border_width_create, + .destroy = (ccss_property_destroy_f) g_free, + .convert = (ccss_property_convert_f) border_width_convert, + .factory = NULL, + .inherit = NULL }, { .name = "border-bottom-color", - .property_create = NULL, - .property_destroy = (ccss_property_destroy_f) g_free, - .property_convert = (ccss_property_convert_f) ccss_color_convert, - .property_factory = ccss_color_factory, - .property_inherit = NULL + .create = NULL, + .destroy = (ccss_property_destroy_f) g_free, + .convert = (ccss_property_convert_f) ccss_color_convert, + .factory = ccss_color_factory, + .inherit = NULL }, { .name = "border-bottom-style", - .property_create = border_style_create, - .property_destroy = (ccss_property_destroy_f) g_free, - .property_convert = (ccss_property_convert_f) border_style_convert, - .property_factory = NULL, - .property_inherit = NULL + .create = border_style_create, + .destroy = (ccss_property_destroy_f) g_free, + .convert = (ccss_property_convert_f) border_style_convert, + .factory = NULL, + .inherit = NULL }, { .name = "border-bottom-width", - .property_create = border_width_create, - .property_destroy = (ccss_property_destroy_f) g_free, - .property_convert = (ccss_property_convert_f) border_width_convert, - .property_factory = NULL, - .property_inherit = NULL + .create = border_width_create, + .destroy = (ccss_property_destroy_f) g_free, + .convert = (ccss_property_convert_f) border_width_convert, + .factory = NULL, + .inherit = NULL }, { .name = "border-left", - .property_create = NULL, - .property_destroy = (ccss_property_destroy_f) g_free, - .property_convert = NULL, - .property_factory = border_left_factory, - .property_inherit = border_left_inherit + .create = NULL, + .destroy = (ccss_property_destroy_f) g_free, + .convert = NULL, + .factory = border_left_factory, + .inherit = border_left_inherit }, { .name = "border-top", - .property_create = NULL, - .property_destroy = (ccss_property_destroy_f) g_free, - .property_convert = NULL, - .property_factory = border_top_factory, - .property_inherit = border_top_inherit + .create = NULL, + .destroy = (ccss_property_destroy_f) g_free, + .convert = NULL, + .factory = border_top_factory, + .inherit = border_top_inherit }, { .name = "border-right", - .property_create = NULL, - .property_destroy = (ccss_property_destroy_f) g_free, - .property_convert = NULL, - .property_factory = border_right_factory, - .property_inherit = border_right_inherit + .create = NULL, + .destroy = (ccss_property_destroy_f) g_free, + .convert = NULL, + .factory = border_right_factory, + .inherit = border_right_inherit }, { .name = "border-bottom", - .property_create = NULL, - .property_destroy = (ccss_property_destroy_f) g_free, - .property_convert = NULL, - .property_factory = border_bottom_factory, - .property_inherit = border_bottom_inherit + .create = NULL, + .destroy = (ccss_property_destroy_f) g_free, + .convert = NULL, + .factory = border_bottom_factory, + .inherit = border_bottom_inherit }, { .name = "border-color", - .property_create = NULL, - .property_destroy = (ccss_property_destroy_f) g_free, - .property_convert = (ccss_property_convert_f) ccss_color_convert, - .property_factory = border_color_factory, - .property_inherit = border_color_inherit + .create = NULL, + .destroy = (ccss_property_destroy_f) g_free, + .convert = (ccss_property_convert_f) ccss_color_convert, + .factory = border_color_factory, + .inherit = border_color_inherit }, { .name = "border-style", - .property_create = NULL, - .property_destroy = (ccss_property_destroy_f) g_free, - .property_convert = (ccss_property_convert_f) border_style_convert, - .property_factory = border_style_factory, - .property_inherit = border_style_inherit + .create = NULL, + .destroy = (ccss_property_destroy_f) g_free, + .convert = (ccss_property_convert_f) border_style_convert, + .factory = border_style_factory, + .inherit = border_style_inherit }, { .name = "border-width", - .property_create = NULL, - .property_destroy = (ccss_property_destroy_f) g_free, - .property_convert = (ccss_property_convert_f) border_width_convert, - .property_factory = border_width_factory, - .property_inherit = border_width_inherit + .create = NULL, + .destroy = (ccss_property_destroy_f) g_free, + .convert = (ccss_property_convert_f) border_width_convert, + .factory = border_width_factory, + .inherit = border_width_inherit }, { .name = "border", - .property_create = NULL, - .property_destroy = (ccss_property_destroy_f) g_free, - .property_convert = NULL, - .property_factory = border_factory, - .property_inherit = border_inherit + .create = NULL, + .destroy = (ccss_property_destroy_f) g_free, + .convert = NULL, + .factory = border_factory, + .inherit = border_inherit }, { .name = "border-spacing", - .property_create = border_spacing_create, - .property_destroy = (ccss_property_destroy_f) g_free, - .property_convert = (ccss_property_convert_f) border_spacing_convert, - .property_factory = NULL, - .property_inherit = NULL + .create = border_spacing_create, + .destroy = (ccss_property_destroy_f) g_free, + .convert = (ccss_property_convert_f) border_spacing_convert, + .factory = NULL, + .inherit = NULL }, { .name = NULL, } diff --git a/ccss/ccss-color-parser.c b/ccss/ccss-color-parser.c index b966803..0d01e7f 100644 --- a/ccss/ccss-color-parser.c +++ b/ccss/ccss-color-parser.c @@ -638,11 +638,11 @@ ccss_color_convert (ccss_color_t const *property, static ccss_property_class_t const _ptable[] = { { .name = "color", - .property_create = NULL, - .property_destroy = (ccss_property_destroy_f) g_free, - .property_convert = (ccss_property_convert_f) ccss_color_convert, - .property_factory = ccss_color_factory, - .property_inherit = NULL + .create = NULL, + .destroy = (ccss_property_destroy_f) g_free, + .convert = (ccss_property_convert_f) ccss_color_convert, + .factory = ccss_color_factory, + .inherit = NULL }, { .name = NULL } diff --git a/ccss/ccss-grammar-parse.c b/ccss/ccss-grammar-parse.c index 6c44e7d..106a89a 100644 --- a/ccss/ccss-grammar-parse.c +++ b/ccss/ccss-grammar-parse.c @@ -362,14 +362,14 @@ property_cb (CRDocHandler *handler, info->grammar->properties, "*"); } - if (property_class->property_factory) { - property_class->property_factory (info->grammar, block, - property_name, values, - info->user_data); - } else if (property_class->property_create) { - property = property_class->property_create (info->grammar, - values, - info->user_data); + if (property_class->factory) { + property_class->factory (info->grammar, block, + property_name, values, + info->user_data); + } else if (property_class->create) { + property = property_class->create (info->grammar, + values, + info->user_data); if (property) { ccss_block_add_property (block, property_name, property); diff --git a/ccss/ccss-padding-parser.c b/ccss/ccss-padding-parser.c index 94f2733..1b18d6f 100644 --- a/ccss/ccss-padding-parser.c +++ b/ccss/ccss-padding-parser.c @@ -240,39 +240,39 @@ padding_inherit (ccss_style_t const *container_style, static ccss_property_class_t const _ptable[] = { { .name = "padding-top", - .property_create = padding_create, - .property_destroy = (ccss_property_destroy_f) g_free, - .property_convert = (ccss_property_convert_f) padding_convert, - .property_factory = NULL, - .property_inherit = NULL + .create = padding_create, + .destroy = (ccss_property_destroy_f) g_free, + .convert = (ccss_property_convert_f) padding_convert, + .factory = NULL, + .inherit = NULL }, { .name = "padding-right", - .property_create = padding_create, - .property_destroy = (ccss_property_destroy_f) g_free, - .property_convert = (ccss_property_convert_f) padding_convert, - .property_factory = NULL, - .property_inherit = NULL + .create = padding_create, + .destroy = (ccss_property_destroy_f) g_free, + .convert = (ccss_property_convert_f) padding_convert, + .factory = NULL, + .inherit = NULL }, { .name = "padding-bottom", - .property_create = padding_create, - .property_destroy = (ccss_property_destroy_f) g_free, - .property_convert = (ccss_property_convert_f) padding_convert, - .property_factory = NULL, - .property_inherit = NULL + .create = padding_create, + .destroy = (ccss_property_destroy_f) g_free, + .convert = (ccss_property_convert_f) padding_convert, + .factory = NULL, + .inherit = NULL }, { .name = "padding-left", - .property_create = padding_create, - .property_destroy = (ccss_property_destroy_f) g_free, - .property_convert = (ccss_property_convert_f) padding_convert, - .property_factory = NULL, - .property_inherit = NULL + .create = padding_create, + .destroy = (ccss_property_destroy_f) g_free, + .convert = (ccss_property_convert_f) padding_convert, + .factory = NULL, + .inherit = NULL }, { .name = "padding", - .property_create = NULL, - .property_destroy = (ccss_property_destroy_f) g_free, - .property_convert = (ccss_property_convert_f) padding_convert, - .property_factory = padding_factory, - .property_inherit = padding_inherit + .create = NULL, + .destroy = (ccss_property_destroy_f) g_free, + .convert = (ccss_property_convert_f) padding_convert, + .factory = padding_factory, + .inherit = padding_inherit }, { .name = NULL } diff --git a/ccss/ccss-property-parser.c b/ccss/ccss-property-parser.c index 5d73d64..fac10a1 100644 --- a/ccss/ccss-property-parser.c +++ b/ccss/ccss-property-parser.c @@ -144,11 +144,11 @@ property_convert (ccss_property_generic_t *self, ccss_property_class_t const _ptable[] = { { .name = "*", - .property_create = NULL, - .property_destroy = (ccss_property_destroy_f) property_destroy, - .property_convert = (ccss_property_convert_f) property_convert, - .property_factory = property_factory, - .property_inherit = NULL + .create = NULL, + .destroy = (ccss_property_destroy_f) property_destroy, + .convert = (ccss_property_convert_f) property_convert, + .factory = property_factory, + .inherit = NULL }, { .name = NULL } diff --git a/ccss/ccss-property.c b/ccss/ccss-property.c index 66b00fd..ae47df4 100644 --- a/ccss/ccss-property.c +++ b/ccss/ccss-property.c @@ -49,9 +49,9 @@ ccss_property_destroy (ccss_property_base_t *self) g_return_if_fail (self); g_return_if_fail (self->property_class); g_return_if_fail (self->property_class); - g_return_if_fail (self->property_class->property_destroy); + g_return_if_fail (self->property_class->destroy); - self->property_class->property_destroy (self); + self->property_class->destroy (self); } /** diff --git a/ccss/ccss-property.h b/ccss/ccss-property.h index b24357d..9fa9c6d 100644 --- a/ccss/ccss-property.h +++ b/ccss/ccss-property.h @@ -137,25 +137,41 @@ typedef bool (*ccss_property_inherit_f) (struct ccss_style_ const *container_sty struct ccss_style_ *style); /** + * ccss_property_serialize_f: + * @self: pointer to property instance. + * + * Hook function to reformat a property to CSS syntax. + * + * Returns: %TRUE if property inheritance could be resolved. + **/ +typedef char * (*ccss_property_serialize_f) (ccss_property_base_t const *self); + +/** * ccss_property_class_t: - * @name: property name. - * @property_create: allocation hook, see #ccss_property_create_f. - * @property_destroy: deallocation hook, see #ccss_property_destroy_f. - * @property_convert: conversion hook, see #ccss_property_convert_f. - * @property_factory: factory hook, see #ccss_property_factory_f. - * @property_inherit: inherit hook, see #ccss_property_inherit_f. + * @name: property name. + * @create: allocation hook, see #ccss_property_create_f. + * @destroy: deallocation hook, see #ccss_property_destroy_f. + * @convert: conversion hook, see #ccss_property_convert_f. + * @factory: factory hook, see #ccss_property_factory_f. + * @inherit: inherit hook, see #ccss_property_inherit_f. + * @inherit: inherit hook, see #ccss_property_inherit_f. + * @serialize: serialize hook, see #ccss_property_serialize_f. * * Property interpretation vtable entry. - * - * TODO: drop vtable functions 'property' prefix. **/ typedef struct { - char const *name; - ccss_property_create_f property_create; - ccss_property_destroy_f property_destroy; - ccss_property_convert_f property_convert; - ccss_property_factory_f property_factory; - ccss_property_inherit_f property_inherit; + char const *name; + ccss_property_create_f create; + ccss_property_destroy_f destroy; + ccss_property_convert_f convert; + ccss_property_factory_f factory; + ccss_property_inherit_f inherit; + ccss_property_serialize_f serialize; + void (*_padding_0) (void); + void (*_padding_1) (void); + void (*_padding_2) (void); + void (*_padding_3) (void); + void (*_padding_4) (void); } ccss_property_class_t; /** diff --git a/ccss/ccss-style.c b/ccss/ccss-style.c index a9c0c57..4a36e9d 100644 --- a/ccss/ccss-style.c +++ b/ccss/ccss-style.c @@ -161,13 +161,13 @@ ccss_style_get_double (ccss_style_t const *self, /* Have conversion function? */ g_return_val_if_fail (property->property_class, false); - if (NULL == property->property_class->property_convert) { + if (NULL == property->property_class->convert) { return false; } - return property->property_class->property_convert (property, - CCSS_PROPERTY_TYPE_DOUBLE, - value); + return property->property_class->convert (property, + CCSS_PROPERTY_TYPE_DOUBLE, + value); } /** @@ -199,13 +199,13 @@ ccss_style_get_string (ccss_style_t const *self, /* Have conversion function? */ g_return_val_if_fail (property->property_class, false); - if (NULL == property->property_class->property_convert) { + if (NULL == property->property_class->convert) { return false; } - return property->property_class->property_convert (property, - CCSS_PROPERTY_TYPE_STRING, - value); + return property->property_class->convert (property, + CCSS_PROPERTY_TYPE_STRING, + value); } /** @@ -419,11 +419,11 @@ ccss_style_dump (ccss_style_t const *self) strval = g_strdup (ccss_property_state_serialize (property->state)); } else if (property->property_class && - property->property_class->property_convert) { + property->property_class->convert) { - property->property_class->property_convert (property, - CCSS_PROPERTY_TYPE_STRING, - &strval); + property->property_class->convert (property, + CCSS_PROPERTY_TYPE_STRING, + &strval); } if (NULL == strval) { strval = g_strdup ("<unknown>"); diff --git a/ccss/ccss-stylesheet.c b/ccss/ccss-stylesheet.c index 7236d7a..576b9f0 100644 --- a/ccss/ccss-stylesheet.c +++ b/ccss/ccss-stylesheet.c @@ -443,15 +443,14 @@ inherit_container_style (ccss_style_t const *container_style, bool is_resolved; - if (property->property_class->property_inherit) { + if (property->property_class->inherit) { /* FIXME: should swap parameters and have the style pull from the container * instead. So "style" wants to inherit "background", it can pull * "background-color" and stuff from the container. * Otherwise the approach with the css engine's user-agent.css is restricted * to using shorthand properties for inheritance. */ - is_resolved = property->property_class->property_inherit ( - container_style, - style); + is_resolved = property->property_class->inherit + (container_style, style); } else { g_hash_table_insert (style->properties, (gpointer) property_id, diff --git a/examples/example-4.c b/examples/example-4.c index 5b85598..26598d1 100644 --- a/examples/example-4.c +++ b/examples/example-4.c @@ -70,10 +70,10 @@ font_family_convert (font_family_t const *self, static ccss_property_class_t const _properties[] = { { .name = "font-family", - .property_create = (ccss_property_create_f) font_family_new, - .property_destroy = (ccss_property_destroy_f) font_family_free, - .property_convert = (ccss_property_convert_f) font_family_convert, - .property_factory = NULL + .create = (ccss_property_create_f) font_family_new, + .destroy = (ccss_property_destroy_f) font_family_free, + .convert = (ccss_property_convert_f) font_family_convert, + .factory = NULL }, { .name = NULL } |