[evolution] EHTMLEditorSelection - After settings for size to some value and back to the default the font is a l



commit d1500714790859a9a0498b21a6cf5de7e7e2eaa8
Author: Tomas Popela <tpopela redhat com>
Date:   Fri Feb 20 08:19:12 2015 +0100

    EHTMLEditorSelection - After settings for size to some value and back to the default the font is a little 
bit smaller

 e-util/e-html-editor-selection.c |   24 +++++++++++++++++++++++-
 1 files changed, 23 insertions(+), 1 deletions(-)
---
diff --git a/e-util/e-html-editor-selection.c b/e-util/e-html-editor-selection.c
index 45b55e6..cc0830b 100644
--- a/e-util/e-html-editor-selection.c
+++ b/e-util/e-html-editor-selection.c
@@ -2664,7 +2664,7 @@ e_html_editor_selection_get_font_size (EHTMLEditorSelection *selection)
                E_HTML_EDITOR_SELECTION_FONT_SIZE_NORMAL);
 
        size = get_font_property (selection, "size");
-       if (!size)
+       if (!(size && *size))
                return E_HTML_EDITOR_SELECTION_FONT_SIZE_NORMAL;
 
        size_int = atoi (size);
@@ -2703,6 +2703,28 @@ e_html_editor_selection_set_font_size (EHTMLEditorSelection *selection,
        e_html_editor_view_exec_command (view, command, size_str);
        g_free (size_str);
 
+       /* Text in <font size="3"></font> (size 3 is our default size) is a little
+        * bit smaller than font outsize it. So move it outside of it. */
+       if (font_size == E_HTML_EDITOR_SELECTION_FONT_SIZE_NORMAL) {
+               WebKitDOMDocument *document;
+               WebKitDOMElement *element;
+
+               document = webkit_web_view_get_dom_document (WEBKIT_WEB_VIEW (view));
+               element = webkit_dom_document_query_selector (document, "font[size=\"3\"]", NULL);
+               if (element) {
+                       WebKitDOMNode *child;
+
+                       while ((child = webkit_dom_node_get_first_child (WEBKIT_DOM_NODE (element))))
+                               webkit_dom_node_insert_before (
+                                       webkit_dom_node_get_parent_node (WEBKIT_DOM_NODE (element)),
+                                       child,
+                                       WEBKIT_DOM_NODE (element),
+                                       NULL);
+
+                       remove_node (WEBKIT_DOM_NODE (element));
+               }
+       }
+
        g_object_unref (view);
 
        g_object_notify (G_OBJECT (selection), "font-size");


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