Quantcast

[HtmlUnit] SVN: [13792] trunk/htmlunit/src

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[HtmlUnit] SVN: [13792] trunk/htmlunit/src

asashour-2
Revision: 13792
          http://sourceforge.net/p/htmlunit/code/13792
Author:   asashour
Date:     2017-03-16 09:11:55 +0000 (Thu, 16 Mar 2017)
Log Message:
-----------
Deprecate HtmlImage.getComplete()

Modified Paths:
--------------
    trunk/htmlunit/src/changes/changes.xml
    trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlImage.java
    trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLImageElement.java

Modified: trunk/htmlunit/src/changes/changes.xml
===================================================================
--- trunk/htmlunit/src/changes/changes.xml 2017-03-16 08:49:23 UTC (rev 13791)
+++ trunk/htmlunit/src/changes/changes.xml 2017-03-16 09:11:55 UTC (rev 13792)
@@ -8,7 +8,10 @@
 
     <body>
         <release version="2.26" date="???" description="Bugfixes">
-            <action type="fix" dev="asashour">
+            <action type="update" dev="asashour">
+                Deprecate HtmlImage.getComplete().
+            </action>
+            <action type="update" dev="asashour">
                 Deprecate HtmlKeygen.
             </action>
             <action type="fix" dev="rbri">

Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlImage.java
===================================================================
--- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlImage.java 2017-03-16 08:49:23 UTC (rev 13791)
+++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlImage.java 2017-03-16 09:11:55 UTC (rev 13792)
@@ -464,7 +464,9 @@
                 imageData_.close();
                 imageData_ = null;
             }
-            downloaded_ = true;
+            downloaded_ = hasFeature(JS_IMAGE_COMPLETE_RETURNS_TRUE_FOR_NO_REQUEST)
+                    || (imageWebResponse_ != null && imageWebResponse_.getContentType().contains("image"));
+
             width_ = -1;
             height_ = -1;
         }
@@ -633,11 +635,20 @@
     /**
      * @return true if the image was successfully downloaded
      */
+    public boolean isComplete() {
+        return downloaded_ ||
+                (hasFeature(JS_IMAGE_COMPLETE_RETURNS_TRUE_FOR_NO_REQUEST)
+                ? ATTRIBUTE_NOT_DEFINED == getSrcAttribute()
+                : imageData_ != null);
+    }
+
+    /**
+     * @return true if the image was successfully downloaded
+     * @deprecated as of 2.26, please use {@link #isComplete()} instead
+     */
+    @Deprecated
     public boolean getComplete() {
-        if (hasFeature(JS_IMAGE_COMPLETE_RETURNS_TRUE_FOR_NO_REQUEST)) {
-            return downloaded_ || ATTRIBUTE_NOT_DEFINED == getSrcAttribute();
-        }
-        return imageData_ != null;
+        return isComplete();
     }
 
     /**

Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLImageElement.java
===================================================================
--- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLImageElement.java 2017-03-16 08:49:23 UTC (rev 13791)
+++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLImageElement.java 2017-03-16 09:11:55 UTC (rev 13792)
@@ -361,8 +361,8 @@
      * @return the value of the {@code complete} property
      */
     @JsxGetter
-    public boolean getComplete() {
-        return ((HtmlImage) getDomNodeOrDie()).getComplete();
+    public boolean isComplete() {
+        return ((HtmlImage) getDomNodeOrDie()).isComplete();
     }
 
     /**


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
HtmlUnit-develop mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/htmlunit-develop
Loading...