From: Anna Koskinen Date: Fri, 11 Jan 2013 08:37:03 +0000 (+0200) Subject: Merge of (#10460) to Vaadin 7. X-Git-Tag: 7.0.0.rc1~34^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=08ddaa7ab9b8329fbcd8f2e1cd83e3b5db438148;p=vaadin-framework.git Merge of (#10460) to Vaadin 7. Math.min/Math.max fix for iOS6. Change-Id: I386140a35eb99a2a0b3db7524ae3d49e428217e8 --- diff --git a/client/src/com/vaadin/client/ApplicationConfiguration.java b/client/src/com/vaadin/client/ApplicationConfiguration.java index d43e2b4d31..5c3ec36d78 100644 --- a/client/src/com/vaadin/client/ApplicationConfiguration.java +++ b/client/src/com/vaadin/client/ApplicationConfiguration.java @@ -533,6 +533,14 @@ public class ApplicationConfiguration implements EntryPoint { @Override public void onModuleLoad() { + BrowserInfo browserInfo = BrowserInfo.get(); + + // Enable iOS6 cast fix (see #10460) + if (browserInfo.isIOS() && browserInfo.isWebkit() + && browserInfo.getBrowserMajorVersion() == 6) { + enableIOS6castFix(); + } + // Prepare VConsole for debugging if (isDebugMode()) { Console console = GWT.create(Console.class); @@ -568,6 +576,18 @@ public class ApplicationConfiguration implements EntryPoint { registerCallback(GWT.getModuleName()); } + /** + * Fix to iOS6 failing when comparing with 0 directly after the kind of + * comparison done by GWT when a double or float is cast to an int. Forcing + * another trivial operation (other than a compare to 0) after the dangerous + * comparison makes the issue go away. See #10460. + */ + private static native void enableIOS6castFix() + /*-{ + Math.max = function(a,b) {return (a > b === 1 < 2)? a : b} + Math.min = function(a,b) {return (a < b === 1 < 2)? a : b} + }-*/; + /** * Registers that callback that the bootstrap javascript uses to start * applications once the widgetset is loaded and all required information is