From 56f8ae3a3f68dfebe4d6f226fc63f6de438c64e0 Mon Sep 17 00:00:00 2001 From: Tomas Popela Date: Thu, 7 Aug 2014 11:30:53 +0200 Subject: EHTMLEditorSelection - Fix the unindentation of the list --- e-util/e-html-editor-selection.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/e-util/e-html-editor-selection.c b/e-util/e-html-editor-selection.c index aadcef5171..47aeecf0e3 100644 --- a/e-util/e-html-editor-selection.c +++ b/e-util/e-html-editor-selection.c @@ -1708,6 +1708,15 @@ remove_quoting_from_element (WebKitDOMElement *element) webkit_dom_node_normalize (WEBKIT_DOM_NODE (element)); } +static gboolean +node_is_list_or_item (WebKitDOMNode *node) +{ + return node && ( + WEBKIT_DOM_IS_HTMLO_LIST_ELEMENT (node) || + WEBKIT_DOM_IS_HTMLU_LIST_ELEMENT (node) || + WEBKIT_DOM_IS_HTMLLI_ELEMENT (node)); +} + static gboolean node_is_list (WebKitDOMNode *node) { @@ -2810,7 +2819,7 @@ e_html_editor_selection_indent (EHTMLEditorSelection *selection) block, WEBKIT_DOM_NODE (selection_end_marker)); length = webkit_dom_node_list_get_length (list); - if (length == 0 && node_is_list (block)) { + if (length == 0 && node_is_list_or_item (block)) { indent_list (selection, document); if (!after_selection_end) { block = next_block; @@ -3150,7 +3159,7 @@ e_html_editor_selection_unindent (EHTMLEditorSelection *selection) block, WEBKIT_DOM_NODE (selection_end_marker)); length = webkit_dom_node_list_get_length (list); - if (length == 0 && node_is_list (block)) { + if (length == 0 && node_is_list_or_item (block)) { unindent_list (selection, document); if (!after_selection_end) { block = next_block; @@ -5722,9 +5731,7 @@ e_html_editor_selection_wrap_paragraph (EHTMLEditorSelection *selection, indentation_level = get_indentation_level (paragraph); citation_level = get_citation_level (WEBKIT_DOM_NODE (paragraph)); - if (node_is_list (WEBKIT_DOM_NODE (paragraph)) || - WEBKIT_DOM_IS_HTMLLI_ELEMENT (paragraph)) { - + if (node_is_list_or_item (WEBKIT_DOM_NODE (paragraph))) { gint list_level = get_list_level (WEBKIT_DOM_NODE (paragraph)); indentation_level = 0; -- cgit v1.2.3