[evolution/wip/webkit2] Bug 767236 - quick correction spell check in context menu is gone
- From: Tomas Popela <tpopela src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/wip/webkit2] Bug 767236 - quick correction spell check in context menu is gone
- Date: Wed, 8 Jun 2016 14:30:34 +0000 (UTC)
commit df079f362da87909cab775d8784a7b93311578a9
Author: Tomas Popela <tpopela redhat com>
Date: Wed Jun 8 16:29:59 2016 +0200
Bug 767236 - quick correction spell check in context menu is gone
Actually this is a regression after commit d83a448, but we can skip the call
to the e_html_editor_selection_has_text and only operate on the current caret
word.
e-util/e-content-editor.c | 22 --------
e-util/e-content-editor.h | 5 --
e-util/e-html-editor.c | 2 +-
.../e-webkit-content-editor.c | 29 -----------
.../e-html-editor-selection-dom-functions.c | 51 --------------------
.../e-html-editor-selection-dom-functions.h | 2 -
.../web-extension/e-html-editor-web-extension.c | 19 -------
7 files changed, 1 insertions(+), 129 deletions(-)
---
diff --git a/e-util/e-content-editor.c b/e-util/e-content-editor.c
index 95dee91..87ae722 100644
--- a/e-util/e-content-editor.c
+++ b/e-util/e-content-editor.c
@@ -913,28 +913,6 @@ e_content_editor_select_all (EContentEditor *editor)
}
/**
- * e_content_editor_has_text:
- * @editor: an #EContentEditor
- *
- * Returns whether current selection contains any text.
- *
- * Returns: @TRUE when current selection contains text, @FALSE otherwise.
- */
-gboolean
-e_content_editor_selection_has_text (EContentEditor *editor)
-{
- EContentEditorInterface *iface;
-
- g_return_val_if_fail (E_IS_CONTENT_EDITOR (editor), FALSE);
-
- iface = E_CONTENT_EDITOR_GET_IFACE (editor);
- g_return_val_if_fail (iface != NULL, FALSE);
- g_return_val_if_fail (iface->selection_has_text != NULL, FALSE);
-
- return iface->selection_has_text (editor);
-}
-
-/**
* e_content_editor_selection_get_text:
* @editor: an #EContentEditor
*
diff --git a/e-util/e-content-editor.h b/e-util/e-content-editor.h
index 600088d..94a5ddd 100644
--- a/e-util/e-content-editor.h
+++ b/e-util/e-content-editor.h
@@ -113,8 +113,6 @@ struct _EContentEditorInterface {
gboolean (*get_spell_check) (EContentEditor *editor);
- gboolean (*selection_has_text) (EContentEditor *editor);
-
gchar * (*selection_get_text) (EContentEditor *editor);
gchar * (*get_caret_word) (EContentEditor *editor);
@@ -618,9 +616,6 @@ gboolean e_content_editor_get_spell_check
void e_content_editor_select_all (EContentEditor *editor);
-gboolean e_content_editor_selection_has_text
- (EContentEditor *editor);
-
gchar * e_content_editor_selection_get_text
(EContentEditor *editor);
diff --git a/e-util/e-html-editor.c b/e-util/e-html-editor.c
index edf78b5..8474c31 100644
--- a/e-util/e-html-editor.c
+++ b/e-util/e-html-editor.c
@@ -406,7 +406,7 @@ html_editor_update_actions (EHTMLEditor *editor)
/* Decide if we should show spell checking items. */
visible = FALSE;
- if ((n_languages > 0) && e_content_editor_selection_has_text (cnt_editor)) {
+ if (n_languages > 0) {
gchar *word = e_content_editor_get_caret_word (cnt_editor);
if (word && *word) {
visible = !e_spell_checker_check_word (spell_checker, word, -1);
diff --git a/modules/webkit-content-editor/e-webkit-content-editor.c
b/modules/webkit-content-editor/e-webkit-content-editor.c
index a384265..80cd3eb 100644
--- a/modules/webkit-content-editor/e-webkit-content-editor.c
+++ b/modules/webkit-content-editor/e-webkit-content-editor.c
@@ -2061,34 +2061,6 @@ webkit_content_editor_clear_undo_redo_history (EContentEditor *editor)
NULL);
}
-static gboolean
-webkit_content_editor_selection_has_text (EContentEditor *editor)
-{
- EWebKitContentEditor *wk_editor;
- gboolean ret_val;
- GVariant *result;
-
- wk_editor = E_WEBKIT_CONTENT_EDITOR (editor);
- if (!wk_editor->priv->web_extension)
- return FALSE;
-
- result = g_dbus_proxy_call_sync (
- wk_editor->priv->web_extension,
- "DOMSelectionHasText",
- g_variant_new ("(t)", current_page_id (wk_editor)),
- G_DBUS_CALL_FLAGS_NONE,
- -1,
- NULL,
- NULL);
-
- if (result) {
- g_variant_get (result, "(b)", &ret_val);
- g_variant_unref (result);
- }
-
- return ret_val;
-}
-
static void
webkit_content_editor_replace_caret_word (EContentEditor *editor,
const gchar *replacement)
@@ -6035,7 +6007,6 @@ e_webkit_content_editor_content_editor_init (EContentEditorInterface *iface)
iface->set_spell_checking_languages = webkit_content_editor_set_spell_checking_languages;
iface->set_spell_check = webkit_content_editor_set_spell_check;
iface->get_spell_check = webkit_content_editor_get_spell_check;
- iface->selection_has_text = webkit_content_editor_selection_has_text;
// iface->selection_get_text = webkit_content_editor_selection_get_text;
iface->get_caret_word = webkit_content_editor_get_caret_word;
iface->replace_caret_word = webkit_content_editor_replace_caret_word;
diff --git a/modules/webkit-content-editor/web-extension/e-html-editor-selection-dom-functions.c
b/modules/webkit-content-editor/web-extension/e-html-editor-selection-dom-functions.c
index df2f37b..e49b881 100644
--- a/modules/webkit-content-editor/web-extension/e-html-editor-selection-dom-functions.c
+++ b/modules/webkit-content-editor/web-extension/e-html-editor-selection-dom-functions.c
@@ -5177,17 +5177,6 @@ dom_selection_get_font_color (WebKitDOMDocument *document,
return color;
}
-static WebKitDOMNode *
-get_block_node (WebKitDOMRange *range)
-{
- WebKitDOMNode *node;
-
- node = webkit_dom_range_get_common_ancestor_container (range, NULL);
- node = get_parent_block_node_from_child (node);
-
- return node;
-}
-
/**
* e_html_editor_selection_get_block_format:
* @selection: an #EHTMLEditorSelection
@@ -6555,46 +6544,6 @@ dom_get_caret_word (WebKitDOMDocument *document)
}
/**
- * e_html_editor_selection_has_text:
- * @selection: an #EHTMLEditorSelection
- *
- * Returns whether current selection contains any text.
- *
- * Returns: @TRUE when current selection contains text, @FALSE otherwise.
- */
-gboolean
-dom_selection_has_text (WebKitDOMDocument *document)
-{
- gboolean has_text = FALSE;
- gchar *text = NULL;
- WebKitDOMDOMWindow *dom_window = NULL;
- WebKitDOMDOMSelection *dom_selection = NULL;
- WebKitDOMRange *range = NULL;
-
- if (!(dom_window = webkit_dom_document_get_default_view (document)))
- goto out;
-
- if (!(dom_selection = webkit_dom_dom_window_get_selection (dom_window)))
- goto out;
-
- if (webkit_dom_dom_selection_get_is_collapsed (dom_selection))
- goto out;
-
- if (!(range = webkit_dom_dom_selection_get_range_at (dom_selection, 0, NULL)))
- goto out;
-
- text = webkit_dom_range_get_text (range);
- has_text = text && *text;
- out:
- g_free (text);
- g_clear_object (&dom_window);
- g_clear_object (&dom_selection);
- g_clear_object (&range);
-
- return has_text;
-}
-
-/**
* e_html_editor_selection_get_list_alignment_from_node:
* @node: #an WebKitDOMNode
*
diff --git a/modules/webkit-content-editor/web-extension/e-html-editor-selection-dom-functions.h
b/modules/webkit-content-editor/web-extension/e-html-editor-selection-dom-functions.h
index 562d7ae..097f022 100644
--- a/modules/webkit-content-editor/web-extension/e-html-editor-selection-dom-functions.h
+++ b/modules/webkit-content-editor/web-extension/e-html-editor-selection-dom-functions.h
@@ -256,8 +256,6 @@ void dom_replace_caret_word (WebKitDOMDocument *document,
gchar * dom_get_caret_word (WebKitDOMDocument *document);
-gboolean dom_selection_has_text (WebKitDOMDocument *document);
-
EContentEditorAlignment
dom_get_list_alignment_from_node
(WebKitDOMNode *node);
diff --git a/modules/webkit-content-editor/web-extension/e-html-editor-web-extension.c
b/modules/webkit-content-editor/web-extension/e-html-editor-web-extension.c
index 2b7abb5..c12e917 100644
--- a/modules/webkit-content-editor/web-extension/e-html-editor-web-extension.c
+++ b/modules/webkit-content-editor/web-extension/e-html-editor-web-extension.c
@@ -596,10 +596,6 @@ static const char introspection_xml[] =
" <arg type='t' name='page_id' direction='in'/>"
" <arg type='s' name='word' direction='out'/>"
" </method>"
-" <method name='DOMSelectionHasText'>"
-" <arg type='t' name='page_id' direction='in'/>"
-" <arg type='b' name='has_text' direction='out'/>"
-" </method>"
"<!-- ********************************************************* -->"
"<!-- Functions that are used in EComposerPrivate -->"
"<!-- ********************************************************* -->"
@@ -2293,21 +2289,6 @@ handle_method_call (GDBusConnection *connection,
"(@s)",
g_variant_new_take_string (
word ? word : g_strdup (""))));
- } else if (g_strcmp0 (method_name, "DOMSelectionHasText") == 0) {
- gboolean value = FALSE;
-
- g_variant_get (parameters, "(t)", &page_id);
-
- web_page = get_webkit_web_page_or_return_dbus_error (
- invocation, web_extension, page_id);
- if (!web_page)
- goto error;
-
- document = webkit_web_page_get_dom_document (web_page);
- value = dom_selection_has_text (document);
-
- g_dbus_method_invocation_return_value (
- invocation, g_variant_new ("(b)", value));
} else if (g_strcmp0 (method_name, "DOMRemoveSignatures") == 0) {
gboolean top_signature;
gchar *active_signature;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]