[evolution/wip/webkit2] Bug 748178 - Eats CPU and memory when replying to calendar invite
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/wip/webkit2] Bug 748178 - Eats CPU and memory when replying to calendar invite
- Date: Wed, 24 Feb 2016 18:53:20 +0000 (UTC)
commit 496df0a4b331909c3eba67e48a1171d000fe87d5
Author: Tomas Popela <tpopela redhat com>
Date: Wed Feb 24 19:53:18 2016 +0100
Bug 748178 - Eats CPU and memory when replying to calendar invite
.../e-html-editor-selection-dom-functions.c | 27 +++++++++++--------
1 files changed, 16 insertions(+), 11 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 928a44b..3e52e18 100644
--- a/web-extensions/composer/e-html-editor-selection-dom-functions.c
+++ b/web-extensions/composer/e-html-editor-selection-dom-functions.c
@@ -1907,11 +1907,8 @@ find_where_to_break_line (WebKitDOMNode *node,
do {
uc = g_utf8_get_char (str);
if (!uc) {
- g_free (text_start);
- if (pos <= max_len)
- return pos;
- else
- return last_space > 0 ? last_space - 1 : 0;
+ ret_val = pos <= max_len ? pos : last_space > 0 ? last_space - 1 : 0;
+ goto out;
}
/* If last_space is zero then the word is longer than
@@ -1919,16 +1916,15 @@ find_where_to_break_line (WebKitDOMNode *node,
* a space */
if ((pos > max_len) && (last_space > 0)) {
if (last_space > word_wrap_length) {
- g_free (text_start);
- return last_space > 0 ? last_space - 1 : 0;
+ ret_val = last_space > 0 ? last_space - 1 : 0;
+ goto out;
}
if (last_space > max_len) {
if (g_unichar_isspace (g_utf8_get_char (text_start)))
ret_val = 1;
- g_free (text_start);
- return ret_val;
+ goto out;
}
if (last_space == max_len - 1) {
@@ -1937,8 +1933,8 @@ find_where_to_break_line (WebKitDOMNode *node,
last_space++;
}
- g_free (text_start);
- return last_space > 0 ? last_space - 1 : 0;
+ ret_val = last_space > 0 ? last_space - 1 : 0;
+ goto out;
}
if (g_unichar_isspace (uc) || str[0] == '-')
@@ -1968,8 +1964,13 @@ find_where_to_break_line (WebKitDOMNode *node,
}
}
+ out:
g_free (text_start);
+ /* No space found, split at max_len. */
+ if (ret_val == 0)
+ ret_val = max_len;
+
return ret_val;
}
@@ -2379,6 +2380,9 @@ wrap_lines (WebKitDOMDocument *document,
WEBKIT_DOM_NODE (element),
nd,
NULL);
+
+ node = webkit_dom_node_get_next_sibling (
+ WEBKIT_DOM_NODE (element));
} else {
webkit_dom_node_append_child (
webkit_dom_node_get_parent_node (node),
@@ -2411,6 +2415,7 @@ wrap_lines (WebKitDOMDocument *document,
WEBKIT_DOM_NODE (element),
nd,
NULL);
+
line_length = 0;
break;
} else {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]