[evolution/wip/webkit2] Composer - Set GObject's data on history event instead on its data and rename them



commit d6763014303626617ea8d33faa3b6059a832620b
Author: Tomas Popela <tpopela redhat com>
Date:   Thu Mar 3 12:33:12 2016 +0100

    Composer - Set GObject's data on history event instead on its data and rename them

 .../composer/e-composer-private-dom-functions.c    |   15 +++++++--------
 .../composer/e-html-editor-undo-redo-manager.c     |   15 ++++++++-------
 .../composer/e-html-editor-view-dom-functions.c    |   17 ++++++++++-------
 3 files changed, 25 insertions(+), 22 deletions(-)
---
diff --git a/web-extensions/composer/e-composer-private-dom-functions.c 
b/web-extensions/composer/e-composer-private-dom-functions.c
index 4fdbf58..0a61a2e 100644
--- a/web-extensions/composer/e-composer-private-dom-functions.c
+++ b/web-extensions/composer/e-composer-private-dom-functions.c
@@ -360,8 +360,7 @@ insert_nbsp_history_event (WebKitDOMDocument *document,
        event->type = HISTORY_DELETE;
 
        if (delete)
-               g_object_set_data (
-                       G_OBJECT (fragment), "-x-evo-delete-key", GINT_TO_POINTER (1));
+               g_object_set_data (G_OBJECT (event), "history-delete-key", GINT_TO_POINTER (1));
 
        event->data.fragment = fragment;
 
@@ -473,7 +472,7 @@ dom_save_drag_and_drop_history (WebKitDOMDocument *document,
                /* Select the whole line (to the beginning of the next
                 * one so we can reuse the undo code while undoing this.
                 * Because of this we need to special mark the event
-                * with -x-evo-drag-and-drop to correct the selection
+                * with history-drag-and-drop to correct the selection
                 * after undoing it (otherwise the beginning of the next
                 * line will be selected as well. */
                webkit_dom_dom_selection_modify (
@@ -506,13 +505,13 @@ dom_save_drag_and_drop_history (WebKitDOMDocument *document,
                                webkit_dom_node_clone_node (tmp_block, FALSE),
                                NULL);
                        g_object_set_data (
-                               G_OBJECT (fragment),
-                               "-x-evo-drag-and-drop",
+                               G_OBJECT (event),
+                               "history-drag-and-drop",
                                GINT_TO_POINTER (1));
                        /* It should act as a Delete key press. */
-                       g_object_set_data (G_OBJECT (
-                               fragment),
-                               "-x-evo-delete-key",
+                       g_object_set_data (
+                               G_OBJECT (event),
+                               "history-delete-key",
                                GINT_TO_POINTER (1));
                }
        }
diff --git a/web-extensions/composer/e-html-editor-undo-redo-manager.c 
b/web-extensions/composer/e-html-editor-undo-redo-manager.c
index f947a30..0e68b9c 100644
--- a/web-extensions/composer/e-html-editor-undo-redo-manager.c
+++ b/web-extensions/composer/e-html-editor-undo-redo-manager.c
@@ -418,7 +418,7 @@ undo_delete (WebKitDOMDocument *document,
 
        /* Delete or BackSpace pressed in the beginning of a block or on its end. */
        if (event->type == HISTORY_DELETE && !single_block &&
-           g_object_get_data (G_OBJECT (event->data.fragment), "-x-evo-fragment")) {
+            g_object_get_data (G_OBJECT (event), "history-concatenating-blocks")) {
                WebKitDOMNode *node, *block;
 
                range = get_range_for_point (document, event->after.start);
@@ -491,7 +491,7 @@ undo_delete (WebKitDOMDocument *document,
 
        /* Redoing Return key press */
        if (event->type == HISTORY_INPUT && (empty ||
-           g_object_get_data (G_OBJECT (event->data.fragment), "-x-evo-return-key"))) {
+           g_object_get_data (G_OBJECT (event), "history-return-key"))) {
                if (key_press_event_process_return_key (document, extension)) {
                        body_key_up_event_process_return_key (document, extension);
                } else {
@@ -734,7 +734,7 @@ undo_delete (WebKitDOMDocument *document,
 
                /* If undoing drag and drop where the whole line was moved we need
                 * to correct the selection. */
-               if (g_object_get_data (G_OBJECT (event->data.fragment), "-x-evo-drag-and-drop") &&
+               if (g_object_get_data (G_OBJECT (event), "history-drag-and-drop") &&
                    (element = webkit_dom_document_get_element_by_id (document, 
"-x-evo-selection-end-marker"))) {
                        WebKitDOMNode *prev_block;
 
@@ -811,7 +811,7 @@ undo_delete (WebKitDOMDocument *document,
                                        webkit_dom_node_get_next_sibling (parent),
                                        NULL);
                        } else {
-                               if (g_object_get_data (G_OBJECT (event->data.fragment), 
"-x-evo-removing-from-anchor") ||
+                               if (g_object_get_data (G_OBJECT (event), "history-removing-from-anchor") ||
                                    !event_selection_was_collapsed (event)) {
                                        webkit_dom_node_insert_before (
                                                webkit_dom_node_get_parent_node (WEBKIT_DOM_NODE (element)),
@@ -898,8 +898,8 @@ redo_delete (WebKitDOMDocument *document,
        manager = e_html_editor_web_extension_get_undo_redo_manager (extension);
        restore_selection_to_history_event_state (document, event->before);
 
-       delete_key = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (event->data.fragment), 
"-x-evo-delete-key"));
-       control_key = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (event->data.fragment), 
"-x-evo-control-key"));
+       delete_key = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (event), "history-delete-key"));
+       control_key = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (event), "history-control-key"));
 
        if (!delete_key && key_press_event_process_backspace_key (document, extension))
                goto out;
@@ -922,7 +922,8 @@ redo_delete (WebKitDOMDocument *document,
         * is wrapped on multiple lines, the last line will by separated
         * by WebKit to the separate block. To avoid it let's remove
         * all quoting and wrapping from the next paragraph. */
-       if (delete_key && GPOINTER_TO_INT (g_object_get_data (G_OBJECT (event->data.fragment), 
"-x-evo-fragment"))) {
+       if (delete_key &&
+           GPOINTER_TO_INT (g_object_get_data (G_OBJECT (event), "history-concatenating-blocks"))) {
                WebKitDOMNode *current_block, *next_block, *node;
                WebKitDOMRange *range;
 
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 fc0e7fa..20bda86 100644
--- a/web-extensions/composer/e-html-editor-view-dom-functions.c
+++ b/web-extensions/composer/e-html-editor-view-dom-functions.c
@@ -2157,7 +2157,7 @@ save_history_for_input (WebKitDOMDocument *document,
                        offset - 1,
                        NULL);
        fragment = webkit_dom_range_clone_contents (range_clone, NULL);
-       /* We have to specialy handle Return key press */
+       /* We have to specially handle Return key press */
        if (e_html_editor_web_extension_get_return_key_pressed (extension)) {
                WebKitDOMElement *element_start, *element_end;
                WebKitDOMNode *parent_start, *parent_end, *node;
@@ -2219,7 +2219,7 @@ save_history_for_input (WebKitDOMDocument *document,
                remove_node (WEBKIT_DOM_NODE (element_end));
 
                g_object_set_data (
-                       G_OBJECT (fragment), "-x-evo-return-key", GINT_TO_POINTER (1));
+                       G_OBJECT (ev), "history-return-key", GINT_TO_POINTER (1));
 
 
                webkit_dom_dom_selection_modify (dom_selection, "move", "right", "character");
@@ -7926,8 +7926,8 @@ save_history_for_delete_or_backspace (WebKitDOMDocument *document,
                                                                        NULL);
                                                        }
                                                        g_object_set_data (
-                                                               G_OBJECT (fragment),
-                                                               "-x-evo-fragment",
+                                                               G_OBJECT (ev),
+                                                               "history-concatenating-blocks",
                                                                GINT_TO_POINTER (1));
                                                }
                                        }
@@ -7955,7 +7955,10 @@ save_history_for_delete_or_backspace (WebKitDOMDocument *document,
                if (!fragment)
                        fragment = webkit_dom_range_clone_contents (range_clone, NULL);
                if (removing_from_anchor)
-                       g_object_set_data (G_OBJECT (fragment), "-x-evo-removing-from-anchor", 
GINT_TO_POINTER (1));
+                       g_object_set_data (
+                               G_OBJECT (ev),
+                               "history-removing-from-anchor",
+                               GINT_TO_POINTER (1));
                node = webkit_dom_node_get_first_child (WEBKIT_DOM_NODE (fragment));
                if (!node) {
                        g_free (ev);
@@ -8197,8 +8200,8 @@ save_history_for_delete_or_backspace (WebKitDOMDocument *document,
        g_object_unref (range);
        g_object_unref (dom_selection);
 
-       g_object_set_data (G_OBJECT (fragment), "-x-evo-delete-key", GINT_TO_POINTER (delete_key));
-       g_object_set_data (G_OBJECT (fragment), "-x-evo-control-key", GINT_TO_POINTER (control_key));
+       g_object_set_data (G_OBJECT (ev), "history-delete-key", GINT_TO_POINTER (delete_key));
+       g_object_set_data (G_OBJECT (ev), "history-control-key", GINT_TO_POINTER (control_key));
 
        ev->data.fragment = fragment;
 


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