diff options
author | Tomas Popela <tpopela@redhat.com> | 2014-07-28 19:14:38 +0800 |
---|---|---|
committer | Tomas Popela <tpopela@redhat.com> | 2014-07-29 00:37:16 +0800 |
commit | d70120c774c68a16b78ce1f830ee55804be9b69e (patch) | |
tree | 825c3726868ef6ab2a554d6aeb8262381a6851ea /e-util/e-html-editor-view.c | |
parent | b2096647958179906a4ff88c1ed0f58f160cc2dd (diff) | |
download | gsoc2013-evolution-d70120c774c68a16b78ce1f830ee55804be9b69e.tar gsoc2013-evolution-d70120c774c68a16b78ce1f830ee55804be9b69e.tar.gz gsoc2013-evolution-d70120c774c68a16b78ce1f830ee55804be9b69e.tar.bz2 gsoc2013-evolution-d70120c774c68a16b78ce1f830ee55804be9b69e.tar.lz gsoc2013-evolution-d70120c774c68a16b78ce1f830ee55804be9b69e.tar.xz gsoc2013-evolution-d70120c774c68a16b78ce1f830ee55804be9b69e.tar.zst gsoc2013-evolution-d70120c774c68a16b78ce1f830ee55804be9b69e.zip |
Bug 733825 - Busy loop/deadlock when changing paragraph style in quoted part
We have to insert the text node that marks the end of the block on
right position.
Diffstat (limited to 'e-util/e-html-editor-view.c')
-rw-r--r-- | e-util/e-html-editor-view.c | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/e-util/e-html-editor-view.c b/e-util/e-html-editor-view.c index a26d79b3ad..e857a308a5 100644 --- a/e-util/e-html-editor-view.c +++ b/e-util/e-html-editor-view.c @@ -209,6 +209,24 @@ html_editor_view_should_show_delete_interface_for_element (EHTMLEditorView *view return FALSE; } +static WebKitDOMElement * +get_parent_block_element (WebKitDOMNode *node) +{ + WebKitDOMElement *parent = webkit_dom_node_get_parent_element (node); + + while (parent && + !WEBKIT_DOM_IS_HTML_DIV_ELEMENT (parent) && + !WEBKIT_DOM_IS_HTML_QUOTE_ELEMENT (parent) && + !WEBKIT_DOM_IS_HTMLU_LIST_ELEMENT (parent) && + !WEBKIT_DOM_IS_HTMLO_LIST_ELEMENT (parent) && + !WEBKIT_DOM_IS_HTML_PRE_ELEMENT (parent)) { + parent = webkit_dom_node_get_parent_element ( + WEBKIT_DOM_NODE (parent)); + } + + return parent; +} + void e_html_editor_view_force_spell_check_for_current_paragraph (EHTMLEditorView *view) { @@ -249,24 +267,13 @@ e_html_editor_view_force_spell_check_for_current_paragraph (EHTMLEditorView *vie view, html_editor_view_selection_changed_cb, NULL); e_html_editor_selection_block_selection_changed (selection); - parent = webkit_dom_node_get_parent_element ( - WEBKIT_DOM_NODE (selection_start_marker)); - - while (parent && - !WEBKIT_DOM_IS_HTML_DIV_ELEMENT (parent) && - !WEBKIT_DOM_IS_HTML_QUOTE_ELEMENT (parent) && - !WEBKIT_DOM_IS_HTMLU_LIST_ELEMENT (parent) && - !WEBKIT_DOM_IS_HTMLO_LIST_ELEMENT (parent) && - !WEBKIT_DOM_IS_HTML_PRE_ELEMENT (parent)) { - parent = webkit_dom_node_get_parent_element ( - WEBKIT_DOM_NODE (parent)); - } + parent = get_parent_block_element (WEBKIT_DOM_NODE (selection_start_marker)); /* Append some text on the end of the element */ text = webkit_dom_document_create_text_node (document, "-x-evo-end"); webkit_dom_node_append_child ( - webkit_dom_node_get_parent_node ( - WEBKIT_DOM_NODE (selection_end_marker)), + WEBKIT_DOM_NODE (get_parent_block_element ( + WEBKIT_DOM_NODE (selection_end_marker))), WEBKIT_DOM_NODE (text), NULL); |