[librsvg/librsvg-2.42] yield the identity transform for empty transform attribute
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg/librsvg-2.42] yield the identity transform for empty transform attribute
- Date: Sat, 17 Mar 2018 01:56:25 +0000 (UTC)
commit 174929f5457b832418a2ccb6a04c2f053c5769c9
Author: Dmitry Kontsevoy <dmitry kontsevoy gmail com>
Date: Thu Mar 15 00:24:36 2018 +0300
yield the identity transform for empty transform attribute
rsvg_internals/src/transform.rs | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/rsvg_internals/src/transform.rs b/rsvg_internals/src/transform.rs
index 2ba8f40a..12364901 100644
--- a/rsvg_internals/src/transform.rs
+++ b/rsvg_internals/src/transform.rs
@@ -41,13 +41,13 @@ fn parse_transform_list(s: &str) -> Result<cairo::Matrix, AttributeError> {
let mut matrix = cairo::Matrix::identity();
loop {
- let m = parse_transform_command(&mut parser)?;
- matrix = cairo::Matrix::multiply(&m, &matrix);
-
if parser.is_exhausted() {
break;
}
+ let m = parse_transform_command(&mut parser)?;
+ matrix = cairo::Matrix::multiply(&m, &matrix);
+
optional_comma(&mut parser);
}
@@ -418,4 +418,9 @@ mod parser_tests {
cairo::Matrix::multiply(&r, &a)
);
}
+
+ #[test]
+ fn parses_empty() {
+ assert_eq!(parse_transform("").unwrap(), cairo::Matrix::identity());
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]