[librsvg: 17/22] set_atts(): Don't take a *mut RsvgHandle, take a &LoadingOptions instead



commit 06eeed3c52835d9f8d8ce4b55ab63c38283311a1
Author: Federico Mena Quintero <federico gnome org>
Date:   Mon Jan 7 21:54:54 2019 -0600

    set_atts(): Don't take a *mut RsvgHandle, take a &LoadingOptions instead
    
    Finally!

 rsvg_internals/src/clip_path.rs                  |  4 ++--
 rsvg_internals/src/filters/blend.rs              |  6 +++---
 rsvg_internals/src/filters/color_matrix.rs       |  6 +++---
 rsvg_internals/src/filters/component_transfer.rs | 13 ++++---------
 rsvg_internals/src/filters/composite.rs          |  6 +++---
 rsvg_internals/src/filters/convolve_matrix.rs    |  6 +++---
 rsvg_internals/src/filters/displacement_map.rs   |  6 +++---
 rsvg_internals/src/filters/flood.rs              |  6 +++---
 rsvg_internals/src/filters/gaussian_blur.rs      |  6 +++---
 rsvg_internals/src/filters/image.rs              |  8 ++++----
 rsvg_internals/src/filters/light/light_source.rs |  9 ++-------
 rsvg_internals/src/filters/light/lighting.rs     |  6 +++---
 rsvg_internals/src/filters/merge.rs              | 13 ++++---------
 rsvg_internals/src/filters/mod.rs                | 13 ++++---------
 rsvg_internals/src/filters/morphology.rs         |  6 +++---
 rsvg_internals/src/filters/node.rs               |  9 ++-------
 rsvg_internals/src/filters/offset.rs             |  6 +++---
 rsvg_internals/src/filters/tile.rs               |  6 +++---
 rsvg_internals/src/filters/turbulence.rs         |  6 +++---
 rsvg_internals/src/gradient.rs                   |  9 ++-------
 rsvg_internals/src/image.rs                      | 14 +++++---------
 rsvg_internals/src/link.rs                       |  4 ++--
 rsvg_internals/src/marker.rs                     |  9 ++-------
 rsvg_internals/src/mask.rs                       |  4 ++--
 rsvg_internals/src/node.rs                       |  8 ++++----
 rsvg_internals/src/pattern.rs                    |  9 ++-------
 rsvg_internals/src/shapes.rs                     | 19 +++++++------------
 rsvg_internals/src/stop.rs                       |  4 ++--
 rsvg_internals/src/structure.rs                  | 24 +++++++-----------------
 rsvg_internals/src/style.rs                      |  4 ++--
 rsvg_internals/src/text.rs                       | 10 +++++-----
 rsvg_internals/src/xml.rs                        |  2 +-
 32 files changed, 101 insertions(+), 160 deletions(-)
---
diff --git a/rsvg_internals/src/clip_path.rs b/rsvg_internals/src/clip_path.rs
index 3fd25a1b..77afc9f2 100644
--- a/rsvg_internals/src/clip_path.rs
+++ b/rsvg_internals/src/clip_path.rs
@@ -6,7 +6,7 @@ use attributes::Attribute;
 use coord_units::CoordUnits;
 use drawing_ctx::DrawingCtx;
 use error::RenderingError;
-use handle::RsvgHandle;
+use handle::LoadOptions;
 use node::{NodeResult, NodeTrait, RsvgNode};
 use parsers::ParseValue;
 use property_bag::PropertyBag;
@@ -79,7 +79,7 @@ impl NodeClipPath {
 }
 
 impl NodeTrait for NodeClipPath {
-    fn set_atts(&self, _: &RsvgNode, _: *const RsvgHandle, pbag: &PropertyBag<'_>) -> NodeResult {
+    fn set_atts(&self, _: &RsvgNode, _: &LoadOptions, pbag: &PropertyBag<'_>) -> NodeResult {
         for (attr, value) in pbag.iter() {
             match attr {
                 Attribute::ClipPathUnits => self.units.set(attr.parse(value, ())?),
diff --git a/rsvg_internals/src/filters/blend.rs b/rsvg_internals/src/filters/blend.rs
index 91589f3d..0016b311 100644
--- a/rsvg_internals/src/filters/blend.rs
+++ b/rsvg_internals/src/filters/blend.rs
@@ -5,7 +5,7 @@ use cairo;
 use attributes::Attribute;
 use drawing_ctx::DrawingCtx;
 use error::NodeError;
-use handle::RsvgHandle;
+use handle::LoadOptions;
 use node::{NodeResult, NodeTrait, RsvgNode};
 use parsers::ParseError;
 use property_bag::PropertyBag;
@@ -48,10 +48,10 @@ impl NodeTrait for Blend {
     fn set_atts(
         &self,
         node: &RsvgNode,
-        handle: *const RsvgHandle,
+        load_options: &LoadOptions,
         pbag: &PropertyBag<'_>,
     ) -> NodeResult {
-        self.base.set_atts(node, handle, pbag)?;
+        self.base.set_atts(node, load_options, pbag)?;
 
         for (attr, value) in pbag.iter() {
             match attr {
diff --git a/rsvg_internals/src/filters/color_matrix.rs b/rsvg_internals/src/filters/color_matrix.rs
index cb66665b..112d892c 100644
--- a/rsvg_internals/src/filters/color_matrix.rs
+++ b/rsvg_internals/src/filters/color_matrix.rs
@@ -6,7 +6,7 @@ use nalgebra::{Matrix3, Matrix4x5, Matrix5, Vector5};
 use attributes::Attribute;
 use drawing_ctx::DrawingCtx;
 use error::NodeError;
-use handle::RsvgHandle;
+use handle::LoadOptions;
 use node::{NodeResult, NodeTrait, RsvgNode};
 use parsers::{self, ListLength, NumberListError, ParseError};
 use property_bag::PropertyBag;
@@ -51,10 +51,10 @@ impl NodeTrait for ColorMatrix {
     fn set_atts(
         &self,
         node: &RsvgNode,
-        handle: *const RsvgHandle,
+        load_options: &LoadOptions,
         pbag: &PropertyBag<'_>,
     ) -> NodeResult {
-        self.base.set_atts(node, handle, pbag)?;
+        self.base.set_atts(node, load_options, pbag)?;
 
         // First, determine the operation type.
         let mut operation_type = OperationType::Matrix;
diff --git a/rsvg_internals/src/filters/component_transfer.rs 
b/rsvg_internals/src/filters/component_transfer.rs
index f3b42f34..40cfa0b5 100644
--- a/rsvg_internals/src/filters/component_transfer.rs
+++ b/rsvg_internals/src/filters/component_transfer.rs
@@ -6,7 +6,7 @@ use cairo::{self, ImageSurface};
 use attributes::Attribute;
 use drawing_ctx::DrawingCtx;
 use error::NodeError;
-use handle::RsvgHandle;
+use handle::LoadOptions;
 use node::{NodeResult, NodeTrait, NodeType, RsvgNode};
 use parsers::{self, ListLength, NumberListError, ParseError};
 use property_bag::PropertyBag;
@@ -206,21 +206,16 @@ impl NodeTrait for ComponentTransfer {
     fn set_atts(
         &self,
         node: &RsvgNode,
-        handle: *const RsvgHandle,
+        load_options: &LoadOptions,
         pbag: &PropertyBag<'_>,
     ) -> NodeResult {
-        self.base.set_atts(node, handle, pbag)
+        self.base.set_atts(node, load_options, pbag)
     }
 }
 
 impl NodeTrait for FuncX {
     #[inline]
-    fn set_atts(
-        &self,
-        _node: &RsvgNode,
-        _handle: *const RsvgHandle,
-        pbag: &PropertyBag<'_>,
-    ) -> NodeResult {
+    fn set_atts(&self, _node: &RsvgNode, _: &LoadOptions, pbag: &PropertyBag<'_>) -> NodeResult {
         for (attr, value) in pbag.iter() {
             match attr {
                 Attribute::Type => self.function_type.set(FunctionType::parse(attr, value)?),
diff --git a/rsvg_internals/src/filters/composite.rs b/rsvg_internals/src/filters/composite.rs
index 9c39d103..8dde21da 100644
--- a/rsvg_internals/src/filters/composite.rs
+++ b/rsvg_internals/src/filters/composite.rs
@@ -6,7 +6,7 @@ use cssparser::{CowRcStr, Parser, Token};
 use attributes::Attribute;
 use drawing_ctx::DrawingCtx;
 use error::{NodeError, ValueErrorKind};
-use handle::RsvgHandle;
+use handle::LoadOptions;
 use node::{NodeResult, NodeTrait, RsvgNode};
 use parsers::{self, Parse, ParseValue};
 use property_bag::PropertyBag;
@@ -65,10 +65,10 @@ impl NodeTrait for Composite {
     fn set_atts(
         &self,
         node: &RsvgNode,
-        handle: *const RsvgHandle,
+        load_options: &LoadOptions,
         pbag: &PropertyBag<'_>,
     ) -> NodeResult {
-        self.base.set_atts(node, handle, pbag)?;
+        self.base.set_atts(node, load_options, pbag)?;
 
         for (attr, value) in pbag.iter() {
             match attr {
diff --git a/rsvg_internals/src/filters/convolve_matrix.rs b/rsvg_internals/src/filters/convolve_matrix.rs
index 98e7a1b5..9490eaf7 100644
--- a/rsvg_internals/src/filters/convolve_matrix.rs
+++ b/rsvg_internals/src/filters/convolve_matrix.rs
@@ -6,7 +6,7 @@ use nalgebra::{DMatrix, Dynamic, MatrixVec};
 use attributes::Attribute;
 use drawing_ctx::DrawingCtx;
 use error::NodeError;
-use handle::RsvgHandle;
+use handle::LoadOptions;
 use node::{NodeResult, NodeTrait, RsvgNode};
 use parsers::{self, ListLength, NumberListError, ParseError};
 use property_bag::PropertyBag;
@@ -60,10 +60,10 @@ impl NodeTrait for ConvolveMatrix {
     fn set_atts(
         &self,
         node: &RsvgNode,
-        handle: *const RsvgHandle,
+        load_options: &LoadOptions,
         pbag: &PropertyBag<'_>,
     ) -> NodeResult {
-        self.base.set_atts(node, handle, pbag)?;
+        self.base.set_atts(node, load_options, pbag)?;
 
         for (attr, value) in pbag.iter() {
             match attr {
diff --git a/rsvg_internals/src/filters/displacement_map.rs b/rsvg_internals/src/filters/displacement_map.rs
index bde7bbb6..a01b59db 100644
--- a/rsvg_internals/src/filters/displacement_map.rs
+++ b/rsvg_internals/src/filters/displacement_map.rs
@@ -5,7 +5,7 @@ use cairo::{self, ImageSurface, MatrixTrait};
 use attributes::Attribute;
 use drawing_ctx::DrawingCtx;
 use error::NodeError;
-use handle::RsvgHandle;
+use handle::LoadOptions;
 use node::{NodeResult, NodeTrait, RsvgNode};
 use parsers::{self, ParseError};
 use property_bag::PropertyBag;
@@ -50,10 +50,10 @@ impl NodeTrait for DisplacementMap {
     fn set_atts(
         &self,
         node: &RsvgNode,
-        handle: *const RsvgHandle,
+        load_options: &LoadOptions,
         pbag: &PropertyBag<'_>,
     ) -> NodeResult {
-        self.base.set_atts(node, handle, pbag)?;
+        self.base.set_atts(node, load_options, pbag)?;
 
         for (attr, value) in pbag.iter() {
             match attr {
diff --git a/rsvg_internals/src/filters/flood.rs b/rsvg_internals/src/filters/flood.rs
index bd65ae3b..d32e53aa 100644
--- a/rsvg_internals/src/filters/flood.rs
+++ b/rsvg_internals/src/filters/flood.rs
@@ -2,7 +2,7 @@ use cairo::{self, ImageSurface};
 use cssparser;
 
 use drawing_ctx::DrawingCtx;
-use handle::RsvgHandle;
+use handle::LoadOptions;
 use node::{NodeResult, NodeTrait, RsvgNode};
 use property_bag::PropertyBag;
 use surface_utils::shared_surface::{SharedImageSurface, SurfaceType};
@@ -30,10 +30,10 @@ impl NodeTrait for Flood {
     fn set_atts(
         &self,
         node: &RsvgNode,
-        handle: *const RsvgHandle,
+        load_options: &LoadOptions,
         pbag: &PropertyBag<'_>,
     ) -> NodeResult {
-        self.base.set_atts(node, handle, pbag)
+        self.base.set_atts(node, load_options, pbag)
     }
 }
 
diff --git a/rsvg_internals/src/filters/gaussian_blur.rs b/rsvg_internals/src/filters/gaussian_blur.rs
index b33fe4cc..c895b416 100644
--- a/rsvg_internals/src/filters/gaussian_blur.rs
+++ b/rsvg_internals/src/filters/gaussian_blur.rs
@@ -8,7 +8,7 @@ use nalgebra::{DMatrix, Dynamic, MatrixVec};
 use attributes::Attribute;
 use drawing_ctx::DrawingCtx;
 use error::NodeError;
-use handle::RsvgHandle;
+use handle::LoadOptions;
 use node::{NodeResult, NodeTrait, RsvgNode};
 use parsers;
 use property_bag::PropertyBag;
@@ -47,10 +47,10 @@ impl NodeTrait for GaussianBlur {
     fn set_atts(
         &self,
         node: &RsvgNode,
-        handle: *const RsvgHandle,
+        load_options: &LoadOptions,
         pbag: &PropertyBag<'_>,
     ) -> NodeResult {
-        self.base.set_atts(node, handle, pbag)?;
+        self.base.set_atts(node, load_options, pbag)?;
 
         for (attr, value) in pbag.iter() {
             match attr {
diff --git a/rsvg_internals/src/filters/image.rs b/rsvg_internals/src/filters/image.rs
index 31791dea..b6cb9ae6 100644
--- a/rsvg_internals/src/filters/image.rs
+++ b/rsvg_internals/src/filters/image.rs
@@ -7,7 +7,7 @@ use attributes::Attribute;
 use defs::{Fragment, Href};
 use drawing_ctx::DrawingCtx;
 use error::{NodeError, RenderingError};
-use handle::{self, LoadOptions, RsvgHandle};
+use handle::{self, LoadOptions};
 use node::{CascadedValues, NodeResult, NodeTrait, RsvgNode};
 use parsers::{ParseError, ParseValue};
 use property_bag::PropertyBag;
@@ -183,10 +183,10 @@ impl NodeTrait for Image {
     fn set_atts(
         &self,
         node: &RsvgNode,
-        handle: *const RsvgHandle,
+        load_options: &LoadOptions,
         pbag: &PropertyBag<'_>,
     ) -> NodeResult {
-        self.base.set_atts(node, handle, pbag)?;
+        self.base.set_atts(node, load_options, pbag)?;
 
         for (attr, value) in pbag.iter() {
             match attr {
@@ -199,7 +199,7 @@ impl NodeTrait for Image {
             }
         }
 
-        *self.load_options.borrow_mut() = Some(handle::get_load_options(handle));
+        *self.load_options.borrow_mut() = Some(load_options.clone());
 
         Ok(())
     }
diff --git a/rsvg_internals/src/filters/light/light_source.rs 
b/rsvg_internals/src/filters/light/light_source.rs
index fc028c3a..0a118933 100644
--- a/rsvg_internals/src/filters/light/light_source.rs
+++ b/rsvg_internals/src/filters/light/light_source.rs
@@ -7,7 +7,7 @@ use nalgebra::Vector3;
 use attributes::Attribute;
 use error::NodeError;
 use filters::context::FilterContext;
-use handle::RsvgHandle;
+use handle::LoadOptions;
 use node::{NodeResult, NodeTrait, RsvgNode};
 use parsers;
 use property_bag::PropertyBag;
@@ -201,12 +201,7 @@ impl TransformedLightSource {
 }
 
 impl NodeTrait for LightSource {
-    fn set_atts(
-        &self,
-        _node: &RsvgNode,
-        _handle: *const RsvgHandle,
-        pbag: &PropertyBag<'_>,
-    ) -> NodeResult {
+    fn set_atts(&self, _node: &RsvgNode, _: &LoadOptions, pbag: &PropertyBag<'_>) -> NodeResult {
         for (attr, value) in pbag.iter() {
             match self {
                 LightSource::Distant {
diff --git a/rsvg_internals/src/filters/light/lighting.rs b/rsvg_internals/src/filters/light/lighting.rs
index f654c596..9fed94be 100644
--- a/rsvg_internals/src/filters/light/lighting.rs
+++ b/rsvg_internals/src/filters/light/lighting.rs
@@ -29,7 +29,7 @@ use filters::{
     FilterError,
     PrimitiveWithInput,
 };
-use handle::RsvgHandle;
+use handle::LoadOptions;
 use node::{NodeResult, NodeTrait, NodeType, RsvgNode};
 use parsers;
 use property_bag::PropertyBag;
@@ -101,10 +101,10 @@ impl NodeTrait for Lighting {
     fn set_atts(
         &self,
         node: &RsvgNode,
-        handle: *const RsvgHandle,
+        load_options: &LoadOptions,
         pbag: &PropertyBag<'_>,
     ) -> NodeResult {
-        self.base.set_atts(node, handle, pbag)?;
+        self.base.set_atts(node, load_options, pbag)?;
 
         for (attr, value) in pbag.iter() {
             match attr {
diff --git a/rsvg_internals/src/filters/merge.rs b/rsvg_internals/src/filters/merge.rs
index 9e504b76..8954e510 100644
--- a/rsvg_internals/src/filters/merge.rs
+++ b/rsvg_internals/src/filters/merge.rs
@@ -4,7 +4,7 @@ use cairo::{self, ImageSurface};
 
 use attributes::Attribute;
 use drawing_ctx::DrawingCtx;
-use handle::RsvgHandle;
+use handle::LoadOptions;
 use node::{NodeResult, NodeTrait, NodeType, RsvgNode};
 use property_bag::PropertyBag;
 use rect::IRect;
@@ -49,21 +49,16 @@ impl NodeTrait for Merge {
     fn set_atts(
         &self,
         node: &RsvgNode,
-        handle: *const RsvgHandle,
+        load_options: &LoadOptions,
         pbag: &PropertyBag<'_>,
     ) -> NodeResult {
-        self.base.set_atts(node, handle, pbag)
+        self.base.set_atts(node, load_options, pbag)
     }
 }
 
 impl NodeTrait for MergeNode {
     #[inline]
-    fn set_atts(
-        &self,
-        _node: &RsvgNode,
-        _handle: *const RsvgHandle,
-        pbag: &PropertyBag<'_>,
-    ) -> NodeResult {
+    fn set_atts(&self, _node: &RsvgNode, _: &LoadOptions, pbag: &PropertyBag<'_>) -> NodeResult {
         for (attr, value) in pbag.iter() {
             match attr {
                 Attribute::In => {
diff --git a/rsvg_internals/src/filters/mod.rs b/rsvg_internals/src/filters/mod.rs
index ab845c9a..c4e9ca94 100644
--- a/rsvg_internals/src/filters/mod.rs
+++ b/rsvg_internals/src/filters/mod.rs
@@ -9,7 +9,7 @@ use attributes::Attribute;
 use coord_units::CoordUnits;
 use drawing_ctx::DrawingCtx;
 use error::{RenderingError, ValueErrorKind};
-use handle::RsvgHandle;
+use handle::LoadOptions;
 use length::{Length, LengthDir, LengthUnit};
 use node::{NodeResult, NodeTrait, NodeType, RsvgNode};
 use parsers::{ParseError, ParseValue};
@@ -111,12 +111,7 @@ impl Primitive {
 }
 
 impl NodeTrait for Primitive {
-    fn set_atts(
-        &self,
-        node: &RsvgNode,
-        _: *const RsvgHandle,
-        pbag: &PropertyBag<'_>,
-    ) -> NodeResult {
+    fn set_atts(&self, node: &RsvgNode, _: &LoadOptions, pbag: &PropertyBag<'_>) -> NodeResult {
         // With ObjectBoundingBox, only fractions and percents are allowed.
         let primitiveunits = node
             .get_parent()
@@ -201,10 +196,10 @@ impl NodeTrait for PrimitiveWithInput {
     fn set_atts(
         &self,
         node: &RsvgNode,
-        handle: *const RsvgHandle,
+        load_options: &LoadOptions,
         pbag: &PropertyBag<'_>,
     ) -> NodeResult {
-        self.base.set_atts(node, handle, pbag)?;
+        self.base.set_atts(node, load_options, pbag)?;
 
         for (attr, value) in pbag.iter() {
             match attr {
diff --git a/rsvg_internals/src/filters/morphology.rs b/rsvg_internals/src/filters/morphology.rs
index 61338593..bc511a70 100644
--- a/rsvg_internals/src/filters/morphology.rs
+++ b/rsvg_internals/src/filters/morphology.rs
@@ -6,7 +6,7 @@ use cairo::{self, ImageSurface, MatrixTrait};
 use attributes::Attribute;
 use drawing_ctx::DrawingCtx;
 use error::NodeError;
-use handle::RsvgHandle;
+use handle::LoadOptions;
 use node::{NodeResult, NodeTrait, RsvgNode};
 use parsers::{self, ParseError};
 use property_bag::PropertyBag;
@@ -52,10 +52,10 @@ impl NodeTrait for Morphology {
     fn set_atts(
         &self,
         node: &RsvgNode,
-        handle: *const RsvgHandle,
+        load_options: &LoadOptions,
         pbag: &PropertyBag<'_>,
     ) -> NodeResult {
-        self.base.set_atts(node, handle, pbag)?;
+        self.base.set_atts(node, load_options, pbag)?;
 
         for (attr, value) in pbag.iter() {
             match attr {
diff --git a/rsvg_internals/src/filters/node.rs b/rsvg_internals/src/filters/node.rs
index cf002cd1..88d7f600 100644
--- a/rsvg_internals/src/filters/node.rs
+++ b/rsvg_internals/src/filters/node.rs
@@ -4,7 +4,7 @@ use std::cell::Cell;
 use attributes::Attribute;
 use coord_units::CoordUnits;
 use error::ValueErrorKind;
-use handle::RsvgHandle;
+use handle::LoadOptions;
 use length::{Length, LengthDir, LengthUnit};
 use node::{NodeResult, NodeTrait, RsvgNode};
 use parsers::{Parse, ParseError, ParseValue};
@@ -36,12 +36,7 @@ impl NodeFilter {
 }
 
 impl NodeTrait for NodeFilter {
-    fn set_atts(
-        &self,
-        _node: &RsvgNode,
-        _handle: *const RsvgHandle,
-        pbag: &PropertyBag<'_>,
-    ) -> NodeResult {
+    fn set_atts(&self, _node: &RsvgNode, _: &LoadOptions, pbag: &PropertyBag<'_>) -> NodeResult {
         // Parse filterUnits first as it affects x, y, width, height checks.
         for (attr, value) in pbag.iter() {
             match attr {
diff --git a/rsvg_internals/src/filters/offset.rs b/rsvg_internals/src/filters/offset.rs
index a81c4ad6..194b5164 100644
--- a/rsvg_internals/src/filters/offset.rs
+++ b/rsvg_internals/src/filters/offset.rs
@@ -5,7 +5,7 @@ use cairo::{self, ImageSurface, MatrixTrait};
 use attributes::Attribute;
 use drawing_ctx::DrawingCtx;
 use error::NodeError;
-use handle::RsvgHandle;
+use handle::LoadOptions;
 use node::{NodeResult, NodeTrait, RsvgNode};
 use parsers;
 use property_bag::PropertyBag;
@@ -39,10 +39,10 @@ impl NodeTrait for Offset {
     fn set_atts(
         &self,
         node: &RsvgNode,
-        handle: *const RsvgHandle,
+        load_options: &LoadOptions,
         pbag: &PropertyBag<'_>,
     ) -> NodeResult {
-        self.base.set_atts(node, handle, pbag)?;
+        self.base.set_atts(node, load_options, pbag)?;
 
         for (attr, value) in pbag.iter() {
             match attr {
diff --git a/rsvg_internals/src/filters/tile.rs b/rsvg_internals/src/filters/tile.rs
index 1c407ff4..a4512cf0 100644
--- a/rsvg_internals/src/filters/tile.rs
+++ b/rsvg_internals/src/filters/tile.rs
@@ -1,7 +1,7 @@
 use cairo::{self, ImageSurface, Matrix, MatrixTrait, PatternTrait};
 
 use drawing_ctx::DrawingCtx;
-use handle::RsvgHandle;
+use handle::LoadOptions;
 use node::{NodeResult, NodeTrait, RsvgNode};
 use property_bag::PropertyBag;
 use surface_utils::shared_surface::SharedImageSurface;
@@ -28,10 +28,10 @@ impl NodeTrait for Tile {
     fn set_atts(
         &self,
         node: &RsvgNode,
-        handle: *const RsvgHandle,
+        load_options: &LoadOptions,
         pbag: &PropertyBag<'_>,
     ) -> NodeResult {
-        self.base.set_atts(node, handle, pbag)
+        self.base.set_atts(node, load_options, pbag)
     }
 }
 
diff --git a/rsvg_internals/src/filters/turbulence.rs b/rsvg_internals/src/filters/turbulence.rs
index bc9b705f..000637fe 100644
--- a/rsvg_internals/src/filters/turbulence.rs
+++ b/rsvg_internals/src/filters/turbulence.rs
@@ -5,7 +5,7 @@ use cairo::{self, ImageSurface, MatrixTrait};
 use attributes::Attribute;
 use drawing_ctx::DrawingCtx;
 use error::NodeError;
-use handle::RsvgHandle;
+use handle::LoadOptions;
 use node::{NodeResult, NodeTrait, RsvgNode};
 use parsers::{self, ParseError};
 use property_bag::PropertyBag;
@@ -64,10 +64,10 @@ impl NodeTrait for Turbulence {
     fn set_atts(
         &self,
         node: &RsvgNode,
-        handle: *const RsvgHandle,
+        load_options: &LoadOptions,
         pbag: &PropertyBag<'_>,
     ) -> NodeResult {
-        self.base.set_atts(node, handle, pbag)?;
+        self.base.set_atts(node, load_options, pbag)?;
 
         for (attr, value) in pbag.iter() {
             match attr {
diff --git a/rsvg_internals/src/gradient.rs b/rsvg_internals/src/gradient.rs
index a045a523..5ece9427 100644
--- a/rsvg_internals/src/gradient.rs
+++ b/rsvg_internals/src/gradient.rs
@@ -9,7 +9,7 @@ use coord_units::CoordUnits;
 use defs::Fragment;
 use drawing_ctx::{AcquiredNode, DrawingCtx, NodeStack};
 use error::*;
-use handle::RsvgHandle;
+use handle::LoadOptions;
 use length::*;
 use node::*;
 use paint_server::PaintSource;
@@ -658,12 +658,7 @@ impl NodeGradient {
 }
 
 impl NodeTrait for NodeGradient {
-    fn set_atts(
-        &self,
-        node: &RsvgNode,
-        _: *const RsvgHandle,
-        pbag: &PropertyBag<'_>,
-    ) -> NodeResult {
+    fn set_atts(&self, node: &RsvgNode, _: &LoadOptions, pbag: &PropertyBag<'_>) -> NodeResult {
         let mut g = self.gradient.borrow_mut();
 
         let mut x1 = None;
diff --git a/rsvg_internals/src/image.rs b/rsvg_internals/src/image.rs
index 9db4f856..8f52e8aa 100644
--- a/rsvg_internals/src/image.rs
+++ b/rsvg_internals/src/image.rs
@@ -9,7 +9,7 @@ use defs::Href;
 use drawing_ctx::DrawingCtx;
 use error::{NodeError, RenderingError};
 use float_eq_cairo::ApproxEqCairo;
-use handle::{self, RsvgHandle};
+use handle::{self, LoadOptions};
 use length::*;
 use node::*;
 use parsers::ParseValue;
@@ -41,7 +41,7 @@ impl NodeTrait for NodeImage {
     fn set_atts(
         &self,
         node: &RsvgNode,
-        handle: *const RsvgHandle,
+        load_options: &LoadOptions,
         pbag: &PropertyBag<'_>,
     ) -> NodeResult {
         // SVG element has overflow:hidden
@@ -79,13 +79,9 @@ impl NodeTrait for NodeImage {
 
                     *self.surface.borrow_mut() = Some(
                         // FIXME: translate the error better here
-                        handle::load_image_to_surface(&handle::get_load_options(handle), &url)
-                            .map_err(|e| {
-                                NodeError::value_error(
-                                    attr,
-                                    &format!("could not load image: {}", e),
-                                )
-                            })?,
+                        handle::load_image_to_surface(load_options, &url).map_err(|e| {
+                            NodeError::value_error(attr, &format!("could not load image: {}", e))
+                        })?,
                     );
                 }
 
diff --git a/rsvg_internals/src/link.rs b/rsvg_internals/src/link.rs
index fd0ee488..d25bf6fc 100644
--- a/rsvg_internals/src/link.rs
+++ b/rsvg_internals/src/link.rs
@@ -10,7 +10,7 @@ use std::cell::RefCell;
 use attributes::Attribute;
 use drawing_ctx::DrawingCtx;
 use error::RenderingError;
-use handle::RsvgHandle;
+use handle::LoadOptions;
 use node::*;
 use property_bag::PropertyBag;
 
@@ -27,7 +27,7 @@ impl NodeLink {
 }
 
 impl NodeTrait for NodeLink {
-    fn set_atts(&self, _: &RsvgNode, _: *const RsvgHandle, pbag: &PropertyBag<'_>) -> NodeResult {
+    fn set_atts(&self, _: &RsvgNode, _: &LoadOptions, pbag: &PropertyBag<'_>) -> NodeResult {
         for (attr, value) in pbag.iter() {
             match attr {
                 Attribute::XlinkHref => *self.link.borrow_mut() = Some(value.to_owned()),
diff --git a/rsvg_internals/src/marker.rs b/rsvg_internals/src/marker.rs
index a8d629f9..4cd702f9 100644
--- a/rsvg_internals/src/marker.rs
+++ b/rsvg_internals/src/marker.rs
@@ -12,7 +12,7 @@ use defs::Fragment;
 use drawing_ctx::DrawingCtx;
 use error::*;
 use float_eq_cairo::ApproxEqCairo;
-use handle::RsvgHandle;
+use handle::LoadOptions;
 use iri::IRI;
 use length::{Length, LengthDir};
 use node::*;
@@ -207,12 +207,7 @@ impl NodeMarker {
 }
 
 impl NodeTrait for NodeMarker {
-    fn set_atts(
-        &self,
-        node: &RsvgNode,
-        _: *const RsvgHandle,
-        pbag: &PropertyBag<'_>,
-    ) -> NodeResult {
+    fn set_atts(&self, node: &RsvgNode, _: &LoadOptions, pbag: &PropertyBag<'_>) -> NodeResult {
         // marker element has overflow:hidden
         // https://www.w3.org/TR/SVG/styling.html#UAStyleSheet
         node.set_overflow_hidden();
diff --git a/rsvg_internals/src/mask.rs b/rsvg_internals/src/mask.rs
index dc67cea5..75e52423 100644
--- a/rsvg_internals/src/mask.rs
+++ b/rsvg_internals/src/mask.rs
@@ -5,7 +5,7 @@ use attributes::Attribute;
 use coord_units::CoordUnits;
 use drawing_ctx::DrawingCtx;
 use error::RenderingError;
-use handle::RsvgHandle;
+use handle::LoadOptions;
 use length::{Length, LengthDir};
 use node::{NodeResult, NodeTrait, RsvgNode};
 use parsers::{Parse, ParseValue};
@@ -193,7 +193,7 @@ fn compute_luminance_to_alpha(
 }
 
 impl NodeTrait for NodeMask {
-    fn set_atts(&self, _: &RsvgNode, _: *const RsvgHandle, pbag: &PropertyBag<'_>) -> NodeResult {
+    fn set_atts(&self, _: &RsvgNode, _: &LoadOptions, pbag: &PropertyBag<'_>) -> NodeResult {
         for (attr, value) in pbag.iter() {
             match attr {
                 Attribute::X => self.x.set(attr.parse(value, LengthDir::Horizontal)?),
diff --git a/rsvg_internals/src/node.rs b/rsvg_internals/src/node.rs
index 1cfce031..58a2855b 100644
--- a/rsvg_internals/src/node.rs
+++ b/rsvg_internals/src/node.rs
@@ -8,7 +8,7 @@ use cond::{locale_from_environment, RequiredExtensions, RequiredFeatures, System
 use css::CssStyles;
 use drawing_ctx::DrawingCtx;
 use error::*;
-use handle::RsvgHandle;
+use handle::LoadOptions;
 use parsers::Parse;
 use property_bag::PropertyBag;
 use state::{ComputedValues, Overflow, SpecifiedValue, State};
@@ -100,7 +100,7 @@ pub trait NodeTrait: Downcast {
     fn set_atts(
         &self,
         node: &RsvgNode,
-        handle: *const RsvgHandle,
+        load_options: &LoadOptions,
         pbag: &PropertyBag<'_>,
     ) -> NodeResult;
 
@@ -348,7 +348,7 @@ impl Node {
         self.data.cond.get()
     }
 
-    pub fn set_atts(&self, node: &RsvgNode, handle: *const RsvgHandle, pbag: &PropertyBag<'_>) {
+    pub fn set_atts(&self, node: &RsvgNode, load_options: &LoadOptions, pbag: &PropertyBag<'_>) {
         for (attr, value) in pbag.iter() {
             match attr {
                 Attribute::Transform => match Matrix::parse_str(value, ()) {
@@ -371,7 +371,7 @@ impl Node {
             }
         }
 
-        match self.data.node_impl.set_atts(node, handle, pbag) {
+        match self.data.node_impl.set_atts(node, load_options, pbag) {
             Ok(_) => (),
             Err(e) => {
                 self.set_error(e);
diff --git a/rsvg_internals/src/pattern.rs b/rsvg_internals/src/pattern.rs
index 9d7c5720..17802f9f 100644
--- a/rsvg_internals/src/pattern.rs
+++ b/rsvg_internals/src/pattern.rs
@@ -13,7 +13,7 @@ use defs::Fragment;
 use drawing_ctx::{DrawingCtx, NodeStack};
 use error::{AttributeResultExt, RenderingError};
 use float_eq_cairo::ApproxEqCairo;
-use handle::RsvgHandle;
+use handle::LoadOptions;
 use length::*;
 use node::*;
 use paint_server::PaintSource;
@@ -173,12 +173,7 @@ impl NodePattern {
 }
 
 impl NodeTrait for NodePattern {
-    fn set_atts(
-        &self,
-        node: &RsvgNode,
-        _: *const RsvgHandle,
-        pbag: &PropertyBag<'_>,
-    ) -> NodeResult {
+    fn set_atts(&self, node: &RsvgNode, _: &LoadOptions, pbag: &PropertyBag<'_>) -> NodeResult {
         // pattern element has overflow:hidden
         // https://www.w3.org/TR/SVG/styling.html#UAStyleSheet
         node.set_overflow_hidden();
diff --git a/rsvg_internals/src/shapes.rs b/rsvg_internals/src/shapes.rs
index 3ac956bc..4579cd91 100644
--- a/rsvg_internals/src/shapes.rs
+++ b/rsvg_internals/src/shapes.rs
@@ -7,7 +7,7 @@ use attributes::Attribute;
 use cssparser::{Parser, Token};
 use drawing_ctx::DrawingCtx;
 use error::*;
-use handle::RsvgHandle;
+use handle::LoadOptions;
 use length::*;
 use marker;
 use node::*;
@@ -125,12 +125,7 @@ impl NodePath {
 }
 
 impl NodeTrait for NodePath {
-    fn set_atts(
-        &self,
-        node: &RsvgNode,
-        _: *const RsvgHandle,
-        pbag: &PropertyBag<'_>,
-    ) -> NodeResult {
+    fn set_atts(&self, node: &RsvgNode, _: &LoadOptions, pbag: &PropertyBag<'_>) -> NodeResult {
         for (attr, value) in pbag.iter() {
             if attr == Attribute::D {
                 let mut builder = PathBuilder::new();
@@ -239,7 +234,7 @@ impl NodePoly {
 }
 
 impl NodeTrait for NodePoly {
-    fn set_atts(&self, _: &RsvgNode, _: *const RsvgHandle, pbag: &PropertyBag<'_>) -> NodeResult {
+    fn set_atts(&self, _: &RsvgNode, _: &LoadOptions, pbag: &PropertyBag<'_>) -> NodeResult {
         for (attr, value) in pbag.iter() {
             // support for svg < 1.0 which used verts
             if attr == Attribute::Points || attr == Attribute::Verts {
@@ -300,7 +295,7 @@ impl NodeLine {
 }
 
 impl NodeTrait for NodeLine {
-    fn set_atts(&self, _: &RsvgNode, _: *const RsvgHandle, pbag: &PropertyBag<'_>) -> NodeResult {
+    fn set_atts(&self, _: &RsvgNode, _: &LoadOptions, pbag: &PropertyBag<'_>) -> NodeResult {
         for (attr, value) in pbag.iter() {
             match attr {
                 Attribute::X1 => self.x1.set(attr.parse(value, LengthDir::Horizontal)?),
@@ -366,7 +361,7 @@ impl NodeRect {
 }
 
 impl NodeTrait for NodeRect {
-    fn set_atts(&self, _: &RsvgNode, _: *const RsvgHandle, pbag: &PropertyBag<'_>) -> NodeResult {
+    fn set_atts(&self, _: &RsvgNode, _: &LoadOptions, pbag: &PropertyBag<'_>) -> NodeResult {
         for (attr, value) in pbag.iter() {
             match attr {
                 Attribute::X => self.x.set(attr.parse(value, LengthDir::Horizontal)?),
@@ -566,7 +561,7 @@ impl NodeCircle {
 }
 
 impl NodeTrait for NodeCircle {
-    fn set_atts(&self, _: &RsvgNode, _: *const RsvgHandle, pbag: &PropertyBag<'_>) -> NodeResult {
+    fn set_atts(&self, _: &RsvgNode, _: &LoadOptions, pbag: &PropertyBag<'_>) -> NodeResult {
         for (attr, value) in pbag.iter() {
             match attr {
                 Attribute::Cx => self.cx.set(attr.parse(value, LengthDir::Horizontal)?),
@@ -622,7 +617,7 @@ impl NodeEllipse {
 }
 
 impl NodeTrait for NodeEllipse {
-    fn set_atts(&self, _: &RsvgNode, _: *const RsvgHandle, pbag: &PropertyBag<'_>) -> NodeResult {
+    fn set_atts(&self, _: &RsvgNode, _: &LoadOptions, pbag: &PropertyBag<'_>) -> NodeResult {
         for (attr, value) in pbag.iter() {
             match attr {
                 Attribute::Cx => self.cx.set(attr.parse(value, LengthDir::Horizontal)?),
diff --git a/rsvg_internals/src/stop.rs b/rsvg_internals/src/stop.rs
index 6317d876..13994dee 100644
--- a/rsvg_internals/src/stop.rs
+++ b/rsvg_internals/src/stop.rs
@@ -2,7 +2,7 @@ use std::cell::Cell;
 
 use attributes::Attribute;
 use error::*;
-use handle::RsvgHandle;
+use handle::LoadOptions;
 use length::*;
 use node::*;
 use parsers::ParseValue;
@@ -35,7 +35,7 @@ fn validate_offset(length: Length) -> Result<Length, ValueErrorKind> {
 }
 
 impl NodeTrait for NodeStop {
-    fn set_atts(&self, _: &RsvgNode, _: *const RsvgHandle, pbag: &PropertyBag<'_>) -> NodeResult {
+    fn set_atts(&self, _: &RsvgNode, _: &LoadOptions, pbag: &PropertyBag<'_>) -> NodeResult {
         for (attr, value) in pbag.iter() {
             match attr {
                 Attribute::Offset => {
diff --git a/rsvg_internals/src/structure.rs b/rsvg_internals/src/structure.rs
index be7fc846..fd4dc584 100644
--- a/rsvg_internals/src/structure.rs
+++ b/rsvg_internals/src/structure.rs
@@ -9,7 +9,7 @@ use dpi::Dpi;
 use drawing_ctx::DrawingCtx;
 use error::{AttributeResultExt, RenderingError};
 use float_eq_cairo::ApproxEqCairo;
-use handle::RsvgHandle;
+use handle::LoadOptions;
 use length::*;
 use node::*;
 use parsers::{Parse, ParseValue};
@@ -27,7 +27,7 @@ impl NodeGroup {
 }
 
 impl NodeTrait for NodeGroup {
-    fn set_atts(&self, _: &RsvgNode, _: *const RsvgHandle, _: &PropertyBag<'_>) -> NodeResult {
+    fn set_atts(&self, _: &RsvgNode, _: &LoadOptions, _: &PropertyBag<'_>) -> NodeResult {
         Ok(())
     }
 
@@ -55,7 +55,7 @@ impl NodeDefs {
 }
 
 impl NodeTrait for NodeDefs {
-    fn set_atts(&self, _: &RsvgNode, _: *const RsvgHandle, _: &PropertyBag<'_>) -> NodeResult {
+    fn set_atts(&self, _: &RsvgNode, _: &LoadOptions, _: &PropertyBag<'_>) -> NodeResult {
         Ok(())
     }
 }
@@ -69,7 +69,7 @@ impl NodeSwitch {
 }
 
 impl NodeTrait for NodeSwitch {
-    fn set_atts(&self, _: &RsvgNode, _: *const RsvgHandle, _: &PropertyBag<'_>) -> NodeResult {
+    fn set_atts(&self, _: &RsvgNode, _: &LoadOptions, _: &PropertyBag<'_>) -> NodeResult {
         Ok(())
     }
 
@@ -147,12 +147,7 @@ impl NodeSvg {
 }
 
 impl NodeTrait for NodeSvg {
-    fn set_atts(
-        &self,
-        node: &RsvgNode,
-        _: *const RsvgHandle,
-        pbag: &PropertyBag<'_>,
-    ) -> NodeResult {
+    fn set_atts(&self, node: &RsvgNode, _: &LoadOptions, pbag: &PropertyBag<'_>) -> NodeResult {
         // SVG element has overflow:hidden
         // https://www.w3.org/TR/SVG/styling.html#UAStyleSheet
         node.set_overflow_hidden();
@@ -265,7 +260,7 @@ impl NodeUse {
 }
 
 impl NodeTrait for NodeUse {
-    fn set_atts(&self, _: &RsvgNode, _: *const RsvgHandle, pbag: &PropertyBag<'_>) -> NodeResult {
+    fn set_atts(&self, _: &RsvgNode, _: &LoadOptions, pbag: &PropertyBag<'_>) -> NodeResult {
         for (attr, value) in pbag.iter() {
             match attr {
                 Attribute::XlinkHref => {
@@ -420,12 +415,7 @@ impl NodeSymbol {
 }
 
 impl NodeTrait for NodeSymbol {
-    fn set_atts(
-        &self,
-        node: &RsvgNode,
-        _: *const RsvgHandle,
-        pbag: &PropertyBag<'_>,
-    ) -> NodeResult {
+    fn set_atts(&self, node: &RsvgNode, _: &LoadOptions, pbag: &PropertyBag<'_>) -> NodeResult {
         // symbol element has overflow:hidden
         // https://www.w3.org/TR/SVG/styling.html#UAStyleSheet
         node.set_overflow_hidden();
diff --git a/rsvg_internals/src/style.rs b/rsvg_internals/src/style.rs
index f5a01a0e..acb2033e 100644
--- a/rsvg_internals/src/style.rs
+++ b/rsvg_internals/src/style.rs
@@ -1,5 +1,5 @@
 use attributes::Attribute;
-use handle::RsvgHandle;
+use handle::LoadOptions;
 use node::{NodeResult, NodeTrait, NodeType, RsvgNode};
 use property_bag::PropertyBag;
 use text::NodeChars;
@@ -56,7 +56,7 @@ impl NodeStyle {
 }
 
 impl NodeTrait for NodeStyle {
-    fn set_atts(&self, _: &RsvgNode, _: *const RsvgHandle, pbag: &PropertyBag<'_>) -> NodeResult {
+    fn set_atts(&self, _: &RsvgNode, _: &LoadOptions, pbag: &PropertyBag<'_>) -> NodeResult {
         for (attr, value) in pbag.iter() {
             if attr == Attribute::Type {
                 *self.type_.borrow_mut() = Some(value.to_string());
diff --git a/rsvg_internals/src/text.rs b/rsvg_internals/src/text.rs
index 5d19eeee..23b7916b 100644
--- a/rsvg_internals/src/text.rs
+++ b/rsvg_internals/src/text.rs
@@ -11,7 +11,7 @@ use drawing_ctx::DrawingCtx;
 use error::{AttributeResultExt, RenderingError};
 use float_eq_cairo::ApproxEqCairo;
 use font_props::FontWeightSpec;
-use handle::RsvgHandle;
+use handle::LoadOptions;
 use length::*;
 use node::{CascadedValues, NodeResult, NodeTrait, NodeType, RsvgNode};
 use parsers::ParseValue;
@@ -542,7 +542,7 @@ impl NodeChars {
 }
 
 impl NodeTrait for NodeChars {
-    fn set_atts(&self, _: &RsvgNode, _: *const RsvgHandle, _: &PropertyBag<'_>) -> NodeResult {
+    fn set_atts(&self, _: &RsvgNode, _: &LoadOptions, _: &PropertyBag<'_>) -> NodeResult {
         Ok(())
     }
 }
@@ -585,7 +585,7 @@ impl NodeText {
 }
 
 impl NodeTrait for NodeText {
-    fn set_atts(&self, _: &RsvgNode, _: *const RsvgHandle, pbag: &PropertyBag<'_>) -> NodeResult {
+    fn set_atts(&self, _: &RsvgNode, _: &LoadOptions, pbag: &PropertyBag<'_>) -> NodeResult {
         for (attr, value) in pbag.iter() {
             match attr {
                 Attribute::X => self.x.set(attr.parse(value, LengthDir::Horizontal)?),
@@ -710,7 +710,7 @@ fn extract_chars_children_to_chunks_recursively(
 }
 
 impl NodeTrait for NodeTRef {
-    fn set_atts(&self, _: &RsvgNode, _: *const RsvgHandle, pbag: &PropertyBag<'_>) -> NodeResult {
+    fn set_atts(&self, _: &RsvgNode, _: &LoadOptions, pbag: &PropertyBag<'_>) -> NodeResult {
         for (attr, value) in pbag.iter() {
             match attr {
                 Attribute::XlinkHref => {
@@ -766,7 +766,7 @@ impl NodeTSpan {
 }
 
 impl NodeTrait for NodeTSpan {
-    fn set_atts(&self, _: &RsvgNode, _: *const RsvgHandle, pbag: &PropertyBag<'_>) -> NodeResult {
+    fn set_atts(&self, _: &RsvgNode, _: &LoadOptions, pbag: &PropertyBag<'_>) -> NodeResult {
         for (attr, value) in pbag.iter() {
             match attr {
                 Attribute::X => self
diff --git a/rsvg_internals/src/xml.rs b/rsvg_internals/src/xml.rs
index 5dc849a0..b063360a 100644
--- a/rsvg_internals/src/xml.rs
+++ b/rsvg_internals/src/xml.rs
@@ -335,7 +335,7 @@ impl XmlState {
             parent.add_child(&new_node);
         }
 
-        new_node.set_atts(&new_node, self.handle, pbag);
+        new_node.set_atts(&new_node, &handle::get_load_options(self.handle), pbag);
 
         // The "svg" node is special; it will parse its style attributes
         // until the end, in standard_element_end().



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