[evolution/wip/webkit2] EHTMLEditorSelection - Remove previously inserted BR if correcting wrapping around selection markers



commit 399f0693c4605156d4dd40e441655f77a09a5db9
Author: Tomas Popela <tpopela redhat com>
Date:   Wed Mar 2 18:03:32 2016 +0100

    EHTMLEditorSelection - Remove previously inserted BR if correcting wrapping around selection markers

 .../e-html-editor-selection-dom-functions.c        |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/web-extensions/composer/e-html-editor-selection-dom-functions.c 
b/web-extensions/composer/e-html-editor-selection-dom-functions.c
index 957ec6f..f6863d7 100644
--- a/web-extensions/composer/e-html-editor-selection-dom-functions.c
+++ b/web-extensions/composer/e-html-editor-selection-dom-functions.c
@@ -2570,12 +2570,20 @@ wrap_lines (WebKitDOMDocument *document,
                                        check_next_node = FALSE;
                                        prev_sibling = webkit_dom_node_get_previous_sibling (node);
                                        if (prev_sibling && dom_is_selection_position_node (prev_sibling)) {
+                                               WebKitDOMNode *prev_br = NULL;
+
                                                prev_sibling = webkit_dom_node_get_previous_sibling 
(prev_sibling);
 
                                                /* Collapsed selection */
                                                if (prev_sibling && dom_is_selection_position_node 
(prev_sibling))
                                                        prev_sibling = webkit_dom_node_get_previous_sibling 
(prev_sibling);
 
+                                               if (prev_sibling && WEBKIT_DOM_IS_HTML_BR_ELEMENT 
(prev_sibling) &&
+                                                   element_has_class (WEBKIT_DOM_ELEMENT (prev_sibling), 
"-x-evo-wrap-br")) {
+                                                       prev_br = prev_sibling;
+                                                       prev_sibling = webkit_dom_node_get_previous_sibling 
(prev_sibling);
+                                               }
+
                                                if (prev_sibling && WEBKIT_DOM_IS_CHARACTER_DATA 
(prev_sibling)) {
                                                        gchar *data;
                                                        glong text_length, length = 0;
@@ -2616,7 +2624,9 @@ wrap_lines (WebKitDOMDocument *document,
                                                                        }
 
                                                                        if (nd) {
-                                                                               webkit_dom_node_insert_before 
(
+                                                                               if (prev_br)
+                                                                                       remove_node (prev_br);
+                                                                                
webkit_dom_node_insert_before (
                                                                                        
webkit_dom_node_get_parent_node (nd),
                                                                                        WEBKIT_DOM_NODE 
(element),
                                                                                        nd,


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