[librsvg: 1/7] Oops, parse "transform: none" as well as lists of transform functions
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 1/7] Oops, parse "transform: none" as well as lists of transform functions
- Date: Wed, 1 Sep 2021 00:59:51 +0000 (UTC)
commit 6a68c9a79c0e290363b2fa7605fd6fbd49bad6e8
Author: Federico Mena Quintero <federico gnome org>
Date: Tue Aug 31 17:46:59 2021 -0500
Oops, parse "transform: none" as well as lists of transform functions
Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/582>
src/transform.rs | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
---
diff --git a/src/transform.rs b/src/transform.rs
index a0c8a571..80bae8f6 100644
--- a/src/transform.rs
+++ b/src/transform.rs
@@ -90,9 +90,16 @@ pub enum TransformFunction {
impl Parse for TransformProperty {
fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<TransformProperty, ParseError<'i>> {
- let t = parse_transform_prop_function_list(parser)?;
+ if parser
+ .try_parse(|p| p.expect_ident_matching("none"))
+ .is_ok()
+ {
+ Ok(TransformProperty::None)
+ } else {
+ let t = parse_transform_prop_function_list(parser)?;
- Ok(TransformProperty::List(t))
+ Ok(TransformProperty::List(t))
+ }
}
}
@@ -877,6 +884,14 @@ mod tests {
assert_transform_eq(&parse_transform("").unwrap(), &Transform::identity());
}
+ #[test]
+ fn test_parse_transform_property_none() {
+ assert_eq!(
+ parse_transform_prop("none").unwrap(),
+ TransformProperty::None
+ );
+ }
+
#[test]
fn test_parse_transform_property_matrix() {
let tp = TransformProperty::List(vec![TransformFunction::Matrix(
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]