summaryrefslogtreecommitdiffstats
path: root/src/style.cpp
diff options
context:
space:
mode:
authorTavmjong Bah <tavmjong@free.fr>2017-10-13 11:05:06 +0000
committerTavmjong Bah <tavmjong@free.fr>2017-10-13 11:05:06 +0000
commit4cc0e04066adecf85955a9d6be972a4ba4d83f8b (patch)
tree4ece71cb0de254f5b214bac6c9d6285ae763fcfe /src/style.cpp
parentMigrate style-test to GTest. (diff)
downloadinkscape-4cc0e04066adecf85955a9d6be972a4ba4d83f8b.tar.gz
inkscape-4cc0e04066adecf85955a9d6be972a4ba4d83f8b.zip
Implement !important rule handling for inline-style. Work from Jabier.
Added "!important" rule tests to style-test.cpp.
Diffstat (limited to 'src/style.cpp')
-rw-r--r--src/style.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/style.cpp b/src/style.cpp
index 36d669301..d5bbcd9ce 100644
--- a/src/style.cpp
+++ b/src/style.cpp
@@ -1153,9 +1153,16 @@ SPStyle::_mergeDecl( CRDeclaration const *const decl, SPStyleSrc const &source
* convert to string. Alternatively, set from CRTerm directly rather
* than converting to string.
*/
+
guchar *const str_value_unsigned = cr_term_to_string(decl->value);
gchar *const str_value = reinterpret_cast<gchar *>(str_value_unsigned);
- readIfUnset( prop_idx, str_value, source );
+
+ // Add "!important" rule if necessary as this is not handled by cr_term_to_string().
+ gchar const * important = decl->important ? " !important" : "";
+ Inkscape::CSSOStringStream os;
+ os << str_value << important;
+
+ readIfUnset( prop_idx, os.str().c_str(), source );
g_free(str_value);
}
}