You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ta...@apache.org on 2017/10/10 11:46:39 UTC

svn commit: r1811676 - /myfaces/core/branches/2.3.x/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlJavaScriptUtils.java

Author: tandraschko
Date: Tue Oct 10 11:46:39 2017
New Revision: 1811676

URL: http://svn.apache.org/viewvc?rev=1811676&view=rev
Log:
MYFACES-4122 Auto scroll doesn't work anymore for some environment

Modified:
    myfaces/core/branches/2.3.x/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlJavaScriptUtils.java

Modified: myfaces/core/branches/2.3.x/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlJavaScriptUtils.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.3.x/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlJavaScriptUtils.java?rev=1811676&r1=1811675&r2=1811676&view=diff
==============================================================================
--- myfaces/core/branches/2.3.x/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlJavaScriptUtils.java (original)
+++ myfaces/core/branches/2.3.x/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlJavaScriptUtils.java Tue Oct 10 11:46:39 2017
@@ -204,8 +204,8 @@ public final class HtmlJavaScriptUtils
                     .getRequestParameterMap().get(AUTO_SCROLL_PARAM);
             if (scrolling != null && scrolling.length() > 0)
             {
-                int x = 0;
-                int y = 0;
+                double x = 0;
+                double y = 0;
                 int comma = scrolling.indexOf(',');
                 if (comma == -1)
                 {
@@ -216,8 +216,8 @@ public final class HtmlJavaScriptUtils
                 {
                     try
                     {
-                        //we convert to int against XSS vulnerability
-                        x = Integer.parseInt(scrolling.substring(0, comma));
+                        //we convert to double against XSS vulnerability
+                        x = Double.parseDouble(scrolling.substring(0, comma));
                     }
                     catch (NumberFormatException e)
                     {
@@ -238,8 +238,8 @@ public final class HtmlJavaScriptUtils
                         y = 0; //ignore false numbers
                     }
                 }
-                script.append("window.scrollTo(").append(x).append(",")
-                        .append(y).append(");\n");
+                script.append("window.scrollTo(").append(String.valueOf(x)).append(",")
+                        .append(String.valueOf(y)).append(");\n");
             }
         }