[evolution/wip/webkit2] EHTMLEditorSelection - Wrapping of a block can leave the block unwrapped
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/wip/webkit2] EHTMLEditorSelection - Wrapping of a block can leave the block unwrapped
- Date: Fri, 26 Feb 2016 12:42:09 +0000 (UTC)
commit 29c3a604dd45901cf7ac781e3bb89eae9d9de10c
Author: Tomas Popela <tpopela redhat com>
Date: Fri Feb 26 12:28:42 2016 +0100
EHTMLEditorSelection - Wrapping of a block can leave the block unwrapped
.../e-html-editor-selection-dom-functions.c | 28 +++++++++++++++++--
1 files changed, 25 insertions(+), 3 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 19b953d..755ce90 100644
--- a/web-extensions/composer/e-html-editor-selection-dom-functions.c
+++ b/web-extensions/composer/e-html-editor-selection-dom-functions.c
@@ -2748,12 +2748,34 @@ wrap_lines (WebKitDOMDocument *document,
} else if (webkit_dom_node_get_next_sibling (node)) {
node = webkit_dom_node_get_next_sibling (node);
} else {
+ WebKitDOMNode *tmp_parent;
+
if (webkit_dom_node_is_equal_node (node, start_node))
break;
- node = webkit_dom_node_get_parent_node (node);
- if (node)
- node = webkit_dom_node_get_next_sibling (node);
+ /* Find a next node that we can process. */
+ tmp_parent = webkit_dom_node_get_parent_node (node);
+ if (tmp_parent && webkit_dom_node_get_next_sibling (tmp_parent))
+ node = webkit_dom_node_get_next_sibling (tmp_parent);
+ else {
+ WebKitDOMNode *tmp;
+
+ tmp = tmp_parent;
+ /* Find a node that is not a start node (that would mean
+ * that we already processed the whole block) and it has
+ * a sibling that we can process. */
+ while (tmp && !webkit_dom_node_is_equal_node (tmp, start_node) &&
+ !webkit_dom_node_get_next_sibling (tmp)) {
+ tmp = webkit_dom_node_get_parent_node (tmp);
+ }
+
+ /* If we found a node to process, let's process its
+ * sibling, otherwise give up. */
+ if (tmp)
+ node = webkit_dom_node_get_next_sibling (tmp);
+ else
+ break;
+ }
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]