[librsvg] node: rename RsvgNode to simply Node
- From: Paolo Borelli <pborelli src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg] node: rename RsvgNode to simply Node
- Date: Tue, 17 Mar 2020 08:54:05 +0000 (UTC)
commit c0ffa653ac421244e968c284327507bf155aba44
Author: Paolo Borelli <pborelli gnome org>
Date: Tue Mar 17 09:03:40 2020 +0100
node: rename RsvgNode to simply Node
Now that we have proper namespacing everywhere, we can drop our
manual prefix.
rsvg_internals/src/css.rs | 16 ++++----
rsvg_internals/src/document.rs | 48 ++++++++++++------------
rsvg_internals/src/drawing_ctx.rs | 26 ++++++-------
rsvg_internals/src/element.rs | 2 +-
rsvg_internals/src/error.rs | 4 +-
rsvg_internals/src/filter.rs | 4 +-
rsvg_internals/src/filters/blend.rs | 6 +--
rsvg_internals/src/filters/color_matrix.rs | 6 +--
rsvg_internals/src/filters/component_transfer.rs | 14 +++----
rsvg_internals/src/filters/composite.rs | 6 +--
rsvg_internals/src/filters/context.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 | 6 +--
rsvg_internals/src/filters/light/light_source.rs | 8 ++--
rsvg_internals/src/filters/light/lighting.rs | 12 +++---
rsvg_internals/src/filters/merge.rs | 8 ++--
rsvg_internals/src/filters/mod.rs | 10 ++---
rsvg_internals/src/filters/morphology.rs | 6 +--
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 | 20 +++++-----
rsvg_internals/src/handle.rs | 10 ++---
rsvg_internals/src/image.rs | 6 +--
rsvg_internals/src/lib.rs | 8 ++--
rsvg_internals/src/marker.rs | 6 +--
rsvg_internals/src/node.rs | 22 +++++------
rsvg_internals/src/paint_server.rs | 6 +--
rsvg_internals/src/pattern.rs | 20 +++++-----
rsvg_internals/src/shapes.rs | 32 ++++++++--------
rsvg_internals/src/structure.rs | 30 +++++++--------
rsvg_internals/src/style.rs | 4 +-
rsvg_internals/src/text.rs | 26 ++++++-------
rsvg_internals/src/xml.rs | 4 +-
37 files changed, 210 insertions(+), 214 deletions(-)
---
diff --git a/rsvg_internals/src/css.rs b/rsvg_internals/src/css.rs
index e8580e43..130e5806 100644
--- a/rsvg_internals/src/css.rs
+++ b/rsvg_internals/src/css.rs
@@ -93,7 +93,7 @@ use crate::allowed_url::AllowedUrl;
use crate::element::ElementType;
use crate::error::*;
use crate::io::{self, BinaryData};
-use crate::node::{NodeBorrow, NodeCascade, RsvgNode};
+use crate::node::{Node, NodeBorrow, NodeCascade};
use crate::properties::{parse_property, ComputedValues, ParsedProperty};
/// A parsed CSS declaration
@@ -364,17 +364,17 @@ impl SelectorImpl for Selector {
type PseudoElement = PseudoElement;
}
-/// Wraps an `RsvgNode` with a locally-defined type, so we can implement
+/// Wraps an `Node` with a locally-defined type, so we can implement
/// a foreign trait on it.
///
-/// RsvgNode is an alias for rctree::Node, so we can't implement
+/// `Node` is an alias for `rctree::Node`, so we can't implement
/// `selectors::Element` directly on it. We implement it on the
/// `RsvgElement` wrapper instead.
#[derive(Clone, PartialEq)]
-pub struct RsvgElement(RsvgNode);
+pub struct RsvgElement(Node);
-impl From<RsvgNode> for RsvgElement {
- fn from(n: RsvgNode) -> RsvgElement {
+impl From<Node> for RsvgElement {
+ fn from(n: Node) -> RsvgElement {
RsvgElement(n)
}
}
@@ -706,7 +706,7 @@ impl Stylesheet {
/// Appends the style declarations that match a specified node to a given vector
fn get_matches<'a>(
&'a self,
- node: &RsvgNode,
+ node: &Node,
match_ctx: &mut MatchingContext<Selector>,
acc: &mut Vec<Match<'a>>,
) {
@@ -735,7 +735,7 @@ impl Stylesheet {
}
/// Runs the CSS cascade on the specified tree from all the stylesheets
-pub fn cascade(root: &mut RsvgNode, stylesheets: &[Stylesheet], extra: &[Stylesheet]) {
+pub fn cascade(root: &mut Node, stylesheets: &[Stylesheet], extra: &[Stylesheet]) {
for mut node in root.descendants().filter(|n| n.is_element()) {
let mut matches = Vec::new();
diff --git a/rsvg_internals/src/document.rs b/rsvg_internals/src/document.rs
index 18210469..a5d67d76 100644
--- a/rsvg_internals/src/document.rs
+++ b/rsvg_internals/src/document.rs
@@ -14,7 +14,7 @@ use crate::error::{AcquireError, LoadingError};
use crate::handle::LoadOptions;
use crate::io::{self, BinaryData};
use crate::limits;
-use crate::node::{NodeBorrow, NodeData, RsvgNode};
+use crate::node::{Node, NodeBorrow, NodeData};
use crate::property_bag::PropertyBag;
use crate::structure::{IntrinsicDimensions, Svg};
use crate::surface_utils::shared_surface::SharedImageSurface;
@@ -23,10 +23,10 @@ use crate::xml::xml_load_from_possibly_compressed_stream;
/// A loaded SVG file and its derived data.
pub struct Document {
/// Tree of nodes; the root is guaranteed to be an `<svg>` element.
- tree: RsvgNode,
+ tree: Node,
/// Mapping from `id` attributes to nodes.
- ids: HashMap<String, RsvgNode>,
+ ids: HashMap<String, Node>,
// The following two require interior mutability because we load the extern
// resources all over the place. Eventually we'll be able to do this
@@ -60,7 +60,7 @@ impl Document {
}
/// Gets the root node. This is guaranteed to be an `<svg>` element.
- pub fn root(&self) -> RsvgNode {
+ pub fn root(&self) -> Node {
self.tree.clone()
}
@@ -68,7 +68,7 @@ impl Document {
///
/// This is also used to find elements in referenced resources, as in
/// `xlink:href="subresource.svg#element_name".
- pub fn lookup(&self, fragment: &Fragment) -> Result<RsvgNode, LoadingError> {
+ pub fn lookup(&self, fragment: &Fragment) -> Result<Node, LoadingError> {
if fragment.uri().is_some() {
self.externs
.borrow_mut()
@@ -80,7 +80,7 @@ impl Document {
}
/// Looks up a node only in this document fragment by its `id` attribute.
- pub fn lookup_node_by_id(&self, id: &str) -> Option<RsvgNode> {
+ pub fn lookup_node_by_id(&self, id: &str) -> Option<Node> {
self.ids.get(id).map(|n| (*n).clone())
}
@@ -125,7 +125,7 @@ impl Resources {
&mut self,
load_options: &LoadOptions,
fragment: &Fragment,
- ) -> Result<RsvgNode, LoadingError> {
+ ) -> Result<Node, LoadingError> {
if let Some(ref href) = fragment.uri() {
self.get_extern_document(load_options, href)
.and_then(|doc| {
@@ -231,7 +231,7 @@ fn load_image(
pub struct AcquiredNode {
stack: Option<Rc<RefCell<NodeStack>>>,
- node: RsvgNode,
+ node: Node,
}
impl Drop for AcquiredNode {
@@ -245,7 +245,7 @@ impl Drop for AcquiredNode {
}
impl AcquiredNode {
- pub fn get(&self) -> &RsvgNode {
+ pub fn get(&self) -> &Node {
&self.node
}
}
@@ -278,7 +278,7 @@ impl<'i> AcquiredNodes<'i> {
&self,
fragment: &Fragment,
element_types: &[ElementType],
- ) -> Result<RsvgNode, AcquireError> {
+ ) -> Result<Node, AcquireError> {
let node = self.document.lookup(fragment).map_err(|_| {
// FIXME: callers shouldn't have to know that get_node() can initiate a file load.
// Maybe we should have the following stages:
@@ -338,7 +338,7 @@ impl<'i> AcquiredNodes<'i> {
}
}
- pub fn acquire_ref(&self, node: &RsvgNode) -> Result<AcquiredNode, AcquireError> {
+ pub fn acquire_ref(&self, node: &Node) -> Result<AcquiredNode, AcquireError> {
if self.node_stack.borrow().contains(&node) {
Err(AcquireError::CircularReference(node.clone()))
} else {
@@ -354,7 +354,7 @@ impl<'i> AcquiredNodes<'i> {
// Returns whether a node of a particular type is only accessed by reference
// from other nodes' atributes. The node could in turn cause other nodes
// to get referenced, potentially causing reference cycles.
-fn node_is_accessed_by_reference(node: &RsvgNode) -> bool {
+fn node_is_accessed_by_reference(node: &Node) -> bool {
use ElementType::*;
if !node.is_element() {
@@ -373,30 +373,30 @@ fn node_is_accessed_by_reference(node: &RsvgNode) -> bool {
/// Sometimes parts of the code cannot plainly use the implicit stack of acquired
/// nodes as maintained by DrawingCtx::acquire_node(), and they must keep their
/// own stack of nodes to test for reference cycles. NodeStack can be used to do that.
-pub struct NodeStack(Vec<RsvgNode>);
+pub struct NodeStack(Vec<Node>);
impl NodeStack {
pub fn new() -> NodeStack {
NodeStack(Vec::new())
}
- pub fn push(&mut self, node: &RsvgNode) {
+ pub fn push(&mut self, node: &Node) {
self.0.push(node.clone());
}
- pub fn pop(&mut self) -> Option<RsvgNode> {
+ pub fn pop(&mut self) -> Option<Node> {
self.0.pop()
}
- pub fn contains(&self, node: &RsvgNode) -> bool {
+ pub fn contains(&self, node: &Node) -> bool {
self.0.iter().find(|n| **n == *node).is_some()
}
}
pub struct DocumentBuilder {
load_options: LoadOptions,
- tree: Option<RsvgNode>,
- ids: HashMap<String, RsvgNode>,
+ tree: Option<Node>,
+ ids: HashMap<String, Node>,
stylesheets: Vec<Stylesheet>,
}
@@ -436,9 +436,9 @@ impl DocumentBuilder {
&mut self,
name: &QualName,
pbag: &PropertyBag,
- parent: Option<RsvgNode>,
- ) -> RsvgNode {
- let mut node = RsvgNode::new(NodeData::new_element(name, pbag));
+ parent: Option<Node>,
+ ) -> Node {
+ let mut node = Node::new(NodeData::new_element(name, pbag));
if let Some(id) = node.borrow_element().get_id() {
// This is so we don't overwrite an existing id
@@ -473,19 +473,19 @@ impl DocumentBuilder {
}
}
- pub fn append_characters(&mut self, text: &str, parent: &mut RsvgNode) {
+ pub fn append_characters(&mut self, text: &str, parent: &mut Node) {
if !text.is_empty() {
self.append_chars_to_parent(text, parent);
}
}
- fn append_chars_to_parent(&mut self, text: &str, parent: &mut RsvgNode) {
+ fn append_chars_to_parent(&mut self, text: &str, parent: &mut Node) {
// When the last child is a Chars node we can coalesce
// the text and avoid screwing up the Pango layouts
let chars_node = if let Some(child) = parent.last_child().filter(|c| c.is_chars()) {
child
} else {
- let child = RsvgNode::new(NodeData::new_chars());
+ let child = Node::new(NodeData::new_chars());
parent.append(child.clone());
child
};
diff --git a/rsvg_internals/src/drawing_ctx.rs b/rsvg_internals/src/drawing_ctx.rs
index 2620dbfd..965561ab 100644
--- a/rsvg_internals/src/drawing_ctx.rs
+++ b/rsvg_internals/src/drawing_ctx.rs
@@ -19,7 +19,7 @@ use crate::error::{AcquireError, RenderingError};
use crate::filters;
use crate::gradient::{LinearGradient, RadialGradient};
use crate::marker;
-use crate::node::{CascadedValues, NodeBorrow, NodeDraw, RsvgNode};
+use crate::node::{CascadedValues, Node, NodeBorrow, NodeDraw};
use crate::paint_server::{PaintServer, PaintSource};
use crate::path_builder::*;
use crate::pattern::Pattern;
@@ -96,7 +96,7 @@ pub struct DrawingCtx {
view_box_stack: Rc<RefCell<Vec<ViewBox>>>,
- drawsub_stack: Vec<RsvgNode>,
+ drawsub_stack: Vec<Node>,
measuring: bool,
testing: bool,
@@ -104,7 +104,7 @@ pub struct DrawingCtx {
impl DrawingCtx {
pub fn new(
- node: Option<&RsvgNode>,
+ node: Option<&Node>,
cr: &cairo::Context,
viewport: Rect,
dpi: Dpi,
@@ -314,7 +314,7 @@ impl DrawingCtx {
fn clip_to_node(
&mut self,
- clip_node: &Option<RsvgNode>,
+ clip_node: &Option<Node>,
acquired_nodes: &mut AcquiredNodes,
bbox: &BoundingBox,
) -> Result<(), RenderingError> {
@@ -367,7 +367,7 @@ impl DrawingCtx {
fn generate_cairo_mask(
&mut self,
mask: &Mask,
- mask_node: &RsvgNode,
+ mask_node: &Node,
transform: Transform,
bbox: &BoundingBox,
acquired_nodes: &mut AcquiredNodes,
@@ -459,7 +459,7 @@ impl DrawingCtx {
pub fn with_discrete_layer(
&mut self,
- node: &RsvgNode,
+ node: &Node,
acquired_nodes: &mut AcquiredNodes,
values: &ComputedValues,
clipping: bool,
@@ -736,7 +736,7 @@ impl DrawingCtx {
&mut self,
acquired_nodes: &mut AcquiredNodes,
filter_uri: &Fragment,
- node: &RsvgNode,
+ node: &Node,
values: &ComputedValues,
child_surface: SharedImageSurface,
node_bbox: BoundingBox,
@@ -971,7 +971,7 @@ impl DrawingCtx {
pub fn draw_path(
&mut self,
builder: &PathBuilder,
- node: &RsvgNode,
+ node: &Node,
acquired_nodes: &mut AcquiredNodes,
values: &ComputedValues,
markers: Markers,
@@ -1052,7 +1052,7 @@ impl DrawingCtx {
pub fn draw_node_to_surface(
&mut self,
- node: &RsvgNode,
+ node: &Node,
acquired_nodes: &mut AcquiredNodes,
cascaded: &CascadedValues<'_>,
affine: Transform,
@@ -1083,7 +1083,7 @@ impl DrawingCtx {
pub fn draw_node_from_stack(
&mut self,
- node: &RsvgNode,
+ node: &Node,
acquired_nodes: &mut AcquiredNodes,
cascaded: &CascadedValues<'_>,
clipping: bool,
@@ -1112,7 +1112,7 @@ impl DrawingCtx {
pub fn draw_from_use_node(
&mut self,
- node: &RsvgNode,
+ node: &Node,
acquired_nodes: &mut AcquiredNodes,
cascaded: &CascadedValues<'_>,
clipping: bool,
@@ -1265,11 +1265,11 @@ impl CompositingAffines {
}
}
-// Returns (clip_in_user_space, clip_in_object_space), both Option<RsvgNode>
+// Returns (clip_in_user_space, clip_in_object_space), both Option<Node>
fn get_clip_in_user_and_object_space(
acquired_nodes: &mut AcquiredNodes,
clip_uri: Option<&Fragment>,
-) -> (Option<RsvgNode>, Option<RsvgNode>) {
+) -> (Option<Node>, Option<Node>) {
clip_uri
.and_then(|fragment| {
acquired_nodes
diff --git a/rsvg_internals/src/element.rs b/rsvg_internals/src/element.rs
index bb43f40b..de11afee 100644
--- a/rsvg_internals/src/element.rs
+++ b/rsvg_internals/src/element.rs
@@ -198,7 +198,7 @@ impl Element {
self.specified_values.is_overflow()
}
- pub fn set_atts(&mut self, parent: Option<&RsvgNode>, pbag: &PropertyBag<'_>, locale: &Locale) {
+ pub fn set_atts(&mut self, parent: Option<&Node>, pbag: &PropertyBag<'_>, locale: &Locale) {
if self.node_impl.overflow_hidden() {
self.specified_values.overflow = SpecifiedValue::Specified(Overflow::Hidden);
}
diff --git a/rsvg_internals/src/error.rs b/rsvg_internals/src/error.rs
index 9339adba..786fe281 100644
--- a/rsvg_internals/src/error.rs
+++ b/rsvg_internals/src/error.rs
@@ -7,7 +7,7 @@ use cssparser::{BasicParseError, BasicParseErrorKind, ParseErrorKind, ToCss};
use markup5ever::QualName;
use crate::allowed_url::Fragment;
-use crate::node::RsvgNode;
+use crate::node::Node;
/// A short-lived error.
///
@@ -123,7 +123,7 @@ impl From<cairo::Status> for RenderingError {
pub enum AcquireError {
LinkNotFound(Fragment),
InvalidLinkType(Fragment),
- CircularReference(RsvgNode),
+ CircularReference(Node),
MaxReferencesExceeded,
}
diff --git a/rsvg_internals/src/filter.rs b/rsvg_internals/src/filter.rs
index b55a0f7f..52af7900 100644
--- a/rsvg_internals/src/filter.rs
+++ b/rsvg_internals/src/filter.rs
@@ -8,7 +8,7 @@ use crate::drawing_ctx::DrawingCtx;
use crate::element::ElementResult;
use crate::error::ValueErrorKind;
use crate::length::*;
-use crate::node::{NodeTrait, RsvgNode};
+use crate::node::{Node, NodeTrait};
use crate::parsers::{Parse, ParseValue};
use crate::properties::ComputedValues;
use crate::property_bag::PropertyBag;
@@ -112,7 +112,7 @@ impl Filter {
}
impl NodeTrait for Filter {
- fn set_atts(&mut self, _: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> ElementResult {
+ fn set_atts(&mut self, _: Option<&Node>, pbag: &PropertyBag<'_>) -> ElementResult {
// Parse filterUnits first as it affects x, y, width, height checks.
for (attr, value) in pbag.iter() {
match attr.expanded() {
diff --git a/rsvg_internals/src/filters/blend.rs b/rsvg_internals/src/filters/blend.rs
index 2d6dd16a..0107953c 100755
--- a/rsvg_internals/src/filters/blend.rs
+++ b/rsvg_internals/src/filters/blend.rs
@@ -5,7 +5,7 @@ use crate::document::AcquiredNodes;
use crate::drawing_ctx::DrawingCtx;
use crate::element::ElementResult;
use crate::error::*;
-use crate::node::{NodeTrait, RsvgNode};
+use crate::node::{Node, NodeTrait};
use crate::parsers::{Parse, ParseValue};
use crate::property_bag::PropertyBag;
@@ -56,7 +56,7 @@ impl Default for FeBlend {
impl NodeTrait for FeBlend {
impl_node_as_filter_effect!();
- fn set_atts(&mut self, parent: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> ElementResult {
+ fn set_atts(&mut self, parent: Option<&Node>, pbag: &PropertyBag<'_>) -> ElementResult {
self.base.set_atts(parent, pbag)?;
for (attr, value) in pbag.iter() {
@@ -76,7 +76,7 @@ impl NodeTrait for FeBlend {
impl FilterEffect for FeBlend {
fn render(
&self,
- _node: &RsvgNode,
+ _node: &Node,
ctx: &FilterContext,
acquired_nodes: &mut AcquiredNodes,
draw_ctx: &mut DrawingCtx,
diff --git a/rsvg_internals/src/filters/color_matrix.rs b/rsvg_internals/src/filters/color_matrix.rs
index e1e12416..e4c0547a 100644
--- a/rsvg_internals/src/filters/color_matrix.rs
+++ b/rsvg_internals/src/filters/color_matrix.rs
@@ -6,7 +6,7 @@ use crate::document::AcquiredNodes;
use crate::drawing_ctx::DrawingCtx;
use crate::element::ElementResult;
use crate::error::*;
-use crate::node::{NodeTrait, RsvgNode};
+use crate::node::{Node, NodeTrait};
use crate::number_list::{NumberList, NumberListLength};
use crate::parsers::{Parse, ParseValue};
use crate::property_bag::PropertyBag;
@@ -54,7 +54,7 @@ impl Default for FeColorMatrix {
impl NodeTrait for FeColorMatrix {
impl_node_as_filter_effect!();
- fn set_atts(&mut self, parent: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> ElementResult {
+ fn set_atts(&mut self, parent: Option<&Node>, pbag: &PropertyBag<'_>) -> ElementResult {
self.base.set_atts(parent, pbag)?;
// First, determine the operation type.
@@ -153,7 +153,7 @@ impl NodeTrait for FeColorMatrix {
impl FilterEffect for FeColorMatrix {
fn render(
&self,
- _node: &RsvgNode,
+ _node: &Node,
ctx: &FilterContext,
acquired_nodes: &mut AcquiredNodes,
draw_ctx: &mut DrawingCtx,
diff --git a/rsvg_internals/src/filters/component_transfer.rs
b/rsvg_internals/src/filters/component_transfer.rs
index 5fc339e4..78b5f10d 100644
--- a/rsvg_internals/src/filters/component_transfer.rs
+++ b/rsvg_internals/src/filters/component_transfer.rs
@@ -7,7 +7,7 @@ use crate::document::AcquiredNodes;
use crate::drawing_ctx::DrawingCtx;
use crate::element::{ElementResult, ElementType};
use crate::error::*;
-use crate::node::{NodeBorrow, NodeTrait, RsvgNode};
+use crate::node::{Node, NodeBorrow, NodeTrait};
use crate::number_list::{NumberList, NumberListLength};
use crate::parsers::{Parse, ParseValue};
use crate::property_bag::PropertyBag;
@@ -38,7 +38,7 @@ impl NodeTrait for FeComponentTransfer {
impl_node_as_filter_effect!();
#[inline]
- fn set_atts(&mut self, parent: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> ElementResult {
+ fn set_atts(&mut self, parent: Option<&Node>, pbag: &PropertyBag<'_>) -> ElementResult {
self.base.set_atts(parent, pbag)
}
}
@@ -203,7 +203,7 @@ macro_rules! func_x {
#[inline]
fn set_atts(
&mut self,
- _parent: Option<&RsvgNode>,
+ _parent: Option<&Node>,
pbag: &PropertyBag<'_>,
) -> ElementResult {
for (attr, value) in pbag.iter() {
@@ -269,7 +269,7 @@ macro_rules! func_or_default {
impl FilterEffect for FeComponentTransfer {
fn render(
&self,
- node: &RsvgNode,
+ node: &Node,
ctx: &FilterContext,
acquired_nodes: &mut AcquiredNodes,
draw_ctx: &mut DrawingCtx,
@@ -289,11 +289,7 @@ impl FilterEffect for FeComponentTransfer {
)?;
// Get a node for every pixel component.
- fn get_node<F>(
- node: &RsvgNode,
- element_type: ElementType,
- channel: Channel,
- ) -> Option<RsvgNode>
+ fn get_node<F>(node: &Node, element_type: ElementType, channel: Channel) -> Option<Node>
where
F: FeComponentTransferFunc + NodeTrait,
{
diff --git a/rsvg_internals/src/filters/composite.rs b/rsvg_internals/src/filters/composite.rs
index 2d6225d0..87cdf6d2 100644
--- a/rsvg_internals/src/filters/composite.rs
+++ b/rsvg_internals/src/filters/composite.rs
@@ -5,7 +5,7 @@ use crate::document::AcquiredNodes;
use crate::drawing_ctx::DrawingCtx;
use crate::element::ElementResult;
use crate::error::*;
-use crate::node::{NodeTrait, RsvgNode};
+use crate::node::{Node, NodeTrait};
use crate::parsers::{Parse, ParseValue};
use crate::property_bag::PropertyBag;
@@ -54,7 +54,7 @@ impl Default for FeComposite {
impl NodeTrait for FeComposite {
impl_node_as_filter_effect!();
- fn set_atts(&mut self, parent: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> ElementResult {
+ fn set_atts(&mut self, parent: Option<&Node>, pbag: &PropertyBag<'_>) -> ElementResult {
self.base.set_atts(parent, pbag)?;
for (attr, value) in pbag.iter() {
@@ -76,7 +76,7 @@ impl NodeTrait for FeComposite {
impl FilterEffect for FeComposite {
fn render(
&self,
- _node: &RsvgNode,
+ _node: &Node,
ctx: &FilterContext,
acquired_nodes: &mut AcquiredNodes,
draw_ctx: &mut DrawingCtx,
diff --git a/rsvg_internals/src/filters/context.rs b/rsvg_internals/src/filters/context.rs
index 5d2f748b..0d6abea1 100644
--- a/rsvg_internals/src/filters/context.rs
+++ b/rsvg_internals/src/filters/context.rs
@@ -7,7 +7,7 @@ use crate::coord_units::CoordUnits;
use crate::document::AcquiredNodes;
use crate::drawing_ctx::{DrawingCtx, ViewParams};
use crate::filter::Filter;
-use crate::node::{NodeBorrow, RsvgNode};
+use crate::node::{Node, NodeBorrow};
use crate::paint_server::PaintServer;
use crate::properties::ComputedValues;
use crate::rect::IRect;
@@ -52,7 +52,7 @@ pub enum FilterInput {
/// The filter rendering context.
pub struct FilterContext {
/// The <filter> node.
- node: RsvgNode,
+ node: Node,
/// Bounding box of node being filtered
node_bbox: BoundingBox,
/// Values from the node which referenced this filter.
@@ -99,7 +99,7 @@ pub struct FilterContext {
impl FilterContext {
/// Creates a new `FilterContext`.
pub fn new(
- filter_node: &RsvgNode,
+ filter_node: &Node,
computed_from_node_being_filtered: &ComputedValues,
source_surface: SharedImageSurface,
draw_ctx: &mut DrawingCtx,
diff --git a/rsvg_internals/src/filters/convolve_matrix.rs b/rsvg_internals/src/filters/convolve_matrix.rs
index abe0ebe7..0ffa9a90 100644
--- a/rsvg_internals/src/filters/convolve_matrix.rs
+++ b/rsvg_internals/src/filters/convolve_matrix.rs
@@ -6,7 +6,7 @@ use crate::document::AcquiredNodes;
use crate::drawing_ctx::DrawingCtx;
use crate::element::ElementResult;
use crate::error::*;
-use crate::node::{NodeTrait, RsvgNode};
+use crate::node::{Node, NodeTrait};
use crate::number_list::{NumberList, NumberListLength};
use crate::parsers::{NumberOptionalNumber, Parse, ParseValue};
use crate::property_bag::PropertyBag;
@@ -57,7 +57,7 @@ impl Default for FeConvolveMatrix {
impl NodeTrait for FeConvolveMatrix {
impl_node_as_filter_effect!();
- fn set_atts(&mut self, parent: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> ElementResult {
+ fn set_atts(&mut self, parent: Option<&Node>, pbag: &PropertyBag<'_>) -> ElementResult {
self.base.set_atts(parent, pbag)?;
for (attr, value) in pbag.iter() {
@@ -198,7 +198,7 @@ impl NodeTrait for FeConvolveMatrix {
impl FilterEffect for FeConvolveMatrix {
fn render(
&self,
- _node: &RsvgNode,
+ _node: &Node,
ctx: &FilterContext,
acquired_nodes: &mut AcquiredNodes,
draw_ctx: &mut DrawingCtx,
diff --git a/rsvg_internals/src/filters/displacement_map.rs b/rsvg_internals/src/filters/displacement_map.rs
index 7add536f..94dd57ff 100644
--- a/rsvg_internals/src/filters/displacement_map.rs
+++ b/rsvg_internals/src/filters/displacement_map.rs
@@ -5,7 +5,7 @@ use crate::document::AcquiredNodes;
use crate::drawing_ctx::DrawingCtx;
use crate::element::ElementResult;
use crate::error::*;
-use crate::node::{NodeTrait, RsvgNode};
+use crate::node::{Node, NodeTrait};
use crate::parsers::{Parse, ParseValue};
use crate::property_bag::PropertyBag;
use crate::surface_utils::{iterators::Pixels, shared_surface::ExclusiveImageSurface};
@@ -48,7 +48,7 @@ impl Default for FeDisplacementMap {
impl NodeTrait for FeDisplacementMap {
impl_node_as_filter_effect!();
- fn set_atts(&mut self, parent: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> ElementResult {
+ fn set_atts(&mut self, parent: Option<&Node>, pbag: &PropertyBag<'_>) -> ElementResult {
self.base.set_atts(parent, pbag)?;
for (attr, value) in pbag.iter() {
@@ -74,7 +74,7 @@ impl NodeTrait for FeDisplacementMap {
impl FilterEffect for FeDisplacementMap {
fn render(
&self,
- _node: &RsvgNode,
+ _node: &Node,
ctx: &FilterContext,
acquired_nodes: &mut AcquiredNodes,
draw_ctx: &mut DrawingCtx,
diff --git a/rsvg_internals/src/filters/flood.rs b/rsvg_internals/src/filters/flood.rs
index 34253602..c5922fb6 100644
--- a/rsvg_internals/src/filters/flood.rs
+++ b/rsvg_internals/src/filters/flood.rs
@@ -1,7 +1,7 @@
use crate::document::AcquiredNodes;
use crate::drawing_ctx::DrawingCtx;
use crate::element::ElementResult;
-use crate::node::{CascadedValues, NodeTrait, RsvgNode};
+use crate::node::{CascadedValues, Node, NodeTrait};
use crate::property_bag::PropertyBag;
use super::context::{FilterContext, FilterOutput, FilterResult};
@@ -26,7 +26,7 @@ impl NodeTrait for FeFlood {
impl_node_as_filter_effect!();
#[inline]
- fn set_atts(&mut self, parent: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> ElementResult {
+ fn set_atts(&mut self, parent: Option<&Node>, pbag: &PropertyBag<'_>) -> ElementResult {
self.base.set_atts(parent, pbag)
}
}
@@ -34,7 +34,7 @@ impl NodeTrait for FeFlood {
impl FilterEffect for FeFlood {
fn render(
&self,
- node: &RsvgNode,
+ node: &Node,
ctx: &FilterContext,
_acquired_nodes: &mut AcquiredNodes,
draw_ctx: &mut DrawingCtx,
diff --git a/rsvg_internals/src/filters/gaussian_blur.rs b/rsvg_internals/src/filters/gaussian_blur.rs
index 201dfccf..62520f17 100644
--- a/rsvg_internals/src/filters/gaussian_blur.rs
+++ b/rsvg_internals/src/filters/gaussian_blur.rs
@@ -8,7 +8,7 @@ use crate::document::AcquiredNodes;
use crate::drawing_ctx::DrawingCtx;
use crate::element::ElementResult;
use crate::error::*;
-use crate::node::{NodeTrait, RsvgNode};
+use crate::node::{Node, NodeTrait};
use crate::parsers::{NumberOptionalNumber, ParseValue};
use crate::property_bag::PropertyBag;
use crate::rect::IRect;
@@ -45,7 +45,7 @@ impl Default for FeGaussianBlur {
impl NodeTrait for FeGaussianBlur {
impl_node_as_filter_effect!();
- fn set_atts(&mut self, parent: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> ElementResult {
+ fn set_atts(&mut self, parent: Option<&Node>, pbag: &PropertyBag<'_>) -> ElementResult {
self.base.set_atts(parent, pbag)?;
for (attr, value) in pbag.iter() {
@@ -202,7 +202,7 @@ fn gaussian_blur(
impl FilterEffect for FeGaussianBlur {
fn render(
&self,
- _node: &RsvgNode,
+ _node: &Node,
ctx: &FilterContext,
acquired_nodes: &mut AcquiredNodes,
draw_ctx: &mut DrawingCtx,
diff --git a/rsvg_internals/src/filters/image.rs b/rsvg_internals/src/filters/image.rs
index f53aa7b3..927cdcb3 100644
--- a/rsvg_internals/src/filters/image.rs
+++ b/rsvg_internals/src/filters/image.rs
@@ -6,7 +6,7 @@ use crate::document::AcquiredNodes;
use crate::drawing_ctx::DrawingCtx;
use crate::element::ElementResult;
use crate::error::*;
-use crate::node::{CascadedValues, NodeTrait, RsvgNode};
+use crate::node::{CascadedValues, Node, NodeTrait};
use crate::parsers::ParseValue;
use crate::property_bag::PropertyBag;
use crate::rect::Rect;
@@ -113,7 +113,7 @@ impl FeImage {
impl NodeTrait for FeImage {
impl_node_as_filter_effect!();
- fn set_atts(&mut self, parent: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> ElementResult {
+ fn set_atts(&mut self, parent: Option<&Node>, pbag: &PropertyBag<'_>) -> ElementResult {
self.base.set_atts(parent, pbag)?;
for (attr, value) in pbag.iter() {
@@ -140,7 +140,7 @@ impl NodeTrait for FeImage {
impl FilterEffect for FeImage {
fn render(
&self,
- _node: &RsvgNode,
+ _node: &Node,
ctx: &FilterContext,
acquired_nodes: &mut AcquiredNodes,
draw_ctx: &mut DrawingCtx,
diff --git a/rsvg_internals/src/filters/light/light_source.rs
b/rsvg_internals/src/filters/light/light_source.rs
index 61dc1f37..c0b18738 100644
--- a/rsvg_internals/src/filters/light/light_source.rs
+++ b/rsvg_internals/src/filters/light/light_source.rs
@@ -4,7 +4,7 @@ use nalgebra::Vector3;
use crate::element::ElementResult;
use crate::filters::context::FilterContext;
-use crate::node::{NodeTrait, RsvgNode};
+use crate::node::{Node, NodeTrait};
use crate::parsers::ParseValue;
use crate::property_bag::PropertyBag;
use crate::util::clamp;
@@ -104,7 +104,7 @@ impl FeDistantLight {
}
impl NodeTrait for FeDistantLight {
- fn set_atts(&mut self, _: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> ElementResult {
+ fn set_atts(&mut self, _: Option<&Node>, pbag: &PropertyBag<'_>) -> ElementResult {
for (attr, value) in pbag.iter() {
match attr.expanded() {
expanded_name!("", "azimuth") => self.azimuth = attr.parse(value)?,
@@ -136,7 +136,7 @@ impl FePointLight {
}
impl NodeTrait for FePointLight {
- fn set_atts(&mut self, _: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> ElementResult {
+ fn set_atts(&mut self, _: Option<&Node>, pbag: &PropertyBag<'_>) -> ElementResult {
for (attr, value) in pbag.iter() {
match attr.expanded() {
expanded_name!("", "x") => self.x = attr.parse(value)?,
@@ -185,7 +185,7 @@ impl FeSpotLight {
}
impl NodeTrait for FeSpotLight {
- fn set_atts(&mut self, _: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> ElementResult {
+ fn set_atts(&mut self, _: Option<&Node>, pbag: &PropertyBag<'_>) -> ElementResult {
for (attr, value) in pbag.iter() {
match attr.expanded() {
expanded_name!("", "x") => self.x = attr.parse(value)?,
diff --git a/rsvg_internals/src/filters/light/lighting.rs b/rsvg_internals/src/filters/light/lighting.rs
index 283029fb..2541d4f4 100644
--- a/rsvg_internals/src/filters/light/lighting.rs
+++ b/rsvg_internals/src/filters/light/lighting.rs
@@ -19,7 +19,7 @@ use crate::filters::{
},
FilterEffect, FilterError, PrimitiveWithInput,
};
-use crate::node::{CascadedValues, NodeBorrow, NodeTrait, RsvgNode};
+use crate::node::{CascadedValues, Node, NodeBorrow, NodeTrait};
use crate::parsers::{NumberOptionalNumber, ParseValue};
use crate::property_bag::PropertyBag;
use crate::surface_utils::{
@@ -49,7 +49,7 @@ impl Common {
}
}
- fn set_atts(&mut self, parent: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> ElementResult {
+ fn set_atts(&mut self, parent: Option<&Node>, pbag: &PropertyBag<'_>) -> ElementResult {
self.base.set_atts(parent, pbag)?;
for (attr, value) in pbag.iter() {
@@ -96,7 +96,7 @@ impl Default for FeDiffuseLighting {
impl NodeTrait for FeDiffuseLighting {
impl_node_as_filter_effect!();
- fn set_atts(&mut self, parent: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> ElementResult {
+ fn set_atts(&mut self, parent: Option<&Node>, pbag: &PropertyBag<'_>) -> ElementResult {
self.common.set_atts(parent, pbag)?;
for (attr, value) in pbag.iter() {
@@ -165,7 +165,7 @@ impl Default for FeSpecularLighting {
impl NodeTrait for FeSpecularLighting {
impl_node_as_filter_effect!();
- fn set_atts(&mut self, parent: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> ElementResult {
+ fn set_atts(&mut self, parent: Option<&Node>, pbag: &PropertyBag<'_>) -> ElementResult {
self.common.set_atts(parent, pbag)?;
for (attr, value) in pbag.iter() {
@@ -249,7 +249,7 @@ macro_rules! impl_lighting_filter {
impl FilterEffect for $lighting_type {
fn render(
&self,
- node: &RsvgNode,
+ node: &Node,
ctx: &FilterContext,
acquired_nodes: &mut AcquiredNodes,
draw_ctx: &mut DrawingCtx,
@@ -490,7 +490,7 @@ fn specular_alpha(r: u8, g: u8, b: u8) -> u8 {
impl_lighting_filter!(FeDiffuseLighting, diffuse_alpha);
impl_lighting_filter!(FeSpecularLighting, specular_alpha);
-fn find_light_source(node: &RsvgNode, ctx: &FilterContext) -> Result<LightSource, FilterError> {
+fn find_light_source(node: &Node, ctx: &FilterContext) -> Result<LightSource, FilterError> {
let mut light_sources = node.children().rev().filter(|c| {
c.is_element()
&& match c.borrow_element().get_type() {
diff --git a/rsvg_internals/src/filters/merge.rs b/rsvg_internals/src/filters/merge.rs
index 4c7cb34b..2970b24b 100644
--- a/rsvg_internals/src/filters/merge.rs
+++ b/rsvg_internals/src/filters/merge.rs
@@ -3,7 +3,7 @@ use markup5ever::{expanded_name, local_name, namespace_url, ns};
use crate::document::AcquiredNodes;
use crate::drawing_ctx::DrawingCtx;
use crate::element::{ElementResult, ElementType};
-use crate::node::{NodeBorrow, NodeTrait, RsvgNode};
+use crate::node::{Node, NodeBorrow, NodeTrait};
use crate::parsers::ParseValue;
use crate::property_bag::PropertyBag;
use crate::rect::IRect;
@@ -38,14 +38,14 @@ impl NodeTrait for FeMerge {
impl_node_as_filter_effect!();
#[inline]
- fn set_atts(&mut self, parent: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> ElementResult {
+ fn set_atts(&mut self, parent: Option<&Node>, pbag: &PropertyBag<'_>) -> ElementResult {
self.base.set_atts(parent, pbag)
}
}
impl NodeTrait for FeMergeNode {
#[inline]
- fn set_atts(&mut self, _parent: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> ElementResult {
+ fn set_atts(&mut self, _parent: Option<&Node>, pbag: &PropertyBag<'_>) -> ElementResult {
for (attr, value) in pbag.iter() {
match attr.expanded() {
expanded_name!("", "in") => self.in_ = Some(attr.parse(value)?),
@@ -82,7 +82,7 @@ impl FeMergeNode {
impl FilterEffect for FeMerge {
fn render(
&self,
- node: &RsvgNode,
+ node: &Node,
ctx: &FilterContext,
acquired_nodes: &mut AcquiredNodes,
draw_ctx: &mut DrawingCtx,
diff --git a/rsvg_internals/src/filters/mod.rs b/rsvg_internals/src/filters/mod.rs
index ca5e8f37..45046e65 100644
--- a/rsvg_internals/src/filters/mod.rs
+++ b/rsvg_internals/src/filters/mod.rs
@@ -13,7 +13,7 @@ use crate::element::{ElementResult, ElementType};
use crate::error::{RenderingError, ValueErrorKind};
use crate::filter::Filter;
use crate::length::*;
-use crate::node::{CascadedValues, NodeBorrow, NodeTrait, RsvgNode};
+use crate::node::{CascadedValues, Node, NodeBorrow, NodeTrait};
use crate::parsers::ParseValue;
use crate::properties::ComputedValues;
use crate::property_bag::PropertyBag;
@@ -40,7 +40,7 @@ pub trait FilterEffect: NodeTrait {
/// property hasn't been provided), an error is returned.
fn render(
&self,
- node: &RsvgNode,
+ node: &Node,
ctx: &FilterContext,
acquired_nodes: &mut AcquiredNodes,
draw_ctx: &mut DrawingCtx,
@@ -114,7 +114,7 @@ impl Primitive {
}
impl NodeTrait for Primitive {
- fn set_atts(&mut self, parent: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> ElementResult {
+ fn set_atts(&mut self, parent: Option<&Node>, pbag: &PropertyBag<'_>) -> ElementResult {
// With ObjectBoundingBox, only fractions and percents are allowed.
let primitiveunits = parent
.and_then(|parent| {
@@ -219,7 +219,7 @@ impl PrimitiveWithInput {
}
impl NodeTrait for PrimitiveWithInput {
- fn set_atts(&mut self, parent: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> ElementResult {
+ fn set_atts(&mut self, parent: Option<&Node>, pbag: &PropertyBag<'_>) -> ElementResult {
self.base.set_atts(parent, pbag)?;
for (attr, value) in pbag.iter() {
@@ -244,7 +244,7 @@ impl Deref for PrimitiveWithInput {
/// Applies a filter and returns the resulting surface.
pub fn render(
- filter_node: &RsvgNode,
+ filter_node: &Node,
computed_from_node_being_filtered: &ComputedValues,
source_surface: SharedImageSurface,
acquired_nodes: &mut AcquiredNodes,
diff --git a/rsvg_internals/src/filters/morphology.rs b/rsvg_internals/src/filters/morphology.rs
index b229730c..3c636ed1 100644
--- a/rsvg_internals/src/filters/morphology.rs
+++ b/rsvg_internals/src/filters/morphology.rs
@@ -7,7 +7,7 @@ use crate::document::AcquiredNodes;
use crate::drawing_ctx::DrawingCtx;
use crate::element::ElementResult;
use crate::error::*;
-use crate::node::{NodeTrait, RsvgNode};
+use crate::node::{Node, NodeTrait};
use crate::parsers::{NumberOptionalNumber, Parse, ParseValue};
use crate::property_bag::PropertyBag;
use crate::rect::IRect;
@@ -48,7 +48,7 @@ impl Default for FeMorphology {
impl NodeTrait for FeMorphology {
impl_node_as_filter_effect!();
- fn set_atts(&mut self, parent: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> ElementResult {
+ fn set_atts(&mut self, parent: Option<&Node>, pbag: &PropertyBag<'_>) -> ElementResult {
self.base.set_atts(parent, pbag)?;
for (attr, value) in pbag.iter() {
@@ -77,7 +77,7 @@ impl NodeTrait for FeMorphology {
impl FilterEffect for FeMorphology {
fn render(
&self,
- _node: &RsvgNode,
+ _node: &Node,
ctx: &FilterContext,
acquired_nodes: &mut AcquiredNodes,
draw_ctx: &mut DrawingCtx,
diff --git a/rsvg_internals/src/filters/offset.rs b/rsvg_internals/src/filters/offset.rs
index 0ff30d7c..4e2c0c26 100644
--- a/rsvg_internals/src/filters/offset.rs
+++ b/rsvg_internals/src/filters/offset.rs
@@ -3,7 +3,7 @@ use markup5ever::{expanded_name, local_name, namespace_url, ns};
use crate::document::AcquiredNodes;
use crate::drawing_ctx::DrawingCtx;
use crate::element::ElementResult;
-use crate::node::{NodeTrait, RsvgNode};
+use crate::node::{Node, NodeTrait};
use crate::parsers::ParseValue;
use crate::property_bag::PropertyBag;
@@ -32,7 +32,7 @@ impl Default for FeOffset {
impl NodeTrait for FeOffset {
impl_node_as_filter_effect!();
- fn set_atts(&mut self, parent: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> ElementResult {
+ fn set_atts(&mut self, parent: Option<&Node>, pbag: &PropertyBag<'_>) -> ElementResult {
self.base.set_atts(parent, pbag)?;
for (attr, value) in pbag.iter() {
@@ -50,7 +50,7 @@ impl NodeTrait for FeOffset {
impl FilterEffect for FeOffset {
fn render(
&self,
- _node: &RsvgNode,
+ _node: &Node,
ctx: &FilterContext,
acquired_nodes: &mut AcquiredNodes,
draw_ctx: &mut DrawingCtx,
diff --git a/rsvg_internals/src/filters/tile.rs b/rsvg_internals/src/filters/tile.rs
index 1670e28e..c08af56d 100644
--- a/rsvg_internals/src/filters/tile.rs
+++ b/rsvg_internals/src/filters/tile.rs
@@ -1,7 +1,7 @@
use crate::document::AcquiredNodes;
use crate::drawing_ctx::DrawingCtx;
use crate::element::ElementResult;
-use crate::node::{NodeTrait, RsvgNode};
+use crate::node::{Node, NodeTrait};
use crate::property_bag::PropertyBag;
use super::context::{FilterContext, FilterInput, FilterOutput, FilterResult};
@@ -25,7 +25,7 @@ impl Default for FeTile {
impl NodeTrait for FeTile {
impl_node_as_filter_effect!();
- fn set_atts(&mut self, parent: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> ElementResult {
+ fn set_atts(&mut self, parent: Option<&Node>, pbag: &PropertyBag<'_>) -> ElementResult {
self.base.set_atts(parent, pbag)
}
}
@@ -33,7 +33,7 @@ impl NodeTrait for FeTile {
impl FilterEffect for FeTile {
fn render(
&self,
- _node: &RsvgNode,
+ _node: &Node,
ctx: &FilterContext,
acquired_nodes: &mut AcquiredNodes,
draw_ctx: &mut DrawingCtx,
diff --git a/rsvg_internals/src/filters/turbulence.rs b/rsvg_internals/src/filters/turbulence.rs
index 2d359ebe..839d02d2 100644
--- a/rsvg_internals/src/filters/turbulence.rs
+++ b/rsvg_internals/src/filters/turbulence.rs
@@ -5,7 +5,7 @@ use crate::document::AcquiredNodes;
use crate::drawing_ctx::DrawingCtx;
use crate::element::ElementResult;
use crate::error::*;
-use crate::node::{CascadedValues, NodeTrait, RsvgNode};
+use crate::node::{CascadedValues, Node, NodeTrait};
use crate::parsers::{NumberOptionalNumber, Parse, ParseValue};
use crate::property_bag::PropertyBag;
use crate::surface_utils::{
@@ -60,7 +60,7 @@ impl NodeTrait for FeTurbulence {
impl_node_as_filter_effect!();
#[inline]
- fn set_atts(&mut self, parent: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> ElementResult {
+ fn set_atts(&mut self, parent: Option<&Node>, pbag: &PropertyBag<'_>) -> ElementResult {
self.base.set_atts(parent, pbag)?;
for (attr, value) in pbag.iter() {
@@ -335,7 +335,7 @@ impl NoiseGenerator {
impl FilterEffect for FeTurbulence {
fn render(
&self,
- node: &RsvgNode,
+ node: &Node,
ctx: &FilterContext,
_acquired_nodes: &mut AcquiredNodes,
draw_ctx: &mut DrawingCtx,
diff --git a/rsvg_internals/src/gradient.rs b/rsvg_internals/src/gradient.rs
index 2d085948..11658fb1 100644
--- a/rsvg_internals/src/gradient.rs
+++ b/rsvg_internals/src/gradient.rs
@@ -12,7 +12,7 @@ use crate::drawing_ctx::{DrawingCtx, ViewParams};
use crate::element::{ElementResult, ElementType};
use crate::error::*;
use crate::length::*;
-use crate::node::{CascadedValues, NodeBorrow, NodeTrait, RsvgNode};
+use crate::node::{CascadedValues, Node, NodeBorrow, NodeTrait};
use crate::paint_server::{AsPaintSource, PaintSource};
use crate::parsers::{Parse, ParseValue};
use crate::properties::ComputedValues;
@@ -130,7 +130,7 @@ fn validate_offset(length: Length<Both>) -> Result<Length<Both>, ValueErrorKind>
}
impl NodeTrait for Stop {
- fn set_atts(&mut self, _: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> ElementResult {
+ fn set_atts(&mut self, _: Option<&Node>, pbag: &PropertyBag<'_>) -> ElementResult {
for (attr, value) in pbag.iter() {
match attr.expanded() {
expanded_name!("", "offset") => {
@@ -444,7 +444,7 @@ impl UnresolvedGradient {
/// Looks for <stop> children inside a linearGradient or radialGradient node,
/// and adds their info to the UnresolvedGradient &self.
- fn add_color_stops_from_node(&mut self, node: &RsvgNode) {
+ fn add_color_stops_from_node(&mut self, node: &Node) {
let element_type = node.borrow_element().get_type();
assert!(
@@ -553,7 +553,7 @@ impl RadialGradient {
macro_rules! impl_get_unresolved {
($gradient:ty) => {
impl $gradient {
- fn get_unresolved(&self, node: &RsvgNode) -> Unresolved {
+ fn get_unresolved(&self, node: &Node) -> Unresolved {
let mut gradient = UnresolvedGradient {
units: self.common.units,
transform: self.common.transform,
@@ -596,7 +596,7 @@ impl Common {
}
impl NodeTrait for LinearGradient {
- fn set_atts(&mut self, _: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> ElementResult {
+ fn set_atts(&mut self, _: Option<&Node>, pbag: &PropertyBag<'_>) -> ElementResult {
self.common.set_atts(pbag)?;
for (attr, value) in pbag.iter() {
@@ -615,7 +615,7 @@ impl NodeTrait for LinearGradient {
}
impl NodeTrait for RadialGradient {
- fn set_atts(&mut self, _: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> ElementResult {
+ fn set_atts(&mut self, _: Option<&Node>, pbag: &PropertyBag<'_>) -> ElementResult {
self.common.set_atts(pbag)?;
for (attr, value) in pbag.iter() {
@@ -641,7 +641,7 @@ macro_rules! impl_paint_source {
fn resolve(
&self,
- node: &RsvgNode,
+ node: &Node,
acquired_nodes: &mut AcquiredNodes,
) -> Result<Self::Resolved, AcquireError> {
let mut resolved = self.common.resolved.borrow_mut();
@@ -814,7 +814,7 @@ fn acquire_gradient(
mod tests {
use super::*;
use crate::float_eq_cairo::ApproxEqCairo;
- use crate::node::{NodeData, RsvgNode};
+ use crate::node::{Node, NodeData};
use markup5ever::{namespace_url, ns, QualName};
use std::ptr;
@@ -850,7 +850,7 @@ mod tests {
fn gradient_resolved_from_defaults_is_really_resolved() {
let bag = unsafe { PropertyBag::new_from_xml2_attributes(0, ptr::null()) };
- let node = RsvgNode::new(NodeData::new_element(
+ let node = Node::new(NodeData::new_element(
&QualName::new(None, ns!(svg), local_name!("linearGradient")),
&bag,
));
@@ -861,7 +861,7 @@ mod tests {
let gradient = gradient.resolve_from_defaults();
assert!(gradient.is_resolved());
- let node = RsvgNode::new(NodeData::new_element(
+ let node = Node::new(NodeData::new_element(
&QualName::new(None, ns!(svg), local_name!("radialGradient")),
&bag,
));
diff --git a/rsvg_internals/src/handle.rs b/rsvg_internals/src/handle.rs
index 87b7fc5f..b88381dc 100644
--- a/rsvg_internals/src/handle.rs
+++ b/rsvg_internals/src/handle.rs
@@ -14,7 +14,7 @@ use crate::document::{AcquiredNodes, Document};
use crate::dpi::Dpi;
use crate::drawing_ctx::DrawingCtx;
use crate::error::{DefsLookupErrorKind, LoadingError, RenderingError};
-use crate::node::{CascadedValues, NodeBorrow, RsvgNode};
+use crate::node::{CascadedValues, Node, NodeBorrow};
use crate::rect::{IRect, Rect};
use crate::structure::{IntrinsicDimensions, Svg};
use url::Url;
@@ -291,7 +291,7 @@ impl Handle {
/// Returns (ink_rect, logical_rect)
fn get_node_geometry_with_viewport(
&self,
- node: &RsvgNode,
+ node: &Node,
viewport: Rect,
dpi: Dpi,
is_testing: bool,
@@ -348,7 +348,7 @@ impl Handle {
self.get_node_geometry_with_viewport(&node, unit_rectangle(), dpi, is_testing)
}
- fn get_node_or_root(&self, id: Option<&str>) -> Result<RsvgNode, RenderingError> {
+ fn get_node_or_root(&self, id: Option<&str>) -> Result<Node, RenderingError> {
if let Some(id) = id {
self.lookup_node(id).map_err(RenderingError::InvalidId)
} else {
@@ -368,7 +368,7 @@ impl Handle {
self.get_node_geometry_with_viewport(&node, viewport, dpi, is_testing)
}
- fn lookup_node(&self, id: &str) -> Result<RsvgNode, DefsLookupErrorKind> {
+ fn lookup_node(&self, id: &str) -> Result<Node, DefsLookupErrorKind> {
match Href::parse(&id).map_err(DefsLookupErrorKind::HrefError)? {
Href::PlainUrl(_) => Err(DefsLookupErrorKind::CannotLookupExternalReferences),
Href::WithFragment(fragment) => {
@@ -481,7 +481,7 @@ impl Handle {
fn get_bbox_for_element(
&self,
- node: &RsvgNode,
+ node: &Node,
dpi: Dpi,
is_testing: bool,
) -> Result<BoundingBox, RenderingError> {
diff --git a/rsvg_internals/src/image.rs b/rsvg_internals/src/image.rs
index 14c5fa5b..49b09fab 100644
--- a/rsvg_internals/src/image.rs
+++ b/rsvg_internals/src/image.rs
@@ -10,7 +10,7 @@ use crate::drawing_ctx::{ClipMode, DrawingCtx, ViewParams};
use crate::element::ElementResult;
use crate::error::*;
use crate::length::*;
-use crate::node::*;
+use crate::node::{CascadedValues, Node, NodeTrait};
use crate::parsers::ParseValue;
use crate::properties::ComputedValues;
use crate::property_bag::PropertyBag;
@@ -28,7 +28,7 @@ pub struct Image {
}
impl NodeTrait for Image {
- fn set_atts(&mut self, _: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> ElementResult {
+ fn set_atts(&mut self, _: Option<&Node>, pbag: &PropertyBag<'_>) -> ElementResult {
for (attr, value) in pbag.iter() {
match attr.expanded() {
expanded_name!("", "x") => self.x = attr.parse(value)?,
@@ -63,7 +63,7 @@ impl NodeTrait for Image {
fn draw(
&self,
- node: &RsvgNode,
+ node: &Node,
acquired_nodes: &mut AcquiredNodes,
cascaded: &CascadedValues<'_>,
draw_ctx: &mut DrawingCtx,
diff --git a/rsvg_internals/src/lib.rs b/rsvg_internals/src/lib.rs
index 0939d062..06076244 100644
--- a/rsvg_internals/src/lib.rs
+++ b/rsvg_internals/src/lib.rs
@@ -15,14 +15,14 @@
//! to the drawing process.
//!
//! * [The `Document` struct](document/struct.Document.html) represents a loaded SVG
-//! document. It holds the tree of [`RsvgNode`] elements, and a mapping of `id` attributes
+//! document. It holds the tree of [`Node`] elements, and a mapping of `id` attributes
//! to the corresponding element nodes.
//!
-//! * [The `node` module](node/index.html) provides the [`RsvgNode`] struct and
+//! * [The `node` module](node/index.html) provides the [`Node`] struct and
//! [`NodeTrait`], which form the basis for the tree of SVG elements.
//!
//! * [The `xml` module](xml/index.html) receives events from the XML parser, and builds a
-//! [`Document`] as a tree of [`RsvgNode`].
+//! [`Document`] as a tree of [`Node`].
//!
//! * [The `properties` module](properties/index.html) contains structs that represent
//! collections of CSS properties.
@@ -31,7 +31,7 @@
//! the CSS style properties that librsvg supports.
//!
//! [`Document`]: document/struct.Document.html
-//! [`RsvgNode`]: node/type.RsvgNode.html
+//! [`Node`]: node/type.Node.html
//! [`NodeTrait`]: node/trait.NodeTrait.html
#![allow(clippy::clone_on_ref_ptr)]
diff --git a/rsvg_internals/src/marker.rs b/rsvg_internals/src/marker.rs
index 6f4ca74a..3a34c189 100644
--- a/rsvg_internals/src/marker.rs
+++ b/rsvg_internals/src/marker.rs
@@ -17,7 +17,7 @@ use crate::error::*;
use crate::float_eq_cairo::ApproxEqCairo;
use crate::iri::IRI;
use crate::length::*;
-use crate::node::*;
+use crate::node::{CascadedValues, Node, NodeBorrow, NodeDraw, NodeTrait};
use crate::parsers::{Parse, ParseValue};
use crate::path_builder::*;
use crate::properties::{ComputedValues, SpecifiedValue, SpecifiedValues};
@@ -100,7 +100,7 @@ impl Default for Marker {
impl Marker {
fn render(
&self,
- node: &RsvgNode,
+ node: &Node,
acquired_nodes: &mut AcquiredNodes,
draw_ctx: &mut DrawingCtx,
xpos: f64,
@@ -176,7 +176,7 @@ impl Marker {
}
impl NodeTrait for Marker {
- fn set_atts(&mut self, _: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> ElementResult {
+ fn set_atts(&mut self, _: Option<&Node>, pbag: &PropertyBag<'_>) -> ElementResult {
for (attr, value) in pbag.iter() {
match attr.expanded() {
expanded_name!("", "markerUnits") => self.units = attr.parse(value)?,
diff --git a/rsvg_internals/src/node.rs b/rsvg_internals/src/node.rs
index b0e29355..8c4bdb7b 100644
--- a/rsvg_internals/src/node.rs
+++ b/rsvg_internals/src/node.rs
@@ -3,7 +3,7 @@
//! Librsvg uses the [rctree crate][rctree] to represent the SVG tree of elements.
//! Its [`Node`] struct provides a generic wrapper over nodes in a tree.
//! Librsvg puts a [`NodeData`] as the type parameter of [`Node`]. For convenience,
-//! librsvg has a type alias `RsvgNode = Node<NodeData>`.
+//! librsvg has a type alias `Node = Node<NodeData>`.
//!
//! Nodes are not constructed directly by callers;
//!
@@ -29,12 +29,12 @@ use crate::text::Chars;
/// Strong reference to an element in the SVG tree.
///
/// See the [module documentation](index.html) for more information.
-pub type RsvgNode = rctree::Node<NodeData>;
+pub type Node = rctree::Node<NodeData>;
/// Weak reference to an element in the SVG tree.
///
/// See the [module documentation](index.html) for more information.
-pub type RsvgWeakNode = rctree::WeakNode<NodeData>;
+pub type WeakNode = rctree::WeakNode<NodeData>;
/// Data for a single DOM node.
///
@@ -125,7 +125,7 @@ impl<'a> CascadedValues<'a> {
/// This is what nodes should normally use to draw their children from their `draw()` method.
/// Nodes that need to override the cascade for their children can use `new_from_values()`
/// instead.
- pub fn new(&self, node: &'a RsvgNode) -> CascadedValues<'a> {
+ pub fn new(&self, node: &'a Node) -> CascadedValues<'a> {
match self.inner {
CascadedInner::FromNode(_) => CascadedValues {
inner: CascadedInner::FromNode(node.borrow_element()),
@@ -140,7 +140,7 @@ impl<'a> CascadedValues<'a> {
/// This is to be used only in the toplevel drawing function, or in elements like `<marker>`
/// that don't propagate their parent's cascade to their children. All others should use
/// `new()` to derive the cascade from an existing one.
- pub fn new_from_node(node: &RsvgNode) -> CascadedValues<'_> {
+ pub fn new_from_node(node: &Node) -> CascadedValues<'_> {
CascadedValues {
inner: CascadedInner::FromNode(node.borrow_element()),
}
@@ -151,7 +151,7 @@ impl<'a> CascadedValues<'a> {
///
/// This is for the `<use>` element, which draws the element which it references with the
/// `<use>`'s own cascade, not wih the element's original cascade.
- pub fn new_from_values(node: &'a RsvgNode, values: &ComputedValues) -> CascadedValues<'a> {
+ pub fn new_from_values(node: &'a Node, values: &ComputedValues) -> CascadedValues<'a> {
let mut v = values.clone();
node.borrow_element()
.get_specified_values()
@@ -179,7 +179,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(&mut self, parent: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> ElementResult;
+ fn set_atts(&mut self, parent: Option<&Node>, pbag: &PropertyBag<'_>) -> ElementResult;
/// Sets any special-cased properties that the node may have, that are different
/// from defaults in the node's `SpecifiedValues`.
@@ -193,7 +193,7 @@ pub trait NodeTrait: Downcast {
fn draw(
&self,
- _node: &RsvgNode,
+ _node: &Node,
_acquired_nodes: &mut AcquiredNodes,
_cascaded: &CascadedValues<'_>,
draw_ctx: &mut DrawingCtx,
@@ -235,7 +235,7 @@ pub trait NodeBorrow {
fn borrow_element_mut(&mut self) -> RefMut<Element>;
}
-impl NodeBorrow for RsvgNode {
+impl NodeBorrow for Node {
fn is_element(&self) -> bool {
match *self.borrow() {
NodeData::Element(_) => true,
@@ -277,7 +277,7 @@ pub trait NodeCascade {
fn cascade(&mut self, values: &ComputedValues);
}
-impl NodeCascade for RsvgNode {
+impl NodeCascade for Node {
fn cascade(&mut self, values: &ComputedValues) {
let mut values = values.clone();
@@ -313,7 +313,7 @@ pub trait NodeDraw {
) -> Result<BoundingBox, RenderingError>;
}
-impl NodeDraw for RsvgNode {
+impl NodeDraw for Node {
fn draw(
&self,
acquired_nodes: &mut AcquiredNodes,
diff --git a/rsvg_internals/src/paint_server.rs b/rsvg_internals/src/paint_server.rs
index 0c97f0c3..90062e8e 100644
--- a/rsvg_internals/src/paint_server.rs
+++ b/rsvg_internals/src/paint_server.rs
@@ -7,7 +7,7 @@ use crate::bbox::BoundingBox;
use crate::document::AcquiredNodes;
use crate::drawing_ctx::DrawingCtx;
use crate::error::*;
-use crate::node::{CascadedValues, RsvgNode};
+use crate::node::{CascadedValues, Node};
use crate::parsers::Parse;
use crate::properties::ComputedValues;
use crate::unit_interval::UnitInterval;
@@ -62,13 +62,13 @@ pub trait PaintSource {
fn resolve(
&self,
- node: &RsvgNode,
+ node: &Node,
acquired_nodes: &mut AcquiredNodes,
) -> Result<Self::Resolved, AcquireError>;
fn resolve_fallbacks_and_set_pattern(
&self,
- node: &RsvgNode,
+ node: &Node,
acquired_nodes: &mut AcquiredNodes,
draw_ctx: &mut DrawingCtx,
opacity: UnitInterval,
diff --git a/rsvg_internals/src/pattern.rs b/rsvg_internals/src/pattern.rs
index 7525ebff..26ccef30 100644
--- a/rsvg_internals/src/pattern.rs
+++ b/rsvg_internals/src/pattern.rs
@@ -14,7 +14,7 @@ use crate::element::{ElementResult, ElementType};
use crate::error::*;
use crate::float_eq_cairo::ApproxEqCairo;
use crate::length::*;
-use crate::node::*;
+use crate::node::{CascadedValues, Node, NodeBorrow, NodeDraw, NodeTrait, WeakNode};
use crate::paint_server::{AsPaintSource, PaintSource};
use crate::parsers::ParseValue;
use crate::properties::ComputedValues;
@@ -66,7 +66,7 @@ enum UnresolvedChildren {
ResolvedEmpty,
/// Points back to the Pattern that had usable children.
- WithChildren(RsvgWeakNode),
+ WithChildren(WeakNode),
}
/// Keeps track of which Pattern provided a non-empty set of children during pattern resolution
@@ -75,7 +75,7 @@ enum Children {
Empty,
/// Points back to the Pattern that had usable children
- WithChildren(RsvgWeakNode),
+ WithChildren(WeakNode),
}
/// Main structure used during pattern resolution. For unresolved
@@ -119,7 +119,7 @@ pub struct Pattern {
}
impl NodeTrait for Pattern {
- fn set_atts(&mut self, _: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> ElementResult {
+ fn set_atts(&mut self, _: Option<&Node>, pbag: &PropertyBag<'_>) -> ElementResult {
for (attr, value) in pbag.iter() {
match attr.expanded() {
expanded_name!("", "patternUnits") => self.common.units = Some(attr.parse(value)?),
@@ -164,7 +164,7 @@ impl PaintSource for Pattern {
fn resolve(
&self,
- node: &RsvgNode,
+ node: &Node,
acquired_nodes: &mut AcquiredNodes,
) -> Result<Self::Resolved, AcquireError> {
let mut resolved = self.resolved.borrow_mut();
@@ -476,7 +476,7 @@ impl UnresolvedPattern {
}
impl UnresolvedChildren {
- fn from_node(node: &RsvgNode) -> UnresolvedChildren {
+ fn from_node(node: &Node) -> UnresolvedChildren {
let weak = node.downgrade();
if node.children().any(|child| child.is_element()) {
@@ -527,7 +527,7 @@ impl UnresolvedChildren {
}
impl Children {
- fn node_with_children(&self) -> Option<RsvgNode> {
+ fn node_with_children(&self) -> Option<Node> {
match *self {
Children::Empty => None,
Children::WithChildren(ref wc) => Some(wc.upgrade().unwrap()),
@@ -547,7 +547,7 @@ impl ResolvedPattern {
}
impl Pattern {
- fn get_unresolved(&self, node: &RsvgNode) -> Unresolved {
+ fn get_unresolved(&self, node: &Node) -> Unresolved {
let pattern = UnresolvedPattern {
common: self.common.clone(),
children: UnresolvedChildren::from_node(node),
@@ -563,7 +563,7 @@ impl Pattern {
#[cfg(test)]
mod tests {
use super::*;
- use crate::node::{NodeData, RsvgNode};
+ use crate::node::NodeData;
use markup5ever::{namespace_url, ns, QualName};
use std::ptr;
@@ -571,7 +571,7 @@ mod tests {
fn pattern_resolved_from_defaults_is_really_resolved() {
let bag = unsafe { PropertyBag::new_from_xml2_attributes(0, ptr::null()) };
- let node = RsvgNode::new(NodeData::new_element(
+ let node = Node::new(NodeData::new_element(
&QualName::new(None, ns!(svg), local_name!("pattern")),
&bag,
));
diff --git a/rsvg_internals/src/shapes.rs b/rsvg_internals/src/shapes.rs
index d1fb0330..5401a5ca 100644
--- a/rsvg_internals/src/shapes.rs
+++ b/rsvg_internals/src/shapes.rs
@@ -11,7 +11,7 @@ use crate::drawing_ctx::DrawingCtx;
use crate::element::ElementResult;
use crate::error::*;
use crate::length::*;
-use crate::node::*;
+use crate::node::{CascadedValues, Node, NodeTrait};
use crate::parsers::{optional_comma, Parse, ParseValue};
use crate::path_builder::*;
use crate::path_parser;
@@ -37,7 +37,7 @@ impl Shape {
fn draw(
&self,
- node: &RsvgNode,
+ node: &Node,
acquired_nodes: &mut AcquiredNodes,
values: &ComputedValues,
draw_ctx: &mut DrawingCtx,
@@ -116,7 +116,7 @@ pub struct Path {
}
impl NodeTrait for Path {
- fn set_atts(&mut self, _: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> ElementResult {
+ fn set_atts(&mut self, _: Option<&Node>, pbag: &PropertyBag<'_>) -> ElementResult {
for (attr, value) in pbag.iter() {
if attr.expanded() == expanded_name!("", "d") {
let mut builder = PathBuilder::new();
@@ -135,7 +135,7 @@ impl NodeTrait for Path {
fn draw(
&self,
- node: &RsvgNode,
+ node: &Node,
acquired_nodes: &mut AcquiredNodes,
cascaded: &CascadedValues<'_>,
draw_ctx: &mut DrawingCtx,
@@ -220,7 +220,7 @@ pub struct Polygon {
}
impl NodeTrait for Polygon {
- fn set_atts(&mut self, _: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> ElementResult {
+ fn set_atts(&mut self, _: Option<&Node>, pbag: &PropertyBag<'_>) -> ElementResult {
for (attr, value) in pbag.iter() {
if attr.expanded() == expanded_name!("", "points") {
self.points = attr.parse(value).map(Some)?;
@@ -232,7 +232,7 @@ impl NodeTrait for Polygon {
fn draw(
&self,
- node: &RsvgNode,
+ node: &Node,
acquired_nodes: &mut AcquiredNodes,
cascaded: &CascadedValues<'_>,
draw_ctx: &mut DrawingCtx,
@@ -255,7 +255,7 @@ pub struct Polyline {
}
impl NodeTrait for Polyline {
- fn set_atts(&mut self, _: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> ElementResult {
+ fn set_atts(&mut self, _: Option<&Node>, pbag: &PropertyBag<'_>) -> ElementResult {
for (attr, value) in pbag.iter() {
if attr.expanded() == expanded_name!("", "points") {
self.points = attr.parse(value).map(Some)?;
@@ -267,7 +267,7 @@ impl NodeTrait for Polyline {
fn draw(
&self,
- node: &RsvgNode,
+ node: &Node,
acquired_nodes: &mut AcquiredNodes,
cascaded: &CascadedValues<'_>,
draw_ctx: &mut DrawingCtx,
@@ -291,7 +291,7 @@ pub struct Line {
}
impl NodeTrait for Line {
- fn set_atts(&mut self, _: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> ElementResult {
+ fn set_atts(&mut self, _: Option<&Node>, pbag: &PropertyBag<'_>) -> ElementResult {
for (attr, value) in pbag.iter() {
match attr.expanded() {
expanded_name!("", "x1") => self.x1 = attr.parse(value)?,
@@ -307,7 +307,7 @@ impl NodeTrait for Line {
fn draw(
&self,
- node: &RsvgNode,
+ node: &Node,
acquired_nodes: &mut AcquiredNodes,
cascaded: &CascadedValues<'_>,
draw_ctx: &mut DrawingCtx,
@@ -353,7 +353,7 @@ pub struct Rect {
}
impl NodeTrait for Rect {
- fn set_atts(&mut self, _: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> ElementResult {
+ fn set_atts(&mut self, _: Option<&Node>, pbag: &PropertyBag<'_>) -> ElementResult {
for (attr, value) in pbag.iter() {
match attr.expanded() {
expanded_name!("", "x") => self.x = attr.parse(value)?,
@@ -385,7 +385,7 @@ impl NodeTrait for Rect {
fn draw(
&self,
- node: &RsvgNode,
+ node: &Node,
acquired_nodes: &mut AcquiredNodes,
cascaded: &CascadedValues<'_>,
draw_ctx: &mut DrawingCtx,
@@ -581,7 +581,7 @@ pub struct Circle {
}
impl NodeTrait for Circle {
- fn set_atts(&mut self, _: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> ElementResult {
+ fn set_atts(&mut self, _: Option<&Node>, pbag: &PropertyBag<'_>) -> ElementResult {
for (attr, value) in pbag.iter() {
match attr.expanded() {
expanded_name!("", "cx") => self.cx = attr.parse(value)?,
@@ -598,7 +598,7 @@ impl NodeTrait for Circle {
fn draw(
&self,
- node: &RsvgNode,
+ node: &Node,
acquired_nodes: &mut AcquiredNodes,
cascaded: &CascadedValues<'_>,
draw_ctx: &mut DrawingCtx,
@@ -634,7 +634,7 @@ pub struct Ellipse {
}
impl NodeTrait for Ellipse {
- fn set_atts(&mut self, _: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> ElementResult {
+ fn set_atts(&mut self, _: Option<&Node>, pbag: &PropertyBag<'_>) -> ElementResult {
for (attr, value) in pbag.iter() {
match attr.expanded() {
expanded_name!("", "cx") => self.cx = attr.parse(value)?,
@@ -656,7 +656,7 @@ impl NodeTrait for Ellipse {
fn draw(
&self,
- node: &RsvgNode,
+ node: &Node,
acquired_nodes: &mut AcquiredNodes,
cascaded: &CascadedValues<'_>,
draw_ctx: &mut DrawingCtx,
diff --git a/rsvg_internals/src/structure.rs b/rsvg_internals/src/structure.rs
index 06ae97d0..87e91b03 100644
--- a/rsvg_internals/src/structure.rs
+++ b/rsvg_internals/src/structure.rs
@@ -12,7 +12,7 @@ use crate::drawing_ctx::{ClipMode, DrawingCtx, ViewParams};
use crate::element::ElementResult;
use crate::error::*;
use crate::length::*;
-use crate::node::*;
+use crate::node::{CascadedValues, Node, NodeBorrow, NodeDraw, NodeTrait};
use crate::parsers::{Parse, ParseValue};
use crate::properties::ComputedValues;
use crate::property_bag::PropertyBag;
@@ -23,13 +23,13 @@ use crate::viewbox::*;
pub struct Group();
impl NodeTrait for Group {
- fn set_atts(&mut self, _: Option<&RsvgNode>, _: &PropertyBag<'_>) -> ElementResult {
+ fn set_atts(&mut self, _: Option<&Node>, _: &PropertyBag<'_>) -> ElementResult {
Ok(())
}
fn draw(
&self,
- node: &RsvgNode,
+ node: &Node,
acquired_nodes: &mut AcquiredNodes,
cascaded: &CascadedValues<'_>,
draw_ctx: &mut DrawingCtx,
@@ -51,7 +51,7 @@ impl NodeTrait for Group {
pub struct NonRendering;
impl NodeTrait for NonRendering {
- fn set_atts(&mut self, _: Option<&RsvgNode>, _: &PropertyBag<'_>) -> ElementResult {
+ fn set_atts(&mut self, _: Option<&Node>, _: &PropertyBag<'_>) -> ElementResult {
Ok(())
}
}
@@ -60,13 +60,13 @@ impl NodeTrait for NonRendering {
pub struct Switch();
impl NodeTrait for Switch {
- fn set_atts(&mut self, _: Option<&RsvgNode>, _: &PropertyBag<'_>) -> ElementResult {
+ fn set_atts(&mut self, _: Option<&Node>, _: &PropertyBag<'_>) -> ElementResult {
Ok(())
}
fn draw(
&self,
- node: &RsvgNode,
+ node: &Node,
acquired_nodes: &mut AcquiredNodes,
cascaded: &CascadedValues<'_>,
draw_ctx: &mut DrawingCtx,
@@ -184,7 +184,7 @@ impl Svg {
}
impl NodeTrait for Svg {
- fn set_atts(&mut self, parent: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> ElementResult {
+ fn set_atts(&mut self, parent: Option<&Node>, pbag: &PropertyBag<'_>) -> ElementResult {
// x & y attributes have no effect on outermost svg
// http://www.w3.org/TR/SVG/struct.html#SVGElement
let is_inner_svg = parent.is_some();
@@ -219,7 +219,7 @@ impl NodeTrait for Svg {
fn draw(
&self,
- node: &RsvgNode,
+ node: &Node,
acquired_nodes: &mut AcquiredNodes,
cascaded: &CascadedValues<'_>,
draw_ctx: &mut DrawingCtx,
@@ -309,7 +309,7 @@ impl Use {
}
impl NodeTrait for Use {
- fn set_atts(&mut self, _: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> ElementResult {
+ fn set_atts(&mut self, _: Option<&Node>, pbag: &PropertyBag<'_>) -> ElementResult {
for (attr, value) in pbag.iter() {
match attr.expanded() {
expanded_name!(xlink "href") => {
@@ -336,7 +336,7 @@ impl NodeTrait for Use {
fn draw(
&self,
- node: &RsvgNode,
+ node: &Node,
acquired_nodes: &mut AcquiredNodes,
cascaded: &CascadedValues<'_>,
draw_ctx: &mut DrawingCtx,
@@ -363,7 +363,7 @@ impl Symbol {
}
impl NodeTrait for Symbol {
- fn set_atts(&mut self, _parent: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> ElementResult {
+ fn set_atts(&mut self, _parent: Option<&Node>, pbag: &PropertyBag<'_>) -> ElementResult {
for (attr, value) in pbag.iter() {
match attr.expanded() {
expanded_name!("", "preserveAspectRatio") => {
@@ -396,7 +396,7 @@ impl ClipPath {
}
impl NodeTrait for ClipPath {
- fn set_atts(&mut self, _: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> ElementResult {
+ fn set_atts(&mut self, _: Option<&Node>, pbag: &PropertyBag<'_>) -> ElementResult {
for (attr, value) in pbag.iter() {
match attr.expanded() {
expanded_name!("", "clipPathUnits") => self.units = attr.parse(value)?,
@@ -456,7 +456,7 @@ impl Mask {
}
impl NodeTrait for Mask {
- fn set_atts(&mut self, _: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> ElementResult {
+ fn set_atts(&mut self, _: Option<&Node>, pbag: &PropertyBag<'_>) -> ElementResult {
for (attr, value) in pbag.iter() {
match attr.expanded() {
expanded_name!("", "x") => self.x = attr.parse(value)?,
@@ -485,7 +485,7 @@ pub struct Link {
}
impl NodeTrait for Link {
- fn set_atts(&mut self, _: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> ElementResult {
+ fn set_atts(&mut self, _: Option<&Node>, pbag: &PropertyBag<'_>) -> ElementResult {
for (attr, value) in pbag.iter() {
match attr.expanded() {
expanded_name!(xlink "href") => self.link = Some(value.to_owned()),
@@ -498,7 +498,7 @@ impl NodeTrait for Link {
fn draw(
&self,
- node: &RsvgNode,
+ node: &Node,
acquired_nodes: &mut AcquiredNodes,
cascaded: &CascadedValues<'_>,
draw_ctx: &mut DrawingCtx,
diff --git a/rsvg_internals/src/style.rs b/rsvg_internals/src/style.rs
index 9f7d3172..9b27c587 100644
--- a/rsvg_internals/src/style.rs
+++ b/rsvg_internals/src/style.rs
@@ -4,7 +4,7 @@ use markup5ever::{expanded_name, local_name, namespace_url, ns};
use crate::element::ElementResult;
use crate::error::*;
-use crate::node::{NodeTrait, RsvgNode};
+use crate::node::{Node, NodeTrait};
use crate::property_bag::PropertyBag;
/// Represents the syntax used in the <style> node.
@@ -52,7 +52,7 @@ impl Style {
}
impl NodeTrait for Style {
- fn set_atts(&mut self, _: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> ElementResult {
+ fn set_atts(&mut self, _: Option<&Node>, pbag: &PropertyBag<'_>) -> ElementResult {
for (attr, value) in pbag.iter() {
if attr.expanded() == expanded_name!("", "type") {
self.type_ = Some(StyleType::parse(value).attribute(attr)?);
diff --git a/rsvg_internals/src/text.rs b/rsvg_internals/src/text.rs
index a03991e7..a83562e0 100644
--- a/rsvg_internals/src/text.rs
+++ b/rsvg_internals/src/text.rs
@@ -13,7 +13,7 @@ use crate::error::*;
use crate::float_eq_cairo::ApproxEqCairo;
use crate::font_props::FontWeightSpec;
use crate::length::*;
-use crate::node::{CascadedValues, NodeBorrow, NodeTrait, RsvgNode};
+use crate::node::{CascadedValues, Node, NodeBorrow, NodeTrait};
use crate::parsers::ParseValue;
use crate::properties::ComputedValues;
use crate::property_bag::PropertyBag;
@@ -420,7 +420,7 @@ fn gravity_is_vertical(gravity: pango::Gravity) -> bool {
/// will be used instead of the given arguments.
fn children_to_chunks(
chunks: &mut Vec<Chunk>,
- node: &RsvgNode,
+ node: &Node,
acquired_nodes: &mut AcquiredNodes,
cascaded: &CascadedValues<'_>,
draw_ctx: &mut DrawingCtx,
@@ -514,7 +514,7 @@ impl Chars {
*self.space_normalized.borrow_mut() = None;
}
- fn ensure_normalized_string(&self, node: &RsvgNode, values: &ComputedValues) {
+ fn ensure_normalized_string(&self, node: &Node, values: &ComputedValues) {
let mut normalized = self.space_normalized.borrow_mut();
if (*normalized).is_none() {
@@ -533,7 +533,7 @@ impl Chars {
fn make_span(
&self,
- node: &RsvgNode,
+ node: &Node,
values: &ComputedValues,
dx: Option<Length<Horizontal>>,
dy: Option<Length<Vertical>>,
@@ -552,7 +552,7 @@ impl Chars {
fn to_chunks(
&self,
- node: &RsvgNode,
+ node: &Node,
values: &ComputedValues,
chunks: &mut Vec<Chunk>,
dx: Option<Length<Horizontal>>,
@@ -583,7 +583,7 @@ pub struct Text {
impl Text {
fn make_chunks(
&self,
- node: &RsvgNode,
+ node: &Node,
acquired_nodes: &mut AcquiredNodes,
cascaded: &CascadedValues<'_>,
draw_ctx: &mut DrawingCtx,
@@ -605,7 +605,7 @@ impl Text {
}
impl NodeTrait for Text {
- fn set_atts(&mut self, _: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> ElementResult {
+ fn set_atts(&mut self, _: Option<&Node>, pbag: &PropertyBag<'_>) -> ElementResult {
for (attr, value) in pbag.iter() {
match attr.expanded() {
expanded_name!("", "x") => self.x = attr.parse(value)?,
@@ -621,7 +621,7 @@ impl NodeTrait for Text {
fn draw(
&self,
- node: &RsvgNode,
+ node: &Node,
acquired_nodes: &mut AcquiredNodes,
cascaded: &CascadedValues<'_>,
draw_ctx: &mut DrawingCtx,
@@ -680,7 +680,7 @@ pub struct TRef {
impl TRef {
fn to_chunks(
&self,
- node: &RsvgNode,
+ node: &Node,
acquired_nodes: &mut AcquiredNodes,
cascaded: &CascadedValues<'_>,
chunks: &mut Vec<Chunk>,
@@ -708,7 +708,7 @@ impl TRef {
fn extract_chars_children_to_chunks_recursively(
chunks: &mut Vec<Chunk>,
- node: &RsvgNode,
+ node: &Node,
values: &ComputedValues,
depth: usize,
) {
@@ -724,7 +724,7 @@ fn extract_chars_children_to_chunks_recursively(
}
impl NodeTrait for TRef {
- fn set_atts(&mut self, _: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> ElementResult {
+ fn set_atts(&mut self, _: Option<&Node>, pbag: &PropertyBag<'_>) -> ElementResult {
for (attr, value) in pbag.iter() {
match attr.expanded() {
expanded_name!(xlink "href") => {
@@ -749,7 +749,7 @@ pub struct TSpan {
impl TSpan {
fn to_chunks(
&self,
- node: &RsvgNode,
+ node: &Node,
acquired_nodes: &mut AcquiredNodes,
cascaded: &CascadedValues<'_>,
draw_ctx: &mut DrawingCtx,
@@ -776,7 +776,7 @@ impl TSpan {
}
impl NodeTrait for TSpan {
- fn set_atts(&mut self, _: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> ElementResult {
+ fn set_atts(&mut self, _: Option<&Node>, pbag: &PropertyBag<'_>) -> ElementResult {
for (attr, value) in pbag.iter() {
match attr.expanded() {
expanded_name!("", "x") => self.x = attr.parse(value).map(Some)?,
diff --git a/rsvg_internals/src/xml.rs b/rsvg_internals/src/xml.rs
index 077a8748..8fe8703c 100644
--- a/rsvg_internals/src/xml.rs
+++ b/rsvg_internals/src/xml.rs
@@ -17,7 +17,7 @@ use crate::element::ElementType;
use crate::error::LoadingError;
use crate::io::{self, get_input_stream_for_loading};
use crate::limits::MAX_LOADED_ELEMENTS;
-use crate::node::{NodeBorrow, RsvgNode};
+use crate::node::{Node, NodeBorrow};
use crate::property_bag::PropertyBag;
use crate::style::{Style, StyleType};
use crate::xml2_load::Xml2Parser;
@@ -98,7 +98,7 @@ struct XmlStateInner {
document_builder: Option<DocumentBuilder>,
num_loaded_elements: usize,
context_stack: Vec<Context>,
- current_node: Option<RsvgNode>,
+ current_node: Option<Node>,
entities: HashMap<String, XmlEntityPtr>,
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]