[librsvg/attribute-parsers-737: 22/26] filters/component_transfer.rs: use set_attribute()
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg/attribute-parsers-737: 22/26] filters/component_transfer.rs: use set_attribute()
- Date: Fri, 21 Oct 2022 01:06:08 +0000 (UTC)
commit aed9bfd77532b2a70b1bbc0d68a766b8742a4160
Author: Federico Mena Quintero <federico gnome org>
Date: Thu Oct 20 19:18:22 2022 -0500
filters/component_transfer.rs: use set_attribute()
src/filters/component_transfer.rs | 33 +++++++++++++++++++++++----------
1 file changed, 23 insertions(+), 10 deletions(-)
---
diff --git a/src/filters/component_transfer.rs b/src/filters/component_transfer.rs
index 20387db1f..ec5fb9c0b 100644
--- a/src/filters/component_transfer.rs
+++ b/src/filters/component_transfer.rs
@@ -5,7 +5,7 @@ use markup5ever::{expanded_name, local_name, namespace_url, ns};
use crate::document::AcquiredNodes;
use crate::drawing_ctx::DrawingCtx;
-use crate::element::{Draw, Element, ElementResult, SetAttributes};
+use crate::element::{set_attribute, Draw, Element, ElementResult, SetAttributes};
use crate::error::*;
use crate::node::{CascadedValues, Node, NodeBorrow};
use crate::parsers::{NumberList, Parse, ParseValue};
@@ -215,20 +215,33 @@ macro_rules! func_x {
impl SetAttributes for $func_name {
#[inline]
- fn set_attributes(&mut self, attrs: &Attributes, _session: &Session) -> ElementResult {
+ fn set_attributes(&mut self, attrs: &Attributes, session: &Session) -> ElementResult {
for (attr, value) in attrs.iter() {
match attr.expanded() {
- expanded_name!("", "type") => self.function_type = attr.parse(value)?,
+ expanded_name!("", "type") => {
+ set_attribute(&mut self.function_type, attr.parse(value), session)
+ }
expanded_name!("", "tableValues") => {
// #691: Limit list to 256 to mitigate malicious SVGs
- let NumberList::<0, 256>(v) = attr.parse(value)?;
- self.table_values = v;
+ let mut number_list = NumberList::<0, 256>(Vec::new());
+ set_attribute(&mut number_list, attr.parse(value), session);
+ self.table_values = number_list.0;
+ }
+ expanded_name!("", "slope") => {
+ set_attribute(&mut self.slope, attr.parse(value), session)
+ }
+ expanded_name!("", "intercept") => {
+ set_attribute(&mut self.intercept, attr.parse(value), session)
+ }
+ expanded_name!("", "amplitude") => {
+ set_attribute(&mut self.amplitude, attr.parse(value), session)
+ }
+ expanded_name!("", "exponent") => {
+ set_attribute(&mut self.exponent, attr.parse(value), session)
+ }
+ expanded_name!("", "offset") => {
+ set_attribute(&mut self.offset, attr.parse(value), session)
}
- expanded_name!("", "slope") => self.slope = attr.parse(value)?,
- expanded_name!("", "intercept") => self.intercept = attr.parse(value)?,
- expanded_name!("", "amplitude") => self.amplitude = attr.parse(value)?,
- expanded_name!("", "exponent") => self.exponent = attr.parse(value)?,
- expanded_name!("", "offset") => self.offset = attr.parse(value)?,
_ => (),
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]