- ev_view_zoom (view, 1.0, FALSE);
-}
-
-/* Unfortunately this is not idempotent (!) (numerical stability
- * issues because width and height are rounded)
- *
- * One more reason to make this a toggle and not a command */
-void
-ev_view_best_fit (EvView *view, int allocation_width, int allocation_height)
-{
- double scale;
- int available_width, available_height;
- int width, height;
-
- width = height = 0;
- /* This is the bad part. You could make it stable by doing
- * ev_document_set_scale 1.0. But at least with pdf this means
- * redrawing the whole page */
- ev_document_get_page_size (view->document, -1, &width, &height);
+ int doc_width, doc_height;
+ double scale, scale_w, scale_h;
+ GtkBorder border;
+
+ doc_width = doc_height = 0;
+ scale = scale_w = scale_h = 1.0;
+ ev_document_get_page_size (view->document, -1, &doc_width, &doc_height);
+ /* FIXME: The border size isn't constant. Ugh. Still, if we have extra
+ * space, we just cut it from the border */
+ ev_document_misc_get_page_border_size (doc_width, doc_height, &border);
+
+ if (doc_width == 0 && doc_height == 0) {
+ return 0;
+ }