[librsvg] wip: pass the SVG's ComputedValues to svg.get_size()



commit a77eaeb826f013ca42c40e65eff486f903c7d892
Author: Federico Mena Quintero <federico gnome org>
Date:   Tue Feb 19 13:17:26 2019 -0600

    wip: pass the SVG's ComputedValues to svg.get_size()

 rsvg_internals/src/handle.rs    | 7 +++++--
 rsvg_internals/src/structure.rs | 2 +-
 2 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/rsvg_internals/src/handle.rs b/rsvg_internals/src/handle.rs
index 3ad1c8cd..1a5fd110 100644
--- a/rsvg_internals/src/handle.rs
+++ b/rsvg_internals/src/handle.rs
@@ -427,8 +427,11 @@ impl Handle {
         };
 
         if is_root {
+            let cascaded = node.get_cascaded_values();
+            let values = cascaded.get();
+
             if let Some((root_width, root_height)) =
-                node.with_impl(|svg: &NodeSvg| svg.get_size(self.dpi.get()))
+                node.with_impl(|svg: &NodeSvg| svg.get_size(&values, self.dpi.get()))
             {
                 let ink_r = RsvgRectangle {
                     x: 0.0,
@@ -510,7 +513,7 @@ impl Handle {
 
         if dimensions.width == 0 || dimensions.height == 0 {
             // nothing to render
-            return Ok(())
+            return Ok(());
         }
 
         cr.save();
diff --git a/rsvg_internals/src/structure.rs b/rsvg_internals/src/structure.rs
index 39995aa2..c020e973 100644
--- a/rsvg_internals/src/structure.rs
+++ b/rsvg_internals/src/structure.rs
@@ -136,7 +136,7 @@ impl NodeSvg {
         }
     }
 
-    pub fn get_size(&self, dpi: Dpi) -> Option<(i32, i32)> {
+    pub fn get_size(&self, values: &ComputedValues, dpi: Dpi) -> Option<(i32, i32)> {
         let (_, _, w, h) = self.get_unnormalized_viewport();
 
         match (w, h, self.vbox.get()) {


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