[evolution] EHTMLEditorSelection - Return the right font color when is set on body



commit b03c1e043d621f8c3566373419cb1a3f47909747
Author: Tomas Popela <tpopela redhat com>
Date:   Fri Mar 6 15:21:24 2015 +0100

    EHTMLEditorSelection - Return the right font color when is set on body

 e-util/e-html-editor-selection.c |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)
---
diff --git a/e-util/e-html-editor-selection.c b/e-util/e-html-editor-selection.c
index 4e9b649..f4c7797 100644
--- a/e-util/e-html-editor-selection.c
+++ b/e-util/e-html-editor-selection.c
@@ -2546,16 +2546,25 @@ e_html_editor_selection_get_font_color (EHTMLEditorSelection *selection,
                return;
        }
 
-       g_object_unref (view);
-
        color = get_font_property (selection, "color");
        if (!(color && *color)) {
-               *rgba = black;
-               return;
+               WebKitDOMDocument *document;
+               WebKitDOMHTMLElement *body;
+
+               document = webkit_web_view_get_dom_document (WEBKIT_WEB_VIEW (view));
+               body = webkit_dom_document_get_body (document);
+
+               color = webkit_dom_html_body_element_get_text (WEBKIT_DOM_HTML_BODY_ELEMENT (body));
+               if (!(color && *color)) {
+                       *rgba = black;
+                       g_object_unref (view);
+                       return;
+               }
        }
 
        gdk_rgba_parse (rgba, color);
        g_free (color);
+       g_object_unref (view);
 }
 
 /**


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