[librsvg: 19/26] Rename property names to prop_name in general
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 19/26] Rename property names to prop_name in general
- Date: Sun, 10 Nov 2019 20:18:18 +0000 (UTC)
commit 4aeef8c08018a169f430a690a4c024a17457ca6b
Author: Federico Mena Quintero <federico gnome org>
Date: Fri Nov 8 19:35:58 2019 -0600
Rename property names to prop_name in general
Declaration.attribute is Declaration.prop_name now.
parse_attribute_value_into_parsed_property() is parse_property() now.
rsvg_internals/src/css.rs | 17 +++++++++--------
rsvg_internals/src/properties.rs | 11 +++++------
2 files changed, 14 insertions(+), 14 deletions(-)
---
diff --git a/rsvg_internals/src/css.rs b/rsvg_internals/src/css.rs
index 0d8f2536..04c826e0 100644
--- a/rsvg_internals/src/css.rs
+++ b/rsvg_internals/src/css.rs
@@ -100,16 +100,17 @@ use crate::allowed_url::AllowedUrl;
use crate::error::*;
use crate::io::{self, BinaryData};
use crate::node::{NodeType, RsvgNode};
-use crate::properties::{parse_attribute_value_into_parsed_property, ParsedProperty};
+use crate::properties::{parse_property, ParsedProperty};
use crate::text::NodeChars;
/// A parsed CSS declaration
///
/// For example, in the declaration `fill: green !important`, the
-/// `attribute` would be `fill`, the `property` would be the parsed
-/// value of the green color, and `important` would be `true`.
+/// `prop_name` would be `fill`, the `property` would be
+/// `ParsedProperty::Fill(...)` with the green value, and `important`
+/// would be `true`.
pub struct Declaration {
- pub attribute: QualName,
+ pub prop_name: QualName,
pub property: ParsedProperty,
pub important: bool,
}
@@ -146,14 +147,14 @@ impl<'i> DeclarationParser<'i> for DeclParser {
name: CowRcStr<'i>,
input: &mut Parser<'i, 't>,
) -> Result<Declaration, cssparser::ParseError<'i, ValueErrorKind>> {
- let attribute = QualName::new(None, ns!(svg), LocalName::from(name.as_ref()));
- let property = parse_attribute_value_into_parsed_property(&attribute, input, true)
+ let prop_name = QualName::new(None, ns!(svg), LocalName::from(name.as_ref()));
+ let property = parse_property(&prop_name, input, true)
.map_err(|e| input.new_custom_error(e))?;
let important = input.try_parse(parse_important).is_ok();
Ok(Declaration {
- attribute,
+ prop_name,
property,
important,
})
@@ -268,7 +269,7 @@ impl<'i> QualifiedRuleParser<'i> for QualRuleParser {
for decl_result in decl_parser {
// ignore invalid property name or value
if let Ok(declaration) = decl_result {
- decl_list.declarations.insert(declaration.attribute.clone(), declaration);
+ decl_list.declarations.insert(declaration.prop_name.clone(), declaration);
}
}
diff --git a/rsvg_internals/src/properties.rs b/rsvg_internals/src/properties.rs
index 778071a2..52827a5b 100644
--- a/rsvg_internals/src/properties.rs
+++ b/rsvg_internals/src/properties.rs
@@ -223,9 +223,9 @@ pub struct ComputedValues {
}
#[cfg_attr(rustfmt, rustfmt_skip)]
-pub fn parse_attribute_value_into_parsed_property(attr: &QualName, input: &mut Parser, accept_shorthands:
bool) -> Result<ParsedProperty, ValueErrorKind> {
+pub fn parse_property(prop_name: &QualName, input: &mut Parser, accept_shorthands: bool) ->
Result<ParsedProperty, ValueErrorKind> {
// please keep these sorted
- match attr.expanded() {
+ match prop_name.expanded() {
expanded_name!(svg "baseline-shift") =>
Ok(ParsedProperty::BaselineShift(parse_input(input)?)),
@@ -527,8 +527,7 @@ impl SpecifiedValues {
let mut input = ParserInput::new(value);
let mut parser = Parser::new(&mut input);
- match parse_attribute_value_into_parsed_property(&attr, &mut parser, accept_shorthands)
- .attribute(attr.clone())
+ match parse_property(&attr, &mut parser, accept_shorthands).attribute(attr.clone())
{
Ok(prop) => self.set_parsed_property(&prop),
Err(e) => {
@@ -585,12 +584,12 @@ impl SpecifiedValues {
declaration: &Declaration,
important_styles: &mut HashSet<QualName>,
) {
- if !declaration.important && important_styles.contains(&declaration.attribute) {
+ if !declaration.important && important_styles.contains(&declaration.prop_name) {
return;
}
if declaration.important {
- important_styles.insert(declaration.attribute.clone());
+ important_styles.insert(declaration.prop_name.clone());
}
self.set_parsed_property(&declaration.property);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]