Code

Fix incorrect preview problems on Win32 with native dialogues - see LP #229045
authorozmikepittman <ozmikepittman@users.sourceforge.net>
Sun, 11 May 2008 03:37:28 +0000 (03:37 +0000)
committerozmikepittman <ozmikepittman@users.sourceforge.net>
Sun, 11 May 2008 03:37:28 +0000 (03:37 +0000)
src/document.cpp

index 92aad942d7687e7f8d24cad35a25712962774d8b..d0792ab8a7c5c01931638528d1088cd38f43b417 100644 (file)
@@ -471,7 +471,11 @@ gdouble sp_document_width(SPDocument *document)
     g_return_val_if_fail(document->priv != NULL, 0.0);
     g_return_val_if_fail(document->root != NULL, 0.0);
 
-    return SP_ROOT(document->root)->width.computed;
+    SPRoot *root = SP_ROOT(document->root);
+
+    if (root->width.unit == SVGLength::PERCENT && root->viewBox_set)
+        return root->viewBox.x1 - root->viewBox.x0;
+    return root->width.computed;
 }
 
 void
@@ -525,7 +529,11 @@ gdouble sp_document_height(SPDocument *document)
     g_return_val_if_fail(document->priv != NULL, 0.0);
     g_return_val_if_fail(document->root != NULL, 0.0);
 
-    return SP_ROOT(document->root)->height.computed;
+    SPRoot *root = SP_ROOT(document->root);
+
+    if (root->height.unit == SVGLength::PERCENT && root->viewBox_set)
+        return root->viewBox.y1 - root->viewBox.y0;
+    return root->height.computed;
 }
 
 /**