summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@gnome.org>2022-08-29 20:03:40 -0500
committerFederico Mena Quintero <federico@gnome.org>2022-08-29 20:03:40 -0500
commita3469ef1a941b9d4f028ac5958e25b1974be4a85 (patch)
tree796878f107b045cde037ccae53bd5438adea42a2
parentb50d07a76cbc278bda636bf1fcc61776512c64ae (diff)
downloadlibrsvg-a3469ef1a941b9d4f028ac5958e25b1974be4a85.tar.gz
DocumentBuilder::append_stylesheet - new function
Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/738>
-rw-r--r--src/document.rs11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/document.rs b/src/document.rs
index 28d92875..7f159fe4 100644
--- a/src/document.rs
+++ b/src/document.rs
@@ -535,6 +535,13 @@ impl DocumentBuilder {
&self.session
}
+ /// Adds a stylesheet in order to the document.
+ ///
+ /// Stylesheets will later be matched in the order in which they were added.
+ pub fn append_stylesheet(&mut self, stylesheet: Stylesheet) {
+ self.stylesheets.push(stylesheet);
+ }
+
pub fn append_stylesheet_from_xml_processing_instruction(
&mut self,
alternate: Option<String>,
@@ -556,7 +563,7 @@ impl DocumentBuilder {
.map_err(|_| LoadingError::BadUrl)?;
if let Ok(stylesheet) = Stylesheet::from_href(&aurl, Origin::Author, self.session.clone()) {
- self.stylesheets.push(stylesheet);
+ self.append_stylesheet(stylesheet);
}
Ok(())
@@ -607,7 +614,7 @@ impl DocumentBuilder {
Origin::Author,
self.session.clone(),
) {
- self.stylesheets.push(stylesheet);
+ self.append_stylesheet(stylesheet);
}
}