[librsvg: 2/4] xml: move set style recursion helper
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 2/4] xml: move set style recursion helper
- Date: Mon, 10 Jun 2019 13:42:32 +0000 (UTC)
commit d97645a0171e9402d2fecf900b42daff1b8a9380
Author: Paolo Borelli <pborelli gnome org>
Date: Sun Jun 9 11:37:46 2019 +0200
xml: move set style recursion helper
rsvg_internals/src/node.rs | 10 +---------
rsvg_internals/src/xml.rs | 10 +++++++++-
2 files changed, 10 insertions(+), 10 deletions(-)
---
diff --git a/rsvg_internals/src/node.rs b/rsvg_internals/src/node.rs
index 520c0f2b..56cc1366 100644
--- a/rsvg_internals/src/node.rs
+++ b/rsvg_internals/src/node.rs
@@ -254,7 +254,7 @@ impl NodeData {
// Sets the node's specified values from the style-related attributes in the pbag.
// Also applies CSS rules in our limited way based on the node's tag/class/id.
- fn set_style(&self, node: &RsvgNode, css_rules: &CssRules) {
+ pub fn set_style(&self, node: &RsvgNode, css_rules: &CssRules) {
self.set_css_styles(node, css_rules);
self.set_style_attribute();
}
@@ -485,14 +485,6 @@ impl RsvgNode {
}
}
- pub fn set_styles_recursively(&self, node: &RsvgNode, css_rules: &CssRules) {
- self.borrow().set_style(node, css_rules);
-
- for child in self.children() {
- child.set_styles_recursively(&child, css_rules);
- }
- }
-
pub fn draw(
&self,
cascaded: &CascadedValues<'_>,
diff --git a/rsvg_internals/src/xml.rs b/rsvg_internals/src/xml.rs
index de663675..683891bd 100644
--- a/rsvg_internals/src/xml.rs
+++ b/rsvg_internals/src/xml.rs
@@ -116,7 +116,7 @@ impl XmlState {
Some(ref root) if root.borrow().get_type() == NodeType::Svg => {
let root = self.tree_root.take().unwrap();
- root.set_styles_recursively(&root, self.css_rules.as_ref().unwrap());
+ set_styles_recursively(&root, self.css_rules.as_ref().unwrap());
Ok(Svg::new(
root,
@@ -534,6 +534,14 @@ fn skip_namespace(s: &str) -> &str {
s.find(':').map_or(s, |pos| &s[pos + 1..])
}
+fn set_styles_recursively(node: &RsvgNode, css_rules: &CssRules) {
+ node.borrow().set_style(node, css_rules);
+
+ for child in node.children() {
+ set_styles_recursively(&child, css_rules);
+ }
+}
+
// https://www.w3.org/TR/xml-stylesheet/
//
// The syntax for the xml-stylesheet processing instruction we support
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]