[librsvg: 8/17] Remove parse_style_pair(); use set_style_pair_from_parsed_property() directly



commit dc2f096f92960c2317f7e149078ef98cb3e278cb
Author: Federico Mena Quintero <federico gnome org>
Date:   Thu May 2 18:39:49 2019 -0500

    Remove parse_style_pair(); use set_style_pair_from_parsed_property() directly
    
    This gets us closer to being able to replace the shitty declaration-list parser.

 rsvg_internals/src/properties.rs | 29 ++++++++++-------------------
 1 file changed, 10 insertions(+), 19 deletions(-)
---
diff --git a/rsvg_internals/src/properties.rs b/rsvg_internals/src/properties.rs
index e033d7dd..6c4890bd 100644
--- a/rsvg_internals/src/properties.rs
+++ b/rsvg_internals/src/properties.rs
@@ -593,24 +593,6 @@ impl SpecifiedValues {
         Ok(())
     }
 
-    fn parse_style_pair(
-        &mut self,
-        attr: Attribute,
-        value: &str,
-        important: bool,
-        important_styles: &mut HashSet<Attribute>,
-    ) -> Result<(), NodeError> {
-        if !important && important_styles.contains(&attr) {
-            return Ok(());
-        }
-
-        if important {
-            important_styles.insert(attr);
-        }
-
-        self.parse_attribute_pair(attr, value, true)
-    }
-
     pub fn set_style_pair_from_parsed_property(
         &mut self,
         attr: Attribute,
@@ -664,7 +646,16 @@ impl SpecifiedValues {
                     };
 
                     if let Ok(attr) = Attribute::from_str(prop_name) {
-                        self.parse_style_pair(attr, value, important, important_styles)?;
+                        if let Ok(Some(prop)) =
+                            parse_attribute_value_into_parsed_property(attr, value, true)
+                        {
+                            self.set_style_pair_from_parsed_property(
+                                attr,
+                                &prop,
+                                important,
+                                important_styles,
+                            );
+                        }
                     }
                     // else unknown property name; ignore
                 }


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