[evolution/wip/webkit2] Bug 752997 - Crash when replying to the message



commit b48ccf8bf3ff1ae0c074b8c3dfbe170703a21d6e
Author: Tomas Popela <tpopela redhat com>
Date:   Fri Feb 26 13:23:52 2016 +0100

    Bug 752997 - Crash when replying to the message

 .../composer/e-html-editor-view-dom-functions.c    |   40 ++++++++++++++++++++
 1 files changed, 40 insertions(+), 0 deletions(-)
---
diff --git a/web-extensions/composer/e-html-editor-view-dom-functions.c 
b/web-extensions/composer/e-html-editor-view-dom-functions.c
index dd30788..cee32e8 100644
--- a/web-extensions/composer/e-html-editor-view-dom-functions.c
+++ b/web-extensions/composer/e-html-editor-view-dom-functions.c
@@ -6898,6 +6898,19 @@ dom_process_content_for_html (WebKitDOMDocument *document,
        }
        g_object_unref (list);
 
+       list = webkit_dom_element_query_selector_all (
+               WEBKIT_DOM_ELEMENT (node), "[data-style]", NULL);
+       length = webkit_dom_node_list_get_length (list);
+       for (ii = 0; ii < length; ii++) {
+               WebKitDOMNode *data_style_node;
+
+               data_style_node = webkit_dom_node_list_item (list, ii);
+
+               rename_attribute (WEBKIT_DOM_ELEMENT (data_style_node), "data-style", "style");
+               g_object_unref (data_style_node);
+       }
+       g_object_unref (list);
+
        process_elements (extension, node, FALSE, FALSE, NULL);
 
        html_content = webkit_dom_element_get_outer_html (
@@ -7083,6 +7096,8 @@ dom_process_content_after_load (WebKitDOMDocument *document,
 {
        WebKitDOMHTMLElement *body;
        WebKitDOMDOMWindow *dom_window;
+       WebKitDOMNodeList *list;
+       gint ii, length;
 
        /* Don't use CSS when possible to preserve compatibility with older
         * versions of Evolution or other MUAs */
@@ -7095,6 +7110,31 @@ dom_process_content_after_load (WebKitDOMDocument *document,
        webkit_dom_element_set_attribute (
                WEBKIT_DOM_ELEMENT (body), "data-message", "", NULL);
 
+       /* Workaround for https://bugzilla.gnome.org/show_bug.cgi?id=752997 where
+       * WebKit (2.4.9) crashes when it is trying to move or remove an anchor
+       * element that has an image element inside and this image element has
+       * the CSS float property set in the style attribute. To workaround it we
+       * will rename the style attribute and rename it back when we will send
+       * the message. It is unfortunate that we can change the formatting with
+       * this, but this is definitely better than crashing. This could be
+       * removed once Evolution switches to WebKit2 as the WebKit2 is unaffected
+       * (tested on 2.8.4). */
+       list = webkit_dom_document_query_selector_all (document, "a img[style]", NULL);
+       length = webkit_dom_node_list_get_length (list);
+       for (ii = 0; ii < length; ii++) {
+               WebKitDOMNode *node;
+               gchar *style_value;
+
+               node = webkit_dom_node_list_item (list, ii);
+               style_value = webkit_dom_element_get_attribute (WEBKIT_DOM_ELEMENT (node), "style");
+               if (camel_strstrcase (style_value, "float"))
+                       rename_attribute (WEBKIT_DOM_ELEMENT (node), "style", "data-style");
+               g_free (style_value);
+
+               g_object_unref (node);
+       }
+       g_object_unref (list);
+
        if (e_html_editor_web_extension_get_convert_in_situ (extension)) {
                dom_convert_content (document, extension, NULL);
                /* Make the quote marks non-selectable. */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]