about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJosh Rickmar <jrick@conformal.com>2013-07-10 18:50:36 -0400
committerJosh Rickmar <jrick@conformal.com>2013-07-10 18:52:21 -0400
commitca9dac683e1783e503b70849ec1fbfe326b7ef02 (patch)
tree7afa991be8e1c69fdc917ec06a345e8b65b2d968
parente3d0ac6266a0c92cd785cf57d9068d19edeb7006 (diff)
downloadxombrero-ca9dac683e1783e503b70849ec1fbfe326b7ef02.tar.gz
Don't use broken HTML DOM check on old webkit.
-rw-r--r--inputfocus.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/inputfocus.c b/inputfocus.c
index 846805d..23a0e15 100644
--- a/inputfocus.c
+++ b/inputfocus.c
@@ -156,11 +156,14 @@ focus_input(struct tab *t)
 	 */
 
 	doc = webkit_web_view_get_dom_document(t->wv);
+#if WEBKIT_CHECK_VERSION(2, 0, 0)
+	/* This check is broken on old webkit */
 	if (!WEBKIT_DOM_IS_HTML_DOCUMENT(doc)) {
 		show_oops(t, "%s: DOM node is not a valid HTML document",
 		    __func__);
 		goto done;
 	}
+#endif
 
 	/* try current active element */
 	a = webkit_dom_html_document_get_active_element(
@@ -250,8 +253,10 @@ dom_is_input(struct tab *t, char **text)
 
 	/* unwind frames and iframes until the cows come home */
 	for (;;) {
+#if WEBKIT_CHECK_VERSION(2, 0, 0)
 		if (!WEBKIT_DOM_IS_HTML_DOCUMENT(doc))
 			return (0);
+#endif
 		a = webkit_dom_html_document_get_active_element(
 		    WEBKIT_DOM_HTML_DOCUMENT(doc));
 		if (a == NULL)
@@ -343,16 +348,19 @@ int
 command_mode(struct tab *t, struct karg *args)
 {
 	WebKitDOMDocument	*doc;
-	WebKitDOMElement	*a = NULL;
+	WebKitDOMElement	*a;
 
 	if (args->i == XT_MODE_COMMAND) {
 		doc = webkit_web_view_get_dom_document(t->wv);
+#if WEBKIT_CHECK_VERSION(2, 0, 0)
 		if (!WEBKIT_DOM_IS_HTML_DOCUMENT(doc)) {
 			show_oops(t, "%s: DOM node is not a valid HTML "
 			    "document", __func__);
-		} else
-			a = webkit_dom_html_document_get_active_element(
-			    WEBKIT_DOM_HTML_DOCUMENT(doc));
+			return (XT_CB_HANDLED);
+		}
+#endif
+		a = webkit_dom_html_document_get_active_element(
+		    WEBKIT_DOM_HTML_DOCUMENT(doc));
 		if (a) {
 			webkit_dom_element_blur(a);
 			focus_body(doc);