[evolution/wip/webkit-composer: 354/372] EEditorSelection: Fix disabling of TT font



commit a4285c043b531bfe9b7e25939c5e7d07bc870ba0
Author: Tomas Popela <tpopela redhat com>
Date:   Tue Jan 28 14:47:56 2014 +0100

    EEditorSelection: Fix disabling of TT font
    
    Also remove unneeded check for UNICODE_ZERO_WIDTH_SPACE

 e-util/e-editor-selection.c |   19 ++++---------------
 1 files changed, 4 insertions(+), 15 deletions(-)
---
diff --git a/e-util/e-editor-selection.c b/e-util/e-editor-selection.c
index 73b7376..a2c38f7 100644
--- a/e-util/e-editor-selection.c
+++ b/e-util/e-editor-selection.c
@@ -2379,11 +2379,12 @@ e_editor_selection_set_monospaced (EEditorSelection *selection,
                WebKitDOMNode *node;
 
                node = webkit_dom_range_get_end_container (range, NULL);
-               if (element_has_tag (WEBKIT_DOM_ELEMENT (node), "tt"))
+               if (WEBKIT_DOM_IS_ELEMENT (node) &&
+                   element_has_tag (WEBKIT_DOM_ELEMENT (node), "tt"))
                        tt_element = WEBKIT_DOM_ELEMENT (node);
                else {
                        tt_element = webkit_dom_node_get_parent_element (node);
-                       if (!element_has_tag (WEBKIT_DOM_ELEMENT (node), "tt")) {
+                       if (!element_has_tag (WEBKIT_DOM_ELEMENT (tt_element), "tt")) {
                                g_object_unref (editor_widget);
                                return;
                        }
@@ -2440,22 +2441,11 @@ e_editor_selection_set_monospaced (EEditorSelection *selection,
                        g_free (end);
                } else {
                        WebKitDOMRange *new_range;
-                       gchar *outer_html, *inner_html;
+                       gchar *outer_html;
                        gchar *tmp;
-                       GString *result;
 
                        webkit_dom_element_set_id (tt_element, "ev-tt");
 
-                       inner_html = webkit_dom_html_element_get_inner_html (WEBKIT_DOM_HTML_ELEMENT 
(tt_element));
-                       result = e_str_replace_string (inner_html, UNICODE_ZERO_WIDTH_SPACE, "");
-                       if (result) {
-                               webkit_dom_html_element_set_inner_html (
-                                       WEBKIT_DOM_HTML_ELEMENT (tt_element),
-                                       result->str,
-                                       NULL);
-                               g_string_free (result, TRUE);
-                       }
-
                        outer_html = webkit_dom_html_element_get_outer_html (WEBKIT_DOM_HTML_ELEMENT 
(tt_element));
                        tmp = g_strconcat (outer_html, UNICODE_ZERO_WIDTH_SPACE, NULL);
                        webkit_dom_html_element_set_outer_html (
@@ -2475,7 +2465,6 @@ e_editor_selection_set_monospaced (EEditorSelection *selection,
 
                        webkit_dom_dom_selection_modify (window_selection, "move", "right", "character");
 
-                       g_free (inner_html);
                        g_free (outer_html);
                        g_free (tmp);
                }


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