[evolution/wip/webkit-composer: 737/966] Check if node, that we are trying to edit is WEBKIKT_DOM_CHARACTER_DATA.



commit e8f9a51510b3e3afe11f5572c11308c8021e5e78
Author: Tomas Popela <tpopela redhat com>
Date:   Thu Jul 25 14:12:12 2013 +0200

    Check if node, that we are trying to edit is WEBKIKT_DOM_CHARACTER_DATA.

 e-util/e-editor-selection.c |   27 +++++++++++++++------------
 1 files changed, 15 insertions(+), 12 deletions(-)
---
diff --git a/e-util/e-editor-selection.c b/e-util/e-editor-selection.c
index 17875ef..fd237ea 100644
--- a/e-util/e-editor-selection.c
+++ b/e-util/e-editor-selection.c
@@ -3196,21 +3196,24 @@ e_editor_selection_wrap_lines (EEditorSelection *selection,
                /* If there is hidden space character in the beginning we remove it */
                if (strstr (webkit_dom_node_get_text_content (paragraph), UNICODE_HIDDEN_SPACE)) {
                        WebKitDOMNode *child = webkit_dom_node_get_first_child (paragraph);
-                       GRegex *regex;
-                       gchar *node_text;
 
-                       regex = g_regex_new (UNICODE_HIDDEN_SPACE, 0, 0, NULL);
-                       if (!regex)
-                               return;
+                       if (WEBKIT_DOM_IS_CHARACTER_DATA (child)) {
+                               GRegex *regex;
+                               gchar *node_text;
 
-                       node_text = webkit_dom_character_data_get_data (WEBKIT_DOM_CHARACTER_DATA (child));
-                       webkit_dom_character_data_set_data (
-                               WEBKIT_DOM_CHARACTER_DATA (child),
-                               g_regex_replace_literal (regex, node_text, -1, 0, "", 0, NULL),
-                               NULL);
+                               regex = g_regex_new (UNICODE_HIDDEN_SPACE, 0, 0, NULL);
+                               if (!regex)
+                                       return;
 
-                       g_free (node_text);
-                       g_regex_unref (regex);
+                               node_text = webkit_dom_character_data_get_data (WEBKIT_DOM_CHARACTER_DATA 
(child));
+                               webkit_dom_character_data_set_data (
+                                       WEBKIT_DOM_CHARACTER_DATA (child),
+                                       g_regex_replace_literal (regex, node_text, -1, 0, "", 0, NULL),
+                                       NULL);
+
+                               g_free (node_text);
+                               g_regex_unref (regex);
+                       }
                }
 
                if (previously_wrapped) {


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