diff --git a/SOURCES/evolution-3.28.5-contacts-prefer-orig-value.patch b/SOURCES/evolution-3.28.5-contacts-prefer-orig-value.patch
new file mode 100644
index 0000000..4272d25
--- /dev/null
+++ b/SOURCES/evolution-3.28.5-contacts-prefer-orig-value.patch
@@ -0,0 +1,17 @@
+diff -up evolution-3.28.5/src/addressbook/gui/widgets/eab-contact-merging.c.contacts-prefer-orig-value evolution-3.28.5/src/addressbook/gui/widgets/eab-contact-merging.c
+--- evolution-3.28.5/src/addressbook/gui/widgets/eab-contact-merging.c.contacts-prefer-orig-value 2018-07-30 15:37:05.000000000 +0200
++++ evolution-3.28.5/src/addressbook/gui/widgets/eab-contact-merging.c 2022-09-15 08:19:23.228037822 +0200
+@@ -512,7 +512,12 @@ mergeit (EContactMergingLookup *lookup)
+ G_CALLBACK (dropdown_changed), data);
+ g_object_set_data_full (G_OBJECT (dropdown), "eab-contact-merging::dropdown-data", data, g_free);
+
+- if (field == E_CONTACT_NICKNAME || field == E_CONTACT_GIVEN_NAME || field == E_CONTACT_FAMILY_NAME || field == E_CONTACT_FULL_NAME)
++ /* Only prefer the original value when it's filled */
++ if (string1 && *string1 && (
++ field == E_CONTACT_NICKNAME ||
++ field == E_CONTACT_GIVEN_NAME ||
++ field == E_CONTACT_FAMILY_NAME ||
++ field == E_CONTACT_FULL_NAME))
+ gtk_combo_box_set_active (GTK_COMBO_BOX (dropdown), 1);
+ else
+ gtk_combo_box_set_active (GTK_COMBO_BOX (dropdown), 0);
diff --git a/SOURCES/evolution-3.28.5-frame-flattenning.patch b/SOURCES/evolution-3.28.5-frame-flattenning.patch
new file mode 100644
index 0000000..6ae018c
--- /dev/null
+++ b/SOURCES/evolution-3.28.5-frame-flattenning.patch
@@ -0,0 +1,395 @@
+diff -up evolution-3.28.5/data/webview.css.frame-flattenning evolution-3.28.5/data/webview.css
+--- evolution-3.28.5/data/webview.css.frame-flattenning 2018-07-30 15:37:05.000000000 +0200
++++ evolution-3.28.5/data/webview.css 2022-09-14 11:12:42.996943588 +0200
+@@ -8,8 +8,8 @@ img {
+ }
+
+ body {
+- /* Use margin so that children can safely use width=100% */
+- margin: 5px 10px 5px 10px;
++ /* Use padding so that children can safely use width=100% */
++ padding: 8px;
+ }
+
+ th {
+@@ -30,21 +30,21 @@ img#__evo-contact-photo {
+
+ img.navigable {
+ cursor: pointer;
+- margin-right: 4px;
++ padding-right: 4px;
+ }
+
+ .attachments {
+ background: #FFF;
+ border: 1px solid silver;
+- margin: 10px 10px 10px 10px;
++ padding: 10px 10px 10px 10px;
+ border-left: 0;
+ border-right: 0;
+ border-bottom: 0;
+ }
+
+ .attachment {
+- margin-left: 8px;
+- margin-right: 0px;
++ padding-left: 8px;
++ padding-right: 0px;
+ }
+
+ .attachment td {
+@@ -58,21 +58,21 @@ iframe:not([id$=".itip"]) {
+
+ .part-container {
+ height: 100%;
+- margin-top: 2px;
+- margin-bottom: 2px;
++ padding: 0px;
+ }
+
+ .part-container-nostyle iframe {
+- margin-right: 10px;
++ margin: 0px;
++ padding: 0px;
+ }
+
+ .part-container-inner-margin {
+- margin: 8px;
++ padding: 0px;
+ }
+
+ object { /* GtkWidgets */
+- margin-top: 2px;
+- margin-bottom: 2px;
++ padding-top: 2px;
++ padding-bottom: 2px;
+ }
+
+ .__evo-highlight {
+@@ -139,7 +139,7 @@ th.rtl {
+ /***** PRINTING *******/
+
+ .printing-header {
+- margin-bottom: 20px;
++ padding-bottom: 20px;
+ }
+
+ .printing-header h1,
+@@ -159,7 +159,7 @@ th.rtl {
+ /******* ITIP *********/
+ .itip.icon {
+ float: left;
+- margin-right: 5px;
++ padding-right: 5px;
+ }
+
+ .itip.content {
+@@ -168,7 +168,7 @@ th.rtl {
+ }
+
+ .itip.description {
+- margin: 5px;
++ padding: 5px;
+ }
+
+ .itip tr {
+@@ -192,7 +192,7 @@ th.rtl {
+ }
+
+ #table_row_buttons img {
+- margin-right: 5px;
++ padding-right: 5px;
+ vertical-align: middle;
+ }
+
+diff -up evolution-3.28.5/src/em-format/e-mail-formatter-text-plain.c.frame-flattenning evolution-3.28.5/src/em-format/e-mail-formatter-text-plain.c
+--- evolution-3.28.5/src/em-format/e-mail-formatter-text-plain.c.frame-flattenning 2018-07-30 15:37:05.000000000 +0200
++++ evolution-3.28.5/src/em-format/e-mail-formatter-text-plain.c 2022-09-14 11:12:42.996943588 +0200
+@@ -111,7 +111,7 @@ emfe_text_plain_format (EMailFormatterEx
+ string =
+ "
";
++ "style=\"border: none; padding: 0px; margin: 0;\">";
+
+ g_output_stream_write_all (
+ stream, string, strlen (string),
+diff -up evolution-3.28.5/src/mail/e-mail-display.c.frame-flattenning evolution-3.28.5/src/mail/e-mail-display.c
+--- evolution-3.28.5/src/mail/e-mail-display.c.frame-flattenning 2018-07-30 15:37:05.000000000 +0200
++++ evolution-3.28.5/src/mail/e-mail-display.c 2022-09-14 11:12:42.997943589 +0200
+@@ -1529,6 +1529,19 @@ mail_display_set_fonts (EWebView *web_vi
+ mail_display_get_font_settings (display->priv->settings, monospace, variable);
+ }
+
++static gboolean
++mail_display_can_use_frame_flattening (void)
++{
++ guint wk_major, wk_minor;
++
++ wk_major = webkit_get_major_version ();
++ wk_minor = webkit_get_minor_version ();
++
++ /* The 2.38 is the last version, which supports frame-flattening;
++ prefer it over the manual and expensive calculations. */
++ return (wk_major < 2) || (wk_major == 2 && wk_minor <= 38);
++}
++
+ static void
+ mail_display_web_view_initialize (WebKitWebView *web_view)
+ {
+@@ -1536,9 +1549,11 @@ mail_display_web_view_initialize (WebKit
+
+ webkit_settings = webkit_web_view_get_settings (web_view);
+
+- g_object_set (webkit_settings,
+- "enable-frame-flattening", TRUE,
+- NULL);
++ if (mail_display_can_use_frame_flattening ()) {
++ g_object_set (webkit_settings,
++ "enable-frame-flattening", TRUE,
++ NULL);
++ }
+ }
+
+ static void
+diff -up evolution-3.28.5/src/modules/text-highlight/e-mail-formatter-text-highlight.c.frame-flattenning evolution-3.28.5/src/modules/text-highlight/e-mail-formatter-text-highlight.c
+--- evolution-3.28.5/src/modules/text-highlight/e-mail-formatter-text-highlight.c.frame-flattenning 2018-07-30 15:37:05.000000000 +0200
++++ evolution-3.28.5/src/modules/text-highlight/e-mail-formatter-text-highlight.c 2022-09-14 11:12:42.997943589 +0200
+@@ -122,16 +122,26 @@ text_hightlight_read_data_thread (gpoint
+ {
+ TextHighlightClosure *closure = user_data;
+ gint nbuffer = 10240;
++ gssize read;
++ gsize wrote = 0;
+ gchar *buffer;
+
+ g_return_val_if_fail (closure != NULL, NULL);
+
+ buffer = g_new (gchar, nbuffer);
+
++ strcpy (buffer, "");
++ read = strlen (buffer);
++
++ if (!g_output_stream_write_all (closure->output_stream, buffer, read, &wrote, closure->cancellable, &closure->error) ||
++ (gssize) wrote != read || closure->error) {
++ g_free (buffer);
++ return NULL;
++ }
++
+ while (!camel_stream_eos (closure->read_stream) &&
+ !g_cancellable_set_error_if_cancelled (closure->cancellable, &closure->error)) {
+- gssize read;
+- gsize wrote = 0;
++ wrote = 0;
+
+ read = camel_stream_read (closure->read_stream, buffer, nbuffer, closure->cancellable, &closure->error);
+ if (read < 0 || closure->error)
+diff -up evolution-3.28.5/src/web-extensions/e-dom-utils.c.frame-flattenning evolution-3.28.5/src/web-extensions/e-dom-utils.c
+--- evolution-3.28.5/src/web-extensions/e-dom-utils.c.frame-flattenning 2018-07-30 15:37:05.000000000 +0200
++++ evolution-3.28.5/src/web-extensions/e-dom-utils.c 2022-09-14 11:12:42.997943589 +0200
+@@ -837,9 +837,8 @@ set_iframe_and_body_width (WebKitDOMDocu
+ gchar *style;
+
+ /* Message main body */
+- local_width -= 8; /* 8 + 8 margins of body without iframes */
+- if (level > 1)
+- local_width -= 8;
++ local_width -= level * 20; /* 10 + 10 margins of body without iframes */
++ local_width -= 4;
+
+ style = g_strdup_printf ("width: %" G_GINT64_FORMAT "px;", local_width);
+ e_dom_utils_add_css_rule_into_style_sheet_in_document (
+@@ -867,7 +866,7 @@ set_iframe_and_body_width (WebKitDOMDocu
+ style);
+ g_free (style);
+
+- local_width -= 2; /* 1 + 1 frame borders */
++ local_width -= 4; /* 2 + 2 frame borders */
+
+ style = g_strdup_printf ("width: %" G_GINT64_FORMAT "px;", local_width);
+ e_dom_utils_add_css_rule_into_style_sheet_in_document (
+@@ -891,15 +890,11 @@ set_iframe_and_body_width (WebKitDOMDocu
+ } else {
+ gchar *style;
+
+- local_width -= 20; /* 10 + 10 margins of body with iframes */
+- local_width -= 8; /* attachment margin */
+- local_width -= 2; /* 1 + 1 frame borders */
++ local_width -= (level - 1) * 20; /* 10 + 10 margins of body with iframes */
++ local_width -= 4; /* 2 + 2 frame borders */
++ local_width -= 10; /* attachment margin */
+
+- /* We need to subtract another 10 pixels from the iframe width to
+- * have the iframe's borders on the correct place. We can't subtract
+- * it from local_width as we don't want to propagate this change
+- * further. */
+- style = g_strdup_printf ("width: %" G_GINT64_FORMAT "px;", local_width - 10);
++ style = g_strdup_printf ("width: %" G_GINT64_FORMAT "px;", local_width);
+ e_dom_utils_add_css_rule_into_style_sheet_in_document (
+ document,
+ "-e-mail-formatter-style-sheet",
+@@ -933,7 +928,7 @@ set_iframe_and_body_width (WebKitDOMDocu
+ if (level == 0) {
+ gchar *style = NULL;
+
+- tmp_local_width -= 8; /* attachment's margin */
++ tmp_local_width -= 10; /* attachment's margin */
+
+ style = g_strdup_printf ("width: %" G_GINT64_FORMAT "px;", tmp_local_width);
+ e_dom_utils_add_css_rule_into_style_sheet_in_document (
+@@ -947,9 +942,7 @@ set_iframe_and_body_width (WebKitDOMDocu
+ "-e-mail-formatter-style-sheet",
+ ".attachment-wrapper iframe[src*=\"__formatas=txt\"]",
+ style);
+- g_free (style);
+
+- style = g_strdup_printf ("width: %" G_GINT64_FORMAT "px;", local_width);
+ e_dom_utils_add_css_rule_into_style_sheet_in_document (
+ document,
+ "-e-mail-formatter-style-sheet",
+@@ -992,8 +985,10 @@ dom_window_resize_cb (WebKitDOMDOMWindow
+
+ document = webkit_dom_dom_window_get_document (dom_window);
+
+- if (document)
++ if (document) {
+ e_dom_resize_document_content_to_preview_width (document);
++ e_dom_update_iframe_height (document);
++ }
+ }
+
+ static gboolean
+@@ -1106,6 +1101,7 @@ e_dom_utils_e_mail_display_bind_dom (Web
+ e_dom_wrap_long_anchors (document);
+
+ e_dom_resize_document_content_to_preview_width (document);
++ e_dom_update_iframe_height (document);
+ }
+
+ void
+@@ -1160,6 +1156,99 @@ e_dom_utils_e_mail_display_unstyle_block
+ g_clear_object (&collection);
+ }
+
++static void
++e_dom_update_iframe_height_recursive (WebKitDOMDocument *document)
++{
++ WebKitDOMHTMLCollection *frames = NULL;
++ WebKitDOMHTMLElement *body;
++ gulong ii, length;
++
++ frames = webkit_dom_document_get_elements_by_tag_name_as_html_collection (document, "iframe");
++ length = webkit_dom_html_collection_get_length (frames);
++ for (ii = 0; ii < length; ii++) {
++ WebKitDOMHTMLIFrameElement *iframe;
++ WebKitDOMDocument *content_document;
++
++ iframe = WEBKIT_DOM_HTML_IFRAME_ELEMENT (webkit_dom_html_collection_item (frames, ii));
++
++ content_document = webkit_dom_html_iframe_element_get_content_document (iframe);
++ if (!content_document)
++ continue;
++
++ e_dom_update_iframe_height_recursive (content_document);
++ }
++
++ body = webkit_dom_document_get_body (document);
++ if (body) {
++ WebKitDOMDOMWindow *default_view;
++
++ default_view = webkit_dom_document_get_default_view (document);
++ if (default_view) {
++ WebKitDOMElement *frame_elem;
++
++ frame_elem = webkit_dom_dom_window_get_frame_element (default_view);
++ if (frame_elem) {
++ WebKitDOMHTMLIFrameElement *iframe = WEBKIT_DOM_HTML_IFRAME_ELEMENT (frame_elem);
++ WebKitDOMElement *body_elem = WEBKIT_DOM_ELEMENT (body);
++ glong scroll_height;
++ gchar *height;
++
++ scroll_height = webkit_dom_element_get_scroll_height (body_elem);
++ height = webkit_dom_html_iframe_element_get_height (iframe);
++ if (!height || scroll_height != (glong) g_ascii_strtoll (height, NULL, 10))
++ webkit_dom_html_iframe_element_set_height (iframe, "10");
++ g_free (height);
++
++ height = g_strdup_printf ("%" G_GINT64_FORMAT, (gint64) (scroll_height + 2 +
++ (webkit_dom_element_get_scroll_width (body_elem) > webkit_dom_element_get_client_width (body_elem) ? 20 : 0)));
++ webkit_dom_html_iframe_element_set_height (iframe, height);
++ g_free (height);
++ }
++ }
++
++ g_clear_object (&default_view);
++ }
++
++ g_clear_object (&frames);
++}
++
++static gboolean
++mail_display_can_use_frame_flattening (void)
++{
++ guint wk_major, wk_minor;
++
++ wk_major = webkit_get_major_version ();
++ wk_minor = webkit_get_minor_version ();
++
++ /* The 2.38 is the last version, which supports frame-flattening;
++ prefer it over the manual and expensive calculations. */
++ return (wk_major < 2) || (wk_major == 2 && wk_minor <= 38);
++}
++
++void
++e_dom_update_iframe_height (WebKitDOMDocument *document)
++{
++ WebKitDOMDOMWindow *default_view;
++
++ if (mail_display_can_use_frame_flattening ())
++ return;
++
++ default_view = webkit_dom_document_get_default_view (document);
++ if (default_view) {
++ glong scroll_x, scroll_y;
++
++ scroll_x = webkit_dom_dom_window_get_scroll_x (default_view);
++ scroll_y = webkit_dom_dom_window_get_scroll_y (default_view);
++
++ e_dom_update_iframe_height_recursive (document);
++
++ if (scroll_y != webkit_dom_dom_window_get_scroll_y (default_view))
++ webkit_dom_dom_window_scroll_to (default_view, scroll_x, scroll_y);
++ }
++
++ g_clear_object (&default_view);
++}
++
+ void
+ e_dom_utils_eab_contact_formatter_bind_dom (WebKitDOMDocument *document)
+ {
+diff -up evolution-3.28.5/src/web-extensions/e-dom-utils.h.frame-flattenning evolution-3.28.5/src/web-extensions/e-dom-utils.h
+--- evolution-3.28.5/src/web-extensions/e-dom-utils.h.frame-flattenning 2018-07-30 15:37:05.000000000 +0200
++++ evolution-3.28.5/src/web-extensions/e-dom-utils.h 2022-09-14 11:12:42.997943589 +0200
+@@ -69,6 +69,7 @@ void e_dom_utils_e_mail_display_bind_do
+ GDBusConnection *connection);
+ void e_dom_utils_e_mail_display_unstyle_blockquotes
+ (WebKitDOMDocument *document);
++void e_dom_update_iframe_height (WebKitDOMDocument *document);
+ WebKitDOMElement *
+ e_dom_utils_find_element_by_selector
+ (WebKitDOMDocument *document,
+diff -up evolution-3.28.5/src/web-extensions/e-web-extension.c.frame-flattenning evolution-3.28.5/src/web-extensions/e-web-extension.c
+--- evolution-3.28.5/src/web-extensions/e-web-extension.c.frame-flattenning 2018-07-30 15:37:05.000000000 +0200
++++ evolution-3.28.5/src/web-extensions/e-web-extension.c 2022-09-14 11:12:42.997943589 +0200
+@@ -613,8 +613,10 @@ handle_method_call (GDBusConnection *con
+
+ e_dom_utils_hide_element (document, element_id, hidden);
+
+- if (expand_inner_data)
++ if (expand_inner_data) {
+ e_dom_resize_document_content_to_preview_width (document);
++ e_dom_update_iframe_height (document);
++ }
+ }
+
+ g_dbus_method_invocation_return_value (invocation, NULL);
diff --git a/SPECS/evolution.spec b/SPECS/evolution.spec
index 58c6ca7..a409585 100644
--- a/SPECS/evolution.spec
+++ b/SPECS/evolution.spec
@@ -31,7 +31,7 @@
Name: evolution
Version: 3.28.5
-Release: 18%{?dist}
+Release: 20%{?dist}
Group: Applications/Productivity
Summary: Mail and calendar client for GNOME
License: GPLv2+ and GFDL
@@ -96,6 +96,12 @@ Patch13: evolution-3.28.5-webkitgtk-2.30.patch
# RH bug #1972749
Patch14: evolution-3.28.5-cmake-variable-name-comparison.patch
+# RH bug #2126523
+Patch15: evolution-3.28.5-frame-flattenning.patch
+
+# RH bug #2127019
+Patch16: evolution-3.28.5-contacts-prefer-orig-value.patch
+
## Dependencies ###
Requires: %{_bindir}/killall
@@ -280,6 +286,8 @@ the functionality of the installed %{name} package.
%patch12 -p1 -b .ecalendaritem-settings
%patch13 -p1 -b .webkitgtk-2.30
%patch14 -p1 -b .cmake-variable-name-comparison
+%patch15 -p1 -b .frame-flattenning
+%patch16 -p1 -b .contacts-prefer-orig-value
# Remove the welcome email from Novell
for inbox in src/mail/default/*/Inbox; do
@@ -578,6 +586,12 @@ grep -v "/usr/share/locale" evolution.lang > help.lang
%endif
%changelog
+* Thu Sep 15 2022 Milan Crha - 3.28.5-20
+- Resolves: #2127019 (Contacts: Prefer original value only when filled on contact merge)
+
+* Wed Sep 14 2022 Milan Crha - 3.28.5-19
+- Resolves: #2126523 (Add patch to handle frame flattening change in WebKitGTK)
+
* Wed Jun 16 2021 Milan Crha - 3.28.5-18
- Resolves: #1972749 (PrintableOptions.cmake: Correct variable name comparison)