evolution/evolution-webkit2gtk3-adaptation.patch

305 lines
12 KiB
Diff

From 7c8ee5067ce58911e68586a0887b2e57abc5c9c2 Mon Sep 17 00:00:00 2001
From: Tomas Popela <tpopela@redhat.com>
Date: Thu, 1 Sep 2016 17:53:46 +0200
Subject: Adapt to WebKit Unstable DOM API changes in WebKitGTK+ 2.13.90
Also increase the minimal required WebKitGTK+ version.
---
configure.ac | 2 +-
.../web-extension/e-composer-dom-functions.c | 6 +--
.../web-extension/e-dialogs-dom-functions.c | 2 +-
.../web-extension/e-editor-dom-functions.c | 45 +++++++++++-----------
4 files changed, 28 insertions(+), 27 deletions(-)
diff --git a/modules/webkit-editor/web-extension/e-composer-dom-functions.c b/modules/webkit-editor/web-extension/e-composer-dom-functions.c
index a54b180..221c0af 100644
--- a/modules/webkit-editor/web-extension/e-composer-dom-functions.c
+++ b/modules/webkit-editor/web-extension/e-composer-dom-functions.c
@@ -25,7 +25,7 @@
#define WEBKIT_DOM_USE_UNSTABLE_API
#include <webkitdom/WebKitDOMDOMSelection.h>
#include <webkitdom/WebKitDOMDOMWindowUnstable.h>
-#include <webkitdom/WebKitDOMHTMLElementUnstable.h>
+#include <webkitdom/WebKitDOMElementUnstable.h>
#undef WEBKIT_DOM_USE_UNSTABLE_API
#include <camel/camel.h>
@@ -370,8 +370,8 @@ e_composer_dom_insert_signature (EEditorPage *editor_page,
WEBKIT_DOM_NODE (insert_signature_in), node, NULL);
remove_node (WEBKIT_DOM_NODE (converted_signature));
} else
- webkit_dom_html_element_insert_adjacent_html (
- WEBKIT_DOM_HTML_ELEMENT (insert_signature_in),
+ webkit_dom_element_insert_adjacent_html (
+ insert_signature_in,
"beforeend",
signature_text,
NULL);
diff --git a/modules/webkit-editor/web-extension/e-dialogs-dom-functions.c b/modules/webkit-editor/web-extension/e-dialogs-dom-functions.c
index b3ac1bf..d3699a2 100644
--- a/modules/webkit-editor/web-extension/e-dialogs-dom-functions.c
+++ b/modules/webkit-editor/web-extension/e-dialogs-dom-functions.c
@@ -1087,7 +1087,7 @@ e_dialogs_dom_spell_check_run (EEditorPage *editor_page,
* reached only when we reach the beginning/end of the document */
if (start && end)
webkit_dom_dom_selection_set_base_and_extent (
- dom_selection, start, start_offset, end, end_offset, NULL);
+ dom_selection, start, start_offset, end, end_offset);
g_clear_object (&dom_selection);
diff --git a/modules/webkit-editor/web-extension/e-editor-dom-functions.c b/modules/webkit-editor/web-extension/e-editor-dom-functions.c
index e778849..7d89495 100644
--- a/modules/webkit-editor/web-extension/e-editor-dom-functions.c
+++ b/modules/webkit-editor/web-extension/e-editor-dom-functions.c
@@ -26,6 +26,7 @@
#include <webkitdom/WebKitDOMDOMSelection.h>
#include <webkitdom/WebKitDOMDOMWindowUnstable.h>
#include <webkitdom/WebKitDOMHTMLElementUnstable.h>
+#include <webkitdom/WebKitDOMElementUnstable.h>
#include <webkitdom/WebKitDOMRangeUnstable.h>
#undef WEBKIT_DOM_USE_UNSTABLE_API
@@ -1677,8 +1678,8 @@ e_editor_dom_check_magic_links (EEditorPage *editor_page,
new_href);
if (appending_to_link) {
- webkit_dom_html_element_insert_adjacent_html (
- WEBKIT_DOM_HTML_ELEMENT (parent),
+ webkit_dom_element_insert_adjacent_html (
+ WEBKIT_DOM_ELEMENT (parent),
"beforeend",
text_to_append,
NULL);
@@ -1710,8 +1711,8 @@ e_editor_dom_check_magic_links (EEditorPage *editor_page,
new_href);
if (appending_to_link) {
- webkit_dom_html_element_insert_adjacent_html (
- WEBKIT_DOM_HTML_ELEMENT (parent),
+ webkit_dom_element_insert_adjacent_html (
+ WEBKIT_DOM_ELEMENT (parent),
"beforeend",
text_to_append,
NULL);
@@ -2087,8 +2088,8 @@ emoticon_insert_span (EEmoticon *emoticon,
if (!e_editor_page_get_unicode_smileys_enabled (editor_page)) {
/* &#8203 == UNICODE_ZERO_WIDTH_SPACE */
- webkit_dom_html_element_insert_adjacent_html (
- WEBKIT_DOM_HTML_ELEMENT (span), "afterend", "&#8203;", NULL);
+ webkit_dom_element_insert_adjacent_html (
+ WEBKIT_DOM_ELEMENT (span), "afterend", "&#8203;", NULL);
}
if (ev) {
@@ -2112,8 +2113,8 @@ emoticon_insert_span (EEmoticon *emoticon,
dom_create_selection_marker (document, FALSE)),
NULL);
} else
- webkit_dom_html_element_insert_adjacent_html (
- WEBKIT_DOM_HTML_ELEMENT (node), "afterend", "&#8203;", NULL);
+ webkit_dom_element_insert_adjacent_html (
+ WEBKIT_DOM_ELEMENT (node), "afterend", "&#8203;", NULL);
ev->data.fragment = g_object_ref (fragment);
}
@@ -3910,8 +3911,8 @@ e_editor_dom_body_key_up_event_process_return_key (EEditorPage *editor_page)
if (!webkit_dom_node_get_previous_sibling (WEBKIT_DOM_NODE (selection_start_marker)) &&
(!webkit_dom_node_get_next_sibling (WEBKIT_DOM_NODE (selection_end_marker)) ||
WEBKIT_DOM_IS_HTML_BR_ELEMENT (webkit_dom_node_get_next_sibling (WEBKIT_DOM_NODE (selection_end_marker)))))
- webkit_dom_html_element_insert_adjacent_text (
- WEBKIT_DOM_HTML_ELEMENT (parent),
+ webkit_dom_element_insert_adjacent_text (
+ WEBKIT_DOM_ELEMENT (parent),
"afterbegin",
UNICODE_ZERO_WIDTH_SPACE,
NULL);
@@ -5494,14 +5495,14 @@ e_editor_dom_quote_and_insert_text_into_selection (EEditorPage *editor_page,
static void
mark_citation (WebKitDOMElement *citation)
{
- webkit_dom_html_element_insert_adjacent_text (
- WEBKIT_DOM_HTML_ELEMENT (citation),
+ webkit_dom_element_insert_adjacent_text (
+ citation,
"beforebegin",
"##CITATION_START##",
NULL);
- webkit_dom_html_element_insert_adjacent_text (
- WEBKIT_DOM_HTML_ELEMENT (citation),
+ webkit_dom_element_insert_adjacent_text (
+ citation,
"afterend",
"##CITATION_END##",
NULL);
@@ -5537,8 +5538,8 @@ create_text_markers_for_selection_in_element (WebKitDOMElement *element)
selection_marker = webkit_dom_element_query_selector (
element, "#-x-evo-selection-start-marker", NULL);
if (selection_marker)
- webkit_dom_html_element_insert_adjacent_text (
- WEBKIT_DOM_HTML_ELEMENT (selection_marker),
+ webkit_dom_element_insert_adjacent_text (
+ selection_marker,
"afterend",
"##SELECTION_START##",
NULL);
@@ -5546,8 +5547,8 @@ create_text_markers_for_selection_in_element (WebKitDOMElement *element)
selection_marker = webkit_dom_element_query_selector (
element, "#-x-evo-selection-end-marker", NULL);
if (selection_marker)
- webkit_dom_html_element_insert_adjacent_text (
- WEBKIT_DOM_HTML_ELEMENT (selection_marker),
+ webkit_dom_element_insert_adjacent_text (
+ selection_marker,
"afterend",
"##SELECTION_END##",
NULL);
@@ -11090,8 +11091,8 @@ e_editor_dom_insert_base64_image (EEditorPage *editor_page,
webkit_dom_node_clone_node_with_error (WEBKIT_DOM_NODE (resizable_wrapper), TRUE, NULL),
NULL);
- webkit_dom_html_element_insert_adjacent_html (
- WEBKIT_DOM_HTML_ELEMENT (node), "afterend", "&#8203;", NULL);
+ webkit_dom_element_insert_adjacent_html (
+ WEBKIT_DOM_ELEMENT (node), "afterend", "&#8203;", NULL);
ev->data.fragment = g_object_ref (fragment);
e_editor_dom_selection_get_coordinates (editor_page,
@@ -14617,8 +14618,8 @@ set_font_style (WebKitDOMDocument *document,
text_content = webkit_dom_node_get_text_content (first_child);
if (g_strcmp0 (text_content, UNICODE_ZERO_WIDTH_SPACE) != 0)
- webkit_dom_html_element_insert_adjacent_text (
- WEBKIT_DOM_HTML_ELEMENT (parent),
+ webkit_dom_element_insert_adjacent_text (
+ WEBKIT_DOM_ELEMENT (parent),
"afterend",
UNICODE_ZERO_WIDTH_SPACE,
NULL);
--
cgit v0.12
From 1093ace5577c87e4a5d208aca1c9eb4dbc805b30 Mon Sep 17 00:00:00 2001
From: Tomas Popela <tpopela@redhat.com>
Date: Fri, 2 Sep 2016 12:09:38 +0200
Subject: Replace usage of deprecated WebKit DOM API functions
---
.../web-extension/e-editor-dom-functions.c | 30 ++++++++++------------
web-extensions/e-dom-utils.c | 4 +--
2 files changed, 15 insertions(+), 19 deletions(-)
diff --git a/modules/webkit-editor/web-extension/e-editor-dom-functions.c b/modules/webkit-editor/web-extension/e-editor-dom-functions.c
index 7d89495..f941eca 100644
--- a/modules/webkit-editor/web-extension/e-editor-dom-functions.c
+++ b/modules/webkit-editor/web-extension/e-editor-dom-functions.c
@@ -4766,7 +4766,7 @@ dom_quote_plain_text (WebKitDOMDocument *document)
gchar *name, *value;
WebKitDOMNode *node = webkit_dom_named_node_map_item (attributes, ii);
- name = webkit_dom_node_get_local_name (node);
+ name = webkit_dom_attr_get_name (WEBKIT_DOM_ATTR (node));
value = webkit_dom_node_get_node_value (node);
webkit_dom_element_set_attribute (
@@ -5630,15 +5630,13 @@ clear_attributes (EEditorPage *editor_page)
length = webkit_dom_named_node_map_get_length (attributes);
for (ii = length - 1; ii >= 0; ii--) {
gchar *name;
- WebKitDOMNode *node = webkit_dom_named_node_map_item (attributes, ii);
+ WebKitDOMAttr *attribute = WEBKIT_DOM_ATTR (webkit_dom_named_node_map_item (attributes, ii));
- name = webkit_dom_node_get_local_name (node);
+ name = webkit_dom_attr_get_name (attribute);
if (!g_str_has_prefix (name, "data-") && (g_strcmp0 (name, "spellcheck") != 0))
webkit_dom_element_remove_attribute_node (
- WEBKIT_DOM_ELEMENT (body),
- WEBKIT_DOM_ATTR (node),
- NULL);
+ WEBKIT_DOM_ELEMENT (body), attribute, NULL);
g_free (name);
}
@@ -6590,11 +6588,11 @@ process_indented_element (WebKitDOMElement *element)
gchar *text_content;
gchar *indented_text;
- text_content = webkit_dom_text_get_whole_text (WEBKIT_DOM_TEXT (child));
+ text_content = webkit_dom_character_data_get_data (WEBKIT_DOM_CHARACTER_DATA (child));
indented_text = g_strconcat (spaces, text_content, NULL);
- webkit_dom_text_replace_whole_text (
- WEBKIT_DOM_TEXT (child),
+ webkit_dom_character_data_set_data (
+ WEBKIT_DOM_CHARACTER_DATA (child),
indented_text,
NULL);
@@ -7135,11 +7133,11 @@ process_node_to_plain_text_changing_composer_mode (EEditorPage *editor_page,
length = webkit_dom_named_node_map_get_length (attributes);
for (ii = 0; ii < length; ii++) {
gchar *name = NULL;
- WebKitDOMNode *attribute;
+ WebKitDOMAttr *attribute;
- attribute = webkit_dom_named_node_map_item (attributes, ii);
+ attribute = WEBKIT_DOM_ATTR (webkit_dom_named_node_map_item (attributes, ii));
- name = webkit_dom_node_get_local_name (attribute);
+ name = webkit_dom_attr_get_name (attribute);
if (g_strcmp0 (name, "bgcolor") == 0 ||
g_strcmp0 (name, "text") == 0 ||
@@ -7147,9 +7145,7 @@ process_node_to_plain_text_changing_composer_mode (EEditorPage *editor_page,
g_strcmp0 (name, "link") == 0) {
webkit_dom_element_remove_attribute_node (
- WEBKIT_DOM_ELEMENT (source),
- WEBKIT_DOM_ATTR (attribute),
- NULL);
+ WEBKIT_DOM_ELEMENT (source), attribute, NULL);
length--;
}
g_free (name);
@@ -8394,9 +8390,9 @@ change_cid_images_src_to_base64 (EEditorPage *editor_page)
length = webkit_dom_named_node_map_get_length (attributes);
for (ii = 0; ii < length; ii++) {
gchar *name;
- WebKitDOMNode *node = webkit_dom_named_node_map_item (attributes, ii);
+ WebKitDOMAttr *attribute = WEBKIT_DOM_ATTR( webkit_dom_named_node_map_item (attributes, ii));
- name = webkit_dom_node_get_local_name (node);
+ name = webkit_dom_attr_get_name (attribute);
if (g_str_has_prefix (name, "xmlns:")) {
const gchar *ns = name + 6;
diff --git a/web-extensions/e-dom-utils.c b/web-extensions/e-dom-utils.c
index 5322c17..170b975 100644
--- a/web-extensions/e-dom-utils.c
+++ b/web-extensions/e-dom-utils.c
@@ -969,7 +969,7 @@ e_dom_utils_get_active_element_name (WebKitDOMDocument *document)
element = webkit_dom_document_get_active_element (content_document);
}
- return webkit_dom_node_get_local_name (WEBKIT_DOM_NODE (element));
+ return webkit_dom_element_get_local_name (element);
}
void
@@ -1459,7 +1459,7 @@ element_has_tag (WebKitDOMElement *element,
if (!WEBKIT_DOM_IS_ELEMENT (element))
return FALSE;
- element_tag = webkit_dom_node_get_local_name (WEBKIT_DOM_NODE (element));
+ element_tag = webkit_dom_element_get_tag_name (element);
if (g_ascii_strcasecmp (element_tag, tag) != 0) {
g_free (element_tag);
--
cgit v0.12