[evolution/gnome-3-18] Bug 757348 - Endless loop in webkit_dom_node_append_child(): assertion 'WEBKIT_DOM_IS_NODE(self)' fa



commit d967f4ef7662022ed7a1608b0288c17bd478fdfb
Author: Tomas Popela <tpopela redhat com>
Date:   Mon Nov 2 14:38:51 2015 +0100

    Bug 757348 - Endless loop in webkit_dom_node_append_child(): assertion 'WEBKIT_DOM_IS_NODE(self)' failed
    
    The main cause was that after modifying/deleting an original quoted content
    there were some empty blockquote elements left and they caused the Evolution to
    misbehave. It showed up that we are not removing the empty blockquotes after
    deleting/modifying a quoted content, but only empty blocks inside them. Correct
    the remove_empty_blocks to remove the empty blockquotes as well.
    
    The loop took a place in the remove_wrapping_from_element function. To avoid it
    return early if we pass an empty element to it and apply the same to
    remove_quoting_from_element.

 e-util/e-html-editor-selection.c |    4 ++++
 e-util/e-html-editor-view.c      |   12 ++++++++++++
 2 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/e-util/e-html-editor-selection.c b/e-util/e-html-editor-selection.c
index a27b148..57a52d4 100644
--- a/e-util/e-html-editor-selection.c
+++ b/e-util/e-html-editor-selection.c
@@ -2042,6 +2042,8 @@ remove_wrapping_from_element (WebKitDOMElement *element)
        WebKitDOMNodeList *list;
        gint ii, length;
 
+       g_return_if_fail (element != NULL);
+
        list = webkit_dom_element_query_selector_all (
                element, "br.-x-evo-wrap-br", NULL);
        length = webkit_dom_node_list_get_length (list);
@@ -2082,6 +2084,8 @@ remove_quoting_from_element (WebKitDOMElement *element)
        gint ii, length;
        WebKitDOMNodeList *list;
 
+       g_return_if_fail (element != NULL);
+
        list = webkit_dom_element_query_selector_all (
                element, "span.-x-evo-quoted", NULL);
        length = webkit_dom_node_list_get_length (list);
diff --git a/e-util/e-html-editor-view.c b/e-util/e-html-editor-view.c
index 2011413..c7ab676 100644
--- a/e-util/e-html-editor-view.c
+++ b/e-util/e-html-editor-view.c
@@ -3097,6 +3097,16 @@ remove_empty_blocks (WebKitDOMDocument *document)
                g_object_unref (node);
        }
 
+       list = webkit_dom_document_query_selector_all (
+               document, "blockquote[type=cite]:empty", NULL);
+
+       length = webkit_dom_node_list_get_length (list);
+       for  (ii = 0; ii < length; ii++) {
+               WebKitDOMNode *node = webkit_dom_node_list_item (list, ii);
+               remove_node (node);
+               g_object_unref (node);
+       }
+
        g_object_unref (list);
 }
 
@@ -5600,6 +5610,8 @@ key_press_event_process_delete_or_backspace_key (EHTMLEditorView *view,
                        return FALSE;
                }
 
+               remove_empty_blocks (document);
+
                block = e_html_editor_get_parent_block_node_from_child (
                        WEBKIT_DOM_NODE (selection_start_marker));
 


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