summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a67d097)
raw | patch | inline | side by side (parent: a67d097)
author | buliabyak <buliabyak@users.sourceforge.net> | |
Fri, 19 Sep 2008 21:28:55 +0000 (21:28 +0000) | ||
committer | buliabyak <buliabyak@users.sourceforge.net> | |
Fri, 19 Sep 2008 21:28:55 +0000 (21:28 +0000) |
src/style.cpp | patch | blob | history |
diff --git a/src/style.cpp b/src/style.cpp
index 2b24f37ed63a4057e192621a2a1b5c6082b5914f..9667648006691ef69b49e07faa91721230eb1bb6 100644 (file)
--- a/src/style.cpp
+++ b/src/style.cpp
p += sp_style_write_ienum(p, c + BMAX - p, "text-anchor", enum_text_anchor, &style->text_anchor, NULL, flags);
/// \todo fixme: Per type methods need default flag too (lauris)
- p += sp_style_write_iscale24(p, c + BMAX - p, "opacity", &style->opacity, NULL, flags);
- p += sp_style_write_ipaint(p, c + BMAX - p, "color", &style->color, NULL, flags);
+
+ if (style->opacity.value != SP_SCALE24_MAX) {
+ p += sp_style_write_iscale24(p, c + BMAX - p, "opacity", &style->opacity, NULL, flags);
+ }
+
+ if (!style->color.noneSet) { // CSS does not permit "none" for color
+ p += sp_style_write_ipaint(p, c + BMAX - p, "color", &style->color, NULL, flags);
+ }
p += sp_style_write_ipaint(p, c + BMAX - p, "fill", &style->fill, NULL, flags);
// if fill:none, skip writing fill properties
}
}
+ bool marker_none = false;
+ gchar *master = style->marker[SP_MARKER_LOC].value;
if (style->marker[SP_MARKER_LOC].set) {
p += g_snprintf(p, c + BMAX - p, "marker:%s;", style->marker[SP_MARKER_LOC].value);
} else if (flags == SP_STYLE_FLAG_ALWAYS) {
p += g_snprintf(p, c + BMAX - p, "marker:none;");
+ marker_none = true;
}
- if (style->marker[SP_MARKER_LOC_START].set) {
+ if (style->marker[SP_MARKER_LOC_START].set
+ && (!master || strcmp(master, style->marker[SP_MARKER_LOC_START].value))) {
p += g_snprintf(p, c + BMAX - p, "marker-start:%s;", style->marker[SP_MARKER_LOC_START].value);
- } else if (flags == SP_STYLE_FLAG_ALWAYS) {
+ } else if (flags == SP_STYLE_FLAG_ALWAYS && !marker_none) {
p += g_snprintf(p, c + BMAX - p, "marker-start:none;");
}
- if (style->marker[SP_MARKER_LOC_MID].set) {
+ if (style->marker[SP_MARKER_LOC_MID].set
+ && (!master || strcmp(master, style->marker[SP_MARKER_LOC_MID].value))) {
p += g_snprintf(p, c + BMAX - p, "marker-mid:%s;", style->marker[SP_MARKER_LOC_MID].value);
- } else if (flags == SP_STYLE_FLAG_ALWAYS) {
+ } else if (flags == SP_STYLE_FLAG_ALWAYS && !marker_none) {
p += g_snprintf(p, c + BMAX - p, "marker-mid:none;");
}
- if (style->marker[SP_MARKER_LOC_END].set) {
+ if (style->marker[SP_MARKER_LOC_END].set
+ && (!master || strcmp(master, style->marker[SP_MARKER_LOC_END].value))) {
p += g_snprintf(p, c + BMAX - p, "marker-end:%s;", style->marker[SP_MARKER_LOC_END].value);
- } else if (flags == SP_STYLE_FLAG_ALWAYS) {
+ } else if (flags == SP_STYLE_FLAG_ALWAYS && !marker_none) {
p += g_snprintf(p, c + BMAX - p, "marker-end:none;");
}
@@ -2385,7 +2397,10 @@ sp_style_write_difference(SPStyle const *const from, SPStyle const *const to)
if (from->opacity.set && from->opacity.value != SP_SCALE24_MAX) {
p += sp_style_write_iscale24(p, c + BMAX - p, "opacity", &from->opacity, &to->opacity, SP_STYLE_FLAG_IFSET);
}
- p += sp_style_write_ipaint(p, c + BMAX - p, "color", &from->color, &to->color, SP_STYLE_FLAG_IFSET);
+
+ if (!from->color.noneSet) { // CSS does not permit "none" for color
+ p += sp_style_write_ipaint(p, c + BMAX - p, "color", &from->color, &to->color, SP_STYLE_FLAG_IFSET);
+ }
p += sp_style_write_ipaint(p, c + BMAX - p, "fill", &from->fill, &to->fill, SP_STYLE_FLAG_IFDIFF);
// if fill:none, skip writing fill properties
@@ -2440,16 +2455,17 @@ sp_style_write_difference(SPStyle const *const from, SPStyle const *const to)
}
/* markers */
- if (from->marker[SP_MARKER_LOC].value != NULL) {
- p += g_snprintf(p, c + BMAX - p, "marker:%s;", from->marker[SP_MARKER_LOC].value);
+ gchar *master = from->marker[SP_MARKER_LOC].value;
+ if (master != NULL) {
+ p += g_snprintf(p, c + BMAX - p, "marker:%s;", master);
}
- if (from->marker[SP_MARKER_LOC_START].value != NULL) {
+ if (from->marker[SP_MARKER_LOC_START].value != NULL && (!master || strcmp(master, from->marker[SP_MARKER_LOC_START].value))) {
p += g_snprintf(p, c + BMAX - p, "marker-start:%s;", from->marker[SP_MARKER_LOC_START].value);
}
- if (from->marker[SP_MARKER_LOC_MID].value != NULL) {
+ if (from->marker[SP_MARKER_LOC_MID].value != NULL && (!master || strcmp(master, from->marker[SP_MARKER_LOC_MID].value))) {
p += g_snprintf(p, c + BMAX - p, "marker-mid:%s;", from->marker[SP_MARKER_LOC_MID].value);
}
- if (from->marker[SP_MARKER_LOC_END].value != NULL) {
+ if (from->marker[SP_MARKER_LOC_END].value != NULL && (!master || strcmp(master, from->marker[SP_MARKER_LOC_END].value))) {
p += g_snprintf(p, c + BMAX - p, "marker-end:%s;", from->marker[SP_MARKER_LOC_END].value);
}
if (is_url(sp_repr_css_property(css, "color-profile", NULL))) sp_repr_css_set_property(css, "color-profile", NULL);
if (is_url(sp_repr_css_property(css, "cursor", NULL))) sp_repr_css_set_property(css, "cursor", NULL);
if (is_url(sp_repr_css_property(css, "filter", NULL))) sp_repr_css_set_property(css, "filter", NULL);
+ if (is_url(sp_repr_css_property(css, "marker", NULL))) sp_repr_css_set_property(css, "marker", NULL);
if (is_url(sp_repr_css_property(css, "marker-start", NULL))) sp_repr_css_set_property(css, "marker-start", NULL);
if (is_url(sp_repr_css_property(css, "marker-mid", NULL))) sp_repr_css_set_property(css, "marker-mid", NULL);
if (is_url(sp_repr_css_property(css, "marker-end", NULL))) sp_repr_css_set_property(css, "marker-end", NULL);