[evolution/wip/webkit2] EHTMLEditorView - History can be overwritten when redoing the Return key press in an empty list item
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/wip/webkit2] EHTMLEditorView - History can be overwritten when redoing the Return key press in an empty list item
- Date: Thu, 3 Mar 2016 13:43:33 +0000 (UTC)
commit ba84b26ef4a7a52fe73d48bfdf9a00c10f588a95
Author: Tomas Popela <tpopela redhat com>
Date: Thu Mar 3 13:57:02 2016 +0100
EHTMLEditorView - History can be overwritten when redoing the Return key press in an empty list item
.../composer/e-html-editor-view-dom-functions.c | 20 +++++++++-----------
.../composer/e-html-editor-view-dom-functions.h | 3 +--
2 files changed, 10 insertions(+), 13 deletions(-)
---
diff --git a/web-extensions/composer/e-html-editor-view-dom-functions.c
b/web-extensions/composer/e-html-editor-view-dom-functions.c
index 61117f9..7fe86db 100644
--- a/web-extensions/composer/e-html-editor-view-dom-functions.c
+++ b/web-extensions/composer/e-html-editor-view-dom-functions.c
@@ -8920,8 +8920,7 @@ insert_tabulator (WebKitDOMDocument *document,
gboolean
return_pressed_in_empty_list_item (WebKitDOMDocument *document,
- EHTMLEditorWebExtension *extension,
- gboolean save_history)
+ EHTMLEditorWebExtension *extension)
{
WebKitDOMElement *selection_start_marker, *selection_end_marker;
WebKitDOMNode *parent, *node;
@@ -8946,12 +8945,15 @@ return_pressed_in_empty_list_item (WebKitDOMDocument *document,
/* Check if return was pressed inside an empty list item. */
if (!webkit_dom_node_get_previous_sibling (WEBKIT_DOM_NODE (selection_start_marker)) &&
(!node || (node && WEBKIT_DOM_IS_HTML_BR_ELEMENT (node) && !webkit_dom_node_get_next_sibling
(node)))) {
- EHTMLEditorHistoryEvent *ev;
+ EHTMLEditorHistoryEvent *ev = NULL;
+ EHTMLEditorUndoRedoManager *manager;
WebKitDOMDocumentFragment *fragment;
WebKitDOMElement *paragraph;
WebKitDOMNode *list;
- if (save_history) {
+ manager = e_html_editor_web_extension_get_undo_redo_manager (extension);
+
+ if (!e_html_editor_undo_redo_manager_is_operation_in_progress (manager)) {
/* Insert new history event for Return to have the right coordinates.
* The fragment will be added later. */
ev = g_new0 (EHTMLEditorHistoryEvent, 1);
@@ -8969,7 +8971,7 @@ return_pressed_in_empty_list_item (WebKitDOMDocument *document,
list = split_list_into_two (parent, -1);
- if (save_history) {
+ if (ev) {
webkit_dom_node_append_child (
WEBKIT_DOM_NODE (fragment),
parent,
@@ -8988,9 +8990,7 @@ return_pressed_in_empty_list_item (WebKitDOMDocument *document,
dom_selection_restore (document);
- if (save_history) {
- EHTMLEditorUndoRedoManager *manager;
-
+ if (ev) {
dom_selection_get_coordinates (
document,
&ev->after.start.x,
@@ -9000,8 +9000,6 @@ return_pressed_in_empty_list_item (WebKitDOMDocument *document,
ev->data.fragment = fragment;
- manager = e_html_editor_web_extension_get_undo_redo_manager (extension);
-
e_html_editor_undo_redo_manager_insert_history_event (manager, ev);
}
@@ -9130,7 +9128,7 @@ key_press_event_process_return_key (WebKitDOMDocument *document,
/* If the ENTER key is pressed inside an empty list item then the list
* is broken into two and empty paragraph is inserted between lists. */
- if (return_pressed_in_empty_list_item (document, extension, TRUE))
+ if (return_pressed_in_empty_list_item (document, extension))
return TRUE;
return FALSE;
diff --git a/web-extensions/composer/e-html-editor-view-dom-functions.h
b/web-extensions/composer/e-html-editor-view-dom-functions.h
index bd968b5..177946e 100644
--- a/web-extensions/composer/e-html-editor-view-dom-functions.h
+++ b/web-extensions/composer/e-html-editor-view-dom-functions.h
@@ -178,8 +178,7 @@ void dom_remove_node_and_parents_if_empty
(WebKitDOMNode *node);
gboolean return_pressed_in_empty_list_item
(WebKitDOMDocument *document,
- EHTMLEditorWebExtension *extension,
- gboolean save_history);
+ EHTMLEditorWebExtension *extension);
void dom_merge_siblings_if_necessary
(WebKitDOMDocument *document,
WebKitDOMDocumentFragment *deleted_content);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]