diff options
| author | Guiu Rocafort <neandertalspeople@gmail.com> | 2014-03-05 17:55:31 +0000 |
|---|---|---|
| committer | Guiu Rocafort <neandertalspeople@gmail.com> | 2014-03-05 17:55:31 +0000 |
| commit | 2f732d93349881b4c8d4a0f9ee93ef5c9dd422dc (patch) | |
| tree | 8998af65af0544ce2a92d71b82027607483a0ea3 /src/uri-references.cpp | |
| parent | translations from spanish to english done, it might need a little review, but... (diff) | |
| parent | Change tooltip to one more explicit to make cusp nodes (diff) | |
| download | inkscape-2f732d93349881b4c8d4a0f9ee93ef5c9dd422dc.tar.gz inkscape-2f732d93349881b4c8d4a0f9ee93ef5c9dd422dc.zip | |
completed merging
(bzr r11950.5.2)
Diffstat (limited to 'src/uri-references.cpp')
| -rw-r--r-- | src/uri-references.cpp | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/src/uri-references.cpp b/src/uri-references.cpp index ea8078b28..1da890c56 100644 --- a/src/uri-references.cpp +++ b/src/uri-references.cpp @@ -56,19 +56,33 @@ void URIReference::attach(const URI &uri) throw(BadURIException) document = _owner_document; } + // createChildDoc() assumes that the referenced file is an SVG. + // PNG and JPG files are allowed (in the case of feImage). + gchar *filename = uri.toString(); + bool skip = false; + if( g_str_has_suffix( filename, ".jpg" ) || + g_str_has_suffix( filename, ".JPG" ) || + g_str_has_suffix( filename, ".png" ) || + g_str_has_suffix( filename, ".PNG" ) ) { + skip = true; + } + // The path contains references to seperate document files to load. - if(document && uri.getPath()) { + if(document && uri.getPath() && !skip ) { std::string base = document->getBase() ? document->getBase() : ""; std::string path = uri.getFullPath(base); - if(!path.empty()) + if(!path.empty()) { document = document->createChildDoc(path); - else + } else { document = NULL; + } } if(!document) { - g_warning("Can't get document for referenced URI: %s", uri.toString()); + g_warning("Can't get document for referenced URI: %s", filename); + g_free( filename ); return; } + g_free( filename ); gchar const *fragment = uri.getFragment(); if ( !uri.isRelative() || uri.getQuery() || !fragment ) { @@ -79,7 +93,7 @@ void URIReference::attach(const URI &uri) throw(BadURIException) /* for now this handles the minimal xpointer form that SVG 1.0 * requires of us */ - gchar *id; + gchar *id = NULL; if (!strncmp(fragment, "xpointer(", 9)) { /* FIXME !!! this is wasteful */ /* FIXME: It looks as though this is including "))" in the id. I suggest moving @@ -101,9 +115,7 @@ void URIReference::attach(const URI &uri) throw(BadURIException) /* FIXME !!! validate id as an NCName somewhere */ - if (_uri) { - delete _uri; - } + delete _uri; _uri = new URI(uri); _connection.disconnect(); @@ -160,7 +172,7 @@ void URIReference::_release(SPObject *obj) SPObject* sp_css_uri_reference_resolve( SPDocument *document, const gchar *uri ) { - SPObject* ref = 0; + SPObject* ref = NULL; if ( document && uri && ( strncmp(uri, "url(", 4) == 0 ) ) { gchar *trimmed = extract_uri( uri ); @@ -176,7 +188,7 @@ SPObject* sp_css_uri_reference_resolve( SPDocument *document, const gchar *uri ) SPObject * sp_uri_reference_resolve (SPDocument *document, const gchar *uri) { - SPObject* ref = 0; + SPObject* ref = NULL; if ( uri && (*uri == '#') ) { ref = document->getObjectById( uri + 1 ); |
