[evolution] EHTMLEditorSelection - Return correct block node for signature



commit eb9860759cdd44ea962dd97a0bd0f8025951e8c3
Author: Tomas Popela <tpopela redhat com>
Date:   Mon Oct 20 11:32:05 2014 +0200

    EHTMLEditorSelection - Return correct block node for signature
    
    This was preventing the block format change to perform correctly as it
    was returning its child and stopping on it.

 e-util/e-html-editor-selection.c |   26 ++++++++++++++++----------
 1 files changed, 16 insertions(+), 10 deletions(-)
---
diff --git a/e-util/e-html-editor-selection.c b/e-util/e-html-editor-selection.c
index 8622ef6..476ab7d 100644
--- a/e-util/e-html-editor-selection.c
+++ b/e-util/e-html-editor-selection.c
@@ -1345,16 +1345,22 @@ set_block_alignment (WebKitDOMElement *element,
 static WebKitDOMNode *
 get_parent_block_node_from_child (WebKitDOMNode *node)
 {
-       WebKitDOMNode *parent = webkit_dom_node_get_parent_node (node);
-
-       if (element_has_class (WEBKIT_DOM_ELEMENT (parent), "-x-evo-temp-text-wrapper") ||
-           WEBKIT_DOM_IS_HTML_ANCHOR_ELEMENT (parent) ||
-           element_has_tag (WEBKIT_DOM_ELEMENT (parent), "b") ||
-           element_has_tag (WEBKIT_DOM_ELEMENT (parent), "i") ||
-           element_has_tag (WEBKIT_DOM_ELEMENT (parent), "u"))
-               parent = webkit_dom_node_get_parent_node (parent);
-
-       return parent;
+       WebKitDOMElement *parent = WEBKIT_DOM_ELEMENT (
+               webkit_dom_node_get_parent_node (node));
+
+        if (WEBKIT_DOM_IS_HTML_ANCHOR_ELEMENT (parent) ||
+            element_has_tag (parent, "b") ||
+            element_has_tag (parent, "i") ||
+            element_has_tag (parent, "u"))
+               parent = WEBKIT_DOM_ELEMENT (
+                       webkit_dom_node_get_parent_node (WEBKIT_DOM_NODE (parent)));
+
+       if (element_has_class (parent, "-x-evo-temp-text-wrapper") ||
+           element_has_class (parent, "-x-evo-signature"))
+               parent = WEBKIT_DOM_ELEMENT (
+                       webkit_dom_node_get_parent_node (WEBKIT_DOM_NODE (parent)));
+
+       return WEBKIT_DOM_NODE (parent);
 }
 
 /**


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