[librsvg: 35/48] Pass the previous_handler down to the start_element implementations
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 35/48] Pass the previous_handler down to the start_element implementations
- Date: Sat, 17 Nov 2018 10:22:58 +0000 (UTC)
commit c84d2134f788b4b41765c1c99b0b98ef07b7afa6
Author: Federico Mena Quintero <federico gnome org>
Date: Mon Oct 8 16:11:08 2018 -0500
Pass the previous_handler down to the start_element implementations
rsvg_internals/src/xml.rs | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/rsvg_internals/src/xml.rs b/rsvg_internals/src/xml.rs
index 324f6fe5..e0d5814e 100644
--- a/rsvg_internals/src/xml.rs
+++ b/rsvg_internals/src/xml.rs
@@ -28,6 +28,7 @@ trait XmlHandler {
/// Called when the XML parser sees the beginning of an element
fn start_element(
&self,
+ previous_handler: Option<&XmlHandler>,
parent: Option<&Rc<Node>>,
handle: *mut RsvgHandle,
name: &str,
@@ -52,6 +53,7 @@ struct NodeCreationContext {
impl XmlHandler for NodeCreationContext {
fn start_element(
&self,
+ _previous_handler: Option<&XmlHandler>,
parent: Option<&Rc<Node>>,
handle: *mut RsvgHandle,
name: &str,
@@ -59,7 +61,7 @@ impl XmlHandler for NodeCreationContext {
) -> Box<XmlHandler> {
if name == "style" {
let ctx = StyleContext::empty();
- StyleContext::start_element(&ctx, parent, handle, name, pbag)
+ ctx.start_element(Some(self), parent, handle, name, pbag)
} else {
let node = self.create_node(parent, handle, name, pbag);
@@ -158,6 +160,7 @@ struct StyleContext {
impl XmlHandler for StyleContext {
fn start_element(
&self,
+ _previous_handler: Option<&XmlHandler>,
_parent: Option<&Rc<Node>>,
_handle: *mut RsvgHandle,
_name: &str,
@@ -262,11 +265,11 @@ impl XmlState {
pub fn start_element(&mut self, handle: *mut RsvgHandle, name: &str, pbag: &PropertyBag) {
let next_context = if let Some(top) = self.context_stack.last() {
top.handler
- .start_element(top.handler.get_node().as_ref(), handle, name, pbag)
+ .start_element(Some(&*top.handler), top.handler.get_node().as_ref(), handle, name, pbag)
} else {
let default_context = NodeCreationContext::empty();
- default_context.start_element(None, handle, name, pbag)
+ default_context.start_element(None, None, handle, name, pbag)
};
let context = Context {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]