[librsvg: 3/13] Cascade the document tree from a method in Document
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 3/13] Cascade the document tree from a method in Document
- Date: Sat, 1 Feb 2020 13:24:23 +0000 (UTC)
commit d42b09d18e77740c84ac89e11125f4145c8f0c6a
Author: Federico Mena Quintero <federico gnome org>
Date: Thu Jan 23 16:20:04 2020 -0600
Cascade the document tree from a method in Document
rsvg_internals/src/document.rs | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
---
diff --git a/rsvg_internals/src/document.rs b/rsvg_internals/src/document.rs
index 9841a619..6bbd7cc4 100644
--- a/rsvg_internals/src/document.rs
+++ b/rsvg_internals/src/document.rs
@@ -9,7 +9,7 @@ use std::rc::Rc;
use crate::allowed_url::{AllowedUrl, AllowedUrlError, Fragment};
use crate::create_node::create_node;
-use crate::css::{cascade, Origin, Stylesheet};
+use crate::css::{self, Origin, Stylesheet};
use crate::error::LoadingError;
use crate::handle::LoadOptions;
use crate::io::{self, BinaryData};
@@ -100,6 +100,10 @@ impl Document {
assert!(node_data.get_type() == NodeType::Svg);
node_data.get_impl::<Svg>().get_intrinsic_dimensions()
}
+
+ pub fn cascade(&mut self) {
+ css::cascade(&mut self.tree, &self.stylesheets);
+ }
}
struct Resources {
@@ -348,18 +352,20 @@ impl DocumentBuilder {
match tree {
None => Err(LoadingError::SvgHasNoElements),
- Some(mut root) => {
+ Some(root) => {
if root.borrow().get_type() == NodeType::Svg {
- cascade(&mut root, &stylesheets);
-
- Ok(Document {
+ let mut document = Document {
tree: root.clone(),
ids,
externs: RefCell::new(Resources::new()),
images: RefCell::new(Images::new()),
load_options: load_options.clone(),
stylesheets,
- })
+ };
+
+ document.cascade();
+
+ Ok(document)
} else {
Err(LoadingError::RootElementIsNotSvg)
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]