[evolution/wip/webkit2] EHTMLEditorView - Be more efficient when trying to get if we are going to remove last element in bod
- From: Tomas Popela <tpopela src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/wip/webkit2] EHTMLEditorView - Be more efficient when trying to get if we are going to remove last element in bod
- Date: Wed, 22 Apr 2015 13:05:46 +0000 (UTC)
commit b7ef3254360751ccdb86a3f47ff2f8740fabee7a
Author: Tomas Popela <tpopela redhat com>
Date: Thu Mar 26 13:42:16 2015 +0100
EHTMLEditorView - Be more efficient when trying to get if we are going to remove last element in body
web-extensions/e-html-editor-view-dom-functions.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/web-extensions/e-html-editor-view-dom-functions.c
b/web-extensions/e-html-editor-view-dom-functions.c
index 801f9eb..1e9ce4e 100644
--- a/web-extensions/e-html-editor-view-dom-functions.c
+++ b/web-extensions/e-html-editor-view-dom-functions.c
@@ -2392,13 +2392,14 @@ prevent_from_deleting_last_element_in_body (WebKitDOMDocument *document)
{
gboolean ret_val = FALSE;
WebKitDOMHTMLElement *body;
- WebKitDOMNodeList *list;
+ WebKitDOMNode *node;
body = webkit_dom_document_get_body (document);
- list = webkit_dom_node_get_child_nodes (WEBKIT_DOM_NODE (body));
-
- if (webkit_dom_node_list_get_length (list) <= 1) {
+ node = webkit_dom_node_get_first_child (WEBKIT_DOM_NODE (body));
+ if (!node || (
+ webkit_dom_node_get_next_sibling (node) &&
+ !webkit_dom_node_get_next_sibling (webkit_dom_node_get_next_sibling (node)))) {
gchar *content;
content = webkit_dom_node_get_text_content (WEBKIT_DOM_NODE (body));
@@ -2411,7 +2412,6 @@ prevent_from_deleting_last_element_in_body (WebKitDOMDocument *document)
if (webkit_dom_element_query_selector (WEBKIT_DOM_ELEMENT (body), "img", NULL))
ret_val = FALSE;
}
- g_object_unref (list);
return ret_val;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]