aboutsummaryrefslogtreecommitdiffstats
path: root/embed
diff options
context:
space:
mode:
authorXan Lopez <xlopez@igalia.com>2011-06-01 02:15:44 +0800
committerXan Lopez <xlopez@igalia.com>2011-06-01 02:15:44 +0800
commit644d1c301ce4813283e1ce22935bc2357fe93c1b (patch)
tree1a37e76f2159c91c2eb805c4d9081021ce587301 /embed
parentfaf06ad3dd147216463c01d219f3da5ce9167ce9 (diff)
downloadgsoc2013-epiphany-644d1c301ce4813283e1ce22935bc2357fe93c1b.tar
gsoc2013-epiphany-644d1c301ce4813283e1ce22935bc2357fe93c1b.tar.gz
gsoc2013-epiphany-644d1c301ce4813283e1ce22935bc2357fe93c1b.tar.bz2
gsoc2013-epiphany-644d1c301ce4813283e1ce22935bc2357fe93c1b.tar.lz
gsoc2013-epiphany-644d1c301ce4813283e1ce22935bc2357fe93c1b.tar.xz
gsoc2013-epiphany-644d1c301ce4813283e1ce22935bc2357fe93c1b.tar.zst
gsoc2013-epiphany-644d1c301ce4813283e1ce22935bc2357fe93c1b.zip
ephy-web-view: warn about unsubmitted forms on close
Reimplement this again, hopefully a lot more accurately now with WebKit :) Bug #604986
Diffstat (limited to 'embed')
-rw-r--r--embed/ephy-web-view.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index 288472955..64ddc69a9 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -3066,6 +3066,39 @@ ephy_web_view_set_typed_address (EphyWebView *view,
gboolean
ephy_web_view_has_modified_forms (EphyWebView *view)
{
+ WebKitDOMHTMLCollection *forms = NULL;
+ WebKitDOMDocument *document = NULL;
+ gulong forms_n;
+ int i;
+
+ document = webkit_web_view_get_dom_document (WEBKIT_WEB_VIEW (view));
+ forms = webkit_dom_document_get_forms (document);
+ forms_n = webkit_dom_html_collection_get_length (forms);
+
+ for (i = 0; i < forms_n; i++) {
+ WebKitDOMHTMLCollection *elements;
+ WebKitDOMNode *form_element = webkit_dom_html_collection_item (forms, i);
+ gulong elements_n;
+ int j;
+
+ elements = webkit_dom_html_form_element_get_elements (WEBKIT_DOM_HTML_FORM_ELEMENT (form_element));
+ elements_n = webkit_dom_html_collection_get_length (elements);
+
+ for (j = 0; j < elements_n; j++) {
+ WebKitDOMNode *element;
+
+ element = webkit_dom_html_collection_item (elements, j);
+
+ if (WEBKIT_DOM_IS_HTML_TEXT_AREA_ELEMENT (element))
+ if (webkit_dom_html_text_area_element_is_edited (WEBKIT_DOM_HTML_TEXT_AREA_ELEMENT (element)))
+ return TRUE;
+
+ if (WEBKIT_DOM_IS_HTML_INPUT_ELEMENT (element))
+ if (webkit_dom_html_input_element_is_edited (WEBKIT_DOM_HTML_INPUT_ELEMENT (element)))
+ return TRUE;
+ }
+ }
+
return FALSE;
}