From fcacec1fdcef22c4bebf6c6450c0e8d752addd57 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 20 Jan 2023 08:49:54 +0100 Subject: [PATCH] I#2210 - Scale embedded images in HTML messages to respect viewport Closes https://gitlab.gnome.org/GNOME/evolution/-/issues/2210 --- data/webkit/e-web-view.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/data/webkit/e-web-view.js b/data/webkit/e-web-view.js index ab9ca5a6d5..3af1eb84f1 100644 --- a/data/webkit/e-web-view.js +++ b/data/webkit/e-web-view.js @@ -928,6 +928,20 @@ Evo.mailDisplayResizeContentToPreviewWidth = function() /* Add rules to every sub document */ for (ii = 0; ii < iframes.length; ii++) { + var jj, frmdoc = iframes[ii].contentDocument; + for (jj = 0; frmdoc && jj < frmdoc.images.length; jj++) { + var img = frmdoc.images[jj]; + if (!img.hasAttribute("width") && !img.hasAttribute("height")) { + var can = img.hasAttribute("x-evo-width-modified"); + if (!can) + can = img.style.width == "" && img.style.height == ""; + if (can) { + img.setAttribute("x-evo-width-modified", "1"); + img.style.width = local_width + "px"; + } + } + } + if (!this.can_force_width_on_iframe (iframes[ii])) continue;