[librsvg: 35/45] Pass a Session to set_attributes() functions




commit cca3638fedf2bb06724fb962c9aee070777d144a
Author: Federico Mena Quintero <federico gnome org>
Date:   Tue Aug 23 17:50:51 2022 -0500

    Pass a Session to set_attributes() functions
    
    Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/731>

 src/element.rs                    |  4 ++--
 src/filter.rs                     |  3 ++-
 src/filters/blend.rs              |  3 ++-
 src/filters/color_matrix.rs       |  3 ++-
 src/filters/component_transfer.rs |  5 +++--
 src/filters/composite.rs          |  3 ++-
 src/filters/convolve_matrix.rs    |  3 ++-
 src/filters/displacement_map.rs   |  3 ++-
 src/filters/flood.rs              |  3 ++-
 src/filters/gaussian_blur.rs      |  3 ++-
 src/filters/image.rs              |  3 ++-
 src/filters/lighting.rs           | 11 ++++++-----
 src/filters/merge.rs              |  5 +++--
 src/filters/morphology.rs         |  3 ++-
 src/filters/offset.rs             |  3 ++-
 src/filters/tile.rs               |  3 ++-
 src/filters/turbulence.rs         |  3 ++-
 src/gradient.rs                   | 14 +++++++-------
 src/image.rs                      |  3 ++-
 src/marker.rs                     |  3 ++-
 src/pattern.rs                    |  2 +-
 src/shapes.rs                     | 10 +++++-----
 src/structure.rs                  | 13 +++++++------
 src/style.rs                      |  3 ++-
 src/text.rs                       |  6 +++---
 25 files changed, 69 insertions(+), 49 deletions(-)
---
diff --git a/src/element.rs b/src/element.rs
index 7db33608d..274fc4e94 100644
--- a/src/element.rs
+++ b/src/element.rs
@@ -71,7 +71,7 @@ pub trait SetAttributes {
     /// Sets per-element attributes.
     ///
     /// Each element is supposed to iterate the `attributes`, and parse any ones it needs.
-    fn set_attributes(&mut self, _attributes: &Attributes) -> ElementResult {
+    fn set_attributes(&mut self, _attributes: &Attributes, _session: &Session) -> ElementResult {
         Ok(())
     }
 }
@@ -599,7 +599,7 @@ macro_rules! e {
         ) -> Element {
             let mut element_impl = <$element_type>::default();
 
-            let result = element_impl.set_attributes(&attributes);
+            let result = element_impl.set_attributes(&attributes, session);
 
             let element = Element::$element_type(Box::new(ElementInner::new(
                 session,
diff --git a/src/filter.rs b/src/filter.rs
index 2be886b3e..ac81d66e7 100644
--- a/src/filter.rs
+++ b/src/filter.rs
@@ -15,6 +15,7 @@ use crate::length::*;
 use crate::node::NodeBorrow;
 use crate::parsers::{Parse, ParseValue};
 use crate::rect::Rect;
+use crate::session::Session;
 use crate::xml::Attributes;
 
 /// The <filter> node.
@@ -70,7 +71,7 @@ impl Filter {
 }
 
 impl SetAttributes for Filter {
-    fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+    fn set_attributes(&mut self, attrs: &Attributes, _session: &Session) -> ElementResult {
         for (attr, value) in attrs.iter() {
             match attr.expanded() {
                 expanded_name!("", "filterUnits") => self.filter_units = attr.parse(value)?,
diff --git a/src/filters/blend.rs b/src/filters/blend.rs
index c56d68b8d..2928fdfa2 100644
--- a/src/filters/blend.rs
+++ b/src/filters/blend.rs
@@ -9,6 +9,7 @@ use crate::node::{CascadedValues, Node};
 use crate::parsers::{Parse, ParseValue};
 use crate::properties::ColorInterpolationFilters;
 use crate::rect::IRect;
+use crate::session::Session;
 use crate::surface_utils::shared_surface::Operator;
 use crate::xml::Attributes;
 
@@ -59,7 +60,7 @@ pub struct Blend {
 }
 
 impl SetAttributes for FeBlend {
-    fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+    fn set_attributes(&mut self, attrs: &Attributes, _session: &Session) -> ElementResult {
         let (in1, in2) = self.base.parse_two_inputs(attrs)?;
         self.params.in1 = in1;
         self.params.in2 = in2;
diff --git a/src/filters/color_matrix.rs b/src/filters/color_matrix.rs
index a9af7a914..c3c2b5385 100644
--- a/src/filters/color_matrix.rs
+++ b/src/filters/color_matrix.rs
@@ -10,6 +10,7 @@ use crate::node::{CascadedValues, Node};
 use crate::parsers::{NumberList, Parse, ParseValue};
 use crate::properties::ColorInterpolationFilters;
 use crate::rect::IRect;
+use crate::session::Session;
 use crate::surface_utils::{
     iterators::Pixels, shared_surface::ExclusiveImageSurface, ImageSurfaceDataExt, Pixel,
 };
@@ -63,7 +64,7 @@ impl Default for ColorMatrix {
 
 #[rustfmt::skip]
 impl SetAttributes for FeColorMatrix {
-    fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+    fn set_attributes(&mut self, attrs: &Attributes, _session: &Session) -> ElementResult {
         self.params.in1 = self.base.parse_one_input(attrs)?;
 
         // First, determine the operation type.
diff --git a/src/filters/component_transfer.rs b/src/filters/component_transfer.rs
index 1716ef21d..31027e6c5 100644
--- a/src/filters/component_transfer.rs
+++ b/src/filters/component_transfer.rs
@@ -11,6 +11,7 @@ use crate::node::{CascadedValues, Node, NodeBorrow};
 use crate::parsers::{NumberList, Parse, ParseValue};
 use crate::properties::ColorInterpolationFilters;
 use crate::rect::IRect;
+use crate::session::Session;
 use crate::surface_utils::{
     iterators::Pixels, shared_surface::ExclusiveImageSurface, ImageSurfaceDataExt, Pixel,
 };
@@ -40,7 +41,7 @@ pub struct ComponentTransfer {
 }
 
 impl SetAttributes for FeComponentTransfer {
-    fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+    fn set_attributes(&mut self, attrs: &Attributes, _session: &Session) -> ElementResult {
         self.params.in1 = self.base.parse_one_input(attrs)?;
         Ok(())
     }
@@ -214,7 +215,7 @@ macro_rules! func_x {
 
         impl SetAttributes for $func_name {
             #[inline]
-            fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+            fn set_attributes(&mut self, attrs: &Attributes, _session: &Session) -> ElementResult {
                 for (attr, value) in attrs.iter() {
                     match attr.expanded() {
                         expanded_name!("", "type") => self.function_type = attr.parse(value)?,
diff --git a/src/filters/composite.rs b/src/filters/composite.rs
index 2a2e47ed7..1b6904202 100644
--- a/src/filters/composite.rs
+++ b/src/filters/composite.rs
@@ -9,6 +9,7 @@ use crate::node::{CascadedValues, Node};
 use crate::parsers::{Parse, ParseValue};
 use crate::properties::ColorInterpolationFilters;
 use crate::rect::IRect;
+use crate::session::Session;
 use crate::surface_utils::shared_surface::Operator as SurfaceOperator;
 use crate::xml::Attributes;
 
@@ -53,7 +54,7 @@ pub struct Composite {
 }
 
 impl SetAttributes for FeComposite {
-    fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+    fn set_attributes(&mut self, attrs: &Attributes, _session: &Session) -> ElementResult {
         let (in1, in2) = self.base.parse_two_inputs(attrs)?;
         self.params.in1 = in1;
         self.params.in2 = in2;
diff --git a/src/filters/convolve_matrix.rs b/src/filters/convolve_matrix.rs
index bd796730d..54a390c86 100644
--- a/src/filters/convolve_matrix.rs
+++ b/src/filters/convolve_matrix.rs
@@ -10,6 +10,7 @@ use crate::node::{CascadedValues, Node};
 use crate::parsers::{NonNegative, NumberList, NumberOptionalNumber, Parse, ParseValue};
 use crate::properties::ColorInterpolationFilters;
 use crate::rect::IRect;
+use crate::session::Session;
 use crate::surface_utils::{
     iterators::{PixelRectangle, Pixels},
     shared_surface::ExclusiveImageSurface,
@@ -69,7 +70,7 @@ impl Default for ConvolveMatrix {
 }
 
 impl SetAttributes for FeConvolveMatrix {
-    fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+    fn set_attributes(&mut self, attrs: &Attributes, _session: &Session) -> ElementResult {
         self.params.in1 = self.base.parse_one_input(attrs)?;
 
         for (attr, value) in attrs.iter() {
diff --git a/src/filters/displacement_map.rs b/src/filters/displacement_map.rs
index b7aaf8654..c88b4eec5 100644
--- a/src/filters/displacement_map.rs
+++ b/src/filters/displacement_map.rs
@@ -9,6 +9,7 @@ use crate::node::{CascadedValues, Node};
 use crate::parsers::{Parse, ParseValue};
 use crate::properties::ColorInterpolationFilters;
 use crate::rect::IRect;
+use crate::session::Session;
 use crate::surface_utils::{iterators::Pixels, shared_surface::ExclusiveImageSurface};
 use crate::xml::Attributes;
 
@@ -49,7 +50,7 @@ pub struct DisplacementMap {
 }
 
 impl SetAttributes for FeDisplacementMap {
-    fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+    fn set_attributes(&mut self, attrs: &Attributes, _session: &Session) -> ElementResult {
         let (in1, in2) = self.base.parse_two_inputs(attrs)?;
         self.params.in1 = in1;
         self.params.in2 = in2;
diff --git a/src/filters/flood.rs b/src/filters/flood.rs
index a6ee723c3..4a596e92d 100644
--- a/src/filters/flood.rs
+++ b/src/filters/flood.rs
@@ -4,6 +4,7 @@ use crate::element::{ElementResult, SetAttributes};
 use crate::node::{CascadedValues, Node};
 use crate::paint_server::resolve_color;
 use crate::rect::IRect;
+use crate::session::Session;
 use crate::xml::Attributes;
 
 use super::bounds::BoundsBuilder;
@@ -24,7 +25,7 @@ pub struct Flood {
 }
 
 impl SetAttributes for FeFlood {
-    fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+    fn set_attributes(&mut self, attrs: &Attributes, _session: &Session) -> ElementResult {
         self.base.parse_no_inputs(attrs)
     }
 }
diff --git a/src/filters/gaussian_blur.rs b/src/filters/gaussian_blur.rs
index 114b1d69f..3d4fe9ae0 100644
--- a/src/filters/gaussian_blur.rs
+++ b/src/filters/gaussian_blur.rs
@@ -11,6 +11,7 @@ use crate::node::{CascadedValues, Node};
 use crate::parsers::{NonNegative, NumberOptionalNumber, ParseValue};
 use crate::properties::ColorInterpolationFilters;
 use crate::rect::IRect;
+use crate::session::Session;
 use crate::surface_utils::{
     shared_surface::{BlurDirection, Horizontal, SharedImageSurface, Vertical},
     EdgeMode,
@@ -45,7 +46,7 @@ pub struct GaussianBlur {
 }
 
 impl SetAttributes for FeGaussianBlur {
-    fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+    fn set_attributes(&mut self, attrs: &Attributes, _session: &Session) -> ElementResult {
         self.params.in1 = self.base.parse_one_input(attrs)?;
 
         for (attr, value) in attrs.iter() {
diff --git a/src/filters/image.rs b/src/filters/image.rs
index 243bf0cf5..65ddf759c 100644
--- a/src/filters/image.rs
+++ b/src/filters/image.rs
@@ -9,6 +9,7 @@ use crate::node::{CascadedValues, Node};
 use crate::parsers::ParseValue;
 use crate::properties::ComputedValues;
 use crate::rect::Rect;
+use crate::session::Session;
 use crate::surface_utils::shared_surface::SharedImageSurface;
 use crate::viewbox::ViewBox;
 use crate::xml::Attributes;
@@ -115,7 +116,7 @@ impl Image {
 }
 
 impl SetAttributes for FeImage {
-    fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+    fn set_attributes(&mut self, attrs: &Attributes, _session: &Session) -> ElementResult {
         self.base.parse_no_inputs(attrs)?;
 
         for (attr, value) in attrs.iter() {
diff --git a/src/filters/lighting.rs b/src/filters/lighting.rs
index f1e94beb0..3d4c73a5a 100644
--- a/src/filters/lighting.rs
+++ b/src/filters/lighting.rs
@@ -21,6 +21,7 @@ use crate::paint_server::resolve_color;
 use crate::parsers::{NonNegative, NumberOptionalNumber, ParseValue};
 use crate::properties::ColorInterpolationFilters;
 use crate::rect::IRect;
+use crate::session::Session;
 use crate::surface_utils::{
     shared_surface::{ExclusiveImageSurface, SharedImageSurface, SurfaceType},
     ImageSurfaceDataExt, Pixel,
@@ -213,7 +214,7 @@ impl FeDistantLight {
 }
 
 impl SetAttributes for FeDistantLight {
-    fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+    fn set_attributes(&mut self, attrs: &Attributes, _session: &Session) -> ElementResult {
         for (attr, value) in attrs.iter() {
             match attr.expanded() {
                 expanded_name!("", "azimuth") => self.azimuth = attr.parse(value)?,
@@ -247,7 +248,7 @@ impl FePointLight {
 }
 
 impl SetAttributes for FePointLight {
-    fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+    fn set_attributes(&mut self, attrs: &Attributes, _session: &Session) -> ElementResult {
         for (attr, value) in attrs.iter() {
             match attr.expanded() {
                 expanded_name!("", "x") => self.x = attr.parse(value)?,
@@ -297,7 +298,7 @@ impl FeSpotLight {
 }
 
 impl SetAttributes for FeSpotLight {
-    fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+    fn set_attributes(&mut self, attrs: &Attributes, _session: &Session) -> ElementResult {
         for (attr, value) in attrs.iter() {
             match attr.expanded() {
                 expanded_name!("", "x") => self.x = attr.parse(value)?,
@@ -332,7 +333,7 @@ fn transform_dist(t: Transform, d: f64) -> f64 {
 }
 
 impl SetAttributes for FeDiffuseLighting {
-    fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+    fn set_attributes(&mut self, attrs: &Attributes, _session: &Session) -> ElementResult {
         self.params.in1 = self.base.parse_one_input(attrs)?;
 
         for (attr, value) in attrs.iter() {
@@ -377,7 +378,7 @@ impl DiffuseLighting {
 }
 
 impl SetAttributes for FeSpecularLighting {
-    fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+    fn set_attributes(&mut self, attrs: &Attributes, _session: &Session) -> ElementResult {
         self.params.in1 = self.base.parse_one_input(attrs)?;
 
         for (attr, value) in attrs.iter() {
diff --git a/src/filters/merge.rs b/src/filters/merge.rs
index 747465982..e2e9be658 100644
--- a/src/filters/merge.rs
+++ b/src/filters/merge.rs
@@ -7,6 +7,7 @@ use crate::node::{CascadedValues, Node, NodeBorrow};
 use crate::parsers::ParseValue;
 use crate::properties::ColorInterpolationFilters;
 use crate::rect::IRect;
+use crate::session::Session;
 use crate::surface_utils::shared_surface::{Operator, SharedImageSurface, SurfaceType};
 use crate::xml::Attributes;
 
@@ -51,14 +52,14 @@ impl Default for FeMerge {
 }
 
 impl SetAttributes for FeMerge {
-    fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+    fn set_attributes(&mut self, attrs: &Attributes, _session: &Session) -> ElementResult {
         self.base.parse_no_inputs(attrs)
     }
 }
 
 impl SetAttributes for FeMergeNode {
     #[inline]
-    fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+    fn set_attributes(&mut self, attrs: &Attributes, _session: &Session) -> ElementResult {
         for (attr, value) in attrs.iter() {
             if let expanded_name!("", "in") = attr.expanded() {
                 self.in1 = attr.parse(value)?;
diff --git a/src/filters/morphology.rs b/src/filters/morphology.rs
index 7b4dbf377..8a6c0725a 100644
--- a/src/filters/morphology.rs
+++ b/src/filters/morphology.rs
@@ -11,6 +11,7 @@ use crate::node::Node;
 use crate::parsers::{NonNegative, NumberOptionalNumber, Parse, ParseValue};
 use crate::properties::ColorInterpolationFilters;
 use crate::rect::IRect;
+use crate::session::Session;
 use crate::surface_utils::{
     iterators::{PixelRectangle, Pixels},
     shared_surface::ExclusiveImageSurface,
@@ -50,7 +51,7 @@ pub struct Morphology {
 }
 
 impl SetAttributes for FeMorphology {
-    fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+    fn set_attributes(&mut self, attrs: &Attributes, _session: &Session) -> ElementResult {
         self.params.in1 = self.base.parse_one_input(attrs)?;
 
         for (attr, value) in attrs.iter() {
diff --git a/src/filters/offset.rs b/src/filters/offset.rs
index 1f97b6126..d60542a54 100644
--- a/src/filters/offset.rs
+++ b/src/filters/offset.rs
@@ -7,6 +7,7 @@ use crate::node::Node;
 use crate::parsers::ParseValue;
 use crate::properties::ColorInterpolationFilters;
 use crate::rect::IRect;
+use crate::session::Session;
 use crate::xml::Attributes;
 
 use super::bounds::BoundsBuilder;
@@ -32,7 +33,7 @@ pub struct Offset {
 }
 
 impl SetAttributes for FeOffset {
-    fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+    fn set_attributes(&mut self, attrs: &Attributes, _session: &Session) -> ElementResult {
         self.params.in1 = self.base.parse_one_input(attrs)?;
 
         for (attr, value) in attrs.iter() {
diff --git a/src/filters/tile.rs b/src/filters/tile.rs
index 8c397b3ed..45549a71e 100644
--- a/src/filters/tile.rs
+++ b/src/filters/tile.rs
@@ -4,6 +4,7 @@ use crate::element::{ElementResult, SetAttributes};
 use crate::node::Node;
 use crate::properties::ColorInterpolationFilters;
 use crate::rect::IRect;
+use crate::session::Session;
 use crate::xml::Attributes;
 
 use super::bounds::BoundsBuilder;
@@ -27,7 +28,7 @@ pub struct Tile {
 }
 
 impl SetAttributes for FeTile {
-    fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+    fn set_attributes(&mut self, attrs: &Attributes, _session: &Session) -> ElementResult {
         self.params.in1 = self.base.parse_one_input(attrs)?;
         Ok(())
     }
diff --git a/src/filters/turbulence.rs b/src/filters/turbulence.rs
index 2f40f7f26..cb962c45c 100644
--- a/src/filters/turbulence.rs
+++ b/src/filters/turbulence.rs
@@ -9,6 +9,7 @@ use crate::node::{CascadedValues, Node};
 use crate::parsers::{NonNegative, NumberOptionalNumber, Parse, ParseValue};
 use crate::properties::ColorInterpolationFilters;
 use crate::rect::IRect;
+use crate::session::Session;
 use crate::surface_utils::{
     shared_surface::{ExclusiveImageSurface, SurfaceType},
     ImageSurfaceDataExt, Pixel, PixelOps,
@@ -74,7 +75,7 @@ impl Default for Turbulence {
 }
 
 impl SetAttributes for FeTurbulence {
-    fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+    fn set_attributes(&mut self, attrs: &Attributes, _session: &Session) -> ElementResult {
         self.base.parse_no_inputs(attrs)?;
 
         for (attr, value) in attrs.iter() {
diff --git a/src/gradient.rs b/src/gradient.rs
index b1e6813e7..a45e8a850 100644
--- a/src/gradient.rs
+++ b/src/gradient.rs
@@ -17,6 +17,7 @@ use crate::node::{CascadedValues, Node, NodeBorrow};
 use crate::paint_server::resolve_color;
 use crate::parsers::{Parse, ParseValue};
 use crate::properties::ComputedValues;
+use crate::session::Session;
 use crate::transform::{Transform, TransformAttribute};
 use crate::unit_interval::UnitInterval;
 use crate::xml::Attributes;
@@ -65,7 +66,7 @@ pub struct Stop {
 }
 
 impl SetAttributes for Stop {
-    fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+    fn set_attributes(&mut self, attrs: &Attributes, _session: &Session) -> ElementResult {
         for (attr, value) in attrs.iter() {
             if let expanded_name!("", "offset") = attr.expanded() {
                 self.offset = attr.parse(value)?;
@@ -515,7 +516,7 @@ impl RadialGradient {
 }
 
 impl SetAttributes for Common {
-    fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+    fn set_attributes(&mut self, attrs: &Attributes, _session: &Session) -> ElementResult {
         for (attr, value) in attrs.iter() {
             match attr.expanded() {
                 expanded_name!("", "gradientUnits") => self.units = attr.parse(value)?,
@@ -540,8 +541,8 @@ impl SetAttributes for Common {
 }
 
 impl SetAttributes for LinearGradient {
-    fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
-        self.common.set_attributes(attrs)?;
+    fn set_attributes(&mut self, attrs: &Attributes, session: &Session) -> ElementResult {
+        self.common.set_attributes(attrs, session)?;
 
         for (attr, value) in attrs.iter() {
             match attr.expanded() {
@@ -632,8 +633,8 @@ impl_gradient!(LinearGradient, RadialGradient);
 impl_gradient!(RadialGradient, LinearGradient);
 
 impl SetAttributes for RadialGradient {
-    fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
-        self.common.set_attributes(attrs)?;
+    fn set_attributes(&mut self, attrs: &Attributes, session: &Session) -> ElementResult {
+        self.common.set_attributes(attrs, session)?;
         // Create a local expanded name for "fr" because markup5ever doesn't have built-in
         let expanded_name_fr = ExpandedName {
             ns: &Namespace::from(""),
@@ -716,7 +717,6 @@ impl ResolvedGradient {
 mod tests {
     use super::*;
     use crate::node::{Node, NodeData};
-    use crate::session::Session;
     use markup5ever::{namespace_url, ns, QualName};
 
     #[test]
diff --git a/src/image.rs b/src/image.rs
index b674a51e9..64e948b3a 100644
--- a/src/image.rs
+++ b/src/image.rs
@@ -14,6 +14,7 @@ use crate::length::*;
 use crate::node::{CascadedValues, Node, NodeBorrow};
 use crate::parsers::ParseValue;
 use crate::rect::Rect;
+use crate::session::Session;
 use crate::xml::Attributes;
 
 /// The `<image>` element.
@@ -27,7 +28,7 @@ pub struct Image {
 }
 
 impl SetAttributes for Image {
-    fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+    fn set_attributes(&mut self, attrs: &Attributes, _session: &Session) -> ElementResult {
         for (attr, value) in attrs.iter() {
             match attr.expanded() {
                 expanded_name!("", "preserveAspectRatio") => self.aspect = attr.parse(value)?,
diff --git a/src/marker.rs b/src/marker.rs
index 87c0135f4..e5c584f05 100644
--- a/src/marker.rs
+++ b/src/marker.rs
@@ -20,6 +20,7 @@ use crate::node::{CascadedValues, Node, NodeBorrow, NodeDraw};
 use crate::parsers::{Parse, ParseValue};
 use crate::path_builder::{arc_segment, ArcParameterization, CubicBezierCurve, Path, PathCommand};
 use crate::rect::Rect;
+use crate::session::Session;
 use crate::transform::Transform;
 use crate::viewbox::*;
 use crate::xml::Attributes;
@@ -199,7 +200,7 @@ impl Marker {
 }
 
 impl SetAttributes for Marker {
-    fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+    fn set_attributes(&mut self, attrs: &Attributes, _session: &Session) -> ElementResult {
         for (attr, value) in attrs.iter() {
             match attr.expanded() {
                 expanded_name!("", "markerUnits") => self.units = attr.parse(value)?,
diff --git a/src/pattern.rs b/src/pattern.rs
index 7152c13e6..28fba156f 100644
--- a/src/pattern.rs
+++ b/src/pattern.rs
@@ -125,7 +125,7 @@ pub struct Pattern {
 }
 
 impl SetAttributes for Pattern {
-    fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+    fn set_attributes(&mut self, attrs: &Attributes, _session: &Session) -> ElementResult {
         for (attr, value) in attrs.iter() {
             match attr.expanded() {
                 expanded_name!("", "patternUnits") => self.common.units = attr.parse(value)?,
diff --git a/src/shapes.rs b/src/shapes.rs
index d7a161b4c..8af6a362e 100644
--- a/src/shapes.rs
+++ b/src/shapes.rs
@@ -248,7 +248,7 @@ pub struct Path {
 impl_draw!(Path);
 
 impl SetAttributes for Path {
-    fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+    fn set_attributes(&mut self, attrs: &Attributes, session: &Session) -> ElementResult {
         for (attr, value) in attrs.iter() {
             if attr.expanded() == expanded_name!("", "d") {
                 let mut builder = PathBuilder::default();
@@ -256,7 +256,7 @@ impl SetAttributes for Path {
                     // FIXME: we don't propagate errors upstream, but creating a partial
                     // path is OK per the spec
 
-                    rsvg_log!("could not parse path: {}", e);
+                    rsvg_log_session!(session, "could not parse path: {}", e);
                 }
                 self.path = Rc::new(builder.into_path());
             }
@@ -339,7 +339,7 @@ pub struct Polygon {
 impl_draw!(Polygon);
 
 impl SetAttributes for Polygon {
-    fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+    fn set_attributes(&mut self, attrs: &Attributes, _session: &Session) -> ElementResult {
         for (attr, value) in attrs.iter() {
             if attr.expanded() == expanded_name!("", "points") {
                 self.points = attr.parse(value)?;
@@ -364,7 +364,7 @@ pub struct Polyline {
 impl_draw!(Polyline);
 
 impl SetAttributes for Polyline {
-    fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+    fn set_attributes(&mut self, attrs: &Attributes, _session: &Session) -> ElementResult {
         for (attr, value) in attrs.iter() {
             if attr.expanded() == expanded_name!("", "points") {
                 self.points = attr.parse(value)?;
@@ -392,7 +392,7 @@ pub struct Line {
 impl_draw!(Line);
 
 impl SetAttributes for Line {
-    fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+    fn set_attributes(&mut self, attrs: &Attributes, _session: &Session) -> ElementResult {
         for (attr, value) in attrs.iter() {
             match attr.expanded() {
                 expanded_name!("", "x1") => self.x1 = attr.parse(value)?,
diff --git a/src/structure.rs b/src/structure.rs
index da0457284..cfc8cbcd0 100644
--- a/src/structure.rs
+++ b/src/structure.rs
@@ -16,6 +16,7 @@ use crate::node::{CascadedValues, Node, NodeBorrow, NodeDraw};
 use crate::parsers::{Parse, ParseValue};
 use crate::properties::ComputedValues;
 use crate::rect::Rect;
+use crate::session::Session;
 use crate::viewbox::*;
 use crate::xml::Attributes;
 
@@ -264,7 +265,7 @@ impl Svg {
 }
 
 impl SetAttributes for Svg {
-    fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+    fn set_attributes(&mut self, attrs: &Attributes, _session: &Session) -> ElementResult {
         for (attr, value) in attrs.iter() {
             match attr.expanded() {
                 expanded_name!("", "preserveAspectRatio") => {
@@ -345,7 +346,7 @@ impl Default for Use {
 }
 
 impl SetAttributes for Use {
-    fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+    fn set_attributes(&mut self, attrs: &Attributes, _session: &Session) -> ElementResult {
         for (attr, value) in attrs.iter() {
             match attr.expanded() {
                 ref a if is_href(a) => set_href(
@@ -431,7 +432,7 @@ impl Symbol {
 }
 
 impl SetAttributes for Symbol {
-    fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+    fn set_attributes(&mut self, attrs: &Attributes, _session: &Session) -> ElementResult {
         for (attr, value) in attrs.iter() {
             match attr.expanded() {
                 expanded_name!("", "preserveAspectRatio") => {
@@ -462,7 +463,7 @@ impl ClipPath {
 }
 
 impl SetAttributes for ClipPath {
-    fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+    fn set_attributes(&mut self, attrs: &Attributes, _session: &Session) -> ElementResult {
         let result = attrs
             .iter()
             .find(|(attr, _)| attr.expanded() == expanded_name!("", "clipPathUnits"))
@@ -525,7 +526,7 @@ impl Mask {
 }
 
 impl SetAttributes for Mask {
-    fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+    fn set_attributes(&mut self, attrs: &Attributes, _session: &Session) -> ElementResult {
         for (attr, value) in attrs.iter() {
             match attr.expanded() {
                 expanded_name!("", "x") => self.x = attr.parse(value)?,
@@ -550,7 +551,7 @@ pub struct Link {
 }
 
 impl SetAttributes for Link {
-    fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+    fn set_attributes(&mut self, attrs: &Attributes, _session: &Session) -> 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/src/style.rs b/src/style.rs
index 0d566c5be..8c3028e92 100644
--- a/src/style.rs
+++ b/src/style.rs
@@ -4,6 +4,7 @@ use markup5ever::{expanded_name, local_name, namespace_url, ns};
 
 use crate::element::{Draw, ElementResult, SetAttributes};
 use crate::error::*;
+use crate::session::Session;
 use crate::xml::Attributes;
 
 /// Represents the syntax used in the <style> node.
@@ -53,7 +54,7 @@ impl Style {
 }
 
 impl SetAttributes for Style {
-    fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+    fn set_attributes(&mut self, attrs: &Attributes, _session: &Session) -> ElementResult {
         for (attr, value) in attrs.iter() {
             if attr.expanded() == expanded_name!("", "type") {
                 self.type_ = StyleType::parse(value).attribute(attr)?;
diff --git a/src/text.rs b/src/text.rs
index dc4f65e72..15b389a55 100644
--- a/src/text.rs
+++ b/src/text.rs
@@ -732,7 +732,7 @@ impl Text {
 }
 
 impl SetAttributes for Text {
-    fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+    fn set_attributes(&mut self, attrs: &Attributes, _session: &Session) -> ElementResult {
         for (attr, value) in attrs.iter() {
             match attr.expanded() {
                 expanded_name!("", "x") => self.x = attr.parse(value)?,
@@ -926,7 +926,7 @@ fn extract_chars_children_to_chunks_recursively(
 }
 
 impl SetAttributes for TRef {
-    fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+    fn set_attributes(&mut self, attrs: &Attributes, _session: &Session) -> ElementResult {
         self.link = attrs
             .iter()
             .find(|(attr, _)| attr.expanded() == expanded_name!(xlink "href"))
@@ -994,7 +994,7 @@ impl TSpan {
 }
 
 impl SetAttributes for TSpan {
-    fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult {
+    fn set_attributes(&mut self, attrs: &Attributes, _session: &Session) -> ElementResult {
         for (attr, value) in attrs.iter() {
             match attr.expanded() {
                 expanded_name!("", "x") => self.x = attr.parse(value)?,


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