[librsvg: 10/17] DocumentBuilder::append_stylesheet - new function




commit a3469ef1a941b9d4f028ac5958e25b1974be4a85
Author: Federico Mena Quintero <federico gnome org>
Date:   Mon Aug 29 20:03:40 2022 -0500

    DocumentBuilder::append_stylesheet - new function
    
    Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/738>

 src/document.rs | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/src/document.rs b/src/document.rs
index 28d928759..7f159fe43 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);
         }
     }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]