[librsvg: 3/17] Move the xml:lang and xml:space parsing to parse_presentation_attributes()
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 3/17] Move the xml:lang and xml:space parsing to parse_presentation_attributes()
- Date: Fri, 3 May 2019 01:28:53 +0000 (UTC)
commit 839580daeee84ca298192eb64a6595e9d24932df
Author: Federico Mena Quintero <federico gnome org>
Date: Thu May 2 14:04:47 2019 -0500
Move the xml:lang and xml:space parsing to parse_presentation_attributes()
... even though they are non-presentation attributes. They are
definitely not style properties, anyway. This should let us convert
parse_attribute_pair() to using ParsedProperty.
rsvg_internals/src/properties.rs | 36 +++++++++++++++++++++---------------
1 file changed, 21 insertions(+), 15 deletions(-)
---
diff --git a/rsvg_internals/src/properties.rs b/rsvg_internals/src/properties.rs
index 4b3e06db..0992e29b 100644
--- a/rsvg_internals/src/properties.rs
+++ b/rsvg_internals/src/properties.rs
@@ -556,20 +556,6 @@ impl SpecifiedValues {
self.writing_mode = parse_property(value)?;
}
- Attribute::XmlLang => {
- // xml:lang is not a property; it is a non-presentation attribute and as such
- // cannot have the "inherit" value. So, we don't call parse_property() for it,
- // but rather call its parser directly.
- self.xml_lang = SpecifiedValue::Specified(XmlLang::parse_str(value)?);
- }
-
- Attribute::XmlSpace => {
- // xml:space is not a property; it is a non-presentation attribute and as such
- // cannot have the "inherit" value. So, we don't call parse_property() for it,
- // but rather call its parser directly.
- self.xml_space = SpecifiedValue::Specified(XmlSpace::parse_str(value)?);
- }
-
_ => {
// Maybe it's an attribute not parsed here, but in the
// node implementations.
@@ -603,7 +589,27 @@ impl SpecifiedValues {
pbag: &PropertyBag<'_>,
) -> Result<(), NodeError> {
for (attr, value) in pbag.iter() {
- self.parse_attribute_pair(attr, value, false)?;
+ match attr {
+ Attribute::XmlLang => {
+ // xml:lang is a non-presentation attribute and as such cannot have the
+ // "inherit" value. So, we don't call parse_attribute_pair() for it, but
+ // rather call its parser directly.
+ self.xml_lang = SpecifiedValue::Specified(
+ XmlLang::parse_str(value).attribute(Attribute::XmlLang)?,
+ );
+ }
+
+ Attribute::XmlSpace => {
+ // xml:space is a non-presentation attribute and as such cannot have the
+ // "inherit" value. So, we don't call parse_attribute_pair() for it, but
+ // rather call its parser directly.
+ self.xml_space = SpecifiedValue::Specified(
+ XmlSpace::parse_str(value).attribute(Attribute::XmlSpace)?,
+ );
+ }
+
+ _ => self.parse_attribute_pair(attr, value, false)?,
+ }
}
Ok(())
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]