diff options
Diffstat (limited to 'src/style.cpp')
| -rw-r--r-- | src/style.cpp | 39 |
1 files changed, 36 insertions, 3 deletions
diff --git a/src/style.cpp b/src/style.cpp index 36d669301..608cca1e6 100644 --- a/src/style.cpp +++ b/src/style.cpp @@ -134,9 +134,10 @@ SPStyle::SPStyle(SPDocument *document_in, SPObject *object_in) : // SVG 2 Text Wrapping shape_inside( "shape-inside" ), // SPIString - //shape_outside( "shape-outside" ), // SPIString + shape_subtract( "shape-subtract" ), // SPIString shape_padding( "shape-padding", 0.0 ), // SPILength for now - //shape_margin( "shape-margin", 0.0 ), // SPILength for now + shape_margin( "shape-margin", 0.0 ), // SPILength for now + inline_size( "inline-size", 0.0 ), // SPILength for now text_decoration(), text_decoration_line(), @@ -252,6 +253,8 @@ SPStyle::SPStyle(SPDocument *document_in, SPObject *object_in) : stroke_width.setStylePointer( this ); stroke_dashoffset.setStylePointer( this ); shape_padding.setStylePointer( this ); + shape_margin.setStylePointer( this ); + inline_size.setStylePointer( this ); // Properties that depend on 'color' text_decoration_color.setStylePointer( this ); @@ -323,7 +326,10 @@ SPStyle::SPStyle(SPDocument *document_in, SPObject *object_in) : _properties.push_back( &white_space ); _properties.push_back( &shape_inside ); + _properties.push_back( &shape_subtract ); _properties.push_back( &shape_padding ); + _properties.push_back( &shape_margin ); + _properties.push_back( &inline_size ); _properties.push_back( &clip_rule ); _properties.push_back( &display ); @@ -799,9 +805,18 @@ SPStyle::readIfUnset( gint id, gchar const *val, SPStyleSrc const &source ) { case SP_PROP_SHAPE_INSIDE: shape_inside.readIfUnset( val, source ); break; + case SP_PROP_SHAPE_SUBTRACT: + shape_subtract.readIfUnset( val, source ); + break; case SP_PROP_SHAPE_PADDING: shape_padding.readIfUnset( val, source ); break; + case SP_PROP_SHAPE_MARGIN: + shape_margin.readIfUnset( val, source ); + break; + case SP_PROP_INLINE_SIZE: + inline_size.readIfUnset( val, source ); + break; case SP_PROP_DOMINANT_BASELINE: dominant_baseline.readIfUnset( val, source ); break; @@ -1155,7 +1170,13 @@ SPStyle::_mergeDecl( CRDeclaration const *const decl, SPStyleSrc const &source */ 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); } } @@ -1713,9 +1734,18 @@ sp_style_unset_property_attrs(SPObject *o) if (style->shape_inside.set) { repr->setAttribute("shape-inside", NULL); } + if (style->shape_subtract.set) { + repr->setAttribute("shape-subtract", NULL); + } if (style->shape_padding.set) { repr->setAttribute("shape-padding", NULL); } + if (style->shape_margin.set) { + repr->setAttribute("shape-margin", NULL); + } + if (style->inline_size.set) { + repr->setAttribute("inline-size", NULL); + } if (style->writing_mode.set) { repr->setAttribute("writing-mode", NULL); } @@ -1808,7 +1838,10 @@ sp_css_attr_unset_text(SPCSSAttr *css) sp_repr_css_set_property(css, "text-anchor", NULL); sp_repr_css_set_property(css, "white-space", NULL); sp_repr_css_set_property(css, "shape-inside", NULL); + sp_repr_css_set_property(css, "shape-subtract", NULL); sp_repr_css_set_property(css, "shape-padding", NULL); + sp_repr_css_set_property(css, "shape-margin", NULL); + sp_repr_css_set_property(css, "inline-size", NULL); sp_repr_css_set_property(css, "kerning", NULL); // not implemented yet sp_repr_css_set_property(css, "dominant-baseline", NULL); // not implemented yet sp_repr_css_set_property(css, "alignment-baseline", NULL); // not implemented yet |
