Quantcast

[HtmlUnit] SVN: [14149] trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit

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: [14149] trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit

asashour-2
Revision: 14149
          http://sourceforge.net/p/htmlunit/code/14149
Author:   asashour
Date:     2017-04-21 11:15:39 +0000 (Fri, 21 Apr 2017)
Log Message:
-----------
hu3: WindowTest now passes

Modified Paths:
--------------
    trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/DialogWindow.java
    trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java

Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/DialogWindow.java
===================================================================
--- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/DialogWindow.java 2017-04-21 11:00:57 UTC (rev 14148)
+++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/DialogWindow.java 2017-04-21 11:15:39 UTC (rev 14149)
@@ -14,6 +14,8 @@
  */
 package com.gargoylesoftware.htmlunit;
 
+import com.gargoylesoftware.js.nashorn.internal.runtime.ScriptObject;
+
 import net.sourceforge.htmlunit.corejs.javascript.ScriptableObject;
 
 /**
@@ -73,6 +75,17 @@
     }
 
     /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void setScriptObject(final ScriptObject scriptObject) {
+        if (scriptObject != null) {
+            scriptObject.put("dialogArguments", arguments_, false);
+        }
+        super.setScriptObject(scriptObject);
+    }
+
+    /**
      * Closes this window.
      */
     public void close() {

Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java
===================================================================
--- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java 2017-04-21 11:00:57 UTC (rev 14148)
+++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java 2017-04-21 11:15:39 UTC (rev 14149)
@@ -84,10 +84,12 @@
 import com.gargoylesoftware.htmlunit.javascript.host.Window;
 import com.gargoylesoftware.htmlunit.javascript.host.Window2;
 import com.gargoylesoftware.htmlunit.javascript.host.css.ComputedCSSStyleDeclaration;
+import com.gargoylesoftware.htmlunit.javascript.host.css.ComputedCSSStyleDeclaration2;
 import com.gargoylesoftware.htmlunit.javascript.host.dom.Node;
 import com.gargoylesoftware.htmlunit.javascript.host.event.Event;
 import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLDocument;
 import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLElement;
+import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLElement2;
 import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLIFrameElement;
 import com.gargoylesoftware.htmlunit.protocol.data.DataUrlDecoder;
 import com.gargoylesoftware.htmlunit.util.Cookie;
@@ -1799,11 +1801,21 @@
                 // now looks at the visibility of the frame window
                 final BaseFrameElement frameElement = fw.getFrameElement();
                 if (frameElement.isDisplayed()) {
-                    final HTMLElement htmlElement = (HTMLElement) frameElement.getScriptableObject();
-                    final ComputedCSSStyleDeclaration style =
-                            htmlElement.getWindow().getComputedStyle(htmlElement, null);
-                    use = style.getCalculatedWidth(false, false) != 0
-                        && style.getCalculatedHeight(false, false) != 0;
+                    final Object element = frameElement.getScriptableObject();
+                    if (element instanceof HTMLElement2) {
+                        final HTMLElement2 htmlElement = (HTMLElement2) element;
+                        final ComputedCSSStyleDeclaration2 style =
+                                Window2.getComputedStyle(htmlElement.getWindow(), htmlElement, null);
+                        use = style.getCalculatedWidth(false, false) != 0
+                                && style.getCalculatedHeight(false, false) != 0;
+                    }
+                    else {
+                        final HTMLElement htmlElement = (HTMLElement) element;
+                        final ComputedCSSStyleDeclaration style =
+                                htmlElement.getWindow().getComputedStyle(htmlElement, null);
+                        use = style.getCalculatedWidth(false, false) != 0
+                                && style.getCalculatedHeight(false, false) != 0;
+                    }
                 }
             }
             if (use) {


------------------------------------------------------------------------------
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...