summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShlomi Fish <shlomif@shlomifish.org>2016-09-23 12:51:11 +0000
committerShlomi Fish <shlomif@shlomifish.org>2016-09-23 12:51:11 +0000
commit23fe0d70dbef6ac9b12090c36c50abdc5387c547 (patch)
tree6c67e18c9e92508ceb0babbd1d4d27991db7d9e6
parentRemove "== true"s (diff)
parentRemove properties with default values from 'style' entries in users preferenc... (diff)
downloadinkscape-23fe0d70dbef6ac9b12090c36c50abdc5387c547.tar.gz
inkscape-23fe0d70dbef6ac9b12090c36c50abdc5387c547.zip
Merged.
(bzr r15100.1.20)
-rw-r--r--share/attributes/css_defaults20
-rw-r--r--share/attributes/cssprops20
-rwxr-xr-xshare/attributes/genMapDataCSS.pl57
-rw-r--r--src/attribute-rel-util.cpp36
-rw-r--r--src/attribute-rel-util.h5
-rw-r--r--src/extension/internal/gdkpixbuf-input.cpp7
-rw-r--r--src/preferences.cpp2
-rw-r--r--src/selection-chemistry.cpp24
-rw-r--r--src/style.cpp2
9 files changed, 160 insertions, 13 deletions
diff --git a/share/attributes/css_defaults b/share/attributes/css_defaults
index 396c8a2d9..ff9b39b6d 100644
--- a/share/attributes/css_defaults
+++ b/share/attributes/css_defaults
@@ -46,6 +46,8 @@
"font-family" - "NO_DEFAULT" - "yes"
+"font-feature-settings" - "normal" - "yes"
+
"font-size" - "medium" - "yes, the computed value is inherited"
"font-size-adjust" - "none" - "yes"
@@ -56,6 +58,18 @@
"font-variant" - "normal" - "yes"
+"font-variant-alternates" - "normal" - "yes"
+
+"font-variant-caps" - "normal" - "yes"
+
+"font-variant-east-asian" - "normal" - "yes"
+
+"font-variant-ligatures" - "normal" - "yes"
+
+"font-variant-numeric" - "normal" - "yes"
+
+"font-variant-position" - "normal" - "yes"
+
"font-weight" - "normal" - "yes"
"glyph-orientation-horizontal" - "0deg" - "yes"
@@ -110,7 +124,7 @@
"solid-color" - "#000000" - "no"
-"solid-opacity" - "1.0" - "no"
+"solid-opacity" - "1" - "no"
"stop-color" - "black" - "no"
@@ -148,10 +162,14 @@
"text-decoration-style" - "solid" - "no"
+"text-indent" - "0" - "yes"
+
"text-orientation" - "mixed" - "yes"
"text-rendering" - "auto" - "yes"
+"text-transform" - "none" - "yes"
+
"title" - "NO DEFAULT" - "no"
"transform" - "none" - "no"
diff --git a/share/attributes/cssprops b/share/attributes/cssprops
index 1b7776284..fb7397c4e 100644
--- a/share/attributes/cssprops
+++ b/share/attributes/cssprops
@@ -46,6 +46,8 @@
"font-family" - "altGlyph","textPath","text","tref","tspan","flowRoot","flowPara","flowSpan","a","defs","glyph","g","marker","mask","missing-glyph","pattern","svg","switch","symbol","use"
+"font-feature-settings" - "a","defs","glyph","g","marker","mask","missing-glyph","pattern","svg","switch","symbol","use","altGlyph","textPath","text","tref","tspan","flowRoot","flowPara","flowSpan","a","defs","glyph","g","marker","mask","missing-glyph","pattern","svg","switch","symbol","use"
+
"font-size" - "altGlyph","textPath","text","tref","tspan","flowRoot","flowPara","flowSpan","a","defs","glyph","g","marker","mask","missing-glyph","pattern","svg","switch","symbol","use"
"font-size-adjust" - "altGlyph","textPath","text","tref","tspan","flowRoot","flowPara","flowSpan","a","defs","glyph","g","marker","mask","missing-glyph","pattern","svg","switch","symbol","use"
@@ -54,7 +56,19 @@
"font-style" - "altGlyph","textPath","text","tref","tspan","flowRoot","flowPara","flowSpan","a","defs","glyph","g","marker","mask","missing-glyph","pattern","svg","switch","symbol","use"
-"font-variant" - "altGlyph","textPath","text","tref","tspan","flowRoot","flowPara","flowSpan","a","defs","glyph","g","marker","mask","missing-glyph","pattern","svg","switch","symbol","use"
+"font-variant" - "altGlyph","textPath","text","tref","tspan","flowRoot","flowPara","flowSpan","a","defs","glyph","g","marker","mask","missing-glyph","pattern","svg","switch","symbol","use","altGlyph","textPath","text","tref","tspan","flowRoot","flowPara","flowSpan","a","defs","glyph","g","marker","mask","missing-glyph","pattern","svg","switch","symbol","use"
+
+"font-variant-alternates" - "a","defs","glyph","g","marker","mask","missing-glyph","pattern","svg","switch","symbol","use","altGlyph","textPath","text","tref","tspan","flowRoot","flowPara","flowSpan","a","defs","glyph","g","marker","mask","missing-glyph","pattern","svg","switch","symbol","use"
+
+"font-variant-caps" - "a","defs","glyph","g","marker","mask","missing-glyph","pattern","svg","switch","symbol","use","altGlyph","textPath","text","tref","tspan","flowRoot","flowPara","flowSpan","a","defs","glyph","g","marker","mask","missing-glyph","pattern","svg","switch","symbol","use"
+
+"font-variant-east-asian" - "a","defs","glyph","g","marker","mask","missing-glyph","pattern","svg","switch","symbol","use","altGlyph","textPath","text","tref","tspan","flowRoot","flowPara","flowSpan","a","defs","glyph","g","marker","mask","missing-glyph","pattern","svg","switch","symbol","use"
+
+"font-variant-ligatures" - "a","defs","glyph","g","marker","mask","missing-glyph","pattern","svg","switch","symbol","use","altGlyph","textPath","text","tref","tspan","flowRoot","flowPara","flowSpan","a","defs","glyph","g","marker","mask","missing-glyph","pattern","svg","switch","symbol","use"
+
+"font-variant-numeric" - "a","defs","glyph","g","marker","mask","missing-glyph","pattern","svg","switch","symbol","use","altGlyph","textPath","text","tref","tspan","flowRoot","flowPara","flowSpan","a","defs","glyph","g","marker","mask","missing-glyph","pattern","svg","switch","symbol","use"
+
+"font-variant-position" - "a","defs","glyph","g","marker","mask","missing-glyph","pattern","svg","switch","symbol","use","altGlyph","textPath","text","tref","tspan","flowRoot","flowPara","flowSpan","a","defs","glyph","g","marker","mask","missing-glyph","pattern","svg","switch","symbol","use"
"font-weight" - "altGlyph","textPath","text","tref","tspan","flowRoot","flowPara","flowSpan","a","defs","glyph","g","marker","mask","missing-glyph","pattern","svg","switch","symbol","use"
@@ -148,10 +162,14 @@
"text-decoration-style" - "a","defs","glyph","g","marker","mask","missing-glyph","pattern","svg","switch","symbol","use","altGlyph","textPath","text","tref","tspan","flowRoot","flowPara","flowSpan"
+"text-indent" - "a","defs","glyph","g","marker","mask","missing-glyph","pattern","svg","switch","symbol","use","altGlyph","textPath","text","tref","tspan","flowRoot","flowPara","flowSpan","a","defs","glyph","g","marker","mask","missing-glyph","pattern","svg","switch","symbol","use"
+
"text-orientation" - "a","defs","glyph","g","marker","mask","missing-glyph","pattern","svg","switch","symbol","use","altGlyph","textPath","text","tref","tspan","flowRoot","flowPara","flowSpan","a","defs","glyph","g","marker","mask","missing-glyph","pattern","svg","switch","symbol","use"
"text-rendering" - "text","a","defs","glyph","g","marker","mask","missing-glyph","pattern","svg","switch","symbol","use"
+"text-transform" - "a","defs","glyph","g","marker","mask","missing-glyph","pattern","svg","switch","symbol","use","altGlyph","textPath","text","tref","tspan","flowRoot","flowPara","flowSpan","a","defs","glyph","g","marker","mask","missing-glyph","pattern","svg","switch","symbol","use"
+
"title" - "circle","ellipse","image","line","path","polygon","polyline","rect","text","flowRoot","use","g"
"transform" - "a","defs","glyph","g","marker","mask","missing-glyph","pattern","svg","switch","symbol","use","circle","ellipse","image","line","path","polygon","polyline","rect","text","flowRoot","use"
diff --git a/share/attributes/genMapDataCSS.pl b/share/attributes/genMapDataCSS.pl
index c025a68ec..46b0dd120 100755
--- a/share/attributes/genMapDataCSS.pl
+++ b/share/attributes/genMapDataCSS.pl
@@ -207,7 +207,7 @@ $properties{ "solid-color" }->{inherit} = "no";
push @{$properties{ "solid-opacity" }->{elements}}, @container_elements;
push @{$properties{ "solid-opacity" }->{elements}}, @graphics_elements;
-$properties{ "solid-opacity" }->{default} = "1.0";
+$properties{ "solid-opacity" }->{default} = "1";
$properties{ "solid-opacity" }->{inherit} = "no";
push @{$properties{ "white-space" }->{elements}}, @container_elements;
@@ -232,6 +232,18 @@ $properties{ "shape-margin" }->{default} = "0";
$properties{ "shape-margin" }->{inherit} = "no";
+#CSS Text Level 3
+push @{$properties{ "text-indent" }->{elements}}, @container_elements;
+push @{$properties{ "text-indent" }->{elements}}, @text_content_elements;
+$properties{ "text-indent" }->{default} = "0";
+$properties{ "text-indent" }->{inherit} = "yes";
+
+push @{$properties{ "text-transform" }->{elements}}, @container_elements;
+push @{$properties{ "text-transform" }->{elements}}, @text_content_elements;
+$properties{ "text-transform" }->{default} = "none";
+$properties{ "text-transform" }->{inherit} = "yes";
+
+
# CSS Text Decoration
push @{$properties{ "text-decoration-line" }->{elements}}, @container_elements;
push @{$properties{ "text-decoration-line" }->{elements}}, @text_content_elements;
@@ -258,6 +270,49 @@ push @{$properties{ "text-decoration-stroke" }->{elements}}, @text_content_eleme
$properties{ "text-decoration-stroke" }->{default} = "NO_DEFAULT";
$properties{ "text-decoration-stroke" }->{inherit} = "no";
+
+# CSS Fonts
+push @{$properties{ "font-variant-ligatures" }->{elements}}, @container_elements;
+push @{$properties{ "font-variant-ligatures" }->{elements}}, @text_content_elements;
+$properties{ "font-variant-ligatures" }->{default} = "normal";
+$properties{ "font-variant-ligatures" }->{inherit} = "yes";
+
+push @{$properties{ "font-variant-position" }->{elements}}, @container_elements;
+push @{$properties{ "font-variant-position" }->{elements}}, @text_content_elements;
+$properties{ "font-variant-position" }->{default} = "normal";
+$properties{ "font-variant-position" }->{inherit} = "yes";
+
+push @{$properties{ "font-variant-caps" }->{elements}}, @container_elements;
+push @{$properties{ "font-variant-caps" }->{elements}}, @text_content_elements;
+$properties{ "font-variant-caps" }->{default} = "normal";
+$properties{ "font-variant-caps" }->{inherit} = "yes";
+
+push @{$properties{ "font-variant-numeric" }->{elements}}, @container_elements;
+push @{$properties{ "font-variant-numeric" }->{elements}}, @text_content_elements;
+$properties{ "font-variant-numeric" }->{default} = "normal";
+$properties{ "font-variant-numeric" }->{inherit} = "yes";
+
+push @{$properties{ "font-variant-alternates" }->{elements}}, @container_elements;
+push @{$properties{ "font-variant-alternates" }->{elements}}, @text_content_elements;
+$properties{ "font-variant-alternates" }->{default} = "normal";
+$properties{ "font-variant-alternates" }->{inherit} = "yes";
+
+push @{$properties{ "font-variant-east-asian" }->{elements}}, @container_elements;
+push @{$properties{ "font-variant-east-asian" }->{elements}}, @text_content_elements;
+$properties{ "font-variant-east-asian" }->{default} = "normal";
+$properties{ "font-variant-east-asian" }->{inherit} = "yes";
+
+push @{$properties{ "font-variant" }->{elements}}, @container_elements;
+push @{$properties{ "font-variant" }->{elements}}, @text_content_elements;
+$properties{ "font-variant" }->{default} = "normal";
+$properties{ "font-variant" }->{inherit} = "yes";
+
+push @{$properties{ "font-feature-settings" }->{elements}}, @container_elements;
+push @{$properties{ "font-feature-settings" }->{elements}}, @text_content_elements;
+$properties{ "font-feature-settings" }->{default} = "normal";
+$properties{ "font-feature-settings" }->{inherit} = "yes";
+
+
# CSS Writing Modes
push @{$properties{ "text-orientation" }->{elements}}, @container_elements;
push @{$properties{ "text-orientation" }->{elements}}, @text_content_elements;
diff --git a/src/attribute-rel-util.cpp b/src/attribute-rel-util.cpp
index cf1140219..5e770d4ae 100644
--- a/src/attribute-rel-util.cpp
+++ b/src/attribute-rel-util.cpp
@@ -263,6 +263,42 @@ void sp_attribute_clean_style(Node* repr, SPCSSAttr *css, unsigned int flags) {
}
/**
+ * Remove CSS style properties with default values.
+ */
+void sp_attribute_purge_default_style(SPCSSAttr *css, unsigned int flags) {
+
+ g_return_if_fail (css != NULL);
+
+ // Loop over all properties in "style" node, keeping track of which to delete.
+ std::set<Glib::ustring> toDelete;
+ for ( List<AttributeRecord const> iter = css->attributeList() ; iter ; ++iter ) {
+
+ gchar const * property = g_quark_to_string(iter->key);
+ gchar const * value = iter->value;
+
+ // If property value is same as default mark for deletion.
+ if ( SPAttributeRelCSS::findIfDefault( property, value ) ) {
+
+ if ( flags & SP_ATTR_CLEAN_DEFAULT_WARN ) {
+ g_warning( "Preferences CSS Style property: \"%s\" with default value (%s) not needed.",
+ property, value );
+ }
+ if ( flags & SP_ATTR_CLEAN_DEFAULT_REMOVE ) {
+ toDelete.insert( property );
+ }
+ continue;
+ }
+
+ } // End loop over style properties
+
+ // Delete unneeded style properties. Do this at the end so as to not perturb List iterator.
+ for( std::set<Glib::ustring>::const_iterator iter_d = toDelete.begin(); iter_d != toDelete.end(); ++iter_d ) {
+ sp_repr_css_set_property( css, (*iter_d).c_str(), NULL );
+ }
+
+}
+
+/**
* Check one attribute on an element
*/
bool sp_attribute_check_attribute(Glib::ustring element, Glib::ustring id, Glib::ustring attribute, bool warn) {
diff --git a/src/attribute-rel-util.h b/src/attribute-rel-util.h
index 604987779..b8b1f6875 100644
--- a/src/attribute-rel-util.h
+++ b/src/attribute-rel-util.h
@@ -68,6 +68,11 @@ Glib::ustring sp_attribute_clean_style(Node *repr, gchar const *string, unsigned
void sp_attribute_clean_style(Node* repr, SPCSSAttr *css, unsigned int flags);
/**
+ * Remove CSS style properties with default values.
+ */
+void sp_attribute_purge_default_style(SPCSSAttr *css, unsigned int flags);
+
+/**
* Check one attribute on an element
*/
bool sp_attribute_check_attribute(Glib::ustring element, Glib::ustring id, Glib::ustring attribute, bool warn);
diff --git a/src/extension/internal/gdkpixbuf-input.cpp b/src/extension/internal/gdkpixbuf-input.cpp
index b30c67a4d..e0dc90981 100644
--- a/src/extension/internal/gdkpixbuf-input.cpp
+++ b/src/extension/internal/gdkpixbuf-input.cpp
@@ -134,8 +134,13 @@ GdkpixbufInput::open(Inkscape::Extension::Input *mod, char const *uri)
}
// Add it to the current layer
- doc->getRoot()->appendChildRepr(image_node);
+ Inkscape::XML::Node *layer_node = xml_doc->createElement("svg:g");
+ layer_node->setAttribute("inkscape:groupmode", "layer");
+ layer_node->setAttribute("inkscape:label", "Image");
+ doc->getRoot()->appendChildRepr(layer_node);
+ layer_node->appendChild(image_node);
Inkscape::GC::release(image_node);
+ Inkscape::GC::release(layer_node);
fit_canvas_to_drawing(doc);
// Set viewBox if it doesn't exist
diff --git a/src/preferences.cpp b/src/preferences.cpp
index 988604a14..4d522a1d8 100644
--- a/src/preferences.cpp
+++ b/src/preferences.cpp
@@ -24,6 +24,7 @@
#include "xml/node-iterators.h"
#include "xml/attribute-record.h"
#include "util/units.h"
+#include "attribute-rel-util.h"
#define PREFERENCES_FILE_NAME "preferences.xml"
@@ -495,6 +496,7 @@ void Preferences::mergeStyle(Glib::ustring const &pref_path, SPCSSAttr *style)
{
SPCSSAttr *current = getStyle(pref_path);
sp_repr_css_merge(current, style);
+ sp_attribute_purge_default_style(current, SP_ATTR_CLEAN_DEFAULT_REMOVE);
Glib::ustring css_str;
sp_repr_css_write_string(current, css_str);
_setRawValue(pref_path, css_str);
diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp
index 37a0e42e1..834f82edc 100644
--- a/src/selection-chemistry.cpp
+++ b/src/selection-chemistry.cpp
@@ -497,6 +497,8 @@ void sp_selection_duplicate(SPDesktop *desktop, bool suppressDone, bool duplicat
const gchar *id = old_ids[i];
SPObject *old_clone = doc->getObjectById(id);
SPUse *use = dynamic_cast<SPUse *>(old_clone);
+ SPOffset *offset = dynamic_cast<SPOffset *>(old_clone);
+ SPText *text = dynamic_cast<SPText *>(old_clone);
if (use) {
SPItem *orig = use->get_original();
if (!orig) // orphaned
@@ -510,14 +512,20 @@ void sp_selection_duplicate(SPDesktop *desktop, bool suppressDone, bool duplicat
new_clone->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
}
}
- } else {
- SPOffset *offset = dynamic_cast<SPOffset *>(old_clone);
- if (offset) {
- for (guint j = 0; j < old_ids.size(); j++) {
- gchar *source_href = offset->sourceHref;
- if (source_href && source_href[0]=='#' && !strcmp(source_href+1, old_ids[j])) {
- doc->getObjectById(new_ids[i])->getRepr()->setAttribute("xlink:href", Glib::ustring("#") + new_ids[j]);
- }
+ } else if (offset) {
+ gchar *source_href = offset->sourceHref;
+ for (guint j = 0; j < old_ids.size(); j++) {
+ if (source_href && source_href[0]=='#' && !strcmp(source_href+1, old_ids[j])) {
+ doc->getObjectById(new_ids[i])->getRepr()->setAttribute("xlink:href", Glib::ustring("#") + new_ids[j]);
+ }
+ }
+ } else if (text) {
+ SPTextPath *textpath = dynamic_cast<SPTextPath *>(text->firstChild());
+ if (!textpath) continue;
+ const gchar *source_href = sp_textpath_get_path_item(textpath)->getId();
+ for (guint j = 0; j < old_ids.size(); j++) {
+ if (!strcmp(source_href, old_ids[j])) {
+ doc->getObjectById(new_ids[i])->firstChild()->getRepr()->setAttribute("xlink:href", Glib::ustring("#") + new_ids[j]);
}
}
}
diff --git a/src/style.cpp b/src/style.cpp
index e51733cf0..930e271ad 100644
--- a/src/style.cpp
+++ b/src/style.cpp
@@ -110,7 +110,7 @@ SPStyle::SPStyle(SPDocument *document_in, SPObject *object_in) :
font_variant_caps( "font-variant-caps", enum_font_variant_caps, SP_CSS_FONT_VARIANT_CAPS_NORMAL ),
font_variant_numeric( "font-variant-numeric", enum_font_variant_numeric ),
font_variant_alternates("font-variant-alternates", enum_font_variant_alternates, SP_CSS_FONT_VARIANT_ALTERNATES_NORMAL ),
- font_variant_east_asian("font-variant-east_asian", enum_font_variant_east_asian, SP_CSS_FONT_VARIANT_EAST_ASIAN_NORMAL ),
+ font_variant_east_asian("font-variant-east-asian", enum_font_variant_east_asian, SP_CSS_FONT_VARIANT_EAST_ASIAN_NORMAL ),
font_feature_settings( "font-feature-settings", "normal" ),
// Text related properties