[evolution/wip/webkit2] EHTMLEditorView - Pressing the Return key in the beginning of list item will delete the item



commit b83fd88bb1b294c493a16b0abb0f679fd7fa05c1
Author: Tomas Popela <tpopela redhat com>
Date:   Thu Mar 3 15:46:28 2016 +0100

    EHTMLEditorView - Pressing the Return key in the beginning of list item will delete the item

 .../composer/e-html-editor-view-dom-functions.c    |   27 ++++++++++---------
 1 files changed, 14 insertions(+), 13 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 1368888..eb9b108 100644
--- a/web-extensions/composer/e-html-editor-view-dom-functions.c
+++ b/web-extensions/composer/e-html-editor-view-dom-functions.c
@@ -8959,8 +8959,22 @@ selection_is_in_empty_list_item (WebKitDOMNode *selection_start_marker)
        gchar *text;
        WebKitDOMNode *sibling;
 
+       /* FIXME WK2 - useless expression*/
        sibling = webkit_dom_node_get_previous_sibling (WEBKIT_DOM_NODE (selection_start_marker));
 
+       /* Selection needs to be collapsed. */
+       sibling = webkit_dom_node_get_next_sibling (WEBKIT_DOM_NODE (selection_start_marker));
+       if (!dom_is_selection_position_node (sibling))
+               return FALSE;
+
+       /* After the selection end there could be just the BR element. */
+       sibling = webkit_dom_node_get_next_sibling (sibling);
+       if (sibling && !WEBKIT_DOM_IS_HTML_BR_ELEMENT (sibling))
+              return FALSE;
+
+       if (sibling && webkit_dom_node_get_next_sibling (sibling))
+               return FALSE;
+
        if (!sibling)
                return TRUE;
 
@@ -8982,19 +8996,6 @@ selection_is_in_empty_list_item (WebKitDOMNode *selection_start_marker)
 
        g_free (text);
 
-       /* Selection needs to be collapsed. */
-       sibling = webkit_dom_node_get_next_sibling (WEBKIT_DOM_NODE (selection_start_marker));
-       if (!dom_is_selection_position_node (sibling))
-               return FALSE;
-
-       /* After the selection end there could be just the BR element. */
-       sibling = webkit_dom_node_get_next_sibling (sibling);
-       if (sibling && !WEBKIT_DOM_IS_HTML_BR_ELEMENT (sibling))
-              return FALSE;
-
-       if (sibling && webkit_dom_node_get_next_sibling (sibling))
-               return FALSE;
-
        return TRUE;
 }
 


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