[librsvg: 8/38] Svg.get_size - Inline get_unnormalized_size into here, so we can extract this function
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 8/38] Svg.get_size - Inline get_unnormalized_size into here, so we can extract this function
- Date: Tue, 29 Sep 2020 23:37:20 +0000 (UTC)
commit 639c18179a6f33aa77b39fac435a905873ebb0e7
Author: Federico Mena Quintero <federico gnome org>
Date: Fri Jun 19 19:19:04 2020 -0500
Svg.get_size - Inline get_unnormalized_size into here, so we can extract this function
rsvg_internals/src/structure.rs | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/rsvg_internals/src/structure.rs b/rsvg_internals/src/structure.rs
index 2ab459a6..97ea64ae 100644
--- a/rsvg_internals/src/structure.rs
+++ b/rsvg_internals/src/structure.rs
@@ -124,9 +124,17 @@ impl Svg {
/// element. If these are not available, then the size must be computed
/// by actually measuring the geometries of elements in the document.
pub fn get_size(&self, values: &ComputedValues, dpi: Dpi) -> Option<(f64, f64)> {
- let (w, h) = self.get_unnormalized_size();
+ let dimensions = self.get_intrinsic_dimensions();
+
+ // these defaults are per the spec
+ let w = dimensions
+ .width
+ .unwrap_or_else(|| Length::<Horizontal>::parse_str("100%").unwrap());
+ let h = dimensions
+ .height
+ .unwrap_or_else(|| Length::<Vertical>::parse_str("100%").unwrap());
- match (w, h, self.vbox) {
+ match (w, h, dimensions.vbox) {
(w, h, Some(vbox)) => {
let params = ViewParams::new(dpi, vbox.0.width(), vbox.0.height());
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]