summaryrefslogtreecommitdiffstats
path: root/src/object/sp-style-elem.cpp
diff options
context:
space:
mode:
authorJabier Arraiza <jabier.arraiza@marker.es>2019-06-23 17:15:35 +0000
committerJabier Arraiza <jabier.arraiza@marker.es>2019-06-23 17:15:53 +0000
commite82a32013c7837f830b11637182ce3da8a097372 (patch)
tree3be83a1533bb0d22ca4c6ef1d89aa636fedf2d00 /src/object/sp-style-elem.cpp
parentUpdate macOS build pipeline (diff)
downloadinkscape-e82a32013c7837f830b11637182ce3da8a097372.tar.gz
inkscape-e82a32013c7837f830b11637182ce3da8a097372.zip
Remove experimental code to work in MR and fixes for selectors
Diffstat (limited to 'src/object/sp-style-elem.cpp')
-rw-r--r--src/object/sp-style-elem.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/object/sp-style-elem.cpp b/src/object/sp-style-elem.cpp
index 439a1b3cb..3b93ff190 100644
--- a/src/object/sp-style-elem.cpp
+++ b/src/object/sp-style-elem.cpp
@@ -188,10 +188,6 @@ import_style_cb (CRDocHandler *a_handler,
std::cerr << "import_style_cb: No document!" << std::endl;
return;
}
- if (!document->getStyleSheet()) {
- std::cerr << "import_style_cb: No document style sheet!" << std::endl;
- return;
- }
if (!document->getDocumentURI()) {
std::cerr << "import_style_cb: Document URI is NULL" << std::endl;
return;
@@ -207,7 +203,15 @@ import_style_cb (CRDocHandler *a_handler,
CRStatus const parse_status =
cr_parser_parse_file (parser, reinterpret_cast<const guchar *>(import_file.c_str()), CR_UTF_8);
if (parse_status == CR_OK) {
- cr_stylesheet_append_import (document->getStyleSheet(), stylesheet);
+ if (!document->getStyleSheet()) {
+ // if the style is the first style sheet that we've seen, set the document's
+ // first style sheet to this style and create a cascade object with it.
+ document->setStyleSheet(stylesheet);
+ cr_cascade_set_sheet(document->getStyleCascade(), document->getStyleSheet(), ORIGIN_AUTHOR);
+ } else {
+ // If not the first, then chain up this style_sheet
+ cr_stylesheet_append_import(document->getStyleSheet(), stylesheet);
+ }
} else {
std::cerr << "import_style_cb: Could not parse: " << import_file << std::endl;
cr_stylesheet_destroy (stylesheet);