From 6118b98b2fe857907eea037266993ccd0b3d4cb6 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Tue, 30 May 2023 08:26:40 +0200 Subject: [PATCH] Add patch to workaround recursion in iframe height computation in mail preview --- ...around-recursion-in-iframe-height-co.patch | 99 +++++++++++++++++++ evolution.spec | 8 +- 2 files changed, 106 insertions(+), 1 deletion(-) create mode 100644 0002-I-2382-Mail-Workaround-recursion-in-iframe-height-co.patch diff --git a/0002-I-2382-Mail-Workaround-recursion-in-iframe-height-co.patch b/0002-I-2382-Mail-Workaround-recursion-in-iframe-height-co.patch new file mode 100644 index 0000000..5b9fe96 --- /dev/null +++ b/0002-I-2382-Mail-Workaround-recursion-in-iframe-height-co.patch @@ -0,0 +1,99 @@ +diff --git a/data/webkit/e-web-view.js b/data/webkit/e-web-view.js +index c811c479db..032287fd73 100644 +--- a/data/webkit/e-web-view.js ++++ b/data/webkit/e-web-view.js +@@ -760,6 +760,24 @@ Evo.EnsureMainDocumentInitialized = function() + Evo.initializeAndPostContentLoaded(null); + } + ++Evo.mailDisplaySetIFrameHeight = function(iframe, height, forWidth, force) ++{ ++ if (!force && iframe.hasAttribute("x-evo-height-for-width") && iframe.hasAttribute("x-evo-cached-height")) { ++ var heightForWidth = parseInt(iframe.getAttribute("x-evo-height-for-width")); ++ if (heightForWidth == forWidth) { ++ var cachedHeight = parseInt(iframe.getAttribute("x-evo-cached-height")); ++ if (cachedHeight > 0) { ++ iframe.height = cachedHeight; ++ return; ++ } ++ } ++ } ++ ++ iframe.setAttribute("x-evo-height-for-width", forWidth); ++ iframe.setAttribute("x-evo-cached-height", height); ++ iframe.height = height; ++} ++ + Evo.mailDisplayGetScrollbarHeight = function() + { + if (Evo.mailDisplayCachedScrollbarHeight != undefined) +@@ -779,7 +797,7 @@ Evo.mailDisplayUpdateIFramesHeightRecursive = function(doc) + if (!doc) + return; + +- var ii, iframes; ++ var ii, iframes, force = false; + + iframes = doc.getElementsByTagName("iframe"); + +@@ -791,20 +809,27 @@ Evo.mailDisplayUpdateIFramesHeightRecursive = function(doc) + if (!doc.scrollingElement || !doc.defaultView || !doc.defaultView.frameElement) + return; + +- if (doc.defaultView.frameElement.height == doc.scrollingElement.scrollHeight) ++ if (doc.defaultView.frameElement.height == doc.scrollingElement.scrollHeight) { + doc.defaultView.frameElement.height = 10; +- doc.defaultView.frameElement.height = doc.scrollingElement.scrollHeight + 2 + +- (doc.scrollingElement.scrollWidth > doc.scrollingElement.clientWidth ? Evo.mailDisplayGetScrollbarHeight() : 0); ++ force = true; ++ } ++ ++ Evo.mailDisplaySetIFrameHeight(doc.defaultView.frameElement, doc.scrollingElement.scrollHeight + 2 + ++ (doc.scrollingElement.scrollWidth > doc.scrollingElement.clientWidth ? Evo.mailDisplayGetScrollbarHeight() : 0), ++ doc.scrollingElement.clientWidth, force); + } + + Evo.MailDisplayUpdateIFramesHeight = function() + { ++ var scrollx = document.defaultView ? document.defaultView.scrollX : -1; + var scrolly = document.defaultView ? document.defaultView.scrollY : -1; + + Evo.mailDisplayUpdateIFramesHeightRecursive(document); + +- if (scrolly != -1 && document.defaultView.scrollY != scrolly) +- document.defaultView.scrollTo(0, scrolly); ++ if (scrollx != -1 && scrolly != -1 && ( ++ document.defaultView.scrollX != scrollx || ++ document.defaultView.scrollY != scrolly)) ++ document.defaultView.scrollTo(scrollx, scrolly); + + Evo.mailDisplayResizeContentToPreviewWidth(); + Evo.mailDisplayUpdateMagicSpacebarState(); +@@ -1194,6 +1219,9 @@ Evo.unsetHTMLColors = function(doc) + + Evo.mailDisplaySizeChanged = function(entries, observer) + { ++ var scrollx = document.defaultView ? document.defaultView.scrollX : -1; ++ var scrolly = document.defaultView ? document.defaultView.scrollY : -1; ++ + for (const entry of entries) { + if (entry.target.ownerDocument.defaultView.frameElement && entry.borderBoxSize?.length > 0) { + var value = entry.borderBoxSize[0].blockSize; +@@ -1202,9 +1230,15 @@ Evo.mailDisplaySizeChanged = function(entries, observer) + value = entry.target.ownerDocument.scrollingElement.scrollHeight; + if (entry.target.ownerDocument.scrollingElement.scrollWidth > entry.target.ownerDocument.scrollingElement.clientWidth) + value += Evo.mailDisplayGetScrollbarHeight(); +- entry.target.ownerDocument.defaultView.frameElement.height = value; ++ Evo.mailDisplaySetIFrameHeight(entry.target.ownerDocument.defaultView.frameElement, value, ++ entry.target.ownerDocument.scrollingElement.clientWidth, false); + } + } ++ ++ if (scrollx != -1 && scrolly != -1 && ( ++ document.defaultView.scrollX != scrollx || ++ document.defaultView.scrollY != scrolly)) ++ document.defaultView.scrollTo(scrollx, scrolly); + } + + Evo.MailDisplayBindDOM = function(iframe_id, markCitationColor) + diff --git a/evolution.spec b/evolution.spec index c77b8ff..72556cc 100644 --- a/evolution.spec +++ b/evolution.spec @@ -44,7 +44,7 @@ Name: evolution Version: 3.48.2 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Mail and calendar client for GNOME License: GPL-2.0-or-later AND GFDL-1.3-or-later URL: https://wiki.gnome.org/Apps/Evolution @@ -55,6 +55,9 @@ Source2: flatpak-evolution-wrapper.sh.in # https://gitlab.gnome.org/GNOME/evolution/-/issues/2380 Patch01: 0001-Mail-Preview-content-sometimes-grows-indefinitely.patch +# https://gitlab.gnome.org/GNOME/evolution/-/issues/2382 +Patch02: 0002-I-2382-Mail-Workaround-recursion-in-iframe-height-co.patch + # Approximate version number Provides: bundled(libgnomecanvas) = 2.30.0 @@ -581,6 +584,9 @@ grep -v "%{_datadir}/locale" evolution.lang > help.lang %endif %changelog +* Tue May 30 2023 Milan Crha - 3.48.2-3 +- Add patch to workaround recursion in iframe height computation in mail preview + * Mon May 29 2023 Milan Crha - 3.48.2-2 - Add upstream fix for a regression on mail preview panel sometimes growing indefinitely