[librsvg] viewport.rs: Disable rendering if the viewBox size is 0, per the spec



commit d2b9b0d53932ab52166f0c45f5f66261893e37c1
Author: Federico Mena Quintero <federico gnome org>
Date:   Thu Sep 28 09:04:52 2017 -0500

    viewport.rs: Disable rendering if the viewBox size is 0, per the spec

 rust/src/viewport.rs |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/rust/src/viewport.rs b/rust/src/viewport.rs
index 15035f3..2e37856 100644
--- a/rust/src/viewport.rs
+++ b/rust/src/viewport.rs
@@ -98,6 +98,11 @@ fn in_viewport<F>(ctx: &mut ViewportCtx,
         // the preserveAspectRatio attribute is only used if viewBox is specified
         // https://www.w3.org/TR/SVG/coords.html#PreserveAspectRatioAttribute
 
+        if double_equals(vbox.0.width, 0.0) || double_equals(vbox.0.height, 0.0) {
+            // Width or height of 0 for the viewBox disables rendering of the element
+            // https://www.w3.org/TR/SVG/coords.html#ViewBoxAttribute
+            return;
+        }
         let (x, y, w, h) = preserve_aspect_ratio.compute(vbox.0.width, vbox.0.height,
                                                          vx, vy, vw, vh);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]