diff --git a/src/image.c b/src/image.c index cb9725892d1..5abdcf710d1 100644 --- a/src/image.c +++ b/src/image.c @@ -11356,6 +11356,16 @@ svg_load_image (struct frame *f, struct image *img, char *contents, &has_height, &iheight, &has_viewbox, &viewbox); +# if LIBRSVG_CHECK_VERSION (2, 54, 0) + if (has_viewbox && has_width && has_height + && (iwidth.length == 1) && (iwidth.unit == RSVG_UNIT_PERCENT) + && (iwidth.length == 1) && (iheight.unit == RSVG_UNIT_PERCENT)) + { + viewbox_width = viewbox.width; + viewbox_height = viewbox.height; + } + else +# endif if (has_width && has_height) { /* Success! We can use these values directly. */