[evolution/wip/webkit2] EHTMLEditorSelection - Use type macro to check if element is blockquote
- From: Tomas Popela <tpopela src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/wip/webkit2] EHTMLEditorSelection - Use type macro to check if element is blockquote
- Date: Wed, 7 Oct 2015 07:31:08 +0000 (UTC)
commit c911612e62120ab73d5cd0e38b30f8a9f0abb30c
Author: Tomas Popela <tpopela redhat com>
Date: Tue May 12 13:22:19 2015 +0200
EHTMLEditorSelection - Use type macro to check if element is blockquote
Instead of comparing the tag name.
.../e-html-editor-selection-dom-functions.c | 23 +++----------------
1 files changed, 4 insertions(+), 19 deletions(-)
---
diff --git a/web-extensions/e-html-editor-selection-dom-functions.c
b/web-extensions/e-html-editor-selection-dom-functions.c
index e0750a1..739b9b3 100644
--- a/web-extensions/e-html-editor-selection-dom-functions.c
+++ b/web-extensions/e-html-editor-selection-dom-functions.c
@@ -2756,8 +2756,7 @@ get_has_style (WebKitDOMDocument *document,
if (g_ascii_strncasecmp (style_tag, "citation", 8) == 0) {
accept_citation = TRUE;
- result = ((strlen (element_tag) == 10 /* strlen ("blockquote") */) &&
- (g_ascii_strncasecmp (element_tag, "blockquote", 10) == 0));
+ result = WEBKIT_DOM_IS_HTML_QUOTE_ELEMENT (element);
if (element_has_class (element, "-x-evo-indented"))
result = FALSE;
} else {
@@ -2768,7 +2767,7 @@ get_has_style (WebKitDOMDocument *document,
/* Special case: <blockquote type=cite> marks quotation, while
* just <blockquote> is used for indentation. If the <blockquote>
* has type=cite, then ignore it unless style_tag is "citation" */
- if (result && g_ascii_strncasecmp (element_tag, "blockquote", 10) == 0) {
+ if (result && WEBKIT_DOM_IS_HTML_QUOTE_ELEMENT (element)) {
if (webkit_dom_element_has_attribute (element, "type")) {
gchar *type;
type = webkit_dom_element_get_attribute (element, "type");
@@ -3027,16 +3026,9 @@ dom_selection_is_subscript (WebKitDOMDocument *document,
node = webkit_dom_range_get_common_ancestor_container (range, NULL);
while (node) {
- gchar *tag_name;
-
- tag_name = webkit_dom_element_get_tag_name (WEBKIT_DOM_ELEMENT (node));
-
- if (g_ascii_strncasecmp (tag_name, "sup", 3) == 0) {
- g_free (tag_name);
+ if (element_has_tag (WEBKIT_DOM_ELEMENT (node), "sub"))
break;
- }
- g_free (tag_name);
node = webkit_dom_node_get_parent_node (node);
}
@@ -3086,16 +3078,9 @@ dom_selection_is_superscript (WebKitDOMDocument *document,
node = webkit_dom_range_get_common_ancestor_container (range, NULL);
while (node) {
- gchar *tag_name;
-
- tag_name = webkit_dom_element_get_tag_name (WEBKIT_DOM_ELEMENT (node));
-
- if (g_ascii_strncasecmp (tag_name, "sup", 3) == 0) {
- g_free (tag_name);
+ if (element_has_tag (WEBKIT_DOM_ELEMENT (node), "sup"))
break;
- }
- g_free (tag_name);
node = webkit_dom_node_get_parent_node (node);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]