[evolution/wip/webkit2] EHTMLEditorSelection - Improve history selection saving on various places



commit 5111815b4e52573ce57a90add8c09ebb37e3475d
Author: Tomas Popela <tpopela redhat com>
Date:   Wed Feb 24 16:06:05 2016 +0100

    EHTMLEditorSelection - Improve history selection saving on various places

 .../e-html-editor-selection-dom-functions.c        |   45 ++++++++++----------
 1 files changed, 23 insertions(+), 22 deletions(-)
---
diff --git a/web-extensions/composer/e-html-editor-selection-dom-functions.c 
b/web-extensions/composer/e-html-editor-selection-dom-functions.c
index e0757d3..fed4ea0 100644
--- a/web-extensions/composer/e-html-editor-selection-dom-functions.c
+++ b/web-extensions/composer/e-html-editor-selection-dom-functions.c
@@ -899,20 +899,6 @@ dom_selection_indent (WebKitDOMDocument *document,
        dom_selection_save (document);
 
        manager = e_html_editor_web_extension_get_undo_redo_manager (extension);
-       if (!e_html_editor_undo_redo_manager_is_operation_in_progress (manager)) {
-               ev = g_new0 (EHTMLEditorHistoryEvent, 1);
-               ev->type = HISTORY_INDENT;
-
-               dom_selection_get_coordinates (
-                       document,
-                       &ev->before.start.x,
-                       &ev->before.start.y,
-                       &ev->before.end.x,
-                       &ev->before.end.y);
-
-               ev->data.style.from = 1;
-               ev->data.style.to = 1;
-       }
 
        selection_start_marker = webkit_dom_document_query_selector (
                document, "span#-x-evo-selection-start-marker", NULL);
@@ -935,6 +921,21 @@ dom_selection_indent (WebKitDOMDocument *document,
                        &selection_end_marker);
        }
 
+       if (!e_html_editor_undo_redo_manager_is_operation_in_progress (manager)) {
+               ev = g_new0 (EHTMLEditorHistoryEvent, 1);
+               ev->type = HISTORY_INDENT;
+
+               dom_selection_get_coordinates (
+                       document,
+                       &ev->before.start.x,
+                       &ev->before.start.y,
+                       &ev->before.end.x,
+                       &ev->before.end.y);
+
+               ev->data.style.from = 1;
+               ev->data.style.to = 1;
+       }
+
        block = get_parent_indented_block (
                WEBKIT_DOM_NODE (selection_start_marker));
        if (!block)
@@ -5216,6 +5217,14 @@ dom_selection_set_alignment (WebKitDOMDocument *document,
 
        dom_selection_save (document);
 
+       selection_start_marker = webkit_dom_document_query_selector (
+               document, "span#-x-evo-selection-start-marker", NULL);
+       selection_end_marker = webkit_dom_document_query_selector (
+               document, "span#-x-evo-selection-end-marker", NULL);
+
+       if (!selection_start_marker)
+               return;
+
        manager = e_html_editor_web_extension_get_undo_redo_manager (extension);
        if (!e_html_editor_undo_redo_manager_is_operation_in_progress (manager)) {
                ev = g_new0 (EHTMLEditorHistoryEvent, 1);
@@ -5231,14 +5240,6 @@ dom_selection_set_alignment (WebKitDOMDocument *document,
                ev->data.style.to = alignment;
         }
 
-       selection_start_marker = webkit_dom_document_query_selector (
-               document, "span#-x-evo-selection-start-marker", NULL);
-       selection_end_marker = webkit_dom_document_query_selector (
-               document, "span#-x-evo-selection-end-marker", NULL);
-
-       if (!selection_start_marker)
-               return;
-
        block = 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]