diff options
Diffstat (limited to 'src/dom.c')
-rw-r--r-- | src/dom.c | 36 |
1 files changed, 24 insertions, 12 deletions
@@ -46,24 +46,28 @@ void dom_check_auto_insert(Client* c) */ gboolean dom_is_editable(Element* element) { + gboolean result = FALSE; if (!element) { - return FALSE; + return result; } char* tagname = webkit_dom_element_get_tag_name(element); - if (!g_ascii_strcasecmp(tagname, "textarea")) { - return TRUE; - } char *type = webkit_dom_element_get_attribute(element, "type"); - if (!g_ascii_strcasecmp(tagname, "input") + if (!g_ascii_strcasecmp(tagname, "textarea")) { + result = TRUE; + } else if (!g_ascii_strcasecmp(tagname, "input") && g_ascii_strcasecmp(type, "submit") && g_ascii_strcasecmp(type, "reset") && g_ascii_strcasecmp(type, "image") ) { - return TRUE; + result = TRUE; + } else { + result = FALSE; } + g_free(tagname); + g_free(type); - return FALSE; + return result; } static gboolean dom_auto_insert(Client* c, Element* element) @@ -91,15 +95,23 @@ static Element* dom_get_active_element(Document* doc) { Document* d = NULL; Element* active = webkit_dom_html_document_get_active_element((void*)doc); - char* tagname = webkit_dom_element_get_tag_name(active); + char* tagname = webkit_dom_element_get_tag_name(active); + Element* result = NULL; if (!g_strcmp0(tagname, "FRAME")) { d = webkit_dom_html_frame_element_get_content_document(WEBKIT_DOM_HTML_FRAME_ELEMENT(active)); - return dom_get_active_element(d); - } - if (!g_strcmp0(tagname, "IFRAME")) { + result = dom_get_active_element(d); + } else if (!g_strcmp0(tagname, "IFRAME")) { d = webkit_dom_html_iframe_element_get_content_document(WEBKIT_DOM_HTML_IFRAME_ELEMENT(active)); - return dom_get_active_element(d); + result = dom_get_active_element(d); } + g_free(tagname); + + if (result) { + g_free(active); + + return result; + } + return active; } |