[librsvg: 2/6] node: do not pass the node itself to set_atts
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 2/6] node: do not pass the node itself to set_atts
- Date: Sat, 29 Jun 2019 21:50:36 +0000 (UTC)
commit 3e2c213816073c8401293b852bd2dd49190a5c38
Author: Paolo Borelli <pborelli gnome org>
Date: Sat Jun 29 11:46:11 2019 +0200
node: do not pass the node itself to set_atts
Pass the parent instead. The only places where the param was
used were already using it only to get to the parent.
rsvg_internals/src/clip_path.rs | 2 +-
rsvg_internals/src/filters/blend.rs | 4 ++--
rsvg_internals/src/filters/color_matrix.rs | 4 ++--
rsvg_internals/src/filters/component_transfer.rs | 6 +++---
rsvg_internals/src/filters/composite.rs | 4 ++--
rsvg_internals/src/filters/convolve_matrix.rs | 4 ++--
rsvg_internals/src/filters/displacement_map.rs | 4 ++--
rsvg_internals/src/filters/flood.rs | 4 ++--
rsvg_internals/src/filters/gaussian_blur.rs | 4 ++--
rsvg_internals/src/filters/image.rs | 4 ++--
rsvg_internals/src/filters/light/light_source.rs | 2 +-
rsvg_internals/src/filters/light/lighting.rs | 4 ++--
rsvg_internals/src/filters/merge.rs | 6 +++---
rsvg_internals/src/filters/mod.rs | 9 ++++-----
rsvg_internals/src/filters/morphology.rs | 4 ++--
rsvg_internals/src/filters/node.rs | 2 +-
rsvg_internals/src/filters/offset.rs | 4 ++--
rsvg_internals/src/filters/tile.rs | 4 ++--
rsvg_internals/src/filters/turbulence.rs | 4 ++--
rsvg_internals/src/gradient.rs | 6 +++---
rsvg_internals/src/image.rs | 2 +-
rsvg_internals/src/link.rs | 2 +-
rsvg_internals/src/marker.rs | 4 ++--
rsvg_internals/src/mask.rs | 2 +-
rsvg_internals/src/node.rs | 6 +++---
rsvg_internals/src/pattern.rs | 2 +-
rsvg_internals/src/shapes.rs | 14 +++++++-------
rsvg_internals/src/structure.rs | 14 +++++++-------
rsvg_internals/src/style.rs | 2 +-
rsvg_internals/src/text.rs | 8 ++++----
rsvg_internals/src/xml.rs | 2 +-
31 files changed, 71 insertions(+), 72 deletions(-)
---
diff --git a/rsvg_internals/src/clip_path.rs b/rsvg_internals/src/clip_path.rs
index 570de6b5..a2d72311 100644
--- a/rsvg_internals/src/clip_path.rs
+++ b/rsvg_internals/src/clip_path.rs
@@ -65,7 +65,7 @@ impl NodeClipPath {
}
impl NodeTrait for NodeClipPath {
- fn set_atts(&self, _: &RsvgNode, pbag: &PropertyBag<'_>) -> NodeResult {
+ fn set_atts(&self, _: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> NodeResult {
for (attr, value) in pbag.iter() {
match attr {
local_name!("clipPathUnits") => self.units.set(attr.parse(value)?),
diff --git a/rsvg_internals/src/filters/blend.rs b/rsvg_internals/src/filters/blend.rs
index 92361e0b..754f6835 100644
--- a/rsvg_internals/src/filters/blend.rs
+++ b/rsvg_internals/src/filters/blend.rs
@@ -46,8 +46,8 @@ impl Default for Blend {
impl NodeTrait for Blend {
impl_node_as_filter!();
- fn set_atts(&self, node: &RsvgNode, pbag: &PropertyBag<'_>) -> NodeResult {
- self.base.set_atts(node, pbag)?;
+ fn set_atts(&self, parent: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> NodeResult {
+ self.base.set_atts(parent, 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 6bda603b..2381f321 100644
--- a/rsvg_internals/src/filters/color_matrix.rs
+++ b/rsvg_internals/src/filters/color_matrix.rs
@@ -50,8 +50,8 @@ impl Default for ColorMatrix {
impl NodeTrait for ColorMatrix {
impl_node_as_filter!();
- fn set_atts(&self, node: &RsvgNode, pbag: &PropertyBag<'_>) -> NodeResult {
- self.base.set_atts(node, pbag)?;
+ fn set_atts(&self, parent: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> NodeResult {
+ self.base.set_atts(parent, 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 becebfbe..342b2102 100644
--- a/rsvg_internals/src/filters/component_transfer.rs
+++ b/rsvg_internals/src/filters/component_transfer.rs
@@ -205,14 +205,14 @@ impl NodeTrait for ComponentTransfer {
impl_node_as_filter!();
#[inline]
- fn set_atts(&self, node: &RsvgNode, pbag: &PropertyBag<'_>) -> NodeResult {
- self.base.set_atts(node, pbag)
+ fn set_atts(&self, parent: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> NodeResult {
+ self.base.set_atts(parent, pbag)
}
}
impl NodeTrait for FuncX {
#[inline]
- fn set_atts(&self, _node: &RsvgNode, pbag: &PropertyBag<'_>) -> NodeResult {
+ fn set_atts(&self, _parent: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> NodeResult {
for (attr, value) in pbag.iter() {
match attr {
local_name!("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 9ee4bf22..c0432507 100644
--- a/rsvg_internals/src/filters/composite.rs
+++ b/rsvg_internals/src/filters/composite.rs
@@ -63,8 +63,8 @@ impl Default for Composite {
impl NodeTrait for Composite {
impl_node_as_filter!();
- fn set_atts(&self, node: &RsvgNode, pbag: &PropertyBag<'_>) -> NodeResult {
- self.base.set_atts(node, pbag)?;
+ fn set_atts(&self, parent: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> NodeResult {
+ self.base.set_atts(parent, 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 a7e69849..a5d22026 100644
--- a/rsvg_internals/src/filters/convolve_matrix.rs
+++ b/rsvg_internals/src/filters/convolve_matrix.rs
@@ -59,8 +59,8 @@ impl Default for ConvolveMatrix {
impl NodeTrait for ConvolveMatrix {
impl_node_as_filter!();
- fn set_atts(&self, node: &RsvgNode, pbag: &PropertyBag<'_>) -> NodeResult {
- self.base.set_atts(node, pbag)?;
+ fn set_atts(&self, parent: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> NodeResult {
+ self.base.set_atts(parent, 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 58cbf488..b6220da4 100644
--- a/rsvg_internals/src/filters/displacement_map.rs
+++ b/rsvg_internals/src/filters/displacement_map.rs
@@ -48,8 +48,8 @@ impl Default for DisplacementMap {
impl NodeTrait for DisplacementMap {
impl_node_as_filter!();
- fn set_atts(&self, node: &RsvgNode, pbag: &PropertyBag<'_>) -> NodeResult {
- self.base.set_atts(node, pbag)?;
+ fn set_atts(&self, parent: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> NodeResult {
+ self.base.set_atts(parent, 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 5fb457cc..b2c67617 100644
--- a/rsvg_internals/src/filters/flood.rs
+++ b/rsvg_internals/src/filters/flood.rs
@@ -28,8 +28,8 @@ impl NodeTrait for Flood {
impl_node_as_filter!();
#[inline]
- fn set_atts(&self, node: &RsvgNode, pbag: &PropertyBag<'_>) -> NodeResult {
- self.base.set_atts(node, pbag)
+ fn set_atts(&self, parent: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> NodeResult {
+ self.base.set_atts(parent, pbag)
}
}
diff --git a/rsvg_internals/src/filters/gaussian_blur.rs b/rsvg_internals/src/filters/gaussian_blur.rs
index 1ed55fd2..28bbd74f 100644
--- a/rsvg_internals/src/filters/gaussian_blur.rs
+++ b/rsvg_internals/src/filters/gaussian_blur.rs
@@ -45,8 +45,8 @@ impl Default for GaussianBlur {
impl NodeTrait for GaussianBlur {
impl_node_as_filter!();
- fn set_atts(&self, node: &RsvgNode, pbag: &PropertyBag<'_>) -> NodeResult {
- self.base.set_atts(node, pbag)?;
+ fn set_atts(&self, parent: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> NodeResult {
+ self.base.set_atts(parent, 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 dc21a943..32c83a50 100644
--- a/rsvg_internals/src/filters/image.rs
+++ b/rsvg_internals/src/filters/image.rs
@@ -178,8 +178,8 @@ impl Image {
impl NodeTrait for Image {
impl_node_as_filter!();
- fn set_atts(&self, node: &RsvgNode, pbag: &PropertyBag<'_>) -> NodeResult {
- self.base.set_atts(node, pbag)?;
+ fn set_atts(&self, parent: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> NodeResult {
+ self.base.set_atts(parent, pbag)?;
for (attr, value) in pbag.iter() {
match attr {
diff --git a/rsvg_internals/src/filters/light/light_source.rs
b/rsvg_internals/src/filters/light/light_source.rs
index c4399bb3..04a7175b 100644
--- a/rsvg_internals/src/filters/light/light_source.rs
+++ b/rsvg_internals/src/filters/light/light_source.rs
@@ -200,7 +200,7 @@ impl TransformedLightSource {
}
impl NodeTrait for LightSource {
- fn set_atts(&self, _node: &RsvgNode, pbag: &PropertyBag<'_>) -> NodeResult {
+ fn set_atts(&self, _: Option<&RsvgNode>, 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 be60c16f..5082e9e4 100644
--- a/rsvg_internals/src/filters/light/lighting.rs
+++ b/rsvg_internals/src/filters/light/lighting.rs
@@ -99,8 +99,8 @@ impl Lighting {
impl NodeTrait for Lighting {
impl_node_as_filter!();
- fn set_atts(&self, node: &RsvgNode, pbag: &PropertyBag<'_>) -> NodeResult {
- self.base.set_atts(node, pbag)?;
+ fn set_atts(&self, parent: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> NodeResult {
+ self.base.set_atts(parent, 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 b2fe46d8..cd3e9051 100644
--- a/rsvg_internals/src/filters/merge.rs
+++ b/rsvg_internals/src/filters/merge.rs
@@ -38,14 +38,14 @@ impl NodeTrait for Merge {
impl_node_as_filter!();
#[inline]
- fn set_atts(&self, node: &RsvgNode, pbag: &PropertyBag<'_>) -> NodeResult {
- self.base.set_atts(node, pbag)
+ fn set_atts(&self, parent: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> NodeResult {
+ self.base.set_atts(parent, pbag)
}
}
impl NodeTrait for MergeNode {
#[inline]
- fn set_atts(&self, _node: &RsvgNode, pbag: &PropertyBag<'_>) -> NodeResult {
+ fn set_atts(&self, _parent: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> NodeResult {
for (attr, value) in pbag.iter() {
match attr {
local_name!("in") => {
diff --git a/rsvg_internals/src/filters/mod.rs b/rsvg_internals/src/filters/mod.rs
index 04f002d6..6cac6295 100644
--- a/rsvg_internals/src/filters/mod.rs
+++ b/rsvg_internals/src/filters/mod.rs
@@ -119,10 +119,9 @@ impl Primitive {
}
impl NodeTrait for Primitive {
- fn set_atts(&self, node: &RsvgNode, pbag: &PropertyBag<'_>) -> NodeResult {
+ fn set_atts(&self, parent: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> NodeResult {
// With ObjectBoundingBox, only fractions and percents are allowed.
- let primitiveunits = node
- .parent()
+ let primitiveunits = parent
.and_then(|parent| {
if parent.borrow().get_type() == NodeType::Filter {
Some(
@@ -219,8 +218,8 @@ impl PrimitiveWithInput {
}
impl NodeTrait for PrimitiveWithInput {
- fn set_atts(&self, node: &RsvgNode, pbag: &PropertyBag<'_>) -> NodeResult {
- self.base.set_atts(node, pbag)?;
+ fn set_atts(&self, parent: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> NodeResult {
+ self.base.set_atts(parent, 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 763737af..bd812437 100644
--- a/rsvg_internals/src/filters/morphology.rs
+++ b/rsvg_internals/src/filters/morphology.rs
@@ -50,8 +50,8 @@ impl Default for Morphology {
impl NodeTrait for Morphology {
impl_node_as_filter!();
- fn set_atts(&self, node: &RsvgNode, pbag: &PropertyBag<'_>) -> NodeResult {
- self.base.set_atts(node, pbag)?;
+ fn set_atts(&self, parent: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> NodeResult {
+ self.base.set_atts(parent, 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 a3147a59..34be924b 100644
--- a/rsvg_internals/src/filters/node.rs
+++ b/rsvg_internals/src/filters/node.rs
@@ -108,7 +108,7 @@ impl NodeFilter {
}
impl NodeTrait for NodeFilter {
- fn set_atts(&self, _node: &RsvgNode, pbag: &PropertyBag<'_>) -> NodeResult {
+ fn set_atts(&self, _: Option<&RsvgNode>, 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 58e4faf7..47ef0db5 100644
--- a/rsvg_internals/src/filters/offset.rs
+++ b/rsvg_internals/src/filters/offset.rs
@@ -36,8 +36,8 @@ impl Default for Offset {
impl NodeTrait for Offset {
impl_node_as_filter!();
- fn set_atts(&self, node: &RsvgNode, pbag: &PropertyBag<'_>) -> NodeResult {
- self.base.set_atts(node, pbag)?;
+ fn set_atts(&self, parent: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> NodeResult {
+ self.base.set_atts(parent, 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 a9df1a58..821f8dfe 100644
--- a/rsvg_internals/src/filters/tile.rs
+++ b/rsvg_internals/src/filters/tile.rs
@@ -26,8 +26,8 @@ impl Default for Tile {
impl NodeTrait for Tile {
impl_node_as_filter!();
- fn set_atts(&self, node: &RsvgNode, pbag: &PropertyBag<'_>) -> NodeResult {
- self.base.set_atts(node, pbag)
+ fn set_atts(&self, parent: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> NodeResult {
+ self.base.set_atts(parent, pbag)
}
}
diff --git a/rsvg_internals/src/filters/turbulence.rs b/rsvg_internals/src/filters/turbulence.rs
index fac5a4f7..58db18f7 100644
--- a/rsvg_internals/src/filters/turbulence.rs
+++ b/rsvg_internals/src/filters/turbulence.rs
@@ -62,8 +62,8 @@ impl NodeTrait for Turbulence {
impl_node_as_filter!();
#[inline]
- fn set_atts(&self, node: &RsvgNode, pbag: &PropertyBag<'_>) -> NodeResult {
- self.base.set_atts(node, pbag)?;
+ fn set_atts(&self, parent: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> NodeResult {
+ self.base.set_atts(parent, pbag)?;
for (attr, value) in pbag.iter() {
match attr {
diff --git a/rsvg_internals/src/gradient.rs b/rsvg_internals/src/gradient.rs
index 9910e158..03a95384 100644
--- a/rsvg_internals/src/gradient.rs
+++ b/rsvg_internals/src/gradient.rs
@@ -370,7 +370,7 @@ fn validate_offset(length: LengthBoth) -> Result<LengthBoth, ValueErrorKind> {
}
impl NodeTrait for NodeStop {
- fn set_atts(&self, _: &RsvgNode, pbag: &PropertyBag<'_>) -> NodeResult {
+ fn set_atts(&self, _: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> NodeResult {
for (attr, value) in pbag.iter() {
match attr {
local_name!("offset") => {
@@ -497,7 +497,7 @@ pub struct NodeLinearGradient {
}
impl NodeTrait for NodeLinearGradient {
- fn set_atts(&self, _node: &RsvgNode, pbag: &PropertyBag<'_>) -> NodeResult {
+ fn set_atts(&self, _: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> NodeResult {
let mut common = self.common.borrow_mut();
let mut x1 = None;
@@ -586,7 +586,7 @@ pub struct NodeRadialGradient {
}
impl NodeTrait for NodeRadialGradient {
- fn set_atts(&self, _node: &RsvgNode, pbag: &PropertyBag<'_>) -> NodeResult {
+ fn set_atts(&self, _: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> NodeResult {
let mut common = self.common.borrow_mut();
let mut cx = None;
diff --git a/rsvg_internals/src/image.rs b/rsvg_internals/src/image.rs
index 7c57e3c9..3a9af497 100644
--- a/rsvg_internals/src/image.rs
+++ b/rsvg_internals/src/image.rs
@@ -27,7 +27,7 @@ pub struct NodeImage {
}
impl NodeTrait for NodeImage {
- fn set_atts(&self, _node: &RsvgNode, pbag: &PropertyBag<'_>) -> NodeResult {
+ fn set_atts(&self, _: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> NodeResult {
for (attr, value) in pbag.iter() {
match attr {
local_name!("x") => self.x.set(attr.parse(value)?),
diff --git a/rsvg_internals/src/link.rs b/rsvg_internals/src/link.rs
index 23e689ad..89ce6abe 100644
--- a/rsvg_internals/src/link.rs
+++ b/rsvg_internals/src/link.rs
@@ -15,7 +15,7 @@ pub struct NodeLink {
}
impl NodeTrait for NodeLink {
- fn set_atts(&self, _: &RsvgNode, pbag: &PropertyBag<'_>) -> NodeResult {
+ fn set_atts(&self, _: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> NodeResult {
for (attr, value) in pbag.iter() {
match attr {
local_name!("xlink:href") => *self.link.borrow_mut() = Some(value.to_owned()),
diff --git a/rsvg_internals/src/marker.rs b/rsvg_internals/src/marker.rs
index 5e453621..a44e9e84 100644
--- a/rsvg_internals/src/marker.rs
+++ b/rsvg_internals/src/marker.rs
@@ -2,7 +2,7 @@ use std::cell::Cell;
use std::f64::consts::*;
use std::ops::Deref;
-use cairo::{MatrixTrait, Rectangle};
+use cairo::Rectangle;
use markup5ever::local_name;
use cssparser::{CowRcStr, Parser, Token};
@@ -194,7 +194,7 @@ impl NodeMarker {
}
impl NodeTrait for NodeMarker {
- fn set_atts(&self, _node: &RsvgNode, pbag: &PropertyBag<'_>) -> NodeResult {
+ fn set_atts(&self, _: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> NodeResult {
for (attr, value) in pbag.iter() {
match attr {
local_name!("markerUnits") => self.units.set(attr.parse(value)?),
diff --git a/rsvg_internals/src/mask.rs b/rsvg_internals/src/mask.rs
index e07c3b74..9d990a18 100644
--- a/rsvg_internals/src/mask.rs
+++ b/rsvg_internals/src/mask.rs
@@ -188,7 +188,7 @@ fn compute_luminance_to_alpha(
}
impl NodeTrait for NodeMask {
- fn set_atts(&self, _: &RsvgNode, pbag: &PropertyBag<'_>) -> NodeResult {
+ fn set_atts(&self, _: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> NodeResult {
for (attr, value) in pbag.iter() {
match attr {
local_name!("x") => self.x.set(attr.parse(value)?),
diff --git a/rsvg_internals/src/node.rs b/rsvg_internals/src/node.rs
index db6bdea3..9f5817da 100644
--- a/rsvg_internals/src/node.rs
+++ b/rsvg_internals/src/node.rs
@@ -101,7 +101,7 @@ impl NodeData {
self.specified_values.borrow().is_overflow()
}
- pub fn set_atts(&self, node: &RsvgNode, pbag: &PropertyBag<'_>, locale: &Locale) {
+ pub fn set_atts(&self, parent: Option<&RsvgNode>, pbag: &PropertyBag<'_>, locale: &Locale) {
if self.node_impl.overflow_hidden() {
let mut specified_values = self.specified_values.borrow_mut();
specified_values.overflow = SpecifiedValue::Specified(Overflow::Hidden);
@@ -112,7 +112,7 @@ impl NodeData {
if let Err(e) = self
.set_transform_attribute(pbag)
.and_then(|_| self.set_conditional_processing_attributes(pbag, locale))
- .and_then(|_| self.node_impl.set_atts(node, pbag))
+ .and_then(|_| self.node_impl.set_atts(parent, pbag))
.and_then(|_| self.set_presentation_attributes(pbag))
{
self.set_error(e);
@@ -359,7 +359,7 @@ pub trait NodeTrait: Downcast {
/// Sets per-node attributes from the `pbag`
///
/// Each node is supposed to iterate the `pbag`, and parse any attributes it needs.
- fn set_atts(&self, node: &RsvgNode, pbag: &PropertyBag<'_>) -> NodeResult;
+ fn set_atts(&self, parent: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> NodeResult;
/// Sets any special-cased properties that the node may have, that are different
/// from defaults in the node's `SpecifiedValues`.
diff --git a/rsvg_internals/src/pattern.rs b/rsvg_internals/src/pattern.rs
index 9f9aa2ee..076cd0bd 100644
--- a/rsvg_internals/src/pattern.rs
+++ b/rsvg_internals/src/pattern.rs
@@ -128,7 +128,7 @@ impl Default for NodePattern {
}
impl NodeTrait for NodePattern {
- fn set_atts(&self, _node: &RsvgNode, pbag: &PropertyBag<'_>) -> NodeResult {
+ fn set_atts(&self, _: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> NodeResult {
let mut p = self.pattern.borrow_mut();
for (attr, value) in pbag.iter() {
diff --git a/rsvg_internals/src/shapes.rs b/rsvg_internals/src/shapes.rs
index 1c3b894f..aacc9bfb 100644
--- a/rsvg_internals/src/shapes.rs
+++ b/rsvg_internals/src/shapes.rs
@@ -116,7 +116,7 @@ pub struct NodePath {
}
impl NodeTrait for NodePath {
- fn set_atts(&self, node: &RsvgNode, pbag: &PropertyBag<'_>) -> NodeResult {
+ fn set_atts(&self, _: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> NodeResult {
for (attr, value) in pbag.iter() {
if attr == local_name!("d") {
let mut builder = PathBuilder::new();
@@ -125,7 +125,7 @@ impl NodeTrait for NodePath {
// FIXME: we don't propagate errors upstream, but creating a partial
// path is OK per the spec
- rsvg_log!("could not parse path {}: {}", node, e);
+ rsvg_log!("could not parse path: {}", e);
}
*self.builder.borrow_mut() = Some(builder);
@@ -220,7 +220,7 @@ impl NodePoly {
}
impl NodeTrait for NodePoly {
- fn set_atts(&self, _: &RsvgNode, pbag: &PropertyBag<'_>) -> NodeResult {
+ fn set_atts(&self, _: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> NodeResult {
for (attr, value) in pbag.iter() {
if attr == local_name!("points") {
*self.points.borrow_mut() = attr.parse(value.trim()).map(Some)?;
@@ -270,7 +270,7 @@ pub struct NodeLine {
}
impl NodeTrait for NodeLine {
- fn set_atts(&self, _: &RsvgNode, pbag: &PropertyBag<'_>) -> NodeResult {
+ fn set_atts(&self, _: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> NodeResult {
for (attr, value) in pbag.iter() {
match attr {
local_name!("x1") => self.x1.set(attr.parse(value)?),
@@ -323,7 +323,7 @@ pub struct NodeRect {
}
impl NodeTrait for NodeRect {
- fn set_atts(&self, _: &RsvgNode, pbag: &PropertyBag<'_>) -> NodeResult {
+ fn set_atts(&self, _: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> NodeResult {
for (attr, value) in pbag.iter() {
match attr {
local_name!("x") => self.x.set(attr.parse(value)?),
@@ -538,7 +538,7 @@ pub struct NodeCircle {
}
impl NodeTrait for NodeCircle {
- fn set_atts(&self, _: &RsvgNode, pbag: &PropertyBag<'_>) -> NodeResult {
+ fn set_atts(&self, _: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> NodeResult {
for (attr, value) in pbag.iter() {
match attr {
local_name!("cx") => self.cx.set(attr.parse(value)?),
@@ -582,7 +582,7 @@ pub struct NodeEllipse {
}
impl NodeTrait for NodeEllipse {
- fn set_atts(&self, _: &RsvgNode, pbag: &PropertyBag<'_>) -> NodeResult {
+ fn set_atts(&self, _: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> NodeResult {
for (attr, value) in pbag.iter() {
match attr {
local_name!("cx") => self.cx.set(attr.parse(value)?),
diff --git a/rsvg_internals/src/structure.rs b/rsvg_internals/src/structure.rs
index 4e19068c..6f4eef03 100644
--- a/rsvg_internals/src/structure.rs
+++ b/rsvg_internals/src/structure.rs
@@ -24,7 +24,7 @@ use crate::viewbox::*;
pub struct NodeGroup();
impl NodeTrait for NodeGroup {
- fn set_atts(&self, _: &RsvgNode, _: &PropertyBag<'_>) -> NodeResult {
+ fn set_atts(&self, _: Option<&RsvgNode>, _: &PropertyBag<'_>) -> NodeResult {
Ok(())
}
@@ -51,7 +51,7 @@ impl NodeTrait for NodeGroup {
pub struct NodeNonRendering;
impl NodeTrait for NodeNonRendering {
- fn set_atts(&self, _: &RsvgNode, _: &PropertyBag<'_>) -> NodeResult {
+ fn set_atts(&self, _: Option<&RsvgNode>, _: &PropertyBag<'_>) -> NodeResult {
Ok(())
}
}
@@ -60,7 +60,7 @@ impl NodeTrait for NodeNonRendering {
pub struct NodeSwitch();
impl NodeTrait for NodeSwitch {
- fn set_atts(&self, _: &RsvgNode, _: &PropertyBag<'_>) -> NodeResult {
+ fn set_atts(&self, _: Option<&RsvgNode>, _: &PropertyBag<'_>) -> NodeResult {
Ok(())
}
@@ -182,10 +182,10 @@ impl NodeSvg {
}
impl NodeTrait for NodeSvg {
- fn set_atts(&self, node: &RsvgNode, pbag: &PropertyBag<'_>) -> NodeResult {
+ fn set_atts(&self, parent: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> NodeResult {
// x & y attributes have no effect on outermost svg
// http://www.w3.org/TR/SVG/struct.html#SVGElement
- let is_inner_svg = node.parent().is_some();
+ let is_inner_svg = parent.is_some();
for (attr, value) in pbag.iter() {
match attr {
@@ -294,7 +294,7 @@ pub struct NodeUse {
}
impl NodeTrait for NodeUse {
- fn set_atts(&self, _: &RsvgNode, pbag: &PropertyBag<'_>) -> NodeResult {
+ fn set_atts(&self, _: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> NodeResult {
for (attr, value) in pbag.iter() {
match attr {
local_name!("xlink:href") => {
@@ -430,7 +430,7 @@ pub struct NodeSymbol {
}
impl NodeTrait for NodeSymbol {
- fn set_atts(&self, _node: &RsvgNode, pbag: &PropertyBag<'_>) -> NodeResult {
+ fn set_atts(&self, _parent: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> NodeResult {
for (attr, value) in pbag.iter() {
match attr {
local_name!("preserveAspectRatio") => {
diff --git a/rsvg_internals/src/style.rs b/rsvg_internals/src/style.rs
index 4e4bd362..0df4fa4c 100644
--- a/rsvg_internals/src/style.rs
+++ b/rsvg_internals/src/style.rs
@@ -51,7 +51,7 @@ impl NodeStyle {
}
impl NodeTrait for NodeStyle {
- fn set_atts(&self, _: &RsvgNode, pbag: &PropertyBag<'_>) -> NodeResult {
+ fn set_atts(&self, _: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> NodeResult {
for (attr, value) in pbag.iter() {
if attr == local_name!("type") {
*self.type_.borrow_mut() = Some(value.to_string());
diff --git a/rsvg_internals/src/text.rs b/rsvg_internals/src/text.rs
index 6592c71d..c56c4991 100644
--- a/rsvg_internals/src/text.rs
+++ b/rsvg_internals/src/text.rs
@@ -555,7 +555,7 @@ impl NodeChars {
}
impl NodeTrait for NodeChars {
- fn set_atts(&self, _: &RsvgNode, _: &PropertyBag<'_>) -> NodeResult {
+ fn set_atts(&self, _: Option<&RsvgNode>, _: &PropertyBag<'_>) -> NodeResult {
Ok(())
}
}
@@ -590,7 +590,7 @@ impl NodeText {
}
impl NodeTrait for NodeText {
- fn set_atts(&self, _: &RsvgNode, pbag: &PropertyBag<'_>) -> NodeResult {
+ fn set_atts(&self, _: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> NodeResult {
for (attr, value) in pbag.iter() {
match attr {
local_name!("x") => self.x.set(attr.parse(value)?),
@@ -708,7 +708,7 @@ fn extract_chars_children_to_chunks_recursively(
}
impl NodeTrait for NodeTRef {
- fn set_atts(&self, _: &RsvgNode, pbag: &PropertyBag<'_>) -> NodeResult {
+ fn set_atts(&self, _: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> NodeResult {
for (attr, value) in pbag.iter() {
match attr {
local_name!("xlink:href") => {
@@ -755,7 +755,7 @@ impl NodeTSpan {
}
impl NodeTrait for NodeTSpan {
- fn set_atts(&self, _: &RsvgNode, pbag: &PropertyBag<'_>) -> NodeResult {
+ fn set_atts(&self, _: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> NodeResult {
for (attr, value) in pbag.iter() {
match attr {
local_name!("x") => self.x.set(attr.parse(value).map(Some)?),
diff --git a/rsvg_internals/src/xml.rs b/rsvg_internals/src/xml.rs
index 683891bd..0d47e39a 100644
--- a/rsvg_internals/src/xml.rs
+++ b/rsvg_internals/src/xml.rs
@@ -330,7 +330,7 @@ impl XmlState {
new_node
.borrow()
- .set_atts(&new_node, pbag, self.load_options.locale());
+ .set_atts(parent, pbag, self.load_options.locale());
new_node
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]