[librsvg/librsvg-2.50] Rename PropertyBag (property_bag.rs) to Attributes (attributes.rs)
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg/librsvg-2.50] Rename PropertyBag (property_bag.rs) to Attributes (attributes.rs)
- Date: Fri, 2 Oct 2020 19:24:35 +0000 (UTC)
commit ceef0085c51d854f69761059f5976794ccb5e78e
Author: Federico Mena Quintero <federico gnome org>
Date: Fri Sep 4 18:27:11 2020 -0500
Rename PropertyBag (property_bag.rs) to Attributes (attributes.rs)
We'll use this struct to actually store each element's attributes
inside the element, instead of just being a Rust-friendly wrapper
around libxml2's attributes/values.
Makefile.am | 2 +-
po/POTFILES.in | 1 -
.../src/{property_bag.rs => attributes.rs} | 38 ++++++++---------
rsvg_internals/src/document.rs | 6 +--
rsvg_internals/src/element.rs | 48 +++++++++++-----------
rsvg_internals/src/filter.rs | 8 ++--
rsvg_internals/src/filters/blend.rs | 8 ++--
rsvg_internals/src/filters/color_matrix.rs | 10 ++---
rsvg_internals/src/filters/component_transfer.rs | 10 ++---
rsvg_internals/src/filters/composite.rs | 8 ++--
rsvg_internals/src/filters/convolve_matrix.rs | 12 +++---
rsvg_internals/src/filters/displacement_map.rs | 8 ++--
rsvg_internals/src/filters/flood.rs | 6 +--
rsvg_internals/src/filters/gaussian_blur.rs | 8 ++--
rsvg_internals/src/filters/image.rs | 8 ++--
rsvg_internals/src/filters/lighting.rs | 32 +++++++--------
rsvg_internals/src/filters/merge.rs | 10 ++---
rsvg_internals/src/filters/mod.rs | 12 +++---
rsvg_internals/src/filters/morphology.rs | 8 ++--
rsvg_internals/src/filters/offset.rs | 8 ++--
rsvg_internals/src/filters/tile.rs | 6 +--
rsvg_internals/src/filters/turbulence.rs | 8 ++--
rsvg_internals/src/gradient.rs | 28 ++++++-------
rsvg_internals/src/image.rs | 6 +--
rsvg_internals/src/lib.rs | 2 +-
rsvg_internals/src/marker.rs | 6 +--
rsvg_internals/src/node.rs | 6 +--
rsvg_internals/src/pattern.rs | 10 ++---
rsvg_internals/src/properties.rs | 6 +--
rsvg_internals/src/shapes.rs | 30 +++++++-------
rsvg_internals/src/structure.rs | 26 ++++++------
rsvg_internals/src/style.rs | 6 +--
rsvg_internals/src/text.rs | 14 +++----
rsvg_internals/src/xml.rs | 26 ++++++------
rsvg_internals/src/xml2_load.rs | 6 +--
35 files changed, 218 insertions(+), 219 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 00a77a3e..9ca857cf 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -33,6 +33,7 @@ LIBRSVG_INTERNALS_SRC = \
rsvg_internals/src/allowed_url.rs \
rsvg_internals/src/angle.rs \
rsvg_internals/src/aspect_ratio.rs \
+ rsvg_internals/src/attributes.rs \
rsvg_internals/src/bbox.rs \
rsvg_internals/src/color.rs \
rsvg_internals/src/cond.rs \
@@ -85,7 +86,6 @@ LIBRSVG_INTERNALS_SRC = \
rsvg_internals/src/path_parser.rs \
rsvg_internals/src/pattern.rs \
rsvg_internals/src/properties.rs \
- rsvg_internals/src/property_bag.rs \
rsvg_internals/src/property_defs.rs \
rsvg_internals/src/property_macros.rs \
rsvg_internals/src/rect.rs \
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 9abefa27..d9bd029f 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -62,7 +62,6 @@ rsvg_internals/src/parsers.rs
rsvg_internals/src/path_builder.rs
rsvg_internals/src/path_parser.rs
rsvg_internals/src/pattern.rs
-rsvg_internals/src/property_bag.rs
rsvg_internals/src/property_macros.rs
rsvg_internals/src/rect.rs
rsvg_internals/src/shapes.rs
diff --git a/rsvg_internals/src/property_bag.rs b/rsvg_internals/src/attributes.rs
similarity index 84%
rename from rsvg_internals/src/property_bag.rs
rename to rsvg_internals/src/attributes.rs
index 379a5c35..691fccf9 100644
--- a/rsvg_internals/src/property_bag.rs
+++ b/rsvg_internals/src/attributes.rs
@@ -1,4 +1,4 @@
-//! Iterate among libxml2's arrays of XML attribute/value.
+//! Store XML element attributes and their values.
use std::mem;
use std::slice;
@@ -13,13 +13,13 @@ use crate::util::{opt_utf8_cstr, utf8_cstr};
/// See the [`new_from_xml2_attributes`] function for information.
///
/// [`new_from_xml2_attributes`]: #method.new_from_xml2_attributes
-pub struct PropertyBag<'a>(Vec<(QualName, &'a str)>);
+pub struct Attributes<'a>(Vec<(QualName, &'a str)>);
-/// Iterator from `PropertyBag.iter`.
-pub struct PropertyBagIter<'a>(slice::Iter<'a, (QualName, &'a str)>);
+/// Iterator from `Attributes.iter`.
+pub struct AttributesIter<'a>(slice::Iter<'a, (QualName, &'a str)>);
-impl<'a> PropertyBag<'a> {
- /// Creates an iterable `PropertyBag` from the C array of borrowed C strings.
+impl<'a> Attributes<'a> {
+ /// Creates an iterable `Attributes` from the C array of borrowed C strings.
///
/// With libxml2's SAX parser, the caller's startElementNsSAX2Func
/// callback gets passed a `xmlChar **` for attributes, which
@@ -34,13 +34,13 @@ impl<'a> PropertyBag<'a> {
///
/// * All strings are valid UTF-8.
///
- /// The lifetime of the `PropertyBag` should be considered the same as the lifetime of the
- /// `attrs` array, as the property bag does not copy the strings - it directly stores pointers
+ /// The lifetime of the `Attributes` should be considered the same as the lifetime of the
+ /// `attrs` array, as the `Attributes` does not copy the strings - it directly stores pointers
/// into that array's strings.
pub unsafe fn new_from_xml2_attributes(
n_attributes: usize,
attrs: *const *const libc::c_char,
- ) -> PropertyBag<'a> {
+ ) -> Attributes<'a> {
let mut array = Vec::new();
if n_attributes > 0 && !attrs.is_null() {
@@ -81,21 +81,21 @@ impl<'a> PropertyBag<'a> {
}
}
- PropertyBag(array)
+ Attributes(array)
}
- /// Returns the number of attributes in the property bag.
+ /// Returns the number of attributes.
pub fn len(&self) -> usize {
self.0.len()
}
/// Creates an iterator that yields `(QualName, &'a str)` tuples.
- pub fn iter(&self) -> PropertyBagIter<'_> {
- PropertyBagIter(self.0.iter())
+ pub fn iter(&self) -> AttributesIter<'_> {
+ AttributesIter(self.0.iter())
}
}
-impl<'a> Iterator for PropertyBagIter<'a> {
+impl<'a> Iterator for AttributesIter<'a> {
type Item = (QualName, &'a str);
fn next(&mut self) -> Option<Self::Item> {
@@ -111,13 +111,13 @@ mod tests {
use std::ptr;
#[test]
- fn empty_property_bag() {
- let map = unsafe { PropertyBag::new_from_xml2_attributes(0, ptr::null()) };
+ fn empty_attributes() {
+ let map = unsafe { Attributes::new_from_xml2_attributes(0, ptr::null()) };
assert_eq!(map.len(), 0);
}
#[test]
- fn property_bag_with_namespaces() {
+ fn attributes_with_namespaces() {
let attrs = [
(
CString::new("href").unwrap(),
@@ -161,13 +161,13 @@ mod tests {
v.push(val_end); // value_end
}
- let pbag = unsafe { PropertyBag::new_from_xml2_attributes(3, v.as_ptr()) };
+ let attrs = unsafe { Attributes::new_from_xml2_attributes(3, v.as_ptr()) };
let mut had_href: bool = false;
let mut had_ry: bool = false;
let mut had_d: bool = false;
- for (a, v) in pbag.iter() {
+ for (a, v) in attrs.iter() {
match a.expanded() {
expanded_name!(xlink "href") => {
assert!(v == "1");
diff --git a/rsvg_internals/src/document.rs b/rsvg_internals/src/document.rs
index 59e46291..9f3ebda6 100644
--- a/rsvg_internals/src/document.rs
+++ b/rsvg_internals/src/document.rs
@@ -10,13 +10,13 @@ use std::include_str;
use std::rc::Rc;
use crate::allowed_url::{AllowedUrl, AllowedUrlError, Fragment};
+use crate::attributes::Attributes;
use crate::css::{self, Origin, Stylesheet};
use crate::error::{AcquireError, LoadingError};
use crate::handle::LoadOptions;
use crate::io::{self, BinaryData};
use crate::limits;
use crate::node::{Node, NodeBorrow, NodeData};
-use crate::property_bag::PropertyBag;
use crate::surface_utils::shared_surface::SharedImageSurface;
use crate::xml::xml_load_from_possibly_compressed_stream;
@@ -395,10 +395,10 @@ impl DocumentBuilder {
pub fn append_element(
&mut self,
name: &QualName,
- pbag: &PropertyBag,
+ attrs: &Attributes,
parent: Option<Node>,
) -> Node {
- let node = Node::new(NodeData::new_element(name, pbag));
+ let node = Node::new(NodeData::new_element(name, attrs));
if let Some(id) = node.borrow_element().get_id() {
// This is so we don't overwrite an existing id
diff --git a/rsvg_internals/src/element.rs b/rsvg_internals/src/element.rs
index 809d1c36..be886d02 100644
--- a/rsvg_internals/src/element.rs
+++ b/rsvg_internals/src/element.rs
@@ -8,6 +8,7 @@ use std::collections::{HashMap, HashSet};
use std::fmt;
use std::ops::Deref;
+use crate::attributes::Attributes;
use crate::bbox::BoundingBox;
use crate::cond::{RequiredExtensions, RequiredFeatures, SystemLanguage};
use crate::css::{Declaration, Origin};
@@ -40,7 +41,6 @@ use crate::node::*;
use crate::parsers::Parse;
use crate::pattern::Pattern;
use crate::properties::{ComputedValues, SpecifiedValues};
-use crate::property_bag::PropertyBag;
use crate::shapes::{Circle, Ellipse, Line, Path, Polygon, Polyline, Rect};
use crate::structure::{ClipPath, Group, Link, Mask, NonRendering, Svg, Switch, Symbol, Use};
use crate::style::Style;
@@ -70,10 +70,10 @@ use crate::transform::Transform;
pub type ElementResult = Result<(), ElementError>;
pub trait SetAttributes {
- /// Sets per-element attributes from the `pbag`
+ /// Sets per-element attributes.
///
- /// Each element is supposed to iterate the `pbag`, and parse any attributes it needs.
- fn set_attributes(&mut self, _pbag: &PropertyBag<'_>) -> ElementResult {
+ /// Each element is supposed to iterate the `attributes`, and parse any ones it needs.
+ fn set_attributes(&mut self, _attributes: &Attributes) -> ElementResult {
Ok(())
}
}
@@ -142,8 +142,8 @@ impl<T: SetAttributes + Draw> ElementInner<T> {
self.transform
}
- fn save_style_attribute(&mut self, pbag: &PropertyBag<'_>) {
- let result = pbag
+ fn save_style_attribute(&mut self, attrs: &Attributes) {
+ let result = attrs
.iter()
.find(|(attr, _)| attr.expanded() == expanded_name!("", "style"))
.map(|(_, value)| value);
@@ -152,8 +152,8 @@ impl<T: SetAttributes + Draw> ElementInner<T> {
}
}
- fn set_transform_attribute(&mut self, pbag: &PropertyBag<'_>) -> Result<(), ElementError> {
- let result = pbag
+ fn set_transform_attribute(&mut self, attrs: &Attributes) -> Result<(), ElementError> {
+ let result = attrs
.iter()
.find(|(attr, _)| attr.expanded() == expanded_name!("", "transform"))
.map(|(attr, value)| {
@@ -170,11 +170,11 @@ impl<T: SetAttributes + Draw> ElementInner<T> {
fn set_conditional_processing_attributes(
&mut self,
- pbag: &PropertyBag<'_>,
+ attrs: &Attributes,
) -> Result<(), ElementError> {
let mut cond = self.cond;
- for (attr, value) in pbag.iter() {
+ for (attr, value) in attrs.iter() {
let mut parse = || -> Result<_, ValueErrorKind> {
match attr.expanded() {
expanded_name!("", "requiredExtensions") if cond => {
@@ -204,9 +204,9 @@ impl<T: SetAttributes + Draw> ElementInner<T> {
Ok(())
}
- /// Hands the pbag to the node's state, to apply the presentation attributes
- fn set_presentation_attributes(&mut self, pbag: &PropertyBag<'_>) -> Result<(), ElementError> {
- match self.specified_values.parse_presentation_attributes(pbag) {
+ /// Hands the `attrs` to the node's state, to apply the presentation attributes.
+ fn set_presentation_attributes(&mut self, attrs: &Attributes) -> Result<(), ElementError> {
+ match self.specified_values.parse_presentation_attributes(attrs) {
Ok(_) => Ok(()),
Err(e) => {
// FIXME: we'll ignore errors here for now.
@@ -262,13 +262,13 @@ impl<T: SetAttributes + Draw> ElementInner<T> {
}
impl<T: SetAttributes + Draw> SetAttributes for ElementInner<T> {
- fn set_attributes(&mut self, pbag: &PropertyBag<'_>) -> ElementResult {
- self.save_style_attribute(pbag);
+ fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+ self.save_style_attribute(attrs);
- self.set_transform_attribute(pbag)
- .and_then(|_| self.set_conditional_processing_attributes(pbag))
- .and_then(|_| self.element_impl.set_attributes(pbag))
- .and_then(|_| self.set_presentation_attributes(pbag))
+ self.set_transform_attribute(attrs)
+ .and_then(|_| self.set_conditional_processing_attributes(attrs))
+ .and_then(|_| self.element_impl.set_attributes(attrs))
+ .and_then(|_| self.set_presentation_attributes(attrs))
}
}
@@ -459,11 +459,11 @@ impl Element {
///
/// [`Element`]: type.Element.html
/// [`NonRendering`]: ../structure/struct.NonRendering.html
- pub fn new(name: &QualName, pbag: &PropertyBag) -> Element {
+ pub fn new(name: &QualName, attrs: &Attributes) -> Element {
let mut id = None;
let mut class = None;
- for (attr, value) in pbag.iter() {
+ for (attr, value) in attrs.iter() {
match attr.expanded() {
expanded_name!("", "id") => id = Some(value),
expanded_name!("", "class") => class = Some(value),
@@ -499,7 +499,7 @@ impl Element {
let mut element = create_fn(name, id, class);
- if let Err(e) = element.set_attributes(pbag) {
+ if let Err(e) = element.set_attributes(attrs) {
element.set_error(e);
}
@@ -594,8 +594,8 @@ impl Element {
}
impl SetAttributes for Element {
- fn set_attributes(&mut self, pbag: &PropertyBag<'_>) -> ElementResult {
- call_inner!(self, set_attributes, pbag)
+ fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+ call_inner!(self, set_attributes, attrs)
}
}
diff --git a/rsvg_internals/src/filter.rs b/rsvg_internals/src/filter.rs
index abb34c8d..933b60a5 100644
--- a/rsvg_internals/src/filter.rs
+++ b/rsvg_internals/src/filter.rs
@@ -5,6 +5,7 @@ use markup5ever::{expanded_name, local_name, namespace_url, ns};
use std::slice::Iter;
use crate::allowed_url::Fragment;
+use crate::attributes::Attributes;
use crate::bbox::BoundingBox;
use crate::coord_units::CoordUnits;
use crate::document::AcquiredNodes;
@@ -16,7 +17,6 @@ use crate::length::*;
use crate::node::{Node, NodeBorrow};
use crate::parsers::{Parse, ParseValue};
use crate::properties::ComputedValues;
-use crate::property_bag::PropertyBag;
use crate::rect::Rect;
use crate::transform::Transform;
@@ -117,9 +117,9 @@ impl Filter {
}
impl SetAttributes for Filter {
- fn set_attributes(&mut self, pbag: &PropertyBag<'_>) -> ElementResult {
+ fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
// Parse filterUnits first as it affects x, y, width, height checks.
- let result = pbag
+ let result = attrs
.iter()
.find(|(attr, _)| attr.expanded() == expanded_name!("", "filterUnits"))
.and_then(|(attr, value)| attr.parse(value).ok());
@@ -165,7 +165,7 @@ impl SetAttributes for Filter {
};
// Parse the rest of the attributes.
- for (attr, value) in pbag.iter() {
+ for (attr, value) in attrs.iter() {
match attr.expanded() {
expanded_name!("", "x") => {
self.x = attr.parse_and_validate(value, check_units_horizontal)?
diff --git a/rsvg_internals/src/filters/blend.rs b/rsvg_internals/src/filters/blend.rs
index 1e37f350..db41c052 100755
--- a/rsvg_internals/src/filters/blend.rs
+++ b/rsvg_internals/src/filters/blend.rs
@@ -1,13 +1,13 @@
use cssparser::Parser;
use markup5ever::{expanded_name, local_name, namespace_url, ns};
+use crate::attributes::Attributes;
use crate::document::AcquiredNodes;
use crate::drawing_ctx::DrawingCtx;
use crate::element::{ElementResult, SetAttributes};
use crate::error::*;
use crate::node::Node;
use crate::parsers::{Parse, ParseValue};
-use crate::property_bag::PropertyBag;
use super::context::{FilterContext, FilterOutput, FilterResult};
use super::{FilterEffect, FilterError, Input, PrimitiveWithInput};
@@ -53,10 +53,10 @@ impl Default for FeBlend {
}
impl SetAttributes for FeBlend {
- fn set_attributes(&mut self, pbag: &PropertyBag<'_>) -> ElementResult {
- self.base.set_attributes(pbag)?;
+ fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+ self.base.set_attributes(attrs)?;
- for (attr, value) in pbag.iter() {
+ for (attr, value) in attrs.iter() {
match attr.expanded() {
expanded_name!("", "in2") => {
self.in2 = Some(attr.parse(value)?);
diff --git a/rsvg_internals/src/filters/color_matrix.rs b/rsvg_internals/src/filters/color_matrix.rs
index 3cb15431..857b0f33 100644
--- a/rsvg_internals/src/filters/color_matrix.rs
+++ b/rsvg_internals/src/filters/color_matrix.rs
@@ -2,6 +2,7 @@ use cssparser::Parser;
use markup5ever::{expanded_name, local_name, namespace_url, ns};
use nalgebra::{Matrix3, Matrix4x5, Matrix5, Vector5};
+use crate::attributes::Attributes;
use crate::document::AcquiredNodes;
use crate::drawing_ctx::DrawingCtx;
use crate::element::{ElementResult, SetAttributes};
@@ -9,7 +10,6 @@ use crate::error::*;
use crate::node::Node;
use crate::number_list::{NumberList, NumberListLength};
use crate::parsers::{Parse, ParseValue};
-use crate::property_bag::PropertyBag;
use crate::surface_utils::{
iterators::Pixels, shared_surface::ExclusiveImageSurface, ImageSurfaceDataExt, Pixel,
};
@@ -52,12 +52,12 @@ impl Default for FeColorMatrix {
#[rustfmt::skip]
impl SetAttributes for FeColorMatrix {
- fn set_attributes(&mut self, pbag: &PropertyBag<'_>) -> ElementResult {
- self.base.set_attributes(pbag)?;
+ fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+ self.base.set_attributes(attrs)?;
// First, determine the operation type.
let mut operation_type = Default::default();
- for (attr, value) in pbag
+ for (attr, value) in attrs
.iter()
.filter(|(attr, _)| attr.expanded() == expanded_name!("", "type"))
{
@@ -77,7 +77,7 @@ impl SetAttributes for FeColorMatrix {
)
};
} else {
- for (attr, value) in pbag
+ for (attr, value) in attrs
.iter()
.filter(|(attr, _)| attr.expanded() == expanded_name!("", "values"))
{
diff --git a/rsvg_internals/src/filters/component_transfer.rs
b/rsvg_internals/src/filters/component_transfer.rs
index 73ef7340..aab6a0e5 100644
--- a/rsvg_internals/src/filters/component_transfer.rs
+++ b/rsvg_internals/src/filters/component_transfer.rs
@@ -3,6 +3,7 @@ use std::cmp::min;
use cssparser::Parser;
use markup5ever::{expanded_name, local_name, namespace_url, ns};
+use crate::attributes::Attributes;
use crate::document::AcquiredNodes;
use crate::drawing_ctx::DrawingCtx;
use crate::element::{Draw, Element, ElementResult, SetAttributes};
@@ -10,7 +11,6 @@ use crate::error::*;
use crate::node::{Node, NodeBorrow};
use crate::number_list::{NumberList, NumberListLength};
use crate::parsers::{Parse, ParseValue};
-use crate::property_bag::PropertyBag;
use crate::surface_utils::{
iterators::Pixels, shared_surface::ExclusiveImageSurface, ImageSurfaceDataExt, Pixel,
};
@@ -35,8 +35,8 @@ impl Default for FeComponentTransfer {
}
impl SetAttributes for FeComponentTransfer {
- fn set_attributes(&mut self, pbag: &PropertyBag<'_>) -> ElementResult {
- self.base.set_attributes(pbag)
+ fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+ self.base.set_attributes(attrs)
}
}
@@ -198,8 +198,8 @@ macro_rules! func_x {
impl SetAttributes for $func_name {
#[inline]
- fn set_attributes(&mut self, pbag: &PropertyBag<'_>) -> ElementResult {
- for (attr, value) in pbag.iter() {
+ fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+ for (attr, value) in attrs.iter() {
match attr.expanded() {
expanded_name!("", "type") => self.function_type = attr.parse(value)?,
expanded_name!("", "tableValues") => {
diff --git a/rsvg_internals/src/filters/composite.rs b/rsvg_internals/src/filters/composite.rs
index 4e48fb9e..7677178d 100644
--- a/rsvg_internals/src/filters/composite.rs
+++ b/rsvg_internals/src/filters/composite.rs
@@ -1,13 +1,13 @@
use cssparser::Parser;
use markup5ever::{expanded_name, local_name, namespace_url, ns};
+use crate::attributes::Attributes;
use crate::document::AcquiredNodes;
use crate::drawing_ctx::DrawingCtx;
use crate::element::{ElementResult, SetAttributes};
use crate::error::*;
use crate::node::Node;
use crate::parsers::{Parse, ParseValue};
-use crate::property_bag::PropertyBag;
use super::context::{FilterContext, FilterOutput, FilterResult};
use super::{FilterEffect, FilterError, Input, PrimitiveWithInput};
@@ -51,10 +51,10 @@ impl Default for FeComposite {
}
impl SetAttributes for FeComposite {
- fn set_attributes(&mut self, pbag: &PropertyBag<'_>) -> ElementResult {
- self.base.set_attributes(pbag)?;
+ fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+ self.base.set_attributes(attrs)?;
- for (attr, value) in pbag.iter() {
+ for (attr, value) in attrs.iter() {
match attr.expanded() {
expanded_name!("", "in2") => self.in2 = Some(attr.parse(value)?),
expanded_name!("", "operator") => self.operator = attr.parse(value)?,
diff --git a/rsvg_internals/src/filters/convolve_matrix.rs b/rsvg_internals/src/filters/convolve_matrix.rs
index 7d5f68b7..a8f3f844 100644
--- a/rsvg_internals/src/filters/convolve_matrix.rs
+++ b/rsvg_internals/src/filters/convolve_matrix.rs
@@ -2,6 +2,7 @@ use cssparser::Parser;
use markup5ever::{expanded_name, local_name, namespace_url, ns, QualName};
use nalgebra::{DMatrix, Dynamic, VecStorage};
+use crate::attributes::Attributes;
use crate::document::AcquiredNodes;
use crate::drawing_ctx::DrawingCtx;
use crate::element::{ElementResult, SetAttributes};
@@ -9,7 +10,6 @@ use crate::error::*;
use crate::node::Node;
use crate::number_list::{NumberList, NumberListLength};
use crate::parsers::{NumberOptionalNumber, Parse, ParseValue};
-use crate::property_bag::PropertyBag;
use crate::rect::IRect;
use crate::surface_utils::{
iterators::{PixelRectangle, Pixels},
@@ -55,10 +55,10 @@ impl Default for FeConvolveMatrix {
}
impl SetAttributes for FeConvolveMatrix {
- fn set_attributes(&mut self, pbag: &PropertyBag<'_>) -> ElementResult {
- self.base.set_attributes(pbag)?;
+ fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+ self.base.set_attributes(attrs)?;
- for (attr, value) in pbag.iter() {
+ for (attr, value) in attrs.iter() {
match attr.expanded() {
expanded_name!("", "order") => {
let NumberOptionalNumber(x, y) =
@@ -103,7 +103,7 @@ impl SetAttributes for FeConvolveMatrix {
}
// target_x and target_y depend on order.
- for (attr, value) in pbag.iter() {
+ for (attr, value) in attrs.iter() {
match attr.expanded() {
expanded_name!("", "targetX") => {
self.target_x = {
@@ -146,7 +146,7 @@ impl SetAttributes for FeConvolveMatrix {
}
// Finally, parse the kernel matrix.
- for (attr, value) in pbag
+ for (attr, value) in attrs
.iter()
.filter(|(attr, _)| attr.expanded() == expanded_name!("", "kernelMatrix"))
{
diff --git a/rsvg_internals/src/filters/displacement_map.rs b/rsvg_internals/src/filters/displacement_map.rs
index 178a5c45..be91009c 100644
--- a/rsvg_internals/src/filters/displacement_map.rs
+++ b/rsvg_internals/src/filters/displacement_map.rs
@@ -1,13 +1,13 @@
use cssparser::Parser;
use markup5ever::{expanded_name, local_name, namespace_url, ns};
+use crate::attributes::Attributes;
use crate::document::AcquiredNodes;
use crate::drawing_ctx::DrawingCtx;
use crate::element::{ElementResult, SetAttributes};
use crate::error::*;
use crate::node::Node;
use crate::parsers::{Parse, ParseValue};
-use crate::property_bag::PropertyBag;
use crate::surface_utils::{iterators::Pixels, shared_surface::ExclusiveImageSurface};
use super::context::{FilterContext, FilterOutput, FilterResult};
@@ -46,10 +46,10 @@ impl Default for FeDisplacementMap {
}
impl SetAttributes for FeDisplacementMap {
- fn set_attributes(&mut self, pbag: &PropertyBag<'_>) -> ElementResult {
- self.base.set_attributes(pbag)?;
+ fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+ self.base.set_attributes(attrs)?;
- for (attr, value) in pbag.iter() {
+ for (attr, value) in attrs.iter() {
match attr.expanded() {
expanded_name!("", "in2") => self.in2 = Some(attr.parse(value)?),
expanded_name!("", "scale") => self.scale = attr.parse(value)?,
diff --git a/rsvg_internals/src/filters/flood.rs b/rsvg_internals/src/filters/flood.rs
index 5a320cf2..c8adbb7c 100644
--- a/rsvg_internals/src/filters/flood.rs
+++ b/rsvg_internals/src/filters/flood.rs
@@ -1,8 +1,8 @@
+use crate::attributes::Attributes;
use crate::document::AcquiredNodes;
use crate::drawing_ctx::DrawingCtx;
use crate::element::{ElementResult, SetAttributes};
use crate::node::{CascadedValues, Node};
-use crate::property_bag::PropertyBag;
use super::context::{FilterContext, FilterOutput, FilterResult};
use super::{FilterEffect, FilterError, Primitive};
@@ -23,8 +23,8 @@ impl Default for FeFlood {
}
impl SetAttributes for FeFlood {
- fn set_attributes(&mut self, pbag: &PropertyBag<'_>) -> ElementResult {
- self.base.set_attributes(pbag)
+ fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+ self.base.set_attributes(attrs)
}
}
diff --git a/rsvg_internals/src/filters/gaussian_blur.rs b/rsvg_internals/src/filters/gaussian_blur.rs
index 877141a7..9e5d6c8c 100644
--- a/rsvg_internals/src/filters/gaussian_blur.rs
+++ b/rsvg_internals/src/filters/gaussian_blur.rs
@@ -4,13 +4,13 @@ use std::f64;
use markup5ever::{expanded_name, local_name, namespace_url, ns};
use nalgebra::{DMatrix, Dynamic, VecStorage};
+use crate::attributes::Attributes;
use crate::document::AcquiredNodes;
use crate::drawing_ctx::DrawingCtx;
use crate::element::{ElementResult, SetAttributes};
use crate::error::*;
use crate::node::Node;
use crate::parsers::{NumberOptionalNumber, ParseValue};
-use crate::property_bag::PropertyBag;
use crate::rect::IRect;
use crate::surface_utils::{
shared_surface::{BlurDirection, Horizontal, SharedImageSurface, Vertical},
@@ -43,9 +43,9 @@ impl Default for FeGaussianBlur {
}
impl SetAttributes for FeGaussianBlur {
- fn set_attributes(&mut self, pbag: &PropertyBag<'_>) -> ElementResult {
- self.base.set_attributes(pbag)?;
- let result = pbag
+ fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+ self.base.set_attributes(attrs)?;
+ let result = attrs
.iter()
.find(|(attr, _)| attr.expanded() == expanded_name!("", "stdDeviation"))
.and_then(|(attr, value)| {
diff --git a/rsvg_internals/src/filters/image.rs b/rsvg_internals/src/filters/image.rs
index 9bfe04d0..8d5665e3 100644
--- a/rsvg_internals/src/filters/image.rs
+++ b/rsvg_internals/src/filters/image.rs
@@ -2,6 +2,7 @@ use markup5ever::{expanded_name, local_name, namespace_url, ns};
use crate::allowed_url::{Fragment, Href};
use crate::aspect_ratio::AspectRatio;
+use crate::attributes::Attributes;
use crate::document::AcquiredNodes;
use crate::drawing_ctx::DrawingCtx;
use crate::element::{ElementResult, SetAttributes};
@@ -9,7 +10,6 @@ use crate::error::*;
use crate::href::{is_href, set_href};
use crate::node::{CascadedValues, Node};
use crate::parsers::ParseValue;
-use crate::property_bag::PropertyBag;
use crate::rect::Rect;
use crate::viewbox::ViewBox;
@@ -111,10 +111,10 @@ impl FeImage {
}
impl SetAttributes for FeImage {
- fn set_attributes(&mut self, pbag: &PropertyBag<'_>) -> ElementResult {
- self.base.set_attributes(pbag)?;
+ fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+ self.base.set_attributes(attrs)?;
- for (attr, value) in pbag.iter() {
+ for (attr, value) in attrs.iter() {
match attr.expanded() {
expanded_name!("", "preserveAspectRatio") => self.aspect = attr.parse(value)?,
diff --git a/rsvg_internals/src/filters/lighting.rs b/rsvg_internals/src/filters/lighting.rs
index 2c45e9bc..4402718d 100644
--- a/rsvg_internals/src/filters/lighting.rs
+++ b/rsvg_internals/src/filters/lighting.rs
@@ -8,6 +8,7 @@ use num_traits::identities::Zero;
use rayon::prelude::*;
use std::cmp::max;
+use crate::attributes::Attributes;
use crate::document::AcquiredNodes;
use crate::drawing_ctx::DrawingCtx;
use crate::element::{Draw, Element, ElementResult, SetAttributes};
@@ -18,7 +19,6 @@ use crate::filters::{
};
use crate::node::{CascadedValues, Node, NodeBorrow};
use crate::parsers::{NumberOptionalNumber, ParseValue};
-use crate::property_bag::PropertyBag;
use crate::rect::IRect;
use crate::surface_utils::{
shared_surface::{ExclusiveImageSurface, SharedImageSurface, SurfaceType},
@@ -121,8 +121,8 @@ impl FeDistantLight {
}
impl SetAttributes for FeDistantLight {
- fn set_attributes(&mut self, pbag: &PropertyBag<'_>) -> ElementResult {
- for (attr, value) in pbag.iter() {
+ fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+ for (attr, value) in attrs.iter() {
match attr.expanded() {
expanded_name!("", "azimuth") => self.azimuth = attr.parse(value)?,
expanded_name!("", "elevation") => self.elevation = attr.parse(value)?,
@@ -155,8 +155,8 @@ impl FePointLight {
}
impl SetAttributes for FePointLight {
- fn set_attributes(&mut self, pbag: &PropertyBag<'_>) -> ElementResult {
- for (attr, value) in pbag.iter() {
+ fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+ for (attr, value) in attrs.iter() {
match attr.expanded() {
expanded_name!("", "x") => self.x = attr.parse(value)?,
expanded_name!("", "y") => self.y = attr.parse(value)?,
@@ -206,8 +206,8 @@ impl FeSpotLight {
}
impl SetAttributes for FeSpotLight {
- fn set_attributes(&mut self, pbag: &PropertyBag<'_>) -> ElementResult {
- for (attr, value) in pbag.iter() {
+ fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+ for (attr, value) in attrs.iter() {
match attr.expanded() {
expanded_name!("", "x") => self.x = attr.parse(value)?,
expanded_name!("", "y") => self.y = attr.parse(value)?,
@@ -257,10 +257,10 @@ impl Common {
}
impl SetAttributes for Common {
- fn set_attributes(&mut self, pbag: &PropertyBag<'_>) -> ElementResult {
- self.base.set_attributes(pbag)?;
+ fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+ self.base.set_attributes(attrs)?;
- for (attr, value) in pbag.iter() {
+ for (attr, value) in attrs.iter() {
match attr.expanded() {
expanded_name!("", "surfaceScale") => self.surface_scale = attr.parse(value)?,
@@ -302,9 +302,9 @@ impl Default for FeDiffuseLighting {
}
impl SetAttributes for FeDiffuseLighting {
- fn set_attributes(&mut self, pbag: &PropertyBag<'_>) -> ElementResult {
- self.common.set_attributes(pbag)?;
- let result = pbag
+ fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+ self.common.set_attributes(attrs)?;
+ let result = attrs
.iter()
.find(|(attr, _)| attr.expanded() == expanded_name!("", "diffuseConstant"))
.and_then(|(attr, value)| {
@@ -370,10 +370,10 @@ impl Default for FeSpecularLighting {
}
impl SetAttributes for FeSpecularLighting {
- fn set_attributes(&mut self, pbag: &PropertyBag<'_>) -> ElementResult {
- self.common.set_attributes(pbag)?;
+ fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+ self.common.set_attributes(attrs)?;
- for (attr, value) in pbag.iter() {
+ for (attr, value) in attrs.iter() {
match attr.expanded() {
expanded_name!("", "specularConstant") => {
self.specular_constant = attr.parse_and_validate(value, |x| {
diff --git a/rsvg_internals/src/filters/merge.rs b/rsvg_internals/src/filters/merge.rs
index 915fa199..58be106d 100644
--- a/rsvg_internals/src/filters/merge.rs
+++ b/rsvg_internals/src/filters/merge.rs
@@ -1,11 +1,11 @@
use markup5ever::{expanded_name, local_name, namespace_url, ns};
+use crate::attributes::Attributes;
use crate::document::AcquiredNodes;
use crate::drawing_ctx::DrawingCtx;
use crate::element::{Draw, Element, ElementResult, SetAttributes};
use crate::node::{Node, NodeBorrow};
use crate::parsers::ParseValue;
-use crate::property_bag::PropertyBag;
use crate::rect::IRect;
use crate::surface_utils::shared_surface::{SharedImageSurface, SurfaceType};
@@ -34,15 +34,15 @@ impl Default for FeMerge {
}
impl SetAttributes for FeMerge {
- fn set_attributes(&mut self, pbag: &PropertyBag<'_>) -> ElementResult {
- self.base.set_attributes(pbag)
+ fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+ self.base.set_attributes(attrs)
}
}
impl SetAttributes for FeMergeNode {
#[inline]
- fn set_attributes(&mut self, pbag: &PropertyBag<'_>) -> ElementResult {
- self.in_ = pbag
+ fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+ self.in_ = attrs
.iter()
.find(|(attr, _)| attr.expanded() == expanded_name!("", "in"))
.and_then(|(attr, value)| attr.parse(value).ok());
diff --git a/rsvg_internals/src/filters/mod.rs b/rsvg_internals/src/filters/mod.rs
index d59eed09..a04e524e 100644
--- a/rsvg_internals/src/filters/mod.rs
+++ b/rsvg_internals/src/filters/mod.rs
@@ -5,6 +5,7 @@ use markup5ever::{expanded_name, local_name, namespace_url, ns};
use std::ops::Deref;
use std::time::Instant;
+use crate::attributes::Attributes;
use crate::bbox::BoundingBox;
use crate::coord_units::CoordUnits;
use crate::document::AcquiredNodes;
@@ -15,7 +16,6 @@ use crate::length::*;
use crate::node::{CascadedValues, Node, NodeBorrow};
use crate::parsers::{CustomIdent, Parse, ParseValue};
use crate::properties::ComputedValues;
-use crate::property_bag::PropertyBag;
use crate::property_defs::ColorInterpolationFilters;
use crate::surface_utils::shared_surface::{SharedImageSurface, SurfaceType};
use crate::transform::Transform;
@@ -200,8 +200,8 @@ impl Primitive {
}
impl SetAttributes for Primitive {
- fn set_attributes(&mut self, pbag: &PropertyBag<'_>) -> ElementResult {
- for (attr, value) in pbag.iter() {
+ fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+ for (attr, value) in attrs.iter() {
match attr.expanded() {
expanded_name!("", "x") => self.x = Some(attr.parse(value)?),
expanded_name!("", "y") => self.y = Some(attr.parse(value)?),
@@ -246,10 +246,10 @@ impl PrimitiveWithInput {
}
impl SetAttributes for PrimitiveWithInput {
- fn set_attributes(&mut self, pbag: &PropertyBag<'_>) -> ElementResult {
- self.base.set_attributes(pbag)?;
+ fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+ self.base.set_attributes(attrs)?;
- self.in_ = pbag
+ self.in_ = attrs
.iter()
.find(|(attr, _)| attr.expanded() == expanded_name!("", "in"))
.and_then(|(attr, value)| attr.parse(value).ok());
diff --git a/rsvg_internals/src/filters/morphology.rs b/rsvg_internals/src/filters/morphology.rs
index dffa1657..a51271a5 100644
--- a/rsvg_internals/src/filters/morphology.rs
+++ b/rsvg_internals/src/filters/morphology.rs
@@ -3,13 +3,13 @@ use std::cmp::{max, min};
use cssparser::Parser;
use markup5ever::{expanded_name, local_name, namespace_url, ns};
+use crate::attributes::Attributes;
use crate::document::AcquiredNodes;
use crate::drawing_ctx::DrawingCtx;
use crate::element::{ElementResult, SetAttributes};
use crate::error::*;
use crate::node::Node;
use crate::parsers::{NumberOptionalNumber, Parse, ParseValue};
-use crate::property_bag::PropertyBag;
use crate::rect::IRect;
use crate::surface_utils::{
iterators::{PixelRectangle, Pixels},
@@ -46,10 +46,10 @@ impl Default for FeMorphology {
}
impl SetAttributes for FeMorphology {
- fn set_attributes(&mut self, pbag: &PropertyBag<'_>) -> ElementResult {
- self.base.set_attributes(pbag)?;
+ fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+ self.base.set_attributes(attrs)?;
- for (attr, value) in pbag.iter() {
+ for (attr, value) in attrs.iter() {
match attr.expanded() {
expanded_name!("", "operator") => self.operator = attr.parse(value)?,
expanded_name!("", "radius") => {
diff --git a/rsvg_internals/src/filters/offset.rs b/rsvg_internals/src/filters/offset.rs
index 3cb54880..769a55e1 100644
--- a/rsvg_internals/src/filters/offset.rs
+++ b/rsvg_internals/src/filters/offset.rs
@@ -1,11 +1,11 @@
use markup5ever::{expanded_name, local_name, namespace_url, ns};
+use crate::attributes::Attributes;
use crate::document::AcquiredNodes;
use crate::drawing_ctx::DrawingCtx;
use crate::element::{ElementResult, SetAttributes};
use crate::node::Node;
use crate::parsers::ParseValue;
-use crate::property_bag::PropertyBag;
use super::context::{FilterContext, FilterOutput, FilterResult};
use super::{FilterEffect, FilterError, PrimitiveWithInput};
@@ -30,10 +30,10 @@ impl Default for FeOffset {
}
impl SetAttributes for FeOffset {
- fn set_attributes(&mut self, pbag: &PropertyBag<'_>) -> ElementResult {
- self.base.set_attributes(pbag)?;
+ fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+ self.base.set_attributes(attrs)?;
- for (attr, value) in pbag.iter() {
+ for (attr, value) in attrs.iter() {
match attr.expanded() {
expanded_name!("", "dx") => self.dx = attr.parse(value)?,
expanded_name!("", "dy") => self.dy = attr.parse(value)?,
diff --git a/rsvg_internals/src/filters/tile.rs b/rsvg_internals/src/filters/tile.rs
index 8be49ed8..ab33684e 100644
--- a/rsvg_internals/src/filters/tile.rs
+++ b/rsvg_internals/src/filters/tile.rs
@@ -1,8 +1,8 @@
+use crate::attributes::Attributes;
use crate::document::AcquiredNodes;
use crate::drawing_ctx::DrawingCtx;
use crate::element::{ElementResult, SetAttributes};
use crate::node::Node;
-use crate::property_bag::PropertyBag;
use super::context::{FilterContext, FilterInput, FilterOutput, FilterResult};
use super::{FilterEffect, FilterError, PrimitiveWithInput};
@@ -23,8 +23,8 @@ impl Default for FeTile {
}
impl SetAttributes for FeTile {
- fn set_attributes(&mut self, pbag: &PropertyBag<'_>) -> ElementResult {
- self.base.set_attributes(pbag)
+ fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+ self.base.set_attributes(attrs)
}
}
diff --git a/rsvg_internals/src/filters/turbulence.rs b/rsvg_internals/src/filters/turbulence.rs
index f7719254..22caf895 100644
--- a/rsvg_internals/src/filters/turbulence.rs
+++ b/rsvg_internals/src/filters/turbulence.rs
@@ -1,13 +1,13 @@
use cssparser::Parser;
use markup5ever::{expanded_name, local_name, namespace_url, ns};
+use crate::attributes::Attributes;
use crate::document::AcquiredNodes;
use crate::drawing_ctx::DrawingCtx;
use crate::element::{ElementResult, SetAttributes};
use crate::error::*;
use crate::node::{CascadedValues, Node};
use crate::parsers::{NumberOptionalNumber, Parse, ParseValue};
-use crate::property_bag::PropertyBag;
use crate::surface_utils::{
shared_surface::{ExclusiveImageSurface, SurfaceType},
ImageSurfaceDataExt, Pixel,
@@ -57,10 +57,10 @@ impl Default for FeTurbulence {
}
impl SetAttributes for FeTurbulence {
- fn set_attributes(&mut self, pbag: &PropertyBag<'_>) -> ElementResult {
- self.base.set_attributes(pbag)?;
+ fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+ self.base.set_attributes(attrs)?;
- for (attr, value) in pbag.iter() {
+ for (attr, value) in attrs.iter() {
match attr.expanded() {
expanded_name!("", "baseFrequency") => {
let NumberOptionalNumber(x, y) =
diff --git a/rsvg_internals/src/gradient.rs b/rsvg_internals/src/gradient.rs
index b1a068cd..529e4656 100644
--- a/rsvg_internals/src/gradient.rs
+++ b/rsvg_internals/src/gradient.rs
@@ -8,6 +8,7 @@ use matches::matches;
use std::cell::RefCell;
use crate::allowed_url::Fragment;
+use crate::attributes::Attributes;
use crate::coord_units::CoordUnits;
use crate::document::{AcquiredNodes, NodeStack};
use crate::element::{Draw, Element, ElementResult, SetAttributes};
@@ -16,7 +17,6 @@ use crate::href::{is_href, set_href};
use crate::length::*;
use crate::node::{CascadedValues, Node, NodeBorrow};
use crate::parsers::{Parse, ParseValue};
-use crate::property_bag::PropertyBag;
use crate::property_defs::StopColor;
use crate::transform::Transform;
use crate::unit_interval::UnitInterval;
@@ -81,8 +81,8 @@ fn validate_offset(length: Length<Both>) -> Result<Length<Both>, ValueErrorKind>
}
impl SetAttributes for Stop {
- fn set_attributes(&mut self, pbag: &PropertyBag<'_>) -> ElementResult {
- let result = pbag
+ fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+ let result = attrs
.iter()
.find(|(attr, _)| attr.expanded() == expanded_name!("", "offset"))
.and_then(|(attr, value)| attr.parse_and_validate(value, validate_offset).ok())
@@ -512,8 +512,8 @@ impl RadialGradient {
}
impl SetAttributes for Common {
- fn set_attributes(&mut self, pbag: &PropertyBag<'_>) -> ElementResult {
- for (attr, value) in pbag.iter() {
+ fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+ for (attr, value) in attrs.iter() {
match attr.expanded() {
expanded_name!("", "gradientUnits") => self.units = Some(attr.parse(value)?),
expanded_name!("", "gradientTransform") => {
@@ -536,10 +536,10 @@ impl SetAttributes for Common {
}
impl SetAttributes for LinearGradient {
- fn set_attributes(&mut self, pbag: &PropertyBag<'_>) -> ElementResult {
- self.common.set_attributes(pbag)?;
+ fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+ self.common.set_attributes(attrs)?;
- for (attr, value) in pbag.iter() {
+ for (attr, value) in attrs.iter() {
match attr.expanded() {
expanded_name!("", "x1") => self.x1 = Some(attr.parse(value)?),
expanded_name!("", "y1") => self.y1 = Some(attr.parse(value)?),
@@ -632,15 +632,15 @@ impl_gradient!(LinearGradient, RadialGradient);
impl_gradient!(RadialGradient, LinearGradient);
impl SetAttributes for RadialGradient {
- fn set_attributes(&mut self, pbag: &PropertyBag<'_>) -> ElementResult {
- self.common.set_attributes(pbag)?;
+ fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+ self.common.set_attributes(attrs)?;
// Create a local expanded name for "fr" because markup5ever doesn't have built-in
let expanded_name_fr = ExpandedName {
ns: &Namespace::from(""),
local: &LocalName::from("fr"),
};
- for (attr, value) in pbag.iter() {
+ for (attr, value) in attrs.iter() {
let attr_expanded = attr.expanded();
if attr_expanded == expanded_name_fr {
@@ -706,11 +706,11 @@ mod tests {
#[test]
fn gradient_resolved_from_defaults_is_really_resolved() {
- let bag = unsafe { PropertyBag::new_from_xml2_attributes(0, ptr::null()) };
+ let attrs = unsafe { Attributes::new_from_xml2_attributes(0, ptr::null()) };
let node = Node::new(NodeData::new_element(
&QualName::new(None, ns!(svg), local_name!("linearGradient")),
- &bag,
+ &attrs,
));
let unresolved = borrow_element_as!(node, LinearGradient).get_unresolved(&node);
@@ -719,7 +719,7 @@ mod tests {
let node = Node::new(NodeData::new_element(
&QualName::new(None, ns!(svg), local_name!("radialGradient")),
- &bag,
+ &attrs,
));
let unresolved = borrow_element_as!(node, RadialGradient).get_unresolved(&node);
diff --git a/rsvg_internals/src/image.rs b/rsvg_internals/src/image.rs
index 481f4519..4fc0f4d8 100644
--- a/rsvg_internals/src/image.rs
+++ b/rsvg_internals/src/image.rs
@@ -4,6 +4,7 @@ use markup5ever::{expanded_name, local_name, namespace_url, ns};
use crate::allowed_url::Href;
use crate::aspect_ratio::AspectRatio;
+use crate::attributes::Attributes;
use crate::bbox::BoundingBox;
use crate::document::AcquiredNodes;
use crate::drawing_ctx::DrawingCtx;
@@ -13,7 +14,6 @@ use crate::href::{is_href, set_href};
use crate::length::*;
use crate::node::{CascadedValues, Node};
use crate::parsers::ParseValue;
-use crate::property_bag::PropertyBag;
use crate::rect::Rect;
#[derive(Default)]
@@ -27,8 +27,8 @@ pub struct Image {
}
impl SetAttributes for Image {
- fn set_attributes(&mut self, pbag: &PropertyBag<'_>) -> ElementResult {
- for (attr, value) in pbag.iter() {
+ fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+ for (attr, value) in attrs.iter() {
match attr.expanded() {
expanded_name!("", "x") => self.x = attr.parse(value)?,
expanded_name!("", "y") => self.y = attr.parse(value)?,
diff --git a/rsvg_internals/src/lib.rs b/rsvg_internals/src/lib.rs
index e9f29dfb..49cdc197 100644
--- a/rsvg_internals/src/lib.rs
+++ b/rsvg_internals/src/lib.rs
@@ -103,6 +103,7 @@ mod property_macros;
mod allowed_url;
mod angle;
mod aspect_ratio;
+mod attributes;
mod bbox;
mod color;
mod cond;
@@ -131,7 +132,6 @@ pub mod path_builder; // pub for benchmarking
pub mod path_parser; // pub for benchmarking
mod pattern;
mod properties;
-mod property_bag;
mod property_defs;
pub mod rect;
mod shapes;
diff --git a/rsvg_internals/src/marker.rs b/rsvg_internals/src/marker.rs
index 19f05f76..7670096d 100644
--- a/rsvg_internals/src/marker.rs
+++ b/rsvg_internals/src/marker.rs
@@ -9,6 +9,7 @@ use markup5ever::{expanded_name, local_name, namespace_url, ns};
use crate::allowed_url::Fragment;
use crate::angle::Angle;
use crate::aspect_ratio::*;
+use crate::attributes::Attributes;
use crate::bbox::BoundingBox;
use crate::document::AcquiredNodes;
use crate::drawing_ctx::DrawingCtx;
@@ -21,7 +22,6 @@ use crate::node::{CascadedValues, Node, NodeBorrow, NodeDraw};
use crate::parsers::{Parse, ParseValue};
use crate::path_builder::{arc_segment, ArcParameterization, CubicBezierCurve, Path, PathCommand};
use crate::properties::ComputedValues;
-use crate::property_bag::PropertyBag;
use crate::rect::Rect;
use crate::transform::Transform;
use crate::viewbox::*;
@@ -176,8 +176,8 @@ impl Marker {
}
impl SetAttributes for Marker {
- fn set_attributes(&mut self, pbag: &PropertyBag<'_>) -> ElementResult {
- for (attr, value) in pbag.iter() {
+ fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+ for (attr, value) in attrs.iter() {
match attr.expanded() {
expanded_name!("", "markerUnits") => self.units = attr.parse(value)?,
expanded_name!("", "refX") => self.ref_x = attr.parse(value)?,
diff --git a/rsvg_internals/src/node.rs b/rsvg_internals/src/node.rs
index 8bbd716b..f12c2917 100644
--- a/rsvg_internals/src/node.rs
+++ b/rsvg_internals/src/node.rs
@@ -15,13 +15,13 @@ use markup5ever::QualName;
use std::cell::{Ref, RefMut};
use std::fmt;
+use crate::attributes::Attributes;
use crate::bbox::BoundingBox;
use crate::document::AcquiredNodes;
use crate::drawing_ctx::DrawingCtx;
use crate::element::*;
use crate::error::*;
use crate::properties::ComputedValues;
-use crate::property_bag::PropertyBag;
use crate::text::Chars;
/// Strong reference to an element in the SVG tree.
@@ -68,8 +68,8 @@ pub enum NodeData {
}
impl NodeData {
- pub fn new_element(name: &QualName, pbag: &PropertyBag) -> NodeData {
- NodeData::Element(Element::new(name, pbag))
+ pub fn new_element(name: &QualName, attrs: &Attributes) -> NodeData {
+ NodeData::Element(Element::new(name, attrs))
}
pub fn new_chars(initial_text: &str) -> NodeData {
diff --git a/rsvg_internals/src/pattern.rs b/rsvg_internals/src/pattern.rs
index 3320e543..ad8a1436 100644
--- a/rsvg_internals/src/pattern.rs
+++ b/rsvg_internals/src/pattern.rs
@@ -5,6 +5,7 @@ use std::cell::RefCell;
use crate::allowed_url::Fragment;
use crate::aspect_ratio::*;
+use crate::attributes::Attributes;
use crate::coord_units::CoordUnits;
use crate::document::{AcquiredNodes, NodeStack};
use crate::drawing_ctx::ViewParams;
@@ -15,7 +16,6 @@ use crate::length::*;
use crate::node::{Node, NodeBorrow, WeakNode};
use crate::parsers::ParseValue;
use crate::properties::ComputedValues;
-use crate::property_bag::PropertyBag;
use crate::rect::Rect;
use crate::transform::Transform;
use crate::viewbox::*;
@@ -111,8 +111,8 @@ pub struct Pattern {
}
impl SetAttributes for Pattern {
- fn set_attributes(&mut self, pbag: &PropertyBag<'_>) -> ElementResult {
- for (attr, value) in pbag.iter() {
+ fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+ for (attr, value) in attrs.iter() {
match attr.expanded() {
expanded_name!("", "patternUnits") => self.common.units = Some(attr.parse(value)?),
expanded_name!("", "patternContentUnits") => {
@@ -425,11 +425,11 @@ mod tests {
#[test]
fn pattern_resolved_from_defaults_is_really_resolved() {
- let bag = unsafe { PropertyBag::new_from_xml2_attributes(0, ptr::null()) };
+ let attrs = unsafe { Attributes::new_from_xml2_attributes(0, ptr::null()) };
let node = Node::new(NodeData::new_element(
&QualName::new(None, ns!(svg), local_name!("pattern")),
- &bag,
+ &attrs,
));
let unresolved = borrow_element_as!(node, Pattern).get_unresolved(&node);
diff --git a/rsvg_internals/src/properties.rs b/rsvg_internals/src/properties.rs
index 57e808c5..b2ad2245 100644
--- a/rsvg_internals/src/properties.rs
+++ b/rsvg_internals/src/properties.rs
@@ -26,11 +26,11 @@ use markup5ever::{
};
use std::collections::HashSet;
+use crate::attributes::Attributes;
use crate::css::{DeclParser, Declaration, Origin};
use crate::error::*;
use crate::font_props::*;
use crate::parsers::{Parse, ParseValue};
-use crate::property_bag::PropertyBag;
use crate::property_defs::*;
use crate::property_macros::Property;
@@ -721,9 +721,9 @@ impl SpecifiedValues {
pub fn parse_presentation_attributes(
&mut self,
- pbag: &PropertyBag<'_>,
+ attrs: &Attributes,
) -> Result<(), ElementError> {
- for (attr, value) in pbag.iter() {
+ for (attr, value) in attrs.iter() {
match attr.expanded() {
expanded_name!(xml "lang") => {
// xml:lang is a non-presentation attribute and as such cannot have the
diff --git a/rsvg_internals/src/shapes.rs b/rsvg_internals/src/shapes.rs
index 4bf57fc3..6bb563c6 100644
--- a/rsvg_internals/src/shapes.rs
+++ b/rsvg_internals/src/shapes.rs
@@ -5,6 +5,7 @@ use markup5ever::{expanded_name, local_name, namespace_url, ns};
use std::ops::Deref;
use std::rc::Rc;
+use crate::attributes::Attributes;
use crate::bbox::BoundingBox;
use crate::document::AcquiredNodes;
use crate::drawing_ctx::DrawingCtx;
@@ -16,7 +17,6 @@ use crate::parsers::{optional_comma, Parse, ParseValue};
use crate::path_builder::{LargeArc, Path as SvgPath, PathBuilder, Sweep};
use crate::path_parser;
use crate::properties::ComputedValues;
-use crate::property_bag::PropertyBag;
use cssparser::{Parser, Token};
#[derive(Copy, Clone, PartialEq)]
@@ -116,8 +116,8 @@ pub struct Path {
}
impl SetAttributes for Path {
- fn set_attributes(&mut self, pbag: &PropertyBag<'_>) -> ElementResult {
- for (attr, value) in pbag.iter() {
+ fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+ for (attr, value) in attrs.iter() {
if attr.expanded() == expanded_name!("", "d") {
let mut builder = PathBuilder::default();
if let Err(e) = path_parser::parse_path_into_builder(value, &mut builder) {
@@ -222,8 +222,8 @@ pub struct Polygon {
}
impl SetAttributes for Polygon {
- fn set_attributes(&mut self, pbag: &PropertyBag<'_>) -> ElementResult {
- for (attr, value) in pbag.iter() {
+ fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+ for (attr, value) in attrs.iter() {
if attr.expanded() == expanded_name!("", "points") {
self.points = attr.parse(value).map(Some)?;
}
@@ -259,8 +259,8 @@ pub struct Polyline {
}
impl SetAttributes for Polyline {
- fn set_attributes(&mut self, pbag: &PropertyBag<'_>) -> ElementResult {
- for (attr, value) in pbag.iter() {
+ fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+ for (attr, value) in attrs.iter() {
if attr.expanded() == expanded_name!("", "points") {
self.points = attr.parse(value).map(Some)?;
}
@@ -297,8 +297,8 @@ pub struct Line {
}
impl SetAttributes for Line {
- fn set_attributes(&mut self, pbag: &PropertyBag<'_>) -> ElementResult {
- for (attr, value) in pbag.iter() {
+ fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+ for (attr, value) in attrs.iter() {
match attr.expanded() {
expanded_name!("", "x1") => self.x1 = attr.parse(value)?,
expanded_name!("", "y1") => self.y1 = attr.parse(value)?,
@@ -363,8 +363,8 @@ pub struct Rect {
}
impl SetAttributes for Rect {
- fn set_attributes(&mut self, pbag: &PropertyBag<'_>) -> ElementResult {
- for (attr, value) in pbag.iter() {
+ fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+ for (attr, value) in attrs.iter() {
match attr.expanded() {
expanded_name!("", "x") => self.x = attr.parse(value)?,
expanded_name!("", "y") => self.y = attr.parse(value)?,
@@ -595,8 +595,8 @@ pub struct Circle {
}
impl SetAttributes for Circle {
- fn set_attributes(&mut self, pbag: &PropertyBag<'_>) -> ElementResult {
- for (attr, value) in pbag.iter() {
+ fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+ for (attr, value) in attrs.iter() {
match attr.expanded() {
expanded_name!("", "cx") => self.cx = attr.parse(value)?,
expanded_name!("", "cy") => self.cy = attr.parse(value)?,
@@ -652,8 +652,8 @@ pub struct Ellipse {
}
impl SetAttributes for Ellipse {
- fn set_attributes(&mut self, pbag: &PropertyBag<'_>) -> ElementResult {
- for (attr, value) in pbag.iter() {
+ fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+ for (attr, value) in attrs.iter() {
match attr.expanded() {
expanded_name!("", "cx") => self.cx = attr.parse(value)?,
expanded_name!("", "cy") => self.cy = attr.parse(value)?,
diff --git a/rsvg_internals/src/structure.rs b/rsvg_internals/src/structure.rs
index b984d38c..97b0cd5f 100644
--- a/rsvg_internals/src/structure.rs
+++ b/rsvg_internals/src/structure.rs
@@ -4,6 +4,7 @@ use markup5ever::{expanded_name, local_name, namespace_url, ns};
use crate::allowed_url::Fragment;
use crate::aspect_ratio::*;
+use crate::attributes::Attributes;
use crate::bbox::BoundingBox;
use crate::coord_units::CoordUnits;
use crate::document::AcquiredNodes;
@@ -16,7 +17,6 @@ use crate::length::*;
use crate::node::{CascadedValues, Node, NodeBorrow, NodeDraw};
use crate::parsers::{Parse, ParseValue};
use crate::properties::ComputedValues;
-use crate::property_bag::PropertyBag;
use crate::rect::Rect;
use crate::viewbox::*;
@@ -192,8 +192,8 @@ impl Svg {
}
impl SetAttributes for Svg {
- fn set_attributes(&mut self, pbag: &PropertyBag<'_>) -> ElementResult {
- for (attr, value) in pbag.iter() {
+ fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+ for (attr, value) in attrs.iter() {
match attr.expanded() {
expanded_name!("", "preserveAspectRatio") => {
self.preserve_aspect_ratio = attr.parse(value)?
@@ -305,8 +305,8 @@ impl Use {
}
impl SetAttributes for Use {
- fn set_attributes(&mut self, pbag: &PropertyBag<'_>) -> ElementResult {
- for (attr, value) in pbag.iter() {
+ fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+ for (attr, value) in attrs.iter() {
match attr.expanded() {
ref a if is_href(a) => set_href(
a,
@@ -364,8 +364,8 @@ impl Symbol {
}
impl SetAttributes for Symbol {
- fn set_attributes(&mut self, pbag: &PropertyBag<'_>) -> ElementResult {
- for (attr, value) in pbag.iter() {
+ fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+ for (attr, value) in attrs.iter() {
match attr.expanded() {
expanded_name!("", "preserveAspectRatio") => {
self.preserve_aspect_ratio = attr.parse(value)?
@@ -395,8 +395,8 @@ impl ClipPath {
}
impl SetAttributes for ClipPath {
- fn set_attributes(&mut self, pbag: &PropertyBag<'_>) -> ElementResult {
- let result = pbag
+ fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+ let result = attrs
.iter()
.find(|(attr, _)| attr.expanded() == expanded_name!("", "clipPathUnits"))
.and_then(|(attr, value)| attr.parse(value).ok());
@@ -458,8 +458,8 @@ impl Mask {
}
impl SetAttributes for Mask {
- fn set_attributes(&mut self, pbag: &PropertyBag<'_>) -> ElementResult {
- for (attr, value) in pbag.iter() {
+ fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+ for (attr, value) in attrs.iter() {
match attr.expanded() {
expanded_name!("", "x") => self.x = attr.parse(value)?,
expanded_name!("", "y") => self.y = attr.parse(value)?,
@@ -489,8 +489,8 @@ pub struct Link {
}
impl SetAttributes for Link {
- fn set_attributes(&mut self, pbag: &PropertyBag<'_>) -> ElementResult {
- for (attr, value) in pbag.iter() {
+ fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+ for (attr, value) in attrs.iter() {
match attr.expanded() {
ref a if is_href(a) => set_href(a, &mut self.link, value.to_owned()),
_ => (),
diff --git a/rsvg_internals/src/style.rs b/rsvg_internals/src/style.rs
index 3565da0a..c00a97c6 100644
--- a/rsvg_internals/src/style.rs
+++ b/rsvg_internals/src/style.rs
@@ -2,9 +2,9 @@
use markup5ever::{expanded_name, local_name, namespace_url, ns};
+use crate::attributes::Attributes;
use crate::element::{Draw, ElementResult, SetAttributes};
use crate::error::*;
-use crate::property_bag::PropertyBag;
/// Represents the syntax used in the <style> node.
///
@@ -51,8 +51,8 @@ impl Style {
}
impl SetAttributes for Style {
- fn set_attributes(&mut self, pbag: &PropertyBag<'_>) -> ElementResult {
- for (attr, value) in pbag.iter() {
+ fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+ for (attr, value) in attrs.iter() {
if attr.expanded() == expanded_name!("", "type") {
self.type_ = Some(StyleType::parse(value).attribute(attr)?);
}
diff --git a/rsvg_internals/src/text.rs b/rsvg_internals/src/text.rs
index d0fda5fd..b4452e90 100644
--- a/rsvg_internals/src/text.rs
+++ b/rsvg_internals/src/text.rs
@@ -4,6 +4,7 @@ use markup5ever::{expanded_name, local_name, namespace_url, ns};
use std::cell::RefCell;
use crate::allowed_url::Fragment;
+use crate::attributes::Attributes;
use crate::bbox::BoundingBox;
use crate::document::AcquiredNodes;
use crate::drawing_ctx::DrawingCtx;
@@ -14,7 +15,6 @@ use crate::length::*;
use crate::node::{CascadedValues, Node, NodeBorrow};
use crate::parsers::ParseValue;
use crate::properties::ComputedValues;
-use crate::property_bag::PropertyBag;
use crate::property_defs::{
Direction, FontStretch, FontStyle, FontVariant, TextAnchor, UnicodeBidi, WritingMode, XmlLang,
XmlSpace,
@@ -461,8 +461,8 @@ impl Text {
}
impl SetAttributes for Text {
- fn set_attributes(&mut self, pbag: &PropertyBag<'_>) -> ElementResult {
- for (attr, value) in pbag.iter() {
+ fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+ for (attr, value) in attrs.iter() {
match attr.expanded() {
expanded_name!("", "x") => self.x = attr.parse(value)?,
expanded_name!("", "y") => self.y = attr.parse(value)?,
@@ -582,8 +582,8 @@ fn extract_chars_children_to_chunks_recursively(
}
impl SetAttributes for TRef {
- fn set_attributes(&mut self, pbag: &PropertyBag<'_>) -> ElementResult {
- self.link = pbag
+ fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+ self.link = attrs
.iter()
.find(|(attr, _)| attr.expanded() == expanded_name!(xlink "href"))
// Unlike other elements which use `href` in SVG2 versus `xlink:href` in SVG1.1,
@@ -632,8 +632,8 @@ impl TSpan {
}
impl SetAttributes for TSpan {
- fn set_attributes(&mut self, pbag: &PropertyBag<'_>) -> ElementResult {
- for (attr, value) in pbag.iter() {
+ fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+ for (attr, value) in attrs.iter() {
match attr.expanded() {
expanded_name!("", "x") => self.x = attr.parse(value).map(Some)?,
expanded_name!("", "y") => self.y = attr.parse(value).map(Some)?,
diff --git a/rsvg_internals/src/xml.rs b/rsvg_internals/src/xml.rs
index 0765cf04..6cbbeea3 100644
--- a/rsvg_internals/src/xml.rs
+++ b/rsvg_internals/src/xml.rs
@@ -15,12 +15,12 @@ use xml5ever::tendril::format_tendril;
use xml5ever::tokenizer::{TagKind, Token, TokenSink, XmlTokenizer, XmlTokenizerOpts};
use crate::allowed_url::AllowedUrl;
+use crate::attributes::Attributes;
use crate::document::{Document, DocumentBuilder};
use crate::error::LoadingError;
use crate::io::{self, get_input_stream_for_loading};
use crate::limits::MAX_LOADED_ELEMENTS;
use crate::node::{Node, NodeBorrow};
-use crate::property_bag::PropertyBag;
use crate::style::StyleType;
use crate::xml2_load::Xml2Parser;
@@ -166,7 +166,7 @@ impl XmlState {
}
}
- pub fn start_element(&self, name: QualName, pbag: &PropertyBag) -> Result<(), ()> {
+ pub fn start_element(&self, name: QualName, attrs: &Attributes) -> Result<(), ()> {
self.check_limits()?;
let context = self.inner.borrow().context();
@@ -178,8 +178,8 @@ impl XmlState {
self.inner.borrow_mut().num_loaded_elements += 1;
let new_context = match context {
- Context::Start => self.element_creation_start_element(&name, pbag),
- Context::ElementCreation => self.element_creation_start_element(&name, pbag),
+ Context::Start => self.element_creation_start_element(&name, attrs),
+ Context::ElementCreation => self.element_creation_start_element(&name, attrs),
Context::Style => self.inside_style_start_element(&name),
Context::UnsupportedStyleChild => self.unsupported_style_start_element(&name),
@@ -187,7 +187,7 @@ impl XmlState {
Context::XInclude(ref ctx) => self.inside_xinclude_start_element(&ctx, &name),
Context::UnsupportedXIncludeChild => self.unsupported_xinclude_start_element(&name),
Context::XIncludeFallback(ref ctx) => {
- self.xinclude_fallback_start_element(&ctx, &name, pbag)
+ self.xinclude_fallback_start_element(&ctx, &name, attrs)
}
Context::FatalError(_) => unreachable!(),
@@ -312,9 +312,9 @@ impl XmlState {
}
}
- fn element_creation_start_element(&self, name: &QualName, pbag: &PropertyBag) -> Context {
+ fn element_creation_start_element(&self, name: &QualName, attrs: &Attributes) -> Context {
if name.expanded() == xinclude_name!("include") {
- self.xinclude_start_element(name, pbag)
+ self.xinclude_start_element(name, attrs)
} else {
let mut inner = self.inner.borrow_mut();
@@ -323,7 +323,7 @@ impl XmlState {
.document_builder
.as_mut()
.unwrap()
- .append_element(name, pbag, parent);
+ .append_element(name, attrs, parent);
inner.current_node = Some(node);
if name.expanded() == expanded_name!(svg "style") {
@@ -388,14 +388,14 @@ impl XmlState {
Context::UnsupportedStyleChild
}
- fn xinclude_start_element(&self, _name: &QualName, pbag: &PropertyBag) -> Context {
+ fn xinclude_start_element(&self, _name: &QualName, attrs: &Attributes) -> Context {
let mut href = None;
let mut parse = None;
let mut encoding = None;
let ln_parse = LocalName::from("parse");
- for (attr, value) in pbag.iter() {
+ for (attr, value) in attrs.iter() {
match attr.expanded() {
expanded_name!("", "href") => href = Some(value),
ref v
@@ -443,13 +443,13 @@ impl XmlState {
&self,
ctx: &XIncludeContext,
name: &QualName,
- pbag: &PropertyBag,
+ attrs: &Attributes,
) -> Context {
if ctx.need_fallback {
if name.expanded() == xinclude_name!("include") {
- self.xinclude_start_element(name, pbag)
+ self.xinclude_start_element(name, attrs)
} else {
- self.element_creation_start_element(name, pbag)
+ self.element_creation_start_element(name, attrs)
}
} else {
Context::UnsupportedXIncludeChild
diff --git a/rsvg_internals/src/xml2_load.rs b/rsvg_internals/src/xml2_load.rs
index 30244ec0..aeae2359 100644
--- a/rsvg_internals/src/xml2_load.rs
+++ b/rsvg_internals/src/xml2_load.rs
@@ -15,8 +15,8 @@ use std::sync::Once;
use glib::translate::*;
use markup5ever::{namespace_url, ns, LocalName, Namespace, Prefix, QualName};
+use crate::attributes::Attributes;
use crate::error::LoadingError;
-use crate::property_bag::PropertyBag;
use crate::util::{cstr, opt_utf8_cstr, utf8_cstr};
use crate::xml::XmlState;
use crate::xml2::*;
@@ -214,9 +214,9 @@ unsafe extern "C" fn sax_start_element_ns_cb(
let qual_name = make_qual_name(prefix, uri, localname);
let nb_attributes = nb_attributes as usize;
- let pbag = PropertyBag::new_from_xml2_attributes(nb_attributes, attributes as *const *const _);
+ let attrs = Attributes::new_from_xml2_attributes(nb_attributes, attributes as *const *const _);
- if let Err(e) = xml2_parser.state.start_element(qual_name, &pbag) {
+ if let Err(e) = xml2_parser.state.start_element(qual_name, &attrs) {
let _: () = e; // guard in case we change the error type later
let parser = xml2_parser.parser.get();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]