aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomas Popela <tpopela@redhat.com>2014-07-21 22:38:53 +0800
committerTomas Popela <tpopela@redhat.com>2014-07-21 23:02:08 +0800
commit5c08e2981273b719503cc2adc740b8e8ed235467 (patch)
tree69740d5494e7275bf6a7f5ae18ff3eae8c03dfdf
parent1de2564ea0ecdb3e7f981441cc9860f0fa3ec3d8 (diff)
downloadgsoc2013-evolution-5c08e2981273b719503cc2adc740b8e8ed235467.tar
gsoc2013-evolution-5c08e2981273b719503cc2adc740b8e8ed235467.tar.gz
gsoc2013-evolution-5c08e2981273b719503cc2adc740b8e8ed235467.tar.bz2
gsoc2013-evolution-5c08e2981273b719503cc2adc740b8e8ed235467.tar.lz
gsoc2013-evolution-5c08e2981273b719503cc2adc740b8e8ed235467.tar.xz
gsoc2013-evolution-5c08e2981273b719503cc2adc740b8e8ed235467.tar.zst
gsoc2013-evolution-5c08e2981273b719503cc2adc740b8e8ed235467.zip
EHTMLEditorSelection - Avoid runtime warning when trying to cast DOMText to DOMElement
-rw-r--r--e-util/e-html-editor-selection.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/e-util/e-html-editor-selection.c b/e-util/e-html-editor-selection.c
index 1d7fdf97a8..0ae1780ec9 100644
--- a/e-util/e-html-editor-selection.c
+++ b/e-util/e-html-editor-selection.c
@@ -1567,11 +1567,15 @@ e_html_editor_selection_get_block_format (EHTMLEditorSelection *selection)
}
static gboolean
-is_selection_position_node (WebKitDOMElement *element)
+is_selection_position_node (WebKitDOMNode *node)
{
- if (!element || !WEBKIT_DOM_IS_ELEMENT (element))
+ WebKitDOMElement *element;
+
+ if (!node || !WEBKIT_DOM_IS_ELEMENT (node))
return FALSE;
+ element = WEBKIT_DOM_ELEMENT (node);
+
return element_has_id (element, "-x-evo-caret-position") ||
element_has_id (element, "-x-evo-selection-start-marker") ||
element_has_id (element, "-x-evo-selection-end-marker");
@@ -5141,7 +5145,7 @@ wrap_lines (EHTMLEditorSelection *selection,
}
g_free (text_content);
} else {
- if (is_selection_position_node (WEBKIT_DOM_ELEMENT (node))) {
+ if (is_selection_position_node (node)) {
node = webkit_dom_node_get_next_sibling (node);
continue;
}
@@ -6010,8 +6014,7 @@ e_html_editor_selection_restore (EHTMLEditorSelection *selection)
selection_start_marker =
webkit_dom_node_get_next_sibling (selection_start_marker);
- ok = is_selection_position_node (
- WEBKIT_DOM_ELEMENT (selection_start_marker));
+ ok = is_selection_position_node (selection_start_marker);
if (ok) {
ok = FALSE;
@@ -6019,8 +6022,7 @@ e_html_editor_selection_restore (EHTMLEditorSelection *selection)
selection_end_marker = webkit_dom_node_get_next_sibling (
selection_start_marker);
- ok = is_selection_position_node (
- WEBKIT_DOM_ELEMENT (selection_end_marker));
+ ok = is_selection_position_node (selection_end_marker);
if (ok) {
remove_node (selection_start_marker);
remove_node (selection_end_marker);