Accepting request 1094331 from GNOME:Factory

- Add abdcc5af227972da8db1731f05e66a14eb4f6656.patch: fix
  "HTML attachment viewport is tiny" (glgo#GNOME/evolution#2400).

OBS-URL: https://build.opensuse.org/request/show/1094331
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/evolution?expand=0&rev=269
This commit is contained in:
Dominique Leuenberger 2023-06-22 21:24:32 +00:00 committed by Git OBS Bridge
commit 73fd62e5fc
3 changed files with 231 additions and 0 deletions

View File

@ -0,0 +1,223 @@
From abdcc5af227972da8db1731f05e66a14eb4f6656 Mon Sep 17 00:00:00 2001
From: Milan Crha <mcrha@redhat.com>
Date: Fri, 16 Jun 2023 12:18:39 +0200
Subject: [PATCH] I#2400 - HTML attachment viewport is tiny
Closes https://gitlab.gnome.org/GNOME/evolution/-/issues/2400
---
data/webkit/e-web-view.js | 138 ++++++++++++++++++++++++++------------
1 file changed, 95 insertions(+), 43 deletions(-)
diff --git a/data/webkit/e-web-view.js b/data/webkit/e-web-view.js
index 032287fd73..10f206092c 100644
--- a/data/webkit/e-web-view.js
+++ b/data/webkit/e-web-view.js
@@ -760,24 +760,6 @@ 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)
@@ -797,7 +779,7 @@ Evo.mailDisplayUpdateIFramesHeightRecursive = function(doc)
if (!doc)
return;
- var ii, iframes, force = false;
+ var ii, iframes;
iframes = doc.getElementsByTagName("iframe");
@@ -809,18 +791,20 @@ 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;
- force = true;
- }
- Evo.mailDisplaySetIFrameHeight(doc.defaultView.frameElement, doc.scrollingElement.scrollHeight + 2 +
- (doc.scrollingElement.scrollWidth > doc.scrollingElement.clientWidth ? Evo.mailDisplayGetScrollbarHeight() : 0),
- doc.scrollingElement.clientWidth, force);
+ doc.defaultView.frameElement.height = doc.scrollingElement.scrollHeight + 2 +
+ (doc.scrollingElement.scrollWidth > doc.scrollingElement.clientWidth ? Evo.mailDisplayGetScrollbarHeight() : 0);
}
-Evo.MailDisplayUpdateIFramesHeight = function()
+Evo.mailDisplayUpdateIFramesHeightCB = function(timeStamp)
{
+ if (Evo.mailDisplayRecalcHeightTimeStamp === timeStamp)
+ return;
+
+ Evo.mailDisplayRecalcHeightTimeStamp = timeStamp;
+
var scrollx = document.defaultView ? document.defaultView.scrollX : -1;
var scrolly = document.defaultView ? document.defaultView.scrollY : -1;
@@ -835,6 +819,11 @@ Evo.MailDisplayUpdateIFramesHeight = function()
Evo.mailDisplayUpdateMagicSpacebarState();
}
+Evo.MailDisplayUpdateIFramesHeight = function()
+{
+ window.requestAnimationFrame(Evo.mailDisplayUpdateIFramesHeightCB);
+}
+
if (this instanceof Window && this.document) {
this.document.onload = function() { Evo.initializeAndPostContentLoaded(this); };
@@ -886,8 +875,13 @@ Evo.VCardBind = function(iframe_id)
Evo.runTraversarForIFrameId(iframe_id, traversar);
}
-Evo.mailDisplayResizeContentToPreviewWidth = function()
+Evo.mailDisplayResizeContentToPreviewWidthCB = function(timeStamp)
{
+ if (Evo.mailDisplayPreviewWidthTimeStamp === timeStamp)
+ return;
+
+ Evo.mailDisplayPreviewWidthTimeStamp = timeStamp;
+
if (!document || !document.documentElement ||
document.documentElement.scrollWidth < document.documentElement.clientWidth) {
return;
@@ -1016,6 +1010,11 @@ Evo.mailDisplayResizeContentToPreviewWidth = function()
window.webkit.messageHandlers.scheduleIFramesHeightUpdate.postMessage(0);
}
+Evo.mailDisplayResizeContentToPreviewWidth = function()
+{
+ window.requestAnimationFrame(Evo.mailDisplayResizeContentToPreviewWidthCB);
+}
+
Evo.mailDisplayUpdateMagicSpacebarState = function()
{
var new_state = 0;
@@ -1217,35 +1216,88 @@ Evo.unsetHTMLColors = function(doc)
}
}
-Evo.mailDisplaySizeChanged = function(entries, observer)
+Evo.mailDisplaySetIFrameHeightForDocument = function(doc, minHeight)
{
+ if (!doc || !doc.defaultView || !doc.scrollingElement)
+ return;
+
+ var iframe = doc.defaultView.frameElement;
+
+ if (!iframe)
+ return;
+
+ var value = minHeight;
+
+ iframe.height = 10;
+
+ if (value < doc.scrollingElement.scrollHeight)
+ value = doc.scrollingElement.scrollHeight;
+ if (doc.scrollingElement.scrollWidth > doc.scrollingElement.clientWidth)
+ value += Evo.mailDisplayGetScrollbarHeight();
+
+ // to ignore size change notifications made by itself
+ if (Evo.mailDisplayResizeObserver)
+ Evo.mailDisplayResizeObserver.expectChange++;
+
+ iframe.height = value;
+
+ // update also parent
+ if (iframe.ownerDocument && iframe.ownerDocument.defaultView && iframe.ownerDocument.defaultView.frameElement)
+ Evo.mailDisplaySetIFrameHeightForDocument(iframe.ownerDocument, 10);
+}
+
+Evo.mailDisplayHandleSizeEntries = function(timeStamp)
+{
+ if (!Evo.mailDisplaySizeEntries || !Evo.mailDisplaySizeEntries.length)
+ return;
+
var scrollx = document.defaultView ? document.defaultView.scrollX : -1;
var scrolly = document.defaultView ? document.defaultView.scrollY : -1;
+ var covered = [], ii;
+
+ for (ii = Evo.mailDisplaySizeEntries.length - 1; ii >= 0; ii--) {
+ var entries = Evo.mailDisplaySizeEntries[ii];
+
+ for (const entry of entries) {
+ if (covered.includes(entry.target))
+ continue;
+ covered[covered.length] = entry.target;
- for (const entry of entries) {
- if (entry.target.ownerDocument.defaultView.frameElement && entry.borderBoxSize?.length > 0) {
- var value = entry.borderBoxSize[0].blockSize;
- entry.target.ownerDocument.defaultView.frameElement.height = 10;
- if (value < entry.target.ownerDocument.scrollingElement.scrollHeight)
- value = entry.target.ownerDocument.scrollingElement.scrollHeight;
- if (entry.target.ownerDocument.scrollingElement.scrollWidth > entry.target.ownerDocument.scrollingElement.clientWidth)
- value += Evo.mailDisplayGetScrollbarHeight();
- Evo.mailDisplaySetIFrameHeight(entry.target.ownerDocument.defaultView.frameElement, value,
- entry.target.ownerDocument.scrollingElement.clientWidth, false);
+ if (entry.target.ownerDocument && entry.target.ownerDocument.defaultView &&
+ entry.target.ownerDocument.defaultView.frameElement && entry.borderBoxSize?.length > 0) {
+ Evo.mailDisplaySetIFrameHeightForDocument(entry.target.ownerDocument, entry.borderBoxSize[0].blockSize);
+ }
}
+
+ if (scrollx != -1 && scrolly != -1 && (
+ document.defaultView.scrollX != scrollx ||
+ document.defaultView.scrollY != scrolly))
+ document.defaultView.scrollTo(scrollx, scrolly);
}
- if (scrollx != -1 && scrolly != -1 && (
- document.defaultView.scrollX != scrollx ||
- document.defaultView.scrollY != scrolly))
- document.defaultView.scrollTo(scrollx, scrolly);
+ Evo.mailDisplaySizeEntries = [];
+}
+
+Evo.mailDisplaySizeChanged = function(entries, observer)
+{
+ if (Evo.mailDisplaySizeEntries === undefined) {
+ Evo.mailDisplaySizeEntries = [];
+ }
+ Evo.mailDisplaySizeEntries[Evo.mailDisplaySizeEntries.length] = entries;
+ if (Evo.mailDisplayResizeObserver.expectChange > 0) {
+ Evo.mailDisplayResizeObserver.expectChange--;
+ return;
+ }
+ window.requestAnimationFrame(Evo.mailDisplayHandleSizeEntries);
}
Evo.MailDisplayBindDOM = function(iframe_id, markCitationColor)
{
Evo.markCitationColor = markCitationColor != "" ? markCitationColor : null;
- if (!Evo.mailDisplayResizeObserver)
+ if (!Evo.mailDisplayResizeObserver) {
Evo.mailDisplayResizeObserver = new ResizeObserver(Evo.mailDisplaySizeChanged);
+ Evo.mailDisplayResizeObserver.expectChange = 0;
+ }
var traversar = {
unstyleBlockquotes : function(doc) {
--
GitLab

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Mon Jun 19 08:20:31 UTC 2023 - Robert Munteanu <rombert@apache.org>
- Add abdcc5af227972da8db1731f05e66a14eb4f6656.patch: fix
"HTML attachment viewport is tiny" (glgo#GNOME/evolution#2400).
-------------------------------------------------------------------
Fri Jun 2 14:48:45 UTC 2023 - Bjørn Lie <bjorn.lie@gmail.com>

View File

@ -29,6 +29,8 @@ License: CC-BY-SA-3.0 AND LGPL-2.0-only AND LGPL-3.0-only AND OLDAP-2.8 A
Group: Productivity/Networking/Email/Clients
URL: https://wiki.gnome.org/Apps/Evolution/
Source0: https://download.gnome.org/sources/evolution/3.48/%{name}-%{version}.tar.xz
# PATCH-FIX-UPSTREAM abdcc5af227972da8db1731f05e66a14eb4f6656.patch glgo#GNOME/evolution#2400
Patch0: abdcc5af227972da8db1731f05e66a14eb4f6656.patch
BuildRequires: bison
BuildRequires: bogofilter
BuildRequires: cmake