diff --git a/src/xml/repr-css.cpp b/src/xml/repr-css.cpp
index afa0ca2ef36a8b439443cc36a8f58886eca162f0..be125f45358481f40259bb75bbc6ad297897872f 100644 (file)
--- a/src/xml/repr-css.cpp
+++ b/src/xml/repr-css.cpp
#include <glibmm/ustring.h>
#include "xml/repr.h"
+#include "xml/simple-document.h"
#include "xml/simple-node.h"
#include "style.h"
#include "libcroco/cr-sel-eng.h"
struct SPCSSAttrImpl : public SimpleNode, public SPCSSAttr {
public:
- SPCSSAttrImpl() : SimpleNode(g_quark_from_static_string("css")) {}
+ SPCSSAttrImpl(Document *doc)
+ : SimpleNode(g_quark_from_static_string("css"), doc) {}
+ SPCSSAttrImpl(SPCSSAttrImpl const &other, Document *doc)
+ : SimpleNode(other, doc) {}
NodeType type() const { return Inkscape::XML::ELEMENT_NODE; }
protected:
- SimpleNode *_duplicate(Document* /*doc*/) const { return new SPCSSAttrImpl(*this); }
+ SimpleNode *_duplicate(Document* doc) const { return new SPCSSAttrImpl(*this, doc); }
};
static void sp_repr_css_add_components(SPCSSAttr *css, Node *repr, gchar const *attr);
+
SPCSSAttr *
sp_repr_css_attr_new()
{
- return new SPCSSAttrImpl();
+ static Inkscape::XML::Document *attr_doc=NULL;
+ if (!attr_doc) {
+ attr_doc = new Inkscape::XML::SimpleDocument();
+ }
+ return new SPCSSAttrImpl(attr_doc);
}
void
g_assert(css != NULL);
g_assert(name != NULL);
- sp_repr_set_attr((Node *) css, name, value);
+ ((Node *) css)->setAttribute(name, value, false);
}
void
g_assert(css != NULL);
g_assert(name != NULL);
- sp_repr_set_attr((Node *) css, name, "inkscape:unset");
+ ((Node *) css)->setAttribute(name, "inkscape:unset", false);
}
double
guchar *const str_value_unsigned = cr_term_to_string(decl->value);
gchar *const str_value = reinterpret_cast<gchar *>(str_value_unsigned);
gchar *value_unquoted = attribute_unquote (str_value); // libcroco returns strings quoted in ""
- sp_repr_set_attr((Node *) css, decl->property->stryng->str, value_unquoted);
+ ((Node *) css)->setAttribute(decl->property->stryng->str, value_unquoted, false);
g_free(value_unquoted);
g_free(str_value);
}