summaryrefslogtreecommitdiff
path: root/src/properties.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/properties.rs')
-rw-r--r--src/properties.rs51
1 files changed, 26 insertions, 25 deletions
diff --git a/src/properties.rs b/src/properties.rs
index 810b1ec7..dd48b76a 100644
--- a/src/properties.rs
+++ b/src/properties.rs
@@ -892,11 +892,7 @@ impl SpecifiedValues {
}
}
- pub fn parse_presentation_attributes(
- &mut self,
- session: &Session,
- attrs: &Attributes,
- ) -> Result<(), ElementError> {
+ pub fn parse_presentation_attributes(&mut self, session: &Session, attrs: &Attributes) {
for (attr, value) in attrs.iter() {
match attr.expanded() {
expanded_name!("", "transform") => {
@@ -912,25 +908,41 @@ impl SpecifiedValues {
// xml:lang is a non-presentation attribute and as such cannot have the
// "inherit" value. So, we don't call parse_one_presentation_attribute()
// for it, but rather call its parser directly.
- self.set_parsed_property(&ParsedProperty::XmlLang(SpecifiedValue::Specified(
- attr.parse(value)?,
- )));
+ let parse_result: Result<XmlLang, _> = attr.parse(value);
+ match parse_result {
+ Ok(lang) => {
+ self.set_parsed_property(&ParsedProperty::XmlLang(
+ SpecifiedValue::Specified(lang),
+ ));
+ }
+
+ Err(e) => {
+ rsvg_log!(session, "ignoring attribute with invalid value: {}", e);
+ }
+ }
}
expanded_name!(xml "space") => {
// xml:space is a non-presentation attribute and as such cannot have the
// "inherit" value. So, we don't call parse_one_presentation_attribute()
// for it, but rather call its parser directly.
- self.set_parsed_property(&ParsedProperty::XmlSpace(SpecifiedValue::Specified(
- attr.parse(value)?,
- )));
+ let parse_result: Result<XmlSpace, _> = attr.parse(value);
+ match parse_result {
+ Ok(space) => {
+ self.set_parsed_property(&ParsedProperty::XmlSpace(
+ SpecifiedValue::Specified(space),
+ ));
+ }
+
+ Err(e) => {
+ rsvg_log!(session, "ignoring attribute with invalid value: {}", e);
+ }
+ }
}
_ => self.parse_one_presentation_attribute(session, attr, value),
}
}
-
- Ok(())
}
pub fn set_property_from_declaration(
@@ -960,7 +972,7 @@ impl SpecifiedValues {
origin: Origin,
important_styles: &mut HashSet<QualName>,
session: &Session,
- ) -> Result<(), ElementError> {
+ ) {
let mut input = ParserInput::new(declarations);
let mut parser = Parser::new(&mut input);
@@ -973,8 +985,6 @@ impl SpecifiedValues {
}
})
.for_each(|decl| self.set_property_from_declaration(&decl, origin, important_styles));
-
- Ok(())
}
}
@@ -1118,13 +1128,4 @@ mod tests {
assert_eq!(computed.opacity(), half_opacity.clone());
}
-
- #[test]
- fn empty_style_attribute_parses_ok() {
- let mut specified = SpecifiedValues::default();
-
- assert!(specified
- .parse_style_declarations("", Origin::Author, &mut HashSet::new(), &Session::default())
- .is_ok())
- }
}