[librsvg: 5/10] Node.set_atts() - Extract function to set the transform attribute



commit fbae08b250b242a5d9a62e7a42466ca96a06d21d
Author: Federico Mena Quintero <federico gnome org>
Date:   Thu May 2 09:05:38 2019 -0500

    Node.set_atts() - Extract function to set the transform attribute

 rsvg_internals/src/node.rs | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)
---
diff --git a/rsvg_internals/src/node.rs b/rsvg_internals/src/node.rs
index ba3e2cd5..161a188a 100644
--- a/rsvg_internals/src/node.rs
+++ b/rsvg_internals/src/node.rs
@@ -350,21 +350,27 @@ impl Node {
         self.data.cond.get()
     }
 
-    pub fn set_atts(&self, node: &RsvgNode, pbag: &PropertyBag<'_>, locale: &Locale) {
+    fn set_transform_attribute(&self, pbag: &PropertyBag<'_>) -> Result<(), NodeError> {
         for (attr, value) in pbag.iter() {
             match attr {
                 Attribute::Transform => match Matrix::parse_str(value) {
                     Ok(affine) => self.data.transform.set(affine),
-                    Err(e) => {
-                        self.set_error(NodeError::attribute_error(Attribute::Transform, e));
-                        return;
-                    }
+                    Err(e) => return Err(NodeError::attribute_error(Attribute::Transform, e)),
                 },
 
                 _ => (),
             }
         }
 
+        Ok(())
+    }
+
+    pub fn set_atts(&self, node: &RsvgNode, pbag: &PropertyBag<'_>, locale: &Locale) {
+        if let Err(e) = self.set_transform_attribute(pbag) {
+            self.set_error(e);
+            return;
+        }
+
         match self.parse_conditional_processing_attributes(pbag, locale) {
             Ok(_) => (),
             Err(e) => {


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