[librsvg/rustification] node_set_atts(): Check here for the property bag being empty
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg/rustification] node_set_atts(): Check here for the property bag being empty
- Date: Thu, 17 Nov 2016 21:36:46 +0000 (UTC)
commit 58a645cc9b547ab558dfa8dc398143a0b01be9f1
Author: Federico Mena Quintero <federico gnome org>
Date: Thu Nov 17 14:05:45 2016 -0600
node_set_atts(): Check here for the property bag being empty
Every ::set_atts() implementation used to check on its own whether the
property bag is empty (common for "plain" SVG elements with no defined
attributes?) before actually querying the property bag.
Now we do that check in a single place, in the toplevel node_set_atts()
helper, instead of having each node type do it on its own.
This means that ::set_atts() implementation which do "validation" work
or any other post-initialization after the attributes have been set,
will have to support their ::set_atts() not being called at all if there
are no attributes in the first place.
rsvg-base.c | 4 +-
rsvg-filter.c | 648 ++++++++++++++++++++++++---------------------------
rsvg-image.c | 52 ++---
rsvg-marker.c | 58 +++---
rsvg-mask.c | 72 +++---
rsvg-paint-server.c | 323 +++++++++++++-------------
rsvg-shapes.c | 184 +++++++--------
rsvg-structure.c | 116 +++++-----
rsvg-text.c | 36 ++--
9 files changed, 707 insertions(+), 786 deletions(-)
---
diff --git a/rsvg-base.c b/rsvg-base.c
index 00fb9c5..0008673 100644
--- a/rsvg-base.c
+++ b/rsvg-base.c
@@ -242,7 +242,9 @@ free_element_name_stack (RsvgHandle *ctx)
static void
node_set_atts (RsvgNode * node, RsvgHandle * ctx, RsvgPropertyBag * atts)
{
- node->set_atts (node, ctx, atts);
+ if (rsvg_property_bag_size (atts) > 0) {
+ node->set_atts (node, ctx, atts);
+ }
}
static void
diff --git a/rsvg-filter.c b/rsvg-filter.c
index 1a6a806..df706a3 100644
--- a/rsvg-filter.c
+++ b/rsvg-filter.c
@@ -785,28 +785,26 @@ rsvg_filter_set_atts (RsvgNode * self, RsvgHandle * ctx, RsvgPropertyBag * atts)
filter = (RsvgFilter *) self;
- if (rsvg_property_bag_size (atts)) {
- if ((value = rsvg_property_bag_lookup (atts, "filterUnits"))) {
- if (!strcmp (value, "userSpaceOnUse"))
- filter->filterunits = userSpaceOnUse;
- else
- filter->filterunits = objectBoundingBox;
- }
- if ((value = rsvg_property_bag_lookup (atts, "primitiveUnits"))) {
- if (!strcmp (value, "objectBoundingBox"))
- filter->primitiveunits = objectBoundingBox;
- else
- filter->primitiveunits = userSpaceOnUse;
- }
- if ((value = rsvg_property_bag_lookup (atts, "x")))
- filter->x = rsvg_length_parse (value, LENGTH_DIR_HORIZONTAL);
- if ((value = rsvg_property_bag_lookup (atts, "y")))
- filter->y = rsvg_length_parse (value, LENGTH_DIR_VERTICAL);
- if ((value = rsvg_property_bag_lookup (atts, "width")))
- filter->width = rsvg_length_parse (value, LENGTH_DIR_HORIZONTAL);
- if ((value = rsvg_property_bag_lookup (atts, "height")))
- filter->height = rsvg_length_parse (value, LENGTH_DIR_VERTICAL);
+ if ((value = rsvg_property_bag_lookup (atts, "filterUnits"))) {
+ if (!strcmp (value, "userSpaceOnUse"))
+ filter->filterunits = userSpaceOnUse;
+ else
+ filter->filterunits = objectBoundingBox;
}
+ if ((value = rsvg_property_bag_lookup (atts, "primitiveUnits"))) {
+ if (!strcmp (value, "objectBoundingBox"))
+ filter->primitiveunits = objectBoundingBox;
+ else
+ filter->primitiveunits = userSpaceOnUse;
+ }
+ if ((value = rsvg_property_bag_lookup (atts, "x")))
+ filter->x = rsvg_length_parse (value, LENGTH_DIR_HORIZONTAL);
+ if ((value = rsvg_property_bag_lookup (atts, "y")))
+ filter->y = rsvg_length_parse (value, LENGTH_DIR_VERTICAL);
+ if ((value = rsvg_property_bag_lookup (atts, "width")))
+ filter->width = rsvg_length_parse (value, LENGTH_DIR_HORIZONTAL);
+ if ((value = rsvg_property_bag_lookup (atts, "height")))
+ filter->height = rsvg_length_parse (value, LENGTH_DIR_VERTICAL);
}
/**
@@ -1024,28 +1022,26 @@ rsvg_filter_primitive_blend_set_atts (RsvgNode * node, RsvgHandle * ctx, RsvgPro
filter = (RsvgFilterPrimitiveBlend *) node;
- if (rsvg_property_bag_size (atts)) {
- if ((value = rsvg_property_bag_lookup (atts, "mode"))) {
- if (!strcmp (value, "multiply"))
- filter->mode = multiply;
- else if (!strcmp (value, "screen"))
- filter->mode = screen;
- else if (!strcmp (value, "darken"))
- filter->mode = darken;
- else if (!strcmp (value, "lighten"))
- filter->mode = lighten;
- else
- filter->mode = normal;
- }
- if ((value = rsvg_property_bag_lookup (atts, "in")))
- g_string_assign (filter->super.in, value);
- if ((value = rsvg_property_bag_lookup (atts, "in2")))
- g_string_assign (filter->in2, value);
- if ((value = rsvg_property_bag_lookup (atts, "result")))
- g_string_assign (filter->super.result, value);
-
- filter_primitive_set_x_y_width_height_atts ((RsvgFilterPrimitive *) filter, atts);
+ if ((value = rsvg_property_bag_lookup (atts, "mode"))) {
+ if (!strcmp (value, "multiply"))
+ filter->mode = multiply;
+ else if (!strcmp (value, "screen"))
+ filter->mode = screen;
+ else if (!strcmp (value, "darken"))
+ filter->mode = darken;
+ else if (!strcmp (value, "lighten"))
+ filter->mode = lighten;
+ else
+ filter->mode = normal;
}
+ if ((value = rsvg_property_bag_lookup (atts, "in")))
+ g_string_assign (filter->super.in, value);
+ if ((value = rsvg_property_bag_lookup (atts, "in2")))
+ g_string_assign (filter->in2, value);
+ if ((value = rsvg_property_bag_lookup (atts, "result")))
+ g_string_assign (filter->super.result, value);
+
+ filter_primitive_set_x_y_width_height_atts ((RsvgFilterPrimitive *) filter, atts);
}
RsvgNode *
@@ -1233,52 +1229,50 @@ rsvg_filter_primitive_convolve_matrix_set_atts (RsvgNode * self,
has_target_x = 0;
has_target_y = 0;
- if (rsvg_property_bag_size (atts)) {
- if ((value = rsvg_property_bag_lookup (atts, "in")))
- g_string_assign (filter->super.in, value);
- if ((value = rsvg_property_bag_lookup (atts, "result")))
- g_string_assign (filter->super.result, value);
+ if ((value = rsvg_property_bag_lookup (atts, "in")))
+ g_string_assign (filter->super.in, value);
+ if ((value = rsvg_property_bag_lookup (atts, "result")))
+ g_string_assign (filter->super.result, value);
- filter_primitive_set_x_y_width_height_atts ((RsvgFilterPrimitive *) filter, atts);
+ filter_primitive_set_x_y_width_height_atts ((RsvgFilterPrimitive *) filter, atts);
- if ((value = rsvg_property_bag_lookup (atts, "targetX"))) {
- has_target_x = 1;
- filter->targetx = atoi (value);
- }
- if ((value = rsvg_property_bag_lookup (atts, "targetY"))) {
- has_target_y = 1;
- filter->targety = atoi (value);
- }
- if ((value = rsvg_property_bag_lookup (atts, "bias")))
- filter->bias = atof (value);
- if ((value = rsvg_property_bag_lookup (atts, "preserveAlpha"))) {
- if (!strcmp (value, "true"))
- filter->preservealpha = TRUE;
- else
- filter->preservealpha = FALSE;
- }
- if ((value = rsvg_property_bag_lookup (atts, "divisor")))
- filter->divisor = atof (value);
- if ((value = rsvg_property_bag_lookup (atts, "order"))) {
- double tempx, tempy;
- rsvg_css_parse_number_optional_number (value, &tempx, &tempy);
- filter->orderx = MAX (tempx, G_MAXINT);
- filter->ordery = MAX (tempy, G_MAXINT);
- }
- if ((value = rsvg_property_bag_lookup (atts, "kernelUnitLength")))
- rsvg_css_parse_number_optional_number (value, &filter->dx, &filter->dy);
+ if ((value = rsvg_property_bag_lookup (atts, "targetX"))) {
+ has_target_x = 1;
+ filter->targetx = atoi (value);
+ }
+ if ((value = rsvg_property_bag_lookup (atts, "targetY"))) {
+ has_target_y = 1;
+ filter->targety = atoi (value);
+ }
+ if ((value = rsvg_property_bag_lookup (atts, "bias")))
+ filter->bias = atof (value);
+ if ((value = rsvg_property_bag_lookup (atts, "preserveAlpha"))) {
+ if (!strcmp (value, "true"))
+ filter->preservealpha = TRUE;
+ else
+ filter->preservealpha = FALSE;
+ }
+ if ((value = rsvg_property_bag_lookup (atts, "divisor")))
+ filter->divisor = atof (value);
+ if ((value = rsvg_property_bag_lookup (atts, "order"))) {
+ double tempx, tempy;
+ rsvg_css_parse_number_optional_number (value, &tempx, &tempy);
+ filter->orderx = MAX (tempx, G_MAXINT);
+ filter->ordery = MAX (tempy, G_MAXINT);
+ }
+ if ((value = rsvg_property_bag_lookup (atts, "kernelUnitLength")))
+ rsvg_css_parse_number_optional_number (value, &filter->dx, &filter->dy);
- if ((value = rsvg_property_bag_lookup (atts, "kernelMatrix")))
- filter->KernelMatrix = rsvg_css_parse_number_list (value, &listlen);
+ if ((value = rsvg_property_bag_lookup (atts, "kernelMatrix")))
+ filter->KernelMatrix = rsvg_css_parse_number_list (value, &listlen);
- if ((value = rsvg_property_bag_lookup (atts, "edgeMode"))) {
- if (!strcmp (value, "wrap"))
- filter->edgemode = 1;
- else if (!strcmp (value, "none"))
- filter->edgemode = 2;
- else
- filter->edgemode = 0;
- }
+ if ((value = rsvg_property_bag_lookup (atts, "edgeMode"))) {
+ if (!strcmp (value, "wrap"))
+ filter->edgemode = 1;
+ else if (!strcmp (value, "none"))
+ filter->edgemode = 2;
+ else
+ filter->edgemode = 0;
}
if ((gint64) listlen != (gint64) filter->orderx * filter->ordery)
@@ -1936,17 +1930,15 @@ rsvg_filter_primitive_gaussian_blur_set_atts (RsvgNode * self,
filter = (RsvgFilterPrimitiveGaussianBlur *) self;
- if (rsvg_property_bag_size (atts)) {
- if ((value = rsvg_property_bag_lookup (atts, "in")))
- g_string_assign (filter->super.in, value);
- if ((value = rsvg_property_bag_lookup (atts, "result")))
- g_string_assign (filter->super.result, value);
+ if ((value = rsvg_property_bag_lookup (atts, "in")))
+ g_string_assign (filter->super.in, value);
+ if ((value = rsvg_property_bag_lookup (atts, "result")))
+ g_string_assign (filter->super.result, value);
- filter_primitive_set_x_y_width_height_atts ((RsvgFilterPrimitive *) filter, atts);
+ filter_primitive_set_x_y_width_height_atts ((RsvgFilterPrimitive *) filter, atts);
- if ((value = rsvg_property_bag_lookup (atts, "stdDeviation")))
- rsvg_css_parse_number_optional_number (value, &filter->sdx, &filter->sdy);
- }
+ if ((value = rsvg_property_bag_lookup (atts, "stdDeviation")))
+ rsvg_css_parse_number_optional_number (value, &filter->sdx, &filter->sdy);
}
RsvgNode *
@@ -2056,19 +2048,17 @@ rsvg_filter_primitive_offset_set_atts (RsvgNode * self, RsvgHandle * ctx, RsvgPr
filter = (RsvgFilterPrimitiveOffset *) self;
- if (rsvg_property_bag_size (atts)) {
- if ((value = rsvg_property_bag_lookup (atts, "in")))
- g_string_assign (filter->super.in, value);
- if ((value = rsvg_property_bag_lookup (atts, "result")))
- g_string_assign (filter->super.result, value);
+ if ((value = rsvg_property_bag_lookup (atts, "in")))
+ g_string_assign (filter->super.in, value);
+ if ((value = rsvg_property_bag_lookup (atts, "result")))
+ g_string_assign (filter->super.result, value);
- filter_primitive_set_x_y_width_height_atts ((RsvgFilterPrimitive *) filter, atts);
+ filter_primitive_set_x_y_width_height_atts ((RsvgFilterPrimitive *) filter, atts);
- if ((value = rsvg_property_bag_lookup (atts, "dx")))
- filter->dx = rsvg_length_parse (value, LENGTH_DIR_HORIZONTAL);
- if ((value = rsvg_property_bag_lookup (atts, "dy")))
- filter->dy = rsvg_length_parse (value, LENGTH_DIR_VERTICAL);
- }
+ if ((value = rsvg_property_bag_lookup (atts, "dx")))
+ filter->dx = rsvg_length_parse (value, LENGTH_DIR_HORIZONTAL);
+ if ((value = rsvg_property_bag_lookup (atts, "dy")))
+ filter->dy = rsvg_length_parse (value, LENGTH_DIR_VERTICAL);
}
RsvgNode *
@@ -2152,12 +2142,10 @@ rsvg_filter_primitive_merge_set_atts (RsvgNode * self, RsvgHandle * ctx, RsvgPro
filter = (RsvgFilterPrimitiveMerge *) self;
- if (rsvg_property_bag_size (atts)) {
- if ((value = rsvg_property_bag_lookup (atts, "result")))
- g_string_assign (filter->super.result, value);
+ if ((value = rsvg_property_bag_lookup (atts, "result")))
+ g_string_assign (filter->super.result, value);
- filter_primitive_set_x_y_width_height_atts ((RsvgFilterPrimitive *) filter, atts);
- }
+ filter_primitive_set_x_y_width_height_atts ((RsvgFilterPrimitive *) filter, atts);
}
RsvgNode *
@@ -2179,11 +2167,10 @@ rsvg_filter_primitive_merge_node_set_atts (RsvgNode * self,
RsvgHandle * ctx, RsvgPropertyBag * atts)
{
const char *value;
- if (rsvg_property_bag_size (atts)) {
- /* see bug 145149 - sodipodi generates bad SVG... */
- if ((value = rsvg_property_bag_lookup (atts, "in")))
- g_string_assign (((RsvgFilterPrimitive *) self)->in, value);
- }
+
+ /* see bug 145149 - sodipodi generates bad SVG... */
+ if ((value = rsvg_property_bag_lookup (atts, "in")))
+ g_string_assign (((RsvgFilterPrimitive *) self)->in, value);
}
static void
@@ -2346,34 +2333,32 @@ rsvg_filter_primitive_color_matrix_set_atts (RsvgNode * self, RsvgHandle * ctx,
type = 0;
- if (rsvg_property_bag_size (atts)) {
- if ((value = rsvg_property_bag_lookup (atts, "in")))
- g_string_assign (filter->super.in, value);
- if ((value = rsvg_property_bag_lookup (atts, "result")))
- g_string_assign (filter->super.result, value);
-
- filter_primitive_set_x_y_width_height_atts ((RsvgFilterPrimitive *) filter, atts);
-
- if ((value = rsvg_property_bag_lookup (atts, "values"))) {
- unsigned int i;
- double *temp = rsvg_css_parse_number_list (value, &listlen);
- filter->KernelMatrix = g_new (int, listlen);
- for (i = 0; i < listlen; i++)
- filter->KernelMatrix[i] = temp[i] * 255.;
- g_free (temp);
- }
- if ((value = rsvg_property_bag_lookup (atts, "type"))) {
- if (!strcmp (value, "matrix"))
- type = 0;
- else if (!strcmp (value, "saturate"))
- type = 1;
- else if (!strcmp (value, "hueRotate"))
- type = 2;
- else if (!strcmp (value, "luminanceToAlpha"))
- type = 3;
- else
- type = 0;
- }
+ if ((value = rsvg_property_bag_lookup (atts, "in")))
+ g_string_assign (filter->super.in, value);
+ if ((value = rsvg_property_bag_lookup (atts, "result")))
+ g_string_assign (filter->super.result, value);
+
+ filter_primitive_set_x_y_width_height_atts ((RsvgFilterPrimitive *) filter, atts);
+
+ if ((value = rsvg_property_bag_lookup (atts, "values"))) {
+ unsigned int i;
+ double *temp = rsvg_css_parse_number_list (value, &listlen);
+ filter->KernelMatrix = g_new (int, listlen);
+ for (i = 0; i < listlen; i++)
+ filter->KernelMatrix[i] = temp[i] * 255.;
+ g_free (temp);
+ }
+ if ((value = rsvg_property_bag_lookup (atts, "type"))) {
+ if (!strcmp (value, "matrix"))
+ type = 0;
+ else if (!strcmp (value, "saturate"))
+ type = 1;
+ else if (!strcmp (value, "hueRotate"))
+ type = 2;
+ else if (!strcmp (value, "luminanceToAlpha"))
+ type = 3;
+ else
+ type = 0;
}
if (type == 0) {
@@ -2653,14 +2638,12 @@ rsvg_filter_primitive_component_transfer_set_atts (RsvgNode * self, RsvgHandle *
filter = (RsvgFilterPrimitiveComponentTransfer *) self;
- if (rsvg_property_bag_size (atts)) {
- if ((value = rsvg_property_bag_lookup (atts, "result")))
- g_string_assign (filter->super.result, value);
- if ((value = rsvg_property_bag_lookup (atts, "in")))
- g_string_assign (filter->super.in, value);
+ if ((value = rsvg_property_bag_lookup (atts, "result")))
+ g_string_assign (filter->super.result, value);
+ if ((value = rsvg_property_bag_lookup (atts, "in")))
+ g_string_assign (filter->super.in, value);
- filter_primitive_set_x_y_width_height_atts ((RsvgFilterPrimitive *) filter, atts);
- }
+ filter_primitive_set_x_y_width_height_atts ((RsvgFilterPrimitive *) filter, atts);
}
RsvgNode *
@@ -2685,43 +2668,41 @@ rsvg_node_component_transfer_function_set_atts (RsvgNode * self,
const char *value;
RsvgNodeComponentTransferFunc *data = (RsvgNodeComponentTransferFunc *) self;
- if (rsvg_property_bag_size (atts)) {
- if ((value = rsvg_property_bag_lookup (atts, "type"))) {
- if (!strcmp (value, "identity"))
- data->function = identity_component_transfer_func;
- else if (!strcmp (value, "table"))
- data->function = table_component_transfer_func;
- else if (!strcmp (value, "discrete"))
- data->function = discrete_component_transfer_func;
- else if (!strcmp (value, "linear"))
- data->function = linear_component_transfer_func;
- else if (!strcmp (value, "gamma"))
- data->function = gamma_component_transfer_func;
- }
- if ((value = rsvg_property_bag_lookup (atts, "tableValues"))) {
- unsigned int i;
- double *temp = rsvg_css_parse_number_list (value,
- &data->nbTableValues);
- data->tableValues = g_new (gint, data->nbTableValues);
- for (i = 0; i < data->nbTableValues; i++)
- data->tableValues[i] = temp[i] * 255.;
- g_free (temp);
- }
- if ((value = rsvg_property_bag_lookup (atts, "slope"))) {
- data->slope = g_ascii_strtod (value, NULL) * 255.;
- }
- if ((value = rsvg_property_bag_lookup (atts, "intercept"))) {
- data->intercept = g_ascii_strtod (value, NULL) * 255.;
- }
- if ((value = rsvg_property_bag_lookup (atts, "amplitude"))) {
- data->amplitude = g_ascii_strtod (value, NULL) * 255.;
- }
- if ((value = rsvg_property_bag_lookup (atts, "exponent"))) {
- data->exponent = g_ascii_strtod (value, NULL);
- }
- if ((value = rsvg_property_bag_lookup (atts, "offset"))) {
- data->offset = g_ascii_strtod (value, NULL) * 255.;
- }
+ if ((value = rsvg_property_bag_lookup (atts, "type"))) {
+ if (!strcmp (value, "identity"))
+ data->function = identity_component_transfer_func;
+ else if (!strcmp (value, "table"))
+ data->function = table_component_transfer_func;
+ else if (!strcmp (value, "discrete"))
+ data->function = discrete_component_transfer_func;
+ else if (!strcmp (value, "linear"))
+ data->function = linear_component_transfer_func;
+ else if (!strcmp (value, "gamma"))
+ data->function = gamma_component_transfer_func;
+ }
+ if ((value = rsvg_property_bag_lookup (atts, "tableValues"))) {
+ unsigned int i;
+ double *temp = rsvg_css_parse_number_list (value,
+ &data->nbTableValues);
+ data->tableValues = g_new (gint, data->nbTableValues);
+ for (i = 0; i < data->nbTableValues; i++)
+ data->tableValues[i] = temp[i] * 255.;
+ g_free (temp);
+ }
+ if ((value = rsvg_property_bag_lookup (atts, "slope"))) {
+ data->slope = g_ascii_strtod (value, NULL) * 255.;
+ }
+ if ((value = rsvg_property_bag_lookup (atts, "intercept"))) {
+ data->intercept = g_ascii_strtod (value, NULL) * 255.;
+ }
+ if ((value = rsvg_property_bag_lookup (atts, "amplitude"))) {
+ data->amplitude = g_ascii_strtod (value, NULL) * 255.;
+ }
+ if ((value = rsvg_property_bag_lookup (atts, "exponent"))) {
+ data->exponent = g_ascii_strtod (value, NULL);
+ }
+ if ((value = rsvg_property_bag_lookup (atts, "offset"))) {
+ data->offset = g_ascii_strtod (value, NULL) * 255.;
}
}
@@ -2851,23 +2832,21 @@ rsvg_filter_primitive_erode_set_atts (RsvgNode * self, RsvgHandle * ctx, RsvgPro
filter = (RsvgFilterPrimitiveErode *) self;
- if (rsvg_property_bag_size (atts)) {
- if ((value = rsvg_property_bag_lookup (atts, "in")))
- g_string_assign (filter->super.in, value);
- if ((value = rsvg_property_bag_lookup (atts, "result")))
- g_string_assign (filter->super.result, value);
+ if ((value = rsvg_property_bag_lookup (atts, "in")))
+ g_string_assign (filter->super.in, value);
+ if ((value = rsvg_property_bag_lookup (atts, "result")))
+ g_string_assign (filter->super.result, value);
- filter_primitive_set_x_y_width_height_atts ((RsvgFilterPrimitive *) filter, atts);
+ filter_primitive_set_x_y_width_height_atts ((RsvgFilterPrimitive *) filter, atts);
- if ((value = rsvg_property_bag_lookup (atts, "radius"))) {
- rsvg_css_parse_number_optional_number (value, &filter->rx, &filter->ry);
- }
- if ((value = rsvg_property_bag_lookup (atts, "operator"))) {
- if (!strcmp (value, "erode"))
- filter->mode = 0;
- else if (!strcmp (value, "dilate"))
- filter->mode = 1;
- }
+ if ((value = rsvg_property_bag_lookup (atts, "radius"))) {
+ rsvg_css_parse_number_optional_number (value, &filter->rx, &filter->ry);
+ }
+ if ((value = rsvg_property_bag_lookup (atts, "operator"))) {
+ if (!strcmp (value, "erode"))
+ filter->mode = 0;
+ else if (!strcmp (value, "dilate"))
+ filter->mode = 1;
}
}
@@ -3069,39 +3048,37 @@ rsvg_filter_primitive_composite_set_atts (RsvgNode * self, RsvgHandle * ctx, Rsv
filter = (RsvgFilterPrimitiveComposite *) self;
- if (rsvg_property_bag_size (atts)) {
- if ((value = rsvg_property_bag_lookup (atts, "operator"))) {
- if (!strcmp (value, "in"))
- filter->mode = COMPOSITE_MODE_IN;
- else if (!strcmp (value, "out"))
- filter->mode = COMPOSITE_MODE_OUT;
- else if (!strcmp (value, "atop"))
- filter->mode = COMPOSITE_MODE_ATOP;
- else if (!strcmp (value, "xor"))
- filter->mode = COMPOSITE_MODE_XOR;
- else if (!strcmp (value, "arithmetic"))
- filter->mode = COMPOSITE_MODE_ARITHMETIC;
- else
- filter->mode = COMPOSITE_MODE_OVER;
- }
- if ((value = rsvg_property_bag_lookup (atts, "in")))
- g_string_assign (filter->super.in, value);
- if ((value = rsvg_property_bag_lookup (atts, "in2")))
- g_string_assign (filter->in2, value);
- if ((value = rsvg_property_bag_lookup (atts, "result")))
- g_string_assign (filter->super.result, value);
-
- filter_primitive_set_x_y_width_height_atts ((RsvgFilterPrimitive *) filter, atts);
-
- if ((value = rsvg_property_bag_lookup (atts, "k1")))
- filter->k1 = g_ascii_strtod (value, NULL) * 255.;
- if ((value = rsvg_property_bag_lookup (atts, "k2")))
- filter->k2 = g_ascii_strtod (value, NULL) * 255.;
- if ((value = rsvg_property_bag_lookup (atts, "k3")))
- filter->k3 = g_ascii_strtod (value, NULL) * 255.;
- if ((value = rsvg_property_bag_lookup (atts, "k4")))
- filter->k4 = g_ascii_strtod (value, NULL) * 255.;
+ if ((value = rsvg_property_bag_lookup (atts, "operator"))) {
+ if (!strcmp (value, "in"))
+ filter->mode = COMPOSITE_MODE_IN;
+ else if (!strcmp (value, "out"))
+ filter->mode = COMPOSITE_MODE_OUT;
+ else if (!strcmp (value, "atop"))
+ filter->mode = COMPOSITE_MODE_ATOP;
+ else if (!strcmp (value, "xor"))
+ filter->mode = COMPOSITE_MODE_XOR;
+ else if (!strcmp (value, "arithmetic"))
+ filter->mode = COMPOSITE_MODE_ARITHMETIC;
+ else
+ filter->mode = COMPOSITE_MODE_OVER;
}
+ if ((value = rsvg_property_bag_lookup (atts, "in")))
+ g_string_assign (filter->super.in, value);
+ if ((value = rsvg_property_bag_lookup (atts, "in2")))
+ g_string_assign (filter->in2, value);
+ if ((value = rsvg_property_bag_lookup (atts, "result")))
+ g_string_assign (filter->super.result, value);
+
+ filter_primitive_set_x_y_width_height_atts ((RsvgFilterPrimitive *) filter, atts);
+
+ if ((value = rsvg_property_bag_lookup (atts, "k1")))
+ filter->k1 = g_ascii_strtod (value, NULL) * 255.;
+ if ((value = rsvg_property_bag_lookup (atts, "k2")))
+ filter->k2 = g_ascii_strtod (value, NULL) * 255.;
+ if ((value = rsvg_property_bag_lookup (atts, "k3")))
+ filter->k3 = g_ascii_strtod (value, NULL) * 255.;
+ if ((value = rsvg_property_bag_lookup (atts, "k4")))
+ filter->k4 = g_ascii_strtod (value, NULL) * 255.;
}
RsvgNode *
@@ -3180,17 +3157,15 @@ rsvg_filter_primitive_flood_set_atts (RsvgNode * self, RsvgHandle * ctx, RsvgPro
const char *value, *id = NULL;
RsvgFilterPrimitive *filter = (RsvgFilterPrimitive *) self;
- if (rsvg_property_bag_size (atts)) {
- if ((value = rsvg_property_bag_lookup (atts, "result")))
- g_string_assign (filter->result, value);
+ if ((value = rsvg_property_bag_lookup (atts, "result")))
+ g_string_assign (filter->result, value);
- filter_primitive_set_x_y_width_height_atts ((RsvgFilterPrimitive *) filter, atts);
+ filter_primitive_set_x_y_width_height_atts ((RsvgFilterPrimitive *) filter, atts);
- if ((value = rsvg_property_bag_lookup (atts, "id")))
- id = value;
+ if ((value = rsvg_property_bag_lookup (atts, "id")))
+ id = value;
- rsvg_parse_style_attrs (ctx, self->state, "feFlood", NULL, id, atts);
- }
+ rsvg_parse_style_attrs (ctx, self->state, "feFlood", NULL, id, atts);
}
RsvgNode *
@@ -3359,23 +3334,21 @@ rsvg_filter_primitive_displacement_map_set_atts (RsvgNode * self, RsvgHandle * c
filter = (RsvgFilterPrimitiveDisplacementMap *) self;
- if (rsvg_property_bag_size (atts)) {
- if ((value = rsvg_property_bag_lookup (atts, "in")))
- g_string_assign (filter->super.in, value);
- if ((value = rsvg_property_bag_lookup (atts, "in2")))
- g_string_assign (filter->in2, value);
- if ((value = rsvg_property_bag_lookup (atts, "result")))
- g_string_assign (filter->super.result, value);
+ if ((value = rsvg_property_bag_lookup (atts, "in")))
+ g_string_assign (filter->super.in, value);
+ if ((value = rsvg_property_bag_lookup (atts, "in2")))
+ g_string_assign (filter->in2, value);
+ if ((value = rsvg_property_bag_lookup (atts, "result")))
+ g_string_assign (filter->super.result, value);
- filter_primitive_set_x_y_width_height_atts ((RsvgFilterPrimitive *) filter, atts);
+ filter_primitive_set_x_y_width_height_atts ((RsvgFilterPrimitive *) filter, atts);
- if ((value = rsvg_property_bag_lookup (atts, "xChannelSelector")))
- filter->xChannelSelector = (value)[0];
- if ((value = rsvg_property_bag_lookup (atts, "yChannelSelector")))
- filter->yChannelSelector = (value)[0];
- if ((value = rsvg_property_bag_lookup (atts, "scale")))
- filter->scale = g_ascii_strtod (value, NULL);
- }
+ if ((value = rsvg_property_bag_lookup (atts, "xChannelSelector")))
+ filter->xChannelSelector = (value)[0];
+ if ((value = rsvg_property_bag_lookup (atts, "yChannelSelector")))
+ filter->yChannelSelector = (value)[0];
+ if ((value = rsvg_property_bag_lookup (atts, "scale")))
+ filter->scale = g_ascii_strtod (value, NULL);
}
RsvgNode *
@@ -3721,25 +3694,23 @@ rsvg_filter_primitive_turbulence_set_atts (RsvgNode * self, RsvgHandle * ctx,
filter = (RsvgFilterPrimitiveTurbulence *) self;
- if (rsvg_property_bag_size (atts)) {
- if ((value = rsvg_property_bag_lookup (atts, "in")))
- g_string_assign (filter->super.in, value);
- if ((value = rsvg_property_bag_lookup (atts, "result")))
- g_string_assign (filter->super.result, value);
+ if ((value = rsvg_property_bag_lookup (atts, "in")))
+ g_string_assign (filter->super.in, value);
+ if ((value = rsvg_property_bag_lookup (atts, "result")))
+ g_string_assign (filter->super.result, value);
- filter_primitive_set_x_y_width_height_atts ((RsvgFilterPrimitive *) filter, atts);
+ filter_primitive_set_x_y_width_height_atts ((RsvgFilterPrimitive *) filter, atts);
- if ((value = rsvg_property_bag_lookup (atts, "baseFrequency")))
- rsvg_css_parse_number_optional_number (value, &filter->fBaseFreqX, &filter->fBaseFreqY);
- if ((value = rsvg_property_bag_lookup (atts, "numOctaves")))
- filter->nNumOctaves = atoi (value);
- if ((value = rsvg_property_bag_lookup (atts, "seed")))
- filter->seed = atoi (value);
- if ((value = rsvg_property_bag_lookup (atts, "stitchTiles")))
- filter->bDoStitching = (!strcmp (value, "stitch"));
- if ((value = rsvg_property_bag_lookup (atts, "type")))
- filter->bFractalSum = (!strcmp (value, "fractalNoise"));
- }
+ if ((value = rsvg_property_bag_lookup (atts, "baseFrequency")))
+ rsvg_css_parse_number_optional_number (value, &filter->fBaseFreqX, &filter->fBaseFreqY);
+ if ((value = rsvg_property_bag_lookup (atts, "numOctaves")))
+ filter->nNumOctaves = atoi (value);
+ if ((value = rsvg_property_bag_lookup (atts, "seed")))
+ filter->seed = atoi (value);
+ if ((value = rsvg_property_bag_lookup (atts, "stitchTiles")))
+ filter->bDoStitching = (!strcmp (value, "stitch"));
+ if ((value = rsvg_property_bag_lookup (atts, "type")))
+ filter->bFractalSum = (!strcmp (value, "fractalNoise"));
}
RsvgNode *
@@ -3947,18 +3918,16 @@ rsvg_filter_primitive_image_set_atts (RsvgNode * self, RsvgHandle * ctx, RsvgPro
filter = (RsvgFilterPrimitiveImage *) self;
filter->ctx = ctx;
- if (rsvg_property_bag_size (atts)) {
- if ((value = rsvg_property_bag_lookup (atts, "in")))
- g_string_assign (filter->super.in, value);
- if ((value = rsvg_property_bag_lookup (atts, "result")))
- g_string_assign (filter->super.result, value);
- if ((value = rsvg_property_bag_lookup (atts, "xlink:href"))) {
- filter->href = g_string_new (NULL);
- g_string_assign (filter->href, value);
- }
-
- filter_primitive_set_x_y_width_height_atts ((RsvgFilterPrimitive *) filter, atts);
+ if ((value = rsvg_property_bag_lookup (atts, "in")))
+ g_string_assign (filter->super.in, value);
+ if ((value = rsvg_property_bag_lookup (atts, "result")))
+ g_string_assign (filter->super.result, value);
+ if ((value = rsvg_property_bag_lookup (atts, "xlink:href"))) {
+ filter->href = g_string_new (NULL);
+ g_string_assign (filter->href, value);
}
+
+ filter_primitive_set_x_y_width_height_atts ((RsvgFilterPrimitive *) filter, atts);
}
RsvgNode *
@@ -4334,28 +4303,26 @@ rsvg_node_light_source_set_atts (RsvgNode * self,
data = (RsvgNodeLightSource *) self;
- if (rsvg_property_bag_size (atts)) {
- if ((value = rsvg_property_bag_lookup (atts, "azimuth")))
- data->azimuth = rsvg_css_parse_angle (value) / 180.0 * M_PI;
- if ((value = rsvg_property_bag_lookup (atts, "elevation")))
- data->elevation = rsvg_css_parse_angle (value) / 180.0 * M_PI;
- if ((value = rsvg_property_bag_lookup (atts, "limitingConeAngle")))
- data->limitingconeAngle = rsvg_css_parse_angle (value) / 180.0 * M_PI;
- if ((value = rsvg_property_bag_lookup (atts, "x")))
- data->x = data->pointsAtX = rsvg_length_parse (value, LENGTH_DIR_HORIZONTAL);
- if ((value = rsvg_property_bag_lookup (atts, "y")))
- data->y = data->pointsAtX = rsvg_length_parse (value, LENGTH_DIR_VERTICAL);
- if ((value = rsvg_property_bag_lookup (atts, "z")))
- data->z = data->pointsAtX = rsvg_length_parse (value, LENGTH_DIR_BOTH);
- if ((value = rsvg_property_bag_lookup (atts, "pointsAtX")))
- data->pointsAtX = rsvg_length_parse (value, LENGTH_DIR_HORIZONTAL);
- if ((value = rsvg_property_bag_lookup (atts, "pointsAtY")))
- data->pointsAtY = rsvg_length_parse (value, LENGTH_DIR_VERTICAL);
- if ((value = rsvg_property_bag_lookup (atts, "pointsAtZ")))
- data->pointsAtZ = rsvg_length_parse (value, LENGTH_DIR_BOTH);
- if ((value = rsvg_property_bag_lookup (atts, "specularExponent")))
- data->specularExponent = g_ascii_strtod (value, NULL);
- }
+ if ((value = rsvg_property_bag_lookup (atts, "azimuth")))
+ data->azimuth = rsvg_css_parse_angle (value) / 180.0 * M_PI;
+ if ((value = rsvg_property_bag_lookup (atts, "elevation")))
+ data->elevation = rsvg_css_parse_angle (value) / 180.0 * M_PI;
+ if ((value = rsvg_property_bag_lookup (atts, "limitingConeAngle")))
+ data->limitingconeAngle = rsvg_css_parse_angle (value) / 180.0 * M_PI;
+ if ((value = rsvg_property_bag_lookup (atts, "x")))
+ data->x = data->pointsAtX = rsvg_length_parse (value, LENGTH_DIR_HORIZONTAL);
+ if ((value = rsvg_property_bag_lookup (atts, "y")))
+ data->y = data->pointsAtX = rsvg_length_parse (value, LENGTH_DIR_VERTICAL);
+ if ((value = rsvg_property_bag_lookup (atts, "z")))
+ data->z = data->pointsAtX = rsvg_length_parse (value, LENGTH_DIR_BOTH);
+ if ((value = rsvg_property_bag_lookup (atts, "pointsAtX")))
+ data->pointsAtX = rsvg_length_parse (value, LENGTH_DIR_HORIZONTAL);
+ if ((value = rsvg_property_bag_lookup (atts, "pointsAtY")))
+ data->pointsAtY = rsvg_length_parse (value, LENGTH_DIR_VERTICAL);
+ if ((value = rsvg_property_bag_lookup (atts, "pointsAtZ")))
+ data->pointsAtZ = rsvg_length_parse (value, LENGTH_DIR_BOTH);
+ if ((value = rsvg_property_bag_lookup (atts, "specularExponent")))
+ data->specularExponent = g_ascii_strtod (value, NULL);
}
RsvgNode *
@@ -4506,24 +4473,21 @@ rsvg_filter_primitive_diffuse_lighting_set_atts (RsvgNode * self, RsvgHandle * c
filter = (RsvgFilterPrimitiveDiffuseLighting *) self;
+ if ((value = rsvg_property_bag_lookup (atts, "in")))
+ g_string_assign (filter->super.in, value);
+ if ((value = rsvg_property_bag_lookup (atts, "result")))
+ g_string_assign (filter->super.result, value);
- if (rsvg_property_bag_size (atts)) {
- if ((value = rsvg_property_bag_lookup (atts, "in")))
- g_string_assign (filter->super.in, value);
- if ((value = rsvg_property_bag_lookup (atts, "result")))
- g_string_assign (filter->super.result, value);
-
- filter_primitive_set_x_y_width_height_atts ((RsvgFilterPrimitive *) filter, atts);
+ filter_primitive_set_x_y_width_height_atts ((RsvgFilterPrimitive *) filter, atts);
- if ((value = rsvg_property_bag_lookup (atts, "kernelUnitLength")))
- rsvg_css_parse_number_optional_number (value, &filter->dx, &filter->dy);
- if ((value = rsvg_property_bag_lookup (atts, "lighting-color")))
- filter->lightingcolor = rsvg_css_parse_color (value, 0);
- if ((value = rsvg_property_bag_lookup (atts, "diffuseConstant")))
- filter->diffuseConstant = g_ascii_strtod (value, NULL);
- if ((value = rsvg_property_bag_lookup (atts, "surfaceScale")))
- filter->surfaceScale = g_ascii_strtod (value, NULL);
- }
+ if ((value = rsvg_property_bag_lookup (atts, "kernelUnitLength")))
+ rsvg_css_parse_number_optional_number (value, &filter->dx, &filter->dy);
+ if ((value = rsvg_property_bag_lookup (atts, "lighting-color")))
+ filter->lightingcolor = rsvg_css_parse_color (value, 0);
+ if ((value = rsvg_property_bag_lookup (atts, "diffuseConstant")))
+ filter->diffuseConstant = g_ascii_strtod (value, NULL);
+ if ((value = rsvg_property_bag_lookup (atts, "surfaceScale")))
+ filter->surfaceScale = g_ascii_strtod (value, NULL);
}
RsvgNode *
@@ -4677,23 +4641,21 @@ rsvg_filter_primitive_specular_lighting_set_atts (RsvgNode * self, RsvgHandle *
filter = (RsvgFilterPrimitiveSpecularLighting *) self;
- if (rsvg_property_bag_size (atts)) {
- if ((value = rsvg_property_bag_lookup (atts, "in")))
- g_string_assign (filter->super.in, value);
- if ((value = rsvg_property_bag_lookup (atts, "result")))
- g_string_assign (filter->super.result, value);
+ if ((value = rsvg_property_bag_lookup (atts, "in")))
+ g_string_assign (filter->super.in, value);
+ if ((value = rsvg_property_bag_lookup (atts, "result")))
+ g_string_assign (filter->super.result, value);
- filter_primitive_set_x_y_width_height_atts ((RsvgFilterPrimitive *) filter, atts);
+ filter_primitive_set_x_y_width_height_atts ((RsvgFilterPrimitive *) filter, atts);
- if ((value = rsvg_property_bag_lookup (atts, "lighting-color")))
- filter->lightingcolor = rsvg_css_parse_color (value, 0);
- if ((value = rsvg_property_bag_lookup (atts, "specularConstant")))
- filter->specularConstant = g_ascii_strtod (value, NULL);
- if ((value = rsvg_property_bag_lookup (atts, "specularExponent")))
- filter->specularExponent = g_ascii_strtod (value, NULL);
- if ((value = rsvg_property_bag_lookup (atts, "surfaceScale")))
- filter->surfaceScale = g_ascii_strtod (value, NULL);
- }
+ if ((value = rsvg_property_bag_lookup (atts, "lighting-color")))
+ filter->lightingcolor = rsvg_css_parse_color (value, 0);
+ if ((value = rsvg_property_bag_lookup (atts, "specularConstant")))
+ filter->specularConstant = g_ascii_strtod (value, NULL);
+ if ((value = rsvg_property_bag_lookup (atts, "specularExponent")))
+ filter->specularExponent = g_ascii_strtod (value, NULL);
+ if ((value = rsvg_property_bag_lookup (atts, "surfaceScale")))
+ filter->surfaceScale = g_ascii_strtod (value, NULL);
}
@@ -4793,14 +4755,12 @@ rsvg_filter_primitive_tile_set_atts (RsvgNode * self, RsvgHandle * ctx, RsvgProp
filter = (RsvgFilterPrimitiveTile *) self;
- if (rsvg_property_bag_size (atts)) {
- if ((value = rsvg_property_bag_lookup (atts, "in")))
- g_string_assign (filter->super.in, value);
- if ((value = rsvg_property_bag_lookup (atts, "result")))
- g_string_assign (filter->super.result, value);
+ if ((value = rsvg_property_bag_lookup (atts, "in")))
+ g_string_assign (filter->super.in, value);
+ if ((value = rsvg_property_bag_lookup (atts, "result")))
+ g_string_assign (filter->super.result, value);
- filter_primitive_set_x_y_width_height_atts ((RsvgFilterPrimitive *) filter, atts);
- }
+ filter_primitive_set_x_y_width_height_atts ((RsvgFilterPrimitive *) filter, atts);
}
RsvgNode *
diff --git a/rsvg-image.c b/rsvg-image.c
index 92fc004..9fa3565 100644
--- a/rsvg-image.c
+++ b/rsvg-image.c
@@ -201,38 +201,36 @@ rsvg_node_image_set_atts (RsvgNode * self, RsvgHandle * ctx, RsvgPropertyBag * a
const char *klazz = NULL, *id = NULL, *value;
RsvgNodeImage *image = (RsvgNodeImage *) self;
- if (rsvg_property_bag_size (atts)) {
- if ((value = rsvg_property_bag_lookup (atts, "x")))
- image->x = rsvg_length_parse (value, LENGTH_DIR_HORIZONTAL);
- if ((value = rsvg_property_bag_lookup (atts, "y")))
- image->y = rsvg_length_parse (value, LENGTH_DIR_VERTICAL);
- if ((value = rsvg_property_bag_lookup (atts, "width")))
- image->w = rsvg_length_parse (value, LENGTH_DIR_HORIZONTAL);
- if ((value = rsvg_property_bag_lookup (atts, "height")))
- image->h = rsvg_length_parse (value, LENGTH_DIR_VERTICAL);
- /* path is used by some older adobe illustrator versions */
- if ((value = rsvg_property_bag_lookup (atts, "path"))
- || (value = rsvg_property_bag_lookup (atts, "xlink:href"))) {
- image->surface = rsvg_cairo_surface_new_from_href (ctx,
- value,
- NULL);
-
- if (!image->surface) {
+ if ((value = rsvg_property_bag_lookup (atts, "x")))
+ image->x = rsvg_length_parse (value, LENGTH_DIR_HORIZONTAL);
+ if ((value = rsvg_property_bag_lookup (atts, "y")))
+ image->y = rsvg_length_parse (value, LENGTH_DIR_VERTICAL);
+ if ((value = rsvg_property_bag_lookup (atts, "width")))
+ image->w = rsvg_length_parse (value, LENGTH_DIR_HORIZONTAL);
+ if ((value = rsvg_property_bag_lookup (atts, "height")))
+ image->h = rsvg_length_parse (value, LENGTH_DIR_VERTICAL);
+ /* path is used by some older adobe illustrator versions */
+ if ((value = rsvg_property_bag_lookup (atts, "path"))
+ || (value = rsvg_property_bag_lookup (atts, "xlink:href"))) {
+ image->surface = rsvg_cairo_surface_new_from_href (ctx,
+ value,
+ NULL);
+
+ if (!image->surface) {
#ifdef G_ENABLE_DEBUG
- g_warning ("Couldn't load image: %s\n", value);
+ g_warning ("Couldn't load image: %s\n", value);
#endif
- }
}
- if ((value = rsvg_property_bag_lookup (atts, "class")))
- klazz = value;
- if ((value = rsvg_property_bag_lookup (atts, "id")))
- id = value;
+ }
+ if ((value = rsvg_property_bag_lookup (atts, "class")))
+ klazz = value;
+ if ((value = rsvg_property_bag_lookup (atts, "id")))
+ id = value;
- if ((value = rsvg_property_bag_lookup (atts, "preserveAspectRatio")))
- image->preserve_aspect_ratio = rsvg_css_parse_aspect_ratio (value);
+ if ((value = rsvg_property_bag_lookup (atts, "preserveAspectRatio")))
+ image->preserve_aspect_ratio = rsvg_css_parse_aspect_ratio (value);
- rsvg_parse_style_attrs (ctx, image->super.state, "image", klazz, id, atts);
- }
+ rsvg_parse_style_attrs (ctx, image->super.state, "image", klazz, id, atts);
}
RsvgNode *
diff --git a/rsvg-marker.c b/rsvg-marker.c
index 2ae5532..1b554f0 100644
--- a/rsvg-marker.c
+++ b/rsvg-marker.c
@@ -59,37 +59,35 @@ rsvg_node_marker_set_atts (RsvgNode * self, RsvgHandle * ctx, RsvgPropertyBag *
RsvgMarker *marker;
marker = (RsvgMarker *) self;
- if (rsvg_property_bag_size (atts)) {
- if ((value = rsvg_property_bag_lookup (atts, "id")))
- id = value;
- if ((value = rsvg_property_bag_lookup (atts, "class")))
- klazz = value;
- if ((value = rsvg_property_bag_lookup (atts, "viewBox")))
- marker->vbox = rsvg_css_parse_vbox (value);
- if ((value = rsvg_property_bag_lookup (atts, "refX")))
- marker->refX = rsvg_length_parse (value, LENGTH_DIR_HORIZONTAL);
- if ((value = rsvg_property_bag_lookup (atts, "refY")))
- marker->refY = rsvg_length_parse (value, LENGTH_DIR_VERTICAL);
- if ((value = rsvg_property_bag_lookup (atts, "markerWidth")))
- marker->width = rsvg_length_parse (value, LENGTH_DIR_HORIZONTAL);
- if ((value = rsvg_property_bag_lookup (atts, "markerHeight")))
- marker->height = rsvg_length_parse (value, LENGTH_DIR_VERTICAL);
- if ((value = rsvg_property_bag_lookup (atts, "orient"))) {
- if (!strcmp (value, "auto"))
- marker->orientAuto = TRUE;
- else
- marker->orient = rsvg_css_parse_angle (value);
- }
- if ((value = rsvg_property_bag_lookup (atts, "markerUnits"))) {
- if (!strcmp (value, "userSpaceOnUse"))
- marker->bbox = FALSE;
- if (!strcmp (value, "strokeWidth"))
- marker->bbox = TRUE;
- }
- if ((value = rsvg_property_bag_lookup (atts, "preserveAspectRatio")))
- marker->preserve_aspect_ratio = rsvg_css_parse_aspect_ratio (value);
- rsvg_parse_style_attrs (ctx, self->state, "marker", klazz, id, atts);
+ if ((value = rsvg_property_bag_lookup (atts, "id")))
+ id = value;
+ if ((value = rsvg_property_bag_lookup (atts, "class")))
+ klazz = value;
+ if ((value = rsvg_property_bag_lookup (atts, "viewBox")))
+ marker->vbox = rsvg_css_parse_vbox (value);
+ if ((value = rsvg_property_bag_lookup (atts, "refX")))
+ marker->refX = rsvg_length_parse (value, LENGTH_DIR_HORIZONTAL);
+ if ((value = rsvg_property_bag_lookup (atts, "refY")))
+ marker->refY = rsvg_length_parse (value, LENGTH_DIR_VERTICAL);
+ if ((value = rsvg_property_bag_lookup (atts, "markerWidth")))
+ marker->width = rsvg_length_parse (value, LENGTH_DIR_HORIZONTAL);
+ if ((value = rsvg_property_bag_lookup (atts, "markerHeight")))
+ marker->height = rsvg_length_parse (value, LENGTH_DIR_VERTICAL);
+ if ((value = rsvg_property_bag_lookup (atts, "orient"))) {
+ if (!strcmp (value, "auto"))
+ marker->orientAuto = TRUE;
+ else
+ marker->orient = rsvg_css_parse_angle (value);
+ }
+ if ((value = rsvg_property_bag_lookup (atts, "markerUnits"))) {
+ if (!strcmp (value, "userSpaceOnUse"))
+ marker->bbox = FALSE;
+ if (!strcmp (value, "strokeWidth"))
+ marker->bbox = TRUE;
}
+ if ((value = rsvg_property_bag_lookup (atts, "preserveAspectRatio")))
+ marker->preserve_aspect_ratio = rsvg_css_parse_aspect_ratio (value);
+ rsvg_parse_style_attrs (ctx, self->state, "marker", klazz, id, atts);
}
RsvgNode *
diff --git a/rsvg-mask.c b/rsvg-mask.c
index 7976186..16d4923 100644
--- a/rsvg-mask.c
+++ b/rsvg-mask.c
@@ -36,33 +36,31 @@ rsvg_mask_set_atts (RsvgNode * self, RsvgHandle * ctx, RsvgPropertyBag * atts)
RsvgMask *mask;
mask = (RsvgMask *) self;
- if (rsvg_property_bag_size (atts)) {
- if ((value = rsvg_property_bag_lookup (atts, "maskUnits"))) {
- if (!strcmp (value, "userSpaceOnUse"))
- mask->maskunits = userSpaceOnUse;
- else
- mask->maskunits = objectBoundingBox;
- }
- if ((value = rsvg_property_bag_lookup (atts, "maskContentUnits"))) {
- if (!strcmp (value, "objectBoundingBox"))
- mask->contentunits = objectBoundingBox;
- else
- mask->contentunits = userSpaceOnUse;
- }
- if ((value = rsvg_property_bag_lookup (atts, "x")))
- mask->x = rsvg_length_parse (value, LENGTH_DIR_HORIZONTAL);
- if ((value = rsvg_property_bag_lookup (atts, "y")))
- mask->y = rsvg_length_parse (value, LENGTH_DIR_VERTICAL);
- if ((value = rsvg_property_bag_lookup (atts, "width")))
- mask->width = rsvg_length_parse (value, LENGTH_DIR_HORIZONTAL);
- if ((value = rsvg_property_bag_lookup (atts, "height")))
- mask->height = rsvg_length_parse (value, LENGTH_DIR_VERTICAL);
- if ((value = rsvg_property_bag_lookup (atts, "id")))
- id = value;
-
- if ((value = rsvg_property_bag_lookup (atts, "class")))
- klazz = value;
+ if ((value = rsvg_property_bag_lookup (atts, "maskUnits"))) {
+ if (!strcmp (value, "userSpaceOnUse"))
+ mask->maskunits = userSpaceOnUse;
+ else
+ mask->maskunits = objectBoundingBox;
}
+ if ((value = rsvg_property_bag_lookup (atts, "maskContentUnits"))) {
+ if (!strcmp (value, "objectBoundingBox"))
+ mask->contentunits = objectBoundingBox;
+ else
+ mask->contentunits = userSpaceOnUse;
+ }
+ if ((value = rsvg_property_bag_lookup (atts, "x")))
+ mask->x = rsvg_length_parse (value, LENGTH_DIR_HORIZONTAL);
+ if ((value = rsvg_property_bag_lookup (atts, "y")))
+ mask->y = rsvg_length_parse (value, LENGTH_DIR_VERTICAL);
+ if ((value = rsvg_property_bag_lookup (atts, "width")))
+ mask->width = rsvg_length_parse (value, LENGTH_DIR_HORIZONTAL);
+ if ((value = rsvg_property_bag_lookup (atts, "height")))
+ mask->height = rsvg_length_parse (value, LENGTH_DIR_VERTICAL);
+ if ((value = rsvg_property_bag_lookup (atts, "id")))
+ id = value;
+
+ if ((value = rsvg_property_bag_lookup (atts, "class")))
+ klazz = value;
rsvg_parse_style_attrs (ctx, mask->super.state, "mask", klazz, id, atts);
}
@@ -109,19 +107,17 @@ rsvg_clip_path_set_atts (RsvgNode * self, RsvgHandle * ctx, RsvgPropertyBag * at
clip_path = (RsvgClipPath *) self;
- if (rsvg_property_bag_size (atts)) {
- if ((value = rsvg_property_bag_lookup (atts, "clipPathUnits"))) {
- if (!strcmp (value, "objectBoundingBox"))
- clip_path->units = objectBoundingBox;
- else
- clip_path->units = userSpaceOnUse;
- }
- if ((value = rsvg_property_bag_lookup (atts, "id")))
- id = value;
-
- if ((value = rsvg_property_bag_lookup (atts, "class")))
- klazz = value;
+ if ((value = rsvg_property_bag_lookup (atts, "clipPathUnits"))) {
+ if (!strcmp (value, "objectBoundingBox"))
+ clip_path->units = objectBoundingBox;
+ else
+ clip_path->units = userSpaceOnUse;
}
+ if ((value = rsvg_property_bag_lookup (atts, "id")))
+ id = value;
+
+ if ((value = rsvg_property_bag_lookup (atts, "class")))
+ klazz = value;
rsvg_parse_style_attrs (ctx, clip_path->super.state, "clipPath", klazz, id, atts);
}
diff --git a/rsvg-paint-server.c b/rsvg-paint-server.c
index fe070c6..abdf022 100644
--- a/rsvg-paint-server.c
+++ b/rsvg-paint-server.c
@@ -160,44 +160,43 @@ rsvg_stop_set_atts (RsvgNode * self, RsvgHandle * ctx, RsvgPropertyBag * atts)
stop = (RsvgGradientStop *) self;
- if (rsvg_property_bag_size (atts)) {
- if ((value = rsvg_property_bag_lookup (atts, "offset"))) {
- /* either a number [0,1] or a percentage */
- RsvgLength length = rsvg_length_parse (value, LENGTH_DIR_BOTH);
-
- if (length.unit == LENGTH_UNIT_DEFAULT || length.unit == LENGTH_UNIT_PERCENT) {
- double offset;
-
- offset = length.length;
-
- if (offset < 0.0)
- offset = 0.0;
- else if (offset > 1.0)
- offset = 1.0;
-
- stop->offset = offset;
- stop->is_valid = TRUE;
- } else {
- /* Only default and percent values are allowed */
- stop->is_valid = FALSE;
- }
- }
- if ((value = rsvg_property_bag_lookup (atts, "style")))
- rsvg_parse_style (ctx, self->state, value);
+ if ((value = rsvg_property_bag_lookup (atts, "offset"))) {
+ /* either a number [0,1] or a percentage */
+ RsvgLength length = rsvg_length_parse (value, LENGTH_DIR_BOTH);
- if ((value = rsvg_property_bag_lookup (atts, "stop-color"))) {
- has_stop_color = TRUE;
+ if (length.unit == LENGTH_UNIT_DEFAULT || length.unit == LENGTH_UNIT_PERCENT) {
+ double offset;
- if (!strcmp (value, "currentColor"))
- is_current_color = TRUE;
- }
+ offset = length.length;
+
+ if (offset < 0.0)
+ offset = 0.0;
+ else if (offset > 1.0)
+ offset = 1.0;
- if ((value = rsvg_property_bag_lookup (atts, "stop-opacity"))) {
- has_stop_opacity = TRUE;
+ stop->offset = offset;
+ stop->is_valid = TRUE;
+ } else {
+ /* Only default and percent values are allowed */
+ stop->is_valid = FALSE;
}
+ }
+ if ((value = rsvg_property_bag_lookup (atts, "style")))
+ rsvg_parse_style (ctx, self->state, value);
+
+ if ((value = rsvg_property_bag_lookup (atts, "stop-color"))) {
+ has_stop_color = TRUE;
- rsvg_parse_style_pairs (ctx, self->state, atts);
+ if (!strcmp (value, "currentColor"))
+ is_current_color = TRUE;
}
+
+ if ((value = rsvg_property_bag_lookup (atts, "stop-opacity"))) {
+ has_stop_opacity = TRUE;
+ }
+
+ rsvg_parse_style_pairs (ctx, self->state, atts);
+
self->parent = ctx->priv->currentnode;
state = rsvg_state_new ();
@@ -242,48 +241,46 @@ rsvg_linear_gradient_set_atts (RsvgNode * self, RsvgHandle * ctx, RsvgPropertyBa
RsvgLinearGradient *grad = (RsvgLinearGradient *) self;
const char *value;
- if (rsvg_property_bag_size (atts)) {
- if ((value = rsvg_property_bag_lookup (atts, "x1"))) {
- grad->x1 = rsvg_length_parse (value, LENGTH_DIR_HORIZONTAL);
- grad->hasx1 = TRUE;
- }
- if ((value = rsvg_property_bag_lookup (atts, "y1"))) {
- grad->y1 = rsvg_length_parse (value, LENGTH_DIR_VERTICAL);
- grad->hasy1 = TRUE;
- }
- if ((value = rsvg_property_bag_lookup (atts, "x2"))) {
- grad->x2 = rsvg_length_parse (value, LENGTH_DIR_HORIZONTAL);
- grad->hasx2 = TRUE;
- }
- if ((value = rsvg_property_bag_lookup (atts, "y2"))) {
- grad->y2 = rsvg_length_parse (value, LENGTH_DIR_VERTICAL);
- grad->hasy2 = TRUE;
- }
- if ((value = rsvg_property_bag_lookup (atts, "spreadMethod"))) {
- if (!strcmp (value, "pad")) {
- grad->spread = CAIRO_EXTEND_PAD;
- } else if (!strcmp (value, "reflect")) {
- grad->spread = CAIRO_EXTEND_REFLECT;
- } else if (!strcmp (value, "repeat")) {
- grad->spread = CAIRO_EXTEND_REPEAT;
- }
- grad->hasspread = TRUE;
- }
- g_free (grad->fallback);
- grad->fallback = g_strdup (rsvg_property_bag_lookup (atts, "xlink:href"));
- if ((value = rsvg_property_bag_lookup (atts, "gradientTransform"))) {
- rsvg_parse_transform (&grad->affine, value);
- grad->hastransform = TRUE;
- }
- if ((value = rsvg_property_bag_lookup (atts, "gradientUnits"))) {
- if (!strcmp (value, "userSpaceOnUse"))
- grad->obj_bbox = FALSE;
- else if (!strcmp (value, "objectBoundingBox"))
- grad->obj_bbox = TRUE;
- grad->hasbbox = TRUE;
- }
- rsvg_parse_style_attrs (ctx, self->state, "linearGradient", NULL, NULL, atts);
+ if ((value = rsvg_property_bag_lookup (atts, "x1"))) {
+ grad->x1 = rsvg_length_parse (value, LENGTH_DIR_HORIZONTAL);
+ grad->hasx1 = TRUE;
+ }
+ if ((value = rsvg_property_bag_lookup (atts, "y1"))) {
+ grad->y1 = rsvg_length_parse (value, LENGTH_DIR_VERTICAL);
+ grad->hasy1 = TRUE;
+ }
+ if ((value = rsvg_property_bag_lookup (atts, "x2"))) {
+ grad->x2 = rsvg_length_parse (value, LENGTH_DIR_HORIZONTAL);
+ grad->hasx2 = TRUE;
}
+ if ((value = rsvg_property_bag_lookup (atts, "y2"))) {
+ grad->y2 = rsvg_length_parse (value, LENGTH_DIR_VERTICAL);
+ grad->hasy2 = TRUE;
+ }
+ if ((value = rsvg_property_bag_lookup (atts, "spreadMethod"))) {
+ if (!strcmp (value, "pad")) {
+ grad->spread = CAIRO_EXTEND_PAD;
+ } else if (!strcmp (value, "reflect")) {
+ grad->spread = CAIRO_EXTEND_REFLECT;
+ } else if (!strcmp (value, "repeat")) {
+ grad->spread = CAIRO_EXTEND_REPEAT;
+ }
+ grad->hasspread = TRUE;
+ }
+ g_free (grad->fallback);
+ grad->fallback = g_strdup (rsvg_property_bag_lookup (atts, "xlink:href"));
+ if ((value = rsvg_property_bag_lookup (atts, "gradientTransform"))) {
+ rsvg_parse_transform (&grad->affine, value);
+ grad->hastransform = TRUE;
+ }
+ if ((value = rsvg_property_bag_lookup (atts, "gradientUnits"))) {
+ if (!strcmp (value, "userSpaceOnUse"))
+ grad->obj_bbox = FALSE;
+ else if (!strcmp (value, "objectBoundingBox"))
+ grad->obj_bbox = TRUE;
+ grad->hasbbox = TRUE;
+ }
+ rsvg_parse_style_attrs (ctx, self->state, "linearGradient", NULL, NULL, atts);
}
static void
@@ -320,55 +317,53 @@ rsvg_radial_gradient_set_atts (RsvgNode * self, RsvgHandle * ctx, RsvgPropertyBa
RsvgRadialGradient *grad = (RsvgRadialGradient *) self;
const char *value;
- if (rsvg_property_bag_size (atts)) {
- if ((value = rsvg_property_bag_lookup (atts, "cx"))) {
- grad->cx = rsvg_length_parse (value, LENGTH_DIR_HORIZONTAL);
- grad->hascx = TRUE;
- if (!grad->hasfx)
- grad->fx = grad->cx;
- }
- if ((value = rsvg_property_bag_lookup (atts, "cy"))) {
- grad->cy = rsvg_length_parse (value, LENGTH_DIR_VERTICAL);
- grad->hascy = TRUE;
- if (!grad->hasfy)
- grad->fy = grad->cy;
- }
- if ((value = rsvg_property_bag_lookup (atts, "r"))) {
- grad->r = rsvg_length_parse (value, LENGTH_DIR_BOTH);
- grad->hasr = TRUE;
- }
- if ((value = rsvg_property_bag_lookup (atts, "fx"))) {
- grad->fx = rsvg_length_parse (value, LENGTH_DIR_HORIZONTAL);
- grad->hasfx = TRUE;
- }
- if ((value = rsvg_property_bag_lookup (atts, "fy"))) {
- grad->fy = rsvg_length_parse (value, LENGTH_DIR_VERTICAL);
- grad->hasfy = TRUE;
- }
- g_free (grad->fallback);
- grad->fallback = g_strdup (rsvg_property_bag_lookup (atts, "xlink:href"));
- if ((value = rsvg_property_bag_lookup (atts, "gradientTransform"))) {
- rsvg_parse_transform (&grad->affine, value);
- grad->hastransform = TRUE;
- }
- if ((value = rsvg_property_bag_lookup (atts, "spreadMethod"))) {
- if (!strcmp (value, "pad"))
- grad->spread = CAIRO_EXTEND_PAD;
- else if (!strcmp (value, "reflect"))
- grad->spread = CAIRO_EXTEND_REFLECT;
- else if (!strcmp (value, "repeat"))
- grad->spread = CAIRO_EXTEND_REPEAT;
- grad->hasspread = TRUE;
- }
- if ((value = rsvg_property_bag_lookup (atts, "gradientUnits"))) {
- if (!strcmp (value, "userSpaceOnUse"))
- grad->obj_bbox = FALSE;
- else if (!strcmp (value, "objectBoundingBox"))
- grad->obj_bbox = TRUE;
- grad->hasbbox = TRUE;
- }
- rsvg_parse_style_attrs (ctx, self->state, "radialGradient", NULL, NULL, atts);
+ if ((value = rsvg_property_bag_lookup (atts, "cx"))) {
+ grad->cx = rsvg_length_parse (value, LENGTH_DIR_HORIZONTAL);
+ grad->hascx = TRUE;
+ if (!grad->hasfx)
+ grad->fx = grad->cx;
+ }
+ if ((value = rsvg_property_bag_lookup (atts, "cy"))) {
+ grad->cy = rsvg_length_parse (value, LENGTH_DIR_VERTICAL);
+ grad->hascy = TRUE;
+ if (!grad->hasfy)
+ grad->fy = grad->cy;
+ }
+ if ((value = rsvg_property_bag_lookup (atts, "r"))) {
+ grad->r = rsvg_length_parse (value, LENGTH_DIR_BOTH);
+ grad->hasr = TRUE;
+ }
+ if ((value = rsvg_property_bag_lookup (atts, "fx"))) {
+ grad->fx = rsvg_length_parse (value, LENGTH_DIR_HORIZONTAL);
+ grad->hasfx = TRUE;
+ }
+ if ((value = rsvg_property_bag_lookup (atts, "fy"))) {
+ grad->fy = rsvg_length_parse (value, LENGTH_DIR_VERTICAL);
+ grad->hasfy = TRUE;
}
+ g_free (grad->fallback);
+ grad->fallback = g_strdup (rsvg_property_bag_lookup (atts, "xlink:href"));
+ if ((value = rsvg_property_bag_lookup (atts, "gradientTransform"))) {
+ rsvg_parse_transform (&grad->affine, value);
+ grad->hastransform = TRUE;
+ }
+ if ((value = rsvg_property_bag_lookup (atts, "spreadMethod"))) {
+ if (!strcmp (value, "pad"))
+ grad->spread = CAIRO_EXTEND_PAD;
+ else if (!strcmp (value, "reflect"))
+ grad->spread = CAIRO_EXTEND_REFLECT;
+ else if (!strcmp (value, "repeat"))
+ grad->spread = CAIRO_EXTEND_REPEAT;
+ grad->hasspread = TRUE;
+ }
+ if ((value = rsvg_property_bag_lookup (atts, "gradientUnits"))) {
+ if (!strcmp (value, "userSpaceOnUse"))
+ grad->obj_bbox = FALSE;
+ else if (!strcmp (value, "objectBoundingBox"))
+ grad->obj_bbox = TRUE;
+ grad->hasbbox = TRUE;
+ }
+ rsvg_parse_style_attrs (ctx, self->state, "radialGradient", NULL, NULL, atts);
}
static void
@@ -403,51 +398,49 @@ rsvg_pattern_set_atts (RsvgNode * self, RsvgHandle * ctx, RsvgPropertyBag * atts
RsvgPattern *pattern = (RsvgPattern *) self;
const char *value;
- if (rsvg_property_bag_size (atts)) {
- if ((value = rsvg_property_bag_lookup (atts, "viewBox"))) {
- pattern->vbox = rsvg_css_parse_vbox (value);
- pattern->hasvbox = TRUE;
- }
- if ((value = rsvg_property_bag_lookup (atts, "x"))) {
- pattern->x = rsvg_length_parse (value, LENGTH_DIR_HORIZONTAL);
- pattern->hasx = TRUE;
- }
- if ((value = rsvg_property_bag_lookup (atts, "y"))) {
- pattern->y = rsvg_length_parse (value, LENGTH_DIR_VERTICAL);
- pattern->hasy = TRUE;
- }
- if ((value = rsvg_property_bag_lookup (atts, "width"))) {
- pattern->width = rsvg_length_parse (value, LENGTH_DIR_HORIZONTAL);
- pattern->haswidth = TRUE;
- }
- if ((value = rsvg_property_bag_lookup (atts, "height"))) {
- pattern->height = rsvg_length_parse (value, LENGTH_DIR_VERTICAL);
- pattern->hasheight = TRUE;
- }
- g_free (pattern->fallback);
- pattern->fallback = g_strdup (rsvg_property_bag_lookup (atts, "xlink:href"));
- if ((value = rsvg_property_bag_lookup (atts, "patternTransform"))) {
- rsvg_parse_transform (&pattern->affine, value);
- pattern->hastransform = TRUE;
- }
- if ((value = rsvg_property_bag_lookup (atts, "patternUnits"))) {
- if (!strcmp (value, "userSpaceOnUse"))
- pattern->obj_bbox = FALSE;
- else if (!strcmp (value, "objectBoundingBox"))
- pattern->obj_bbox = TRUE;
- pattern->hasbbox = TRUE;
- }
- if ((value = rsvg_property_bag_lookup (atts, "patternContentUnits"))) {
- if (!strcmp (value, "userSpaceOnUse"))
- pattern->obj_cbbox = FALSE;
- else if (!strcmp (value, "objectBoundingBox"))
- pattern->obj_cbbox = TRUE;
- pattern->hascbox = TRUE;
- }
- if ((value = rsvg_property_bag_lookup (atts, "preserveAspectRatio"))) {
- pattern->preserve_aspect_ratio = rsvg_css_parse_aspect_ratio (value);
- pattern->hasaspect = TRUE;
- }
+ if ((value = rsvg_property_bag_lookup (atts, "viewBox"))) {
+ pattern->vbox = rsvg_css_parse_vbox (value);
+ pattern->hasvbox = TRUE;
+ }
+ if ((value = rsvg_property_bag_lookup (atts, "x"))) {
+ pattern->x = rsvg_length_parse (value, LENGTH_DIR_HORIZONTAL);
+ pattern->hasx = TRUE;
+ }
+ if ((value = rsvg_property_bag_lookup (atts, "y"))) {
+ pattern->y = rsvg_length_parse (value, LENGTH_DIR_VERTICAL);
+ pattern->hasy = TRUE;
+ }
+ if ((value = rsvg_property_bag_lookup (atts, "width"))) {
+ pattern->width = rsvg_length_parse (value, LENGTH_DIR_HORIZONTAL);
+ pattern->haswidth = TRUE;
+ }
+ if ((value = rsvg_property_bag_lookup (atts, "height"))) {
+ pattern->height = rsvg_length_parse (value, LENGTH_DIR_VERTICAL);
+ pattern->hasheight = TRUE;
+ }
+ g_free (pattern->fallback);
+ pattern->fallback = g_strdup (rsvg_property_bag_lookup (atts, "xlink:href"));
+ if ((value = rsvg_property_bag_lookup (atts, "patternTransform"))) {
+ rsvg_parse_transform (&pattern->affine, value);
+ pattern->hastransform = TRUE;
+ }
+ if ((value = rsvg_property_bag_lookup (atts, "patternUnits"))) {
+ if (!strcmp (value, "userSpaceOnUse"))
+ pattern->obj_bbox = FALSE;
+ else if (!strcmp (value, "objectBoundingBox"))
+ pattern->obj_bbox = TRUE;
+ pattern->hasbbox = TRUE;
+ }
+ if ((value = rsvg_property_bag_lookup (atts, "patternContentUnits"))) {
+ if (!strcmp (value, "userSpaceOnUse"))
+ pattern->obj_cbbox = FALSE;
+ else if (!strcmp (value, "objectBoundingBox"))
+ pattern->obj_cbbox = TRUE;
+ pattern->hascbox = TRUE;
+ }
+ if ((value = rsvg_property_bag_lookup (atts, "preserveAspectRatio"))) {
+ pattern->preserve_aspect_ratio = rsvg_css_parse_aspect_ratio (value);
+ pattern->hasaspect = TRUE;
}
}
diff --git a/rsvg-shapes.c b/rsvg-shapes.c
index 484a9f6..c559fc7 100644
--- a/rsvg-shapes.c
+++ b/rsvg-shapes.c
@@ -76,19 +76,17 @@ rsvg_node_path_set_atts (RsvgNode * self, RsvgHandle * ctx, RsvgPropertyBag * at
const char *klazz = NULL, *id = NULL, *value;
RsvgNodePath *path = (RsvgNodePath *) self;
- if (rsvg_property_bag_size (atts)) {
- if ((value = rsvg_property_bag_lookup (atts, "d"))) {
- if (path->builder)
- rsvg_path_builder_destroy (path->builder);
- path->builder = rsvg_path_parser_from_str_into_builder (value);
- }
- if ((value = rsvg_property_bag_lookup (atts, "class")))
- klazz = value;
- if ((value = rsvg_property_bag_lookup (atts, "id")))
- id = value;
-
- rsvg_parse_style_attrs (ctx, self->state, "path", klazz, id, atts);
+ if ((value = rsvg_property_bag_lookup (atts, "d"))) {
+ if (path->builder)
+ rsvg_path_builder_destroy (path->builder);
+ path->builder = rsvg_path_parser_from_str_into_builder (value);
}
+ if ((value = rsvg_property_bag_lookup (atts, "class")))
+ klazz = value;
+ if ((value = rsvg_property_bag_lookup (atts, "id")))
+ id = value;
+
+ rsvg_parse_style_attrs (ctx, self->state, "path", klazz, id, atts);
}
RsvgNode *
@@ -122,24 +120,22 @@ _rsvg_node_poly_set_atts (RsvgNode * self, RsvgHandle * ctx, RsvgPropertyBag * a
RsvgNodePoly *poly = (RsvgNodePoly *) self;
const char *klazz = NULL, *id = NULL, *value;
- if (rsvg_property_bag_size (atts)) {
- /* support for svg < 1.0 which used verts */
- if ((value = rsvg_property_bag_lookup (atts, "verts"))
- || (value = rsvg_property_bag_lookup (atts, "points"))) {
- if (poly->builder)
- rsvg_path_builder_destroy (poly->builder);
- poly->builder = _rsvg_node_poly_create_builder (value,
- RSVG_NODE_TYPE (self) == RSVG_NODE_TYPE_POLYGON);
- }
- if ((value = rsvg_property_bag_lookup (atts, "class")))
- klazz = value;
- if ((value = rsvg_property_bag_lookup (atts, "id")))
- id = value;
-
- rsvg_parse_style_attrs (ctx, self->state,
- RSVG_NODE_TYPE (self) == RSVG_NODE_TYPE_POLYLINE ? "polyline" : "polygon",
- klazz, id, atts);
+ /* support for svg < 1.0 which used verts */
+ if ((value = rsvg_property_bag_lookup (atts, "verts"))
+ || (value = rsvg_property_bag_lookup (atts, "points"))) {
+ if (poly->builder)
+ rsvg_path_builder_destroy (poly->builder);
+ poly->builder = _rsvg_node_poly_create_builder (value,
+ RSVG_NODE_TYPE (self) == RSVG_NODE_TYPE_POLYGON);
}
+ if ((value = rsvg_property_bag_lookup (atts, "class")))
+ klazz = value;
+ if ((value = rsvg_property_bag_lookup (atts, "id")))
+ id = value;
+
+ rsvg_parse_style_attrs (ctx, self->state,
+ RSVG_NODE_TYPE (self) == RSVG_NODE_TYPE_POLYLINE ? "polyline" : "polygon",
+ klazz, id, atts);
}
@@ -251,22 +247,20 @@ _rsvg_node_line_set_atts (RsvgNode * self, RsvgHandle * ctx, RsvgPropertyBag * a
const char *klazz = NULL, *id = NULL, *value;
RsvgNodeLine *line = (RsvgNodeLine *) self;
- if (rsvg_property_bag_size (atts)) {
- if ((value = rsvg_property_bag_lookup (atts, "x1")))
- line->x1 = rsvg_length_parse (value, LENGTH_DIR_HORIZONTAL);
- if ((value = rsvg_property_bag_lookup (atts, "y1")))
- line->y1 = rsvg_length_parse (value, LENGTH_DIR_VERTICAL);
- if ((value = rsvg_property_bag_lookup (atts, "x2")))
- line->x2 = rsvg_length_parse (value, LENGTH_DIR_HORIZONTAL);
- if ((value = rsvg_property_bag_lookup (atts, "y2")))
- line->y2 = rsvg_length_parse (value, LENGTH_DIR_VERTICAL);
- if ((value = rsvg_property_bag_lookup (atts, "class")))
- klazz = value;
- if ((value = rsvg_property_bag_lookup (atts, "id")))
- id = value;
-
- rsvg_parse_style_attrs (ctx, self->state, "line", klazz, id, atts);
- }
+ if ((value = rsvg_property_bag_lookup (atts, "x1")))
+ line->x1 = rsvg_length_parse (value, LENGTH_DIR_HORIZONTAL);
+ if ((value = rsvg_property_bag_lookup (atts, "y1")))
+ line->y1 = rsvg_length_parse (value, LENGTH_DIR_VERTICAL);
+ if ((value = rsvg_property_bag_lookup (atts, "x2")))
+ line->x2 = rsvg_length_parse (value, LENGTH_DIR_HORIZONTAL);
+ if ((value = rsvg_property_bag_lookup (atts, "y2")))
+ line->y2 = rsvg_length_parse (value, LENGTH_DIR_VERTICAL);
+ if ((value = rsvg_property_bag_lookup (atts, "class")))
+ klazz = value;
+ if ((value = rsvg_property_bag_lookup (atts, "id")))
+ id = value;
+
+ rsvg_parse_style_attrs (ctx, self->state, "line", klazz, id, atts);
}
static void
@@ -320,30 +314,28 @@ _rsvg_node_rect_set_atts (RsvgNode * self, RsvgHandle * ctx, RsvgPropertyBag * a
RsvgNodeRect *rect = (RsvgNodeRect *) self;
/* FIXME: negative w/h/rx/ry is an error, per http://www.w3.org/TR/SVG11/shapes.html#RectElement */
- if (rsvg_property_bag_size (atts)) {
- if ((value = rsvg_property_bag_lookup (atts, "x")))
- rect->x = rsvg_length_parse (value, LENGTH_DIR_HORIZONTAL);
- if ((value = rsvg_property_bag_lookup (atts, "y")))
- rect->y = rsvg_length_parse (value, LENGTH_DIR_VERTICAL);
- if ((value = rsvg_property_bag_lookup (atts, "width")))
- rect->w = rsvg_length_parse (value, LENGTH_DIR_HORIZONTAL);
- if ((value = rsvg_property_bag_lookup (atts, "height")))
- rect->h = rsvg_length_parse (value, LENGTH_DIR_VERTICAL);
- if ((value = rsvg_property_bag_lookup (atts, "rx"))) {
- rect->rx = rsvg_length_parse (value, LENGTH_DIR_HORIZONTAL);
- rect->got_rx = TRUE;
- }
- if ((value = rsvg_property_bag_lookup (atts, "ry"))) {
- rect->ry = rsvg_length_parse (value, LENGTH_DIR_VERTICAL);
- rect->got_ry = TRUE;
- }
- if ((value = rsvg_property_bag_lookup (atts, "class")))
- klazz = value;
- if ((value = rsvg_property_bag_lookup (atts, "id")))
- id = value;
-
- rsvg_parse_style_attrs (ctx, self->state, "rect", klazz, id, atts);
+ if ((value = rsvg_property_bag_lookup (atts, "x")))
+ rect->x = rsvg_length_parse (value, LENGTH_DIR_HORIZONTAL);
+ if ((value = rsvg_property_bag_lookup (atts, "y")))
+ rect->y = rsvg_length_parse (value, LENGTH_DIR_VERTICAL);
+ if ((value = rsvg_property_bag_lookup (atts, "width")))
+ rect->w = rsvg_length_parse (value, LENGTH_DIR_HORIZONTAL);
+ if ((value = rsvg_property_bag_lookup (atts, "height")))
+ rect->h = rsvg_length_parse (value, LENGTH_DIR_VERTICAL);
+ if ((value = rsvg_property_bag_lookup (atts, "rx"))) {
+ rect->rx = rsvg_length_parse (value, LENGTH_DIR_HORIZONTAL);
+ rect->got_rx = TRUE;
+ }
+ if ((value = rsvg_property_bag_lookup (atts, "ry"))) {
+ rect->ry = rsvg_length_parse (value, LENGTH_DIR_VERTICAL);
+ rect->got_ry = TRUE;
}
+ if ((value = rsvg_property_bag_lookup (atts, "class")))
+ klazz = value;
+ if ((value = rsvg_property_bag_lookup (atts, "id")))
+ id = value;
+
+ rsvg_parse_style_attrs (ctx, self->state, "rect", klazz, id, atts);
}
static void
@@ -511,20 +503,18 @@ _rsvg_node_circle_set_atts (RsvgNode * self, RsvgHandle * ctx, RsvgPropertyBag *
const char *klazz = NULL, *id = NULL, *value;
RsvgNodeCircle *circle = (RsvgNodeCircle *) self;
- if (rsvg_property_bag_size (atts)) {
- if ((value = rsvg_property_bag_lookup (atts, "cx")))
- circle->cx = rsvg_length_parse (value, LENGTH_DIR_HORIZONTAL);
- if ((value = rsvg_property_bag_lookup (atts, "cy")))
- circle->cy = rsvg_length_parse (value, LENGTH_DIR_VERTICAL);
- if ((value = rsvg_property_bag_lookup (atts, "r")))
- circle->r = rsvg_length_parse (value, LENGTH_DIR_BOTH);
- if ((value = rsvg_property_bag_lookup (atts, "class")))
- klazz = value;
- if ((value = rsvg_property_bag_lookup (atts, "id")))
- id = value;
-
- rsvg_parse_style_attrs (ctx, self->state, "circle", klazz, id, atts);
- }
+ if ((value = rsvg_property_bag_lookup (atts, "cx")))
+ circle->cx = rsvg_length_parse (value, LENGTH_DIR_HORIZONTAL);
+ if ((value = rsvg_property_bag_lookup (atts, "cy")))
+ circle->cy = rsvg_length_parse (value, LENGTH_DIR_VERTICAL);
+ if ((value = rsvg_property_bag_lookup (atts, "r")))
+ circle->r = rsvg_length_parse (value, LENGTH_DIR_BOTH);
+ if ((value = rsvg_property_bag_lookup (atts, "class")))
+ klazz = value;
+ if ((value = rsvg_property_bag_lookup (atts, "id")))
+ id = value;
+
+ rsvg_parse_style_attrs (ctx, self->state, "circle", klazz, id, atts);
}
static void
@@ -601,22 +591,20 @@ _rsvg_node_ellipse_set_atts (RsvgNode * self, RsvgHandle * ctx, RsvgPropertyBag
const char *klazz = NULL, *id = NULL, *value;
RsvgNodeEllipse *ellipse = (RsvgNodeEllipse *) self;
- if (rsvg_property_bag_size (atts)) {
- if ((value = rsvg_property_bag_lookup (atts, "cx")))
- ellipse->cx = rsvg_length_parse (value, LENGTH_DIR_HORIZONTAL);
- if ((value = rsvg_property_bag_lookup (atts, "cy")))
- ellipse->cy = rsvg_length_parse (value, LENGTH_DIR_VERTICAL);
- if ((value = rsvg_property_bag_lookup (atts, "rx")))
- ellipse->rx = rsvg_length_parse (value, LENGTH_DIR_HORIZONTAL);
- if ((value = rsvg_property_bag_lookup (atts, "ry")))
- ellipse->ry = rsvg_length_parse (value, LENGTH_DIR_VERTICAL);
- if ((value = rsvg_property_bag_lookup (atts, "class")))
- klazz = value;
- if ((value = rsvg_property_bag_lookup (atts, "id")))
- id = value;
-
- rsvg_parse_style_attrs (ctx, self->state, "ellipse", klazz, id, atts);
- }
+ if ((value = rsvg_property_bag_lookup (atts, "cx")))
+ ellipse->cx = rsvg_length_parse (value, LENGTH_DIR_HORIZONTAL);
+ if ((value = rsvg_property_bag_lookup (atts, "cy")))
+ ellipse->cy = rsvg_length_parse (value, LENGTH_DIR_VERTICAL);
+ if ((value = rsvg_property_bag_lookup (atts, "rx")))
+ ellipse->rx = rsvg_length_parse (value, LENGTH_DIR_HORIZONTAL);
+ if ((value = rsvg_property_bag_lookup (atts, "ry")))
+ ellipse->ry = rsvg_length_parse (value, LENGTH_DIR_VERTICAL);
+ if ((value = rsvg_property_bag_lookup (atts, "class")))
+ klazz = value;
+ if ((value = rsvg_property_bag_lookup (atts, "id")))
+ id = value;
+
+ rsvg_parse_style_attrs (ctx, self->state, "ellipse", klazz, id, atts);
}
static void
diff --git a/rsvg-structure.c b/rsvg-structure.c
index 54dfd0a..b1d9d64 100644
--- a/rsvg-structure.c
+++ b/rsvg-structure.c
@@ -123,14 +123,12 @@ rsvg_node_group_set_atts (RsvgNode * self, RsvgHandle * ctx, RsvgPropertyBag * a
{
const char *klazz = NULL, *id = NULL, *value;
- if (rsvg_property_bag_size (atts)) {
- if ((value = rsvg_property_bag_lookup (atts, "class")))
- klazz = value;
- if ((value = rsvg_property_bag_lookup (atts, "id")))
- id = value;
+ if ((value = rsvg_property_bag_lookup (atts, "class")))
+ klazz = value;
+ if ((value = rsvg_property_bag_lookup (atts, "id")))
+ id = value;
- rsvg_parse_style_attrs (ctx, self->state, "g", klazz, id, atts);
- }
+ rsvg_parse_style_attrs (ctx, self->state, "g", klazz, id, atts);
}
RsvgNode *
@@ -312,31 +310,29 @@ rsvg_node_svg_set_atts (RsvgNode * self, RsvgHandle * ctx, RsvgPropertyBag * att
const char *value;
RsvgNodeSvg *svg = (RsvgNodeSvg *) self;
- if (rsvg_property_bag_size (atts)) {
- if ((value = rsvg_property_bag_lookup (atts, "viewBox")))
- svg->vbox = rsvg_css_parse_vbox (value);
-
- if ((value = rsvg_property_bag_lookup (atts, "preserveAspectRatio")))
- svg->preserve_aspect_ratio = rsvg_css_parse_aspect_ratio (value);
- if ((value = rsvg_property_bag_lookup (atts, "width")))
- svg->w = rsvg_length_parse (value, LENGTH_DIR_HORIZONTAL);
- if ((value = rsvg_property_bag_lookup (atts, "height")))
- svg->h = rsvg_length_parse (value, LENGTH_DIR_VERTICAL);
- /*
- * x & y attributes have no effect on outermost svg
- * http://www.w3.org/TR/SVG/struct.html#SVGElement
- */
- if (self->parent && (value = rsvg_property_bag_lookup (atts, "x")))
- svg->x = rsvg_length_parse (value, LENGTH_DIR_HORIZONTAL);
- if (self->parent && (value = rsvg_property_bag_lookup (atts, "y")))
- svg->y = rsvg_length_parse (value, LENGTH_DIR_VERTICAL);
-
- /*
- * style element is not loaded yet here, so we need to store those attribues
- * to be applied later.
- */
- svg->atts = rsvg_property_bag_dup(atts);
- }
+ if ((value = rsvg_property_bag_lookup (atts, "viewBox")))
+ svg->vbox = rsvg_css_parse_vbox (value);
+
+ if ((value = rsvg_property_bag_lookup (atts, "preserveAspectRatio")))
+ svg->preserve_aspect_ratio = rsvg_css_parse_aspect_ratio (value);
+ if ((value = rsvg_property_bag_lookup (atts, "width")))
+ svg->w = rsvg_length_parse (value, LENGTH_DIR_HORIZONTAL);
+ if ((value = rsvg_property_bag_lookup (atts, "height")))
+ svg->h = rsvg_length_parse (value, LENGTH_DIR_VERTICAL);
+ /*
+ * x & y attributes have no effect on outermost svg
+ * http://www.w3.org/TR/SVG/struct.html#SVGElement
+ */
+ if (self->parent && (value = rsvg_property_bag_lookup (atts, "x")))
+ svg->x = rsvg_length_parse (value, LENGTH_DIR_HORIZONTAL);
+ if (self->parent && (value = rsvg_property_bag_lookup (atts, "y")))
+ svg->y = rsvg_length_parse (value, LENGTH_DIR_VERTICAL);
+
+ /*
+ * style element is not loaded yet here, so we need to store those attribues
+ * to be applied later.
+ */
+ svg->atts = rsvg_property_bag_dup(atts);
}
void
@@ -399,26 +395,25 @@ rsvg_node_use_set_atts (RsvgNode * self, RsvgHandle * ctx, RsvgPropertyBag * att
RsvgNodeUse *use;
use = (RsvgNodeUse *) self;
- if (rsvg_property_bag_size (atts)) {
- if ((value = rsvg_property_bag_lookup (atts, "x")))
- use->x = rsvg_length_parse (value, LENGTH_DIR_HORIZONTAL);
- if ((value = rsvg_property_bag_lookup (atts, "y")))
- use->y = rsvg_length_parse (value, LENGTH_DIR_VERTICAL);
- if ((value = rsvg_property_bag_lookup (atts, "width")))
- use->w = rsvg_length_parse (value, LENGTH_DIR_HORIZONTAL);
- if ((value = rsvg_property_bag_lookup (atts, "height")))
- use->h = rsvg_length_parse (value, LENGTH_DIR_VERTICAL);
- if ((value = rsvg_property_bag_lookup (atts, "class")))
- klazz = value;
- if ((value = rsvg_property_bag_lookup (atts, "id")))
- id = value;
- if ((value = rsvg_property_bag_lookup (atts, "xlink:href"))) {
- g_free (use->link);
- use->link = g_strdup (value);
- }
- rsvg_parse_style_attrs (ctx, self->state, "use", klazz, id, atts);
+ if ((value = rsvg_property_bag_lookup (atts, "x")))
+ use->x = rsvg_length_parse (value, LENGTH_DIR_HORIZONTAL);
+ if ((value = rsvg_property_bag_lookup (atts, "y")))
+ use->y = rsvg_length_parse (value, LENGTH_DIR_VERTICAL);
+ if ((value = rsvg_property_bag_lookup (atts, "width")))
+ use->w = rsvg_length_parse (value, LENGTH_DIR_HORIZONTAL);
+ if ((value = rsvg_property_bag_lookup (atts, "height")))
+ use->h = rsvg_length_parse (value, LENGTH_DIR_VERTICAL);
+ if ((value = rsvg_property_bag_lookup (atts, "class")))
+ klazz = value;
+ if ((value = rsvg_property_bag_lookup (atts, "id")))
+ id = value;
+
+ if ((value = rsvg_property_bag_lookup (atts, "xlink:href"))) {
+ g_free (use->link);
+ use->link = g_strdup (value);
}
+ rsvg_parse_style_attrs (ctx, self->state, "use", klazz, id, atts);
}
@@ -446,20 +441,17 @@ rsvg_node_symbol_set_atts (RsvgNode * self, RsvgHandle * ctx, RsvgPropertyBag *
const char *klazz = NULL, *value, *id = NULL;
- if (rsvg_property_bag_size (atts)) {
- if ((value = rsvg_property_bag_lookup (atts, "class")))
- klazz = value;
- if ((value = rsvg_property_bag_lookup (atts, "id")))
- id = value;
+ if ((value = rsvg_property_bag_lookup (atts, "class")))
+ klazz = value;
+ if ((value = rsvg_property_bag_lookup (atts, "id")))
+ id = value;
- if ((value = rsvg_property_bag_lookup (atts, "viewBox")))
- symbol->vbox = rsvg_css_parse_vbox (value);
- if ((value = rsvg_property_bag_lookup (atts, "preserveAspectRatio")))
- symbol->preserve_aspect_ratio = rsvg_css_parse_aspect_ratio (value);
-
- rsvg_parse_style_attrs (ctx, self->state, "symbol", klazz, id, atts);
- }
+ if ((value = rsvg_property_bag_lookup (atts, "viewBox")))
+ symbol->vbox = rsvg_css_parse_vbox (value);
+ if ((value = rsvg_property_bag_lookup (atts, "preserveAspectRatio")))
+ symbol->preserve_aspect_ratio = rsvg_css_parse_aspect_ratio (value);
+ rsvg_parse_style_attrs (ctx, self->state, "symbol", klazz, id, atts);
}
diff --git a/rsvg-text.c b/rsvg-text.c
index ad0c31a..159bcc1 100644
--- a/rsvg-text.c
+++ b/rsvg-text.c
@@ -151,16 +151,14 @@ _rsvg_node_text_set_atts (RsvgNode * self, RsvgHandle * ctx, RsvgPropertyBag * a
const char *klazz = NULL, *id = NULL, *value;
RsvgNodeText *text = (RsvgNodeText *) self;
- if (rsvg_property_bag_size (atts)) {
- set_text_common_atts (text, atts);
+ set_text_common_atts (text, atts);
- if ((value = rsvg_property_bag_lookup (atts, "class")))
- klazz = value;
- if ((value = rsvg_property_bag_lookup (atts, "id")))
- id = value;
+ if ((value = rsvg_property_bag_lookup (atts, "class")))
+ klazz = value;
+ if ((value = rsvg_property_bag_lookup (atts, "id")))
+ id = value;
- rsvg_parse_style_attrs (ctx, self->state, "text", klazz, id, atts);
- }
+ rsvg_parse_style_attrs (ctx, self->state, "text", klazz, id, atts);
}
static void
@@ -393,16 +391,14 @@ _rsvg_node_tspan_set_atts (RsvgNode * self, RsvgHandle * ctx, RsvgPropertyBag *
const char *klazz = NULL, *id = NULL, *value;
RsvgNodeText *text = (RsvgNodeText *) self;
- if (rsvg_property_bag_size (atts)) {
- set_text_common_atts (text, atts);
+ set_text_common_atts (text, atts);
- if ((value = rsvg_property_bag_lookup (atts, "class")))
- klazz = value;
- if ((value = rsvg_property_bag_lookup (atts, "id")))
- id = value;
+ if ((value = rsvg_property_bag_lookup (atts, "class")))
+ klazz = value;
+ if ((value = rsvg_property_bag_lookup (atts, "id")))
+ id = value;
- rsvg_parse_style_attrs (ctx, self->state, "tspan", klazz, id, atts);
- }
+ rsvg_parse_style_attrs (ctx, self->state, "tspan", klazz, id, atts);
}
RsvgNode *
@@ -469,11 +465,9 @@ _rsvg_node_tref_set_atts (RsvgNode * self, RsvgHandle * ctx, RsvgPropertyBag * a
const char *value;
RsvgNodeTref *text = (RsvgNodeTref *) self;
- if (rsvg_property_bag_size (atts)) {
- if ((value = rsvg_property_bag_lookup (atts, "xlink:href"))) {
- g_free (text->link);
- text->link = g_strdup (value);
- }
+ if ((value = rsvg_property_bag_lookup (atts, "xlink:href"))) {
+ g_free (text->link);
+ text->link = g_strdup (value);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]