[librsvg: 6/8] Rename parse_property to parse_value - it's not just for properties anymore




commit 2d665218edee26089186e54ad59393a74b2062f9
Author: Federico Mena Quintero <federico gnome org>
Date:   Fri Sep 17 18:44:51 2021 -0500

    Rename parse_property to parse_value - it's not just for properties anymore
    
    Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/591>

 src/css.rs        | 4 ++--
 src/properties.rs | 7 ++++---
 2 files changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/src/css.rs b/src/css.rs
index 07d56c66..3b19e795 100644
--- a/src/css.rs
+++ b/src/css.rs
@@ -90,7 +90,7 @@ use std::str;
 use crate::error::*;
 use crate::io::{self, BinaryData};
 use crate::node::{Node, NodeBorrow, NodeCascade};
-use crate::properties::{parse_property, ComputedValues, ParseAs, ParsedProperty};
+use crate::properties::{parse_value, ComputedValues, ParseAs, ParsedProperty};
 use crate::url_resolver::UrlResolver;
 
 /// A parsed CSS declaration
@@ -122,7 +122,7 @@ impl<'i> DeclarationParser<'i> for DeclParser {
         input: &mut Parser<'i, 't>,
     ) -> Result<Declaration, ParseError<'i>> {
         let prop_name = QualName::new(None, ns!(), LocalName::from(name.as_ref()));
-        let property = parse_property(&prop_name, input, ParseAs::Property)?;
+        let property = parse_value(&prop_name, input, ParseAs::Property)?;
 
         let important = input.try_parse(parse_important).is_ok();
 
diff --git a/src/properties.rs b/src/properties.rs
index 9a5f7e9b..03c3efee 100644
--- a/src/properties.rs
+++ b/src/properties.rs
@@ -155,7 +155,7 @@ impl ComputedValues {
 /// * `PropertyId`, an fieldless enum with simple values to identify all the properties.
 /// * `ParsedProperty`, a variant enum for all the specified property values.
 /// * `ComputedValue`, a variant enum for all the computed values.
-/// * `parse_property`, the main function to parse a property declaration from user input.
+/// * `parse_value`, the main function to parse a property or attribute value from user input.
 ///
 /// There is a lot of repetitive code, for example, because sometimes
 /// we need to operate on `PropertyId::Foo`, `ParsedProperty::Foo` and
@@ -348,7 +348,8 @@ macro_rules! make_properties {
             }
         }
 
-        pub fn parse_property<'i>(
+        /// Parses a value from either a style property or from an element's attribute.
+        pub fn parse_value<'i>(
             prop_name: &QualName,
             input: &mut Parser<'i, '_>,
             parse_as: ParseAs,
@@ -720,7 +721,7 @@ impl SpecifiedValues {
         // Presentation attributes don't accept shorthands, e.g. there is no
         // attribute like marker="#foo" and it needs to be set in the style attribute
         // like style="marker: #foo;".  So, pass false for accept_shorthands here.
-        match parse_property(&attr, &mut parser, ParseAs::PresentationAttr) {
+        match parse_value(&attr, &mut parser, ParseAs::PresentationAttr) {
             Ok(prop) => {
                 if parser.expect_exhausted().is_ok() {
                     self.set_parsed_property(&prop);


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