[librsvg: 38/48] XmlState: split style_start_element() into valid and invalid cases
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 38/48] XmlState: split style_start_element() into valid and invalid cases
- Date: Sat, 17 Nov 2018 10:23:13 +0000 (UTC)
commit 925e75d72d45e4507838140332c48dca78907cb3
Author: Federico Mena Quintero <federico gnome org>
Date: Wed Nov 7 14:50:36 2018 -0600
XmlState: split style_start_element() into valid and invalid cases
rsvg_internals/src/xml.rs | 29 ++++++++++++++---------------
1 file changed, 14 insertions(+), 15 deletions(-)
---
diff --git a/rsvg_internals/src/xml.rs b/rsvg_internals/src/xml.rs
index 32b2ebae..400a5f7c 100644
--- a/rsvg_internals/src/xml.rs
+++ b/rsvg_internals/src/xml.rs
@@ -18,7 +18,6 @@ use structure::NodeSvg;
use text::NodeChars;
use tree::{RsvgTree, Tree};
use util::utf8_cstr;
-
// struct XIncludeContext {
// needs_fallback: bool,
// }
@@ -216,8 +215,8 @@ impl XmlState {
let parent = parent.clone();
self.element_creation_start_element(Some(&parent), handle, name, pbag)
}
- ContextKind::Style(_) => self.style_start_element(true, name, pbag),
- ContextKind::UnsupportedStyleChild => self.style_start_element(true, name, pbag),
+ ContextKind::Style(_) => self.inside_style_start_element(name),
+ ContextKind::UnsupportedStyleChild => self.inside_style_start_element(name),
ContextKind::XInclude => self.xinclude_start_element(handle, name, pbag),
};
@@ -270,7 +269,7 @@ impl XmlState {
) -> Context {
match name {
"include" => unimplemented!(),
- "style" => self.style_start_element(false, name, pbag),
+ "style" => self.style_start_element(name, pbag),
_ => {
let node = self.create_node(parent, handle, name, pbag);
@@ -352,17 +351,7 @@ impl XmlState {
new_node
}
- fn style_start_element(&self, inside_style: bool, name: &str, pbag: &PropertyBag) -> Context {
- if inside_style {
- // We are already inside a <style> element, and we don't support
- // elements in there. Just push a state that we will ignore.
-
- return Context {
- element_name: name.to_string(),
- kind: ContextKind::UnsupportedStyleChild,
- };
- }
-
+ fn style_start_element(&self, name: &str, pbag: &PropertyBag) -> Context {
// FIXME: See these:
//
// https://www.w3.org/TR/SVG11/styling.html#StyleElementTypeAttribute
@@ -398,6 +387,16 @@ impl XmlState {
}
}
+ fn inside_style_start_element(&self, name: &str) -> Context {
+ // We are already inside a <style> element, and we don't support
+ // elements in there. Just push a state that we will ignore.
+
+ Context {
+ element_name: name.to_string(),
+ kind: ContextKind::UnsupportedStyleChild,
+ }
+ }
+
fn xinclude_start_element(
&mut self,
handle: *mut RsvgHandle,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]