[epiphany] Don't warn about unsubmitted changes unless the form has text



commit 36ef168272ccbb9bd805fb62ae03566ec04004a0
Author: Michael Catanzaro <mcatanzaro igalia com>
Date:   Tue Sep 22 19:50:09 2015 -0500

    Don't warn about unsubmitted changes unless the form has text
    
    You could delete all the text; the form is still modified, but we
    shouldn't warn about it, since you have no data to lose.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=668260

 lib/ephy-web-dom-utils.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/lib/ephy-web-dom-utils.c b/lib/ephy-web-dom-utils.c
index 7db061a..4b85e6b 100644
--- a/lib/ephy-web-dom-utils.c
+++ b/lib/ephy-web-dom-utils.c
@@ -62,8 +62,17 @@ ephy_web_dom_utils_has_modified_forms (WebKitDOMDocument *document)
       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_html_text_area_element_is_edited (WEBKIT_DOM_HTML_TEXT_AREA_ELEMENT (element))) {
+          char *text;
+          gboolean has_data;
+
+          text = webkit_dom_html_text_area_element_get_value (WEBKIT_DOM_HTML_TEXT_AREA_ELEMENT (element));
+          has_data = text && *text;
+          g_free (text);
+
+          if (has_data)
+            return TRUE;
+        }
 
       if (WEBKIT_DOM_IS_HTML_INPUT_ELEMENT (element))
         if (webkit_dom_html_input_element_is_edited (WEBKIT_DOM_HTML_INPUT_ELEMENT (element))) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]