[evolution/wip/webkit2] Cannot change order list to unordered for the first time



commit 123f438f6b87973d1bfe860c9677337765e386a1
Author: Tomas Popela <tpopela redhat com>
Date:   Tue May 31 10:38:58 2016 +0200

    Cannot change order list to unordered for the first time
    
    Return E_HTML_EDITOR_SELECTION_BLOCK_FORMAT_NONE when we are not able to
    determine a type of list instead of returning -1.

 .../e-html-editor-selection-dom-functions.c        |   21 ++++++++++---------
 web-extensions/e-dom-utils.c                       |   14 +++++++-----
 2 files changed, 19 insertions(+), 16 deletions(-)
---
diff --git a/modules/webkit-content-editor/web-extension/e-html-editor-selection-dom-functions.c 
b/modules/webkit-content-editor/web-extension/e-html-editor-selection-dom-functions.c
index 7616d45..65b4949 100644
--- a/modules/webkit-content-editor/web-extension/e-html-editor-selection-dom-functions.c
+++ b/modules/webkit-content-editor/web-extension/e-html-editor-selection-dom-functions.c
@@ -6014,17 +6014,18 @@ format_change_list_to_list (WebKitDOMDocument *document,
        prev = dom_get_list_format_from_node (prev_list);
        next = dom_get_list_format_from_node (next_list);
 
-       if (format == prev && format != -1 && prev != -1) {
-               if (selection_starts_in_first_child && selection_ends_in_last_child) {
-                       done = TRUE;
-                       merge_list_into_list (current_list, prev_list, FALSE);
+       if (format != E_CONTENT_EDITOR_BLOCK_FORMAT_NONE) {
+               if (format == prev && prev != E_CONTENT_EDITOR_BLOCK_FORMAT_NONE) {
+                       if (selection_starts_in_first_child && selection_ends_in_last_child) {
+                               done = TRUE;
+                               merge_list_into_list (current_list, prev_list, FALSE);
+                       }
                }
-       }
-
-       if (format == next && format != -1 && next != -1) {
-               if (selection_starts_in_first_child && selection_ends_in_last_child) {
-                       done = TRUE;
-                       merge_list_into_list (next_list, prev_list, FALSE);
+               if (format == next && next != E_CONTENT_EDITOR_BLOCK_FORMAT_NONE) {
+                       if (selection_starts_in_first_child && selection_ends_in_last_child) {
+                               done = TRUE;
+                               merge_list_into_list (next_list, prev_list, FALSE);
+                       }
                }
        }
 
diff --git a/web-extensions/e-dom-utils.c b/web-extensions/e-dom-utils.c
index 5fc4d03..f855c3f 100644
--- a/web-extensions/e-dom-utils.c
+++ b/web-extensions/e-dom-utils.c
@@ -1821,7 +1821,7 @@ dom_get_list_format_from_node (WebKitDOMNode *node)
                E_CONTENT_EDITOR_BLOCK_FORMAT_UNORDERED_LIST;
 
        if (WEBKIT_DOM_IS_HTML_LI_ELEMENT (node))
-               return -1;
+               return E_CONTENT_EDITOR_BLOCK_FORMAT_NONE;
 
        if (WEBKIT_DOM_IS_HTML_U_LIST_ELEMENT (node))
                return format;
@@ -1844,7 +1844,7 @@ dom_get_list_format_from_node (WebKitDOMNode *node)
                return format;
        }
 
-       return -1;
+       return E_CONTENT_EDITOR_BLOCK_FORMAT_NONE;
 }
 
 void
@@ -1886,11 +1886,13 @@ merge_lists_if_possible (WebKitDOMNode *list)
        prev = dom_get_list_format_from_node (prev_sibling);
        next = dom_get_list_format_from_node (next_sibling);
 
-       if (format == prev && format != -1 && prev != -1)
-               merge_list_into_list (prev_sibling, list, TRUE);
+       if (format != E_CONTENT_EDITOR_BLOCK_FORMAT_NONE) {
+               if (format == prev && prev != E_CONTENT_EDITOR_BLOCK_FORMAT_NONE)
+                       merge_list_into_list (prev_sibling, list, TRUE);
 
-       if (format == next && format != -1 && next != -1)
-               merge_list_into_list (next_sibling, list, FALSE);
+               if (format == next && next != E_CONTENT_EDITOR_BLOCK_FORMAT_NONE)
+                       merge_list_into_list (next_sibling, list, FALSE);
+       }
 
        lists = webkit_dom_element_query_selector_all (
                WEBKIT_DOM_ELEMENT (list), "ol + ol, ul + ul", NULL);


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