Quantcast

[HtmlUnit] SVN: [13747] 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: [13747] trunk/htmlunit/src

rbri
Revision: 13747
          http://sourceforge.net/p/htmlunit/code/13747
Author:   rbri
Date:     2017-03-15 20:08:18 +0000 (Wed, 15 Mar 2017)
Log Message:
-----------
WebClientOptions: add option for screen width/height.

Modified Paths:
--------------
    trunk/htmlunit/src/changes/changes.xml
    trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClientOptions.java
    trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Screen.java

Modified: trunk/htmlunit/src/changes/changes.xml
===================================================================
--- trunk/htmlunit/src/changes/changes.xml 2017-03-15 20:06:42 UTC (rev 13746)
+++ trunk/htmlunit/src/changes/changes.xml 2017-03-15 20:08:18 UTC (rev 13747)
@@ -8,6 +8,9 @@
 
     <body>
         <release version="2.26" date="???" description="Bugfixes">
+            <action type="add" dev="asashour">
+                WebClientOptions: add option for screen width/height.
+            </action>
             <action type="update" dev="rbri">
                 Reduce the number of temp files created when asking images for width/height.
             </action>

Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClientOptions.java
===================================================================
--- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClientOptions.java 2017-03-15 20:06:42 UTC (rev 13746)
+++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClientOptions.java 2017-03-15 20:08:18 UTC (rev 13747)
@@ -56,6 +56,8 @@
     private int historyPageCacheLimit_ = Integer.MAX_VALUE;
     private InetAddress localAddress_;
     private boolean downloadImages_;
+    private int screenWidth_ = 1024;
+    private int screenHeight_ = 768;
 
     /**
      * If set to {@code true}, the client will accept connections to any host, regardless of
@@ -611,4 +613,40 @@
     public boolean isDownloadImages() {
         return downloadImages_;
     }
+
+    /**
+     * Sets the screen width.
+     *
+     * @param screenWidth the screen width
+     */
+    public void setScreenWidth(final int screenWidth) {
+        this.screenWidth_ = screenWidth;
+    }
+
+    /**
+     * Returns the screen width.
+     *
+     * @return the screen width
+     */
+    public int getScreenWidth() {
+        return screenWidth_;
+    }
+
+    /**
+     * Sets the screen height.
+     *
+     * @param screenHeight the screen height
+     */
+    public void setScreenHeight(final int screenHeight) {
+        this.screenHeight_ = screenHeight;
+    }
+
+    /**
+     * Returns the screen height.
+     *
+     * @return the screen height
+     */
+    public int getScreenHeight() {
+        return screenHeight_;
+    }
 }

Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Screen.java
===================================================================
--- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Screen.java 2017-03-15 20:06:42 UTC (rev 13746)
+++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Screen.java 2017-03-15 20:08:18 UTC (rev 13747)
@@ -217,7 +217,7 @@
      */
     @JsxGetter
     public int getHeight() {
-        return 768;
+        return ((Window) getParentScope()).getWebWindow().getWebClient().getOptions().getScreenHeight();
     }
 
     /**
@@ -361,7 +361,7 @@
      */
     @JsxGetter
     public int getWidth() {
-        return 1024;
+        return ((Window) getParentScope()).getWebWindow().getWebClient().getOptions().getScreenWidth();
     }
 
     /**


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