[evolution/wip/webkit-composer: 794/966] EEditorSelection: Fix disabling of TT font
- From: Tomas Popela <tpopela src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/wip/webkit-composer: 794/966] EEditorSelection: Fix disabling of TT font
- Date: Wed, 23 Apr 2014 11:00:11 +0000 (UTC)
commit e2ccac03eb55bf308e9ad2a4e1ba7b52a76b92a4
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 50a7c02..07e51f4 100644
--- a/e-util/e-editor-selection.c
+++ b/e-util/e-editor-selection.c
@@ -2375,11 +2375,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;
}
@@ -2436,22 +2437,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 (
@@ -2471,7 +2461,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]