[librsvg] shapes: use the ParseValue trait



commit 2d8fc3a1cab09fcb8cf1719e6d41d0292cf0e945
Author: Paolo Borelli <pborelli gnome org>
Date:   Sun Dec 30 12:58:49 2018 +0100

    shapes: use the ParseValue trait
    
    This is not only cleaner, but also fixes a bug introduced in the
    recent refactory, where by using the ok() method we were discarding
    errors

 rsvg_internals/src/shapes.rs | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
---
diff --git a/rsvg_internals/src/shapes.rs b/rsvg_internals/src/shapes.rs
index 976ddd9b..3ac956bc 100644
--- a/rsvg_internals/src/shapes.rs
+++ b/rsvg_internals/src/shapes.rs
@@ -4,7 +4,7 @@ use std::cell::RefCell;
 use std::ops::Deref;
 
 use attributes::Attribute;
-use cssparser::{Parser, ParserInput, Token};
+use cssparser::{Parser, Token};
 use drawing_ctx::DrawingCtx;
 use error::*;
 use handle::RsvgHandle;
@@ -243,12 +243,7 @@ impl NodeTrait for NodePoly {
         for (attr, value) in pbag.iter() {
             // support for svg < 1.0 which used verts
             if attr == Attribute::Points || attr == Attribute::Verts {
-                let mut input = ParserInput::new(value.trim());
-                let mut parser = Parser::new(&mut input);
-
-                *self.points.borrow_mut() = Points::parse(&mut parser, ())
-                    .map_err(|err| NodeError::attribute_error(attr, err))
-                    .ok();
+                *self.points.borrow_mut() = attr.parse(value.trim(), ()).map(Some)?;
             }
         }
 


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