summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJabier Arraiza <jabier.arraiza@marker.es>2018-04-21 22:09:55 +0000
committerJabier Arraiza <jabier.arraiza@marker.es>2018-04-21 22:09:55 +0000
commit5e4fd475d24a74972756cd9b10ef0812d98d14a8 (patch)
tree40f441e9b77f4fcdda3af3376440b4a398e67d27 /src
parentUpdate POT files (diff)
downloadinkscape-5e4fd475d24a74972756cd9b10ef0812d98d14a8.tar.gz
inkscape-5e4fd475d24a74972756cd9b10ef0812d98d14a8.zip
Fixes for d promote to property
Diffstat (limited to 'src')
-rw-r--r--src/object/sp-path.cpp70
-rw-r--r--src/style-internal.cpp4
2 files changed, 36 insertions, 38 deletions
diff --git a/src/object/sp-path.cpp b/src/object/sp-path.cpp
index a4724a8e7..b47f63c9e 100644
--- a/src/object/sp-path.cpp
+++ b/src/object/sp-path.cpp
@@ -125,7 +125,40 @@ void SPPath::build(SPDocument *document, Inkscape::XML::Node *repr) {
sp_conn_end_pair_build(this);
SPShape::build(document, repr);
+ // Our code depends on 'd' being an attribute (LPE's, etc.). To support 'd' as a property, we
+ // check it here (after the style property has been evaluated, this allows us to properly
+ // handled precedence of property vs attribute). If we read in a 'd' set by styling, convert it
+ // to an attribute. We'll convert it back on output.
+
+ d_source = style->d.style_src;
+
+ if (style->d.set &&
+
+ (d_source == SP_STYLE_SRC_STYLE_PROP || d_source == SP_STYLE_SRC_STYLE_SHEET) ) {
+ if (style->d.value) {
+ Geom::PathVector pv = sp_svg_read_pathv(style->d.value);
+ SPCurve *curve = new SPCurve(pv);
+ if (curve) {
+
+ // Update curve
+ this->setCurveInsync(curve, TRUE);
+ curve->unref();
+
+ // Convert from property to attribute (convert back on write)
+ getRepr()->setAttribute("d", style->d.value);
+
+ SPCSSAttr *css = sp_repr_css_attr( getRepr(), "style");
+ sp_repr_css_unset_property ( css, "d");
+ sp_repr_css_set ( getRepr(), css, "style" );
+ sp_repr_css_attr_unref ( css );
+
+ style->d.style_src = SP_STYLE_SRC_ATTRIBUTE;
+ } else {
+ // Do nothing... don't overwrite 'd' from attribute
+ }
+ }
+ }
// this->readAttr( "inkscape:original-d" ); // bug #1299948
// Why we take the long way of doing this probably needs some explaining:
//
@@ -279,44 +312,7 @@ void SPPath::update(SPCtx *ctx, guint flags) {
flags &= ~SP_OBJECT_USER_MODIFIED_FLAG_B; // since we change the description, it's not a "just translation" anymore
}
- // Our code depends on 'd' being an attribute (LPE's, etc.). To support 'd' as a property, we
- // check it here (after the style property has been evaluated, this allows us to properly
- // handled precedence of property vs attribute). If we read in a 'd' set by styling, convert it
- // to an attribute. We'll convert it back on output.
-
- d_source = style->d.style_src;
-
- if (style->d.set &&
-
- (d_source == SP_STYLE_SRC_STYLE_PROP || d_source == SP_STYLE_SRC_STYLE_SHEET) ) {
-
- if (style->d.value) {
-
- Geom::PathVector pv = sp_svg_read_pathv(style->d.value);
- SPCurve *curve = new SPCurve(pv);
- if (curve) {
-
- // Update curve
- this->setCurveInsync(curve, TRUE);
- curve->unref();
-
- // Convert from property to attribute (convert back on write)
- getRepr()->setAttribute("d", style->d.value);
-
- SPCSSAttr *css = sp_repr_css_attr( getRepr(), "style");
- sp_repr_css_unset_property ( css, "d");
- sp_repr_css_set ( getRepr(), css, "style" );
- sp_repr_css_attr_unref ( css );
-
- style->d.style_src = SP_STYLE_SRC_ATTRIBUTE;
- } else {
- // Do nothing... don't overwrite 'd' from attribute
- }
- }
- }
-
SPShape::update(ctx, flags);
-
this->connEndPair.update();
}
diff --git a/src/style-internal.cpp b/src/style-internal.cpp
index ef4fbb2ec..f8f2042c4 100644
--- a/src/style-internal.cpp
+++ b/src/style-internal.cpp
@@ -1030,7 +1030,6 @@ SPINumeric::write( guint const flags, SPStyleSrc const &style_src_req, SPIBase c
void
SPIString::read( gchar const *str ) {
-
if( !str ) return;
if (!strcmp(str, "inherit")) {
@@ -1042,6 +1041,9 @@ SPIString::read( gchar const *str ) {
inherit = false;
Glib::ustring str_temp(str);
+ if( name.compare( "d" ) == 0 && style_src == SP_STYLE_SRC_ATTRIBUTE) {
+ set = false;
+ }
if( name.compare( "font-family" ) == 0 ) {
// Family names may be quoted in CSS, internally we use unquoted names.
css_font_family_unquote( str_temp );