[evolution/wip/webkit2] EHTMLEditorView - Don't perform spell check on empty body
- From: Tomas Popela <tpopela src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/wip/webkit2] EHTMLEditorView - Don't perform spell check on empty body
- Date: Wed, 7 Oct 2015 07:30:07 +0000 (UTC)
commit 3305a1e8ca571c86875bed1ac77b90f681512f34
Author: Tomas Popela <tpopela redhat com>
Date: Wed Apr 29 14:49:48 2015 +0200
EHTMLEditorView - Don't perform spell check on empty body
web-extensions/e-html-editor-view-dom-functions.c | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/web-extensions/e-html-editor-view-dom-functions.c
b/web-extensions/e-html-editor-view-dom-functions.c
index 557210a..33d0e27 100644
--- a/web-extensions/e-html-editor-view-dom-functions.c
+++ b/web-extensions/e-html-editor-view-dom-functions.c
@@ -150,6 +150,9 @@ dom_force_spell_check_for_current_paragraph (WebKitDOMDocument *document,
if (!element)
return;
+ if (!webkit_dom_node_get_first_child (WEBKIT_DOM_NODE (element)))
+ return;
+
dom_selection_save (document);
selection_start_marker = webkit_dom_document_query_selector (
@@ -222,17 +225,20 @@ refresh_spell_check (WebKitDOMDocument *document,
gboolean enable_spell_check)
{
WebKitDOMDOMSelection *dom_selection;
- WebKitDOMDOMWindow *window;
+ WebKitDOMDOMWindow *dom_window;
WebKitDOMElement *selection_start_marker, *selection_end_marker;
WebKitDOMHTMLElement *body;
WebKitDOMRange *end_range, *actual;
WebKitDOMText *text;
- window = webkit_dom_document_get_default_view (document);
- dom_selection = webkit_dom_dom_window_get_selection (window);
+ dom_window = webkit_dom_document_get_default_view (document);
+ dom_selection = webkit_dom_dom_window_get_selection (dom_window);
+ body = webkit_dom_document_get_body (document);
+
+ if (!webkit_dom_node_get_first_child (WEBKIT_DOM_NODE (body)))
+ return;
/* Enable/Disable spellcheck in composer */
- body = webkit_dom_document_get_body (document);
webkit_dom_element_set_attribute (
WEBKIT_DOM_ELEMENT (body),
"spellcheck",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]