[evolution/gnome-3-20] EHTMLEditorView - Background image from page is removed when saving draft



commit c2b5bd61b3775d71a0788f108ee57b4aa7b5fb6f
Author: Tomas Popela <tpopela redhat com>
Date:   Fri May 13 16:07:17 2016 +0200

    EHTMLEditorView - Background image from page is removed when saving draft

 e-util/e-html-editor-view.c |   30 ++++++++++++++++--------------
 1 files changed, 16 insertions(+), 14 deletions(-)
---
diff --git a/e-util/e-html-editor-view.c b/e-util/e-html-editor-view.c
index 1decac6..447cb93 100644
--- a/e-util/e-html-editor-view.c
+++ b/e-util/e-html-editor-view.c
@@ -10177,24 +10177,25 @@ remove_image_attributes_from_element (WebKitDOMElement *element)
 }
 
 static void
-remove_background_images_in_document (WebKitDOMDocument *document)
+remove_background_images_in_element (WebKitDOMElement *element)
 {
        gint length, ii;
-       WebKitDOMNodeList *elements;
+       WebKitDOMNodeList *images;
 
-       elements = webkit_dom_document_query_selector_all (
-               document, "[background][data-inline]", NULL);
+       images = webkit_dom_element_query_selector_all (
+               element, "[background][data-inline]", NULL);
 
-       length = webkit_dom_node_list_get_length (elements);
+       length = webkit_dom_node_list_get_length (images);
        for (ii = 0; ii < length; ii++) {
-               WebKitDOMElement *element = WEBKIT_DOM_ELEMENT (
-                       webkit_dom_node_list_item (elements, ii));
+               WebKitDOMElement *image = WEBKIT_DOM_ELEMENT (
+                       webkit_dom_node_list_item (images, ii));
 
-               remove_image_attributes_from_element (element);
-               g_object_unref (element);
+               remove_image_attributes_from_element (image);
+               g_object_unref (image);
        }
 
-       g_object_unref (elements);
+       remove_image_attributes_from_element (element);
+       g_object_unref (element);
 }
 
 static void
@@ -10491,8 +10492,8 @@ process_content_for_plain_text (EHTMLEditorView *view)
                                view, WEBKIT_DOM_ELEMENT (source), FALSE);
                        remove_images_in_element (
                                view, WEBKIT_DOM_ELEMENT (source));
-                       remove_background_images_in_document (
-                               document);
+                       remove_background_images_in_element (
+                               WEBKIT_DOM_ELEMENT (source));
                } else {
                        gchar *inner_html;
                        WebKitDOMElement *div;
@@ -10752,7 +10753,7 @@ convert_when_changing_composer_mode (EHTMLEditorView *view)
        toggle_paragraphs_style (view);
        toggle_smileys (view);
        remove_images (view);
-       remove_background_images_in_document (document);
+       remove_background_images_in_element (WEBKIT_DOM_ELEMENT (body));
 
        clear_attributes (document);
 
@@ -11344,7 +11345,8 @@ e_html_editor_view_set_html_mode (EHTMLEditorView *view,
                toggle_tables (view);
                toggle_unordered_lists (view);
                remove_images (view);
-               remove_background_images_in_document (document);
+               body = webkit_dom_document_get_body (document);
+               remove_background_images_in_element (WEBKIT_DOM_ELEMENT (body));
 
                plain = process_content_for_mode_change (view);
 


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