vaadin / framework

Vaadin 6, 7, 8 is a Java framework for modern Java web applications.
http://vaadin.com/
Other
1.79k stars 729 forks source link

error if IE10 is in zoom mode #3809

Closed vaadin-bot closed 11 years ago

vaadin-bot commented 11 years ago

Originally by Florian Geiger


There is a problem within the static method com.vaadin.terminal.gwt.client.MouseEventDetails#deSerialize(String) where the incoming String values are parsed using Integer.parseInt(). If the browser is IE10 and is in a zoom mode other then 100%, a NumberFormat Exception in class com.vaadin.terminal.gwt.client.MouseEventDetails#deSerialize occurs.

The proposed solution could be:

public static MouseEventDetails deSerialize(String serializedString) {
    MouseEventDetails instance = new MouseEventDetails();
    String[] fields = serializedString.split(",");

    instance.button = saveParseInt(fields[0]);
    instance.clientX = saveParseInt(fields[1]);
    instance.clientY = saveParseInt(fields[2]);
    instance.altKey = Boolean.valueOf(fields[3]).booleanValue();
    instance.ctrlKey = Boolean.valueOf(fields[4]).booleanValue();
    instance.metaKey = Boolean.valueOf(fields[5]).booleanValue();
    instance.shiftKey = Boolean.valueOf(fields[6]).booleanValue();
    instance.type = saveParseInt(fields[7]);
    instance.relativeX = saveParseInt(fields[8]);
    instance.relativeY = saveParseInt(fields[9]);
    return instance;
}

private static int saveParseInt(String s) {
    double d = Double.parseDouble(s);
    return (int) d;
} 

Refers to the support request [https://vaadin.com/pro/support-request#216]


Imported from https://dev.vaadin.com/ issue #11641

vaadin-bot commented 11 years ago

Originally by @Artur-


The base problem is running IE10 in native mode until #9463 has been fully fixed. A better way to fix this particular problem would be to ensure the sent values are integers on the client side, where the actual problem is.

vaadin-bot commented 11 years ago

Originally by Florian Geiger


Sure, it's the better way. But we have no possibility to ensure this because we cannot switch to a newer GWT version as far as we are on the vaadin 6 trunk and we also have to support IE10.

vaadin-bot commented 11 years ago

Originally by @jdahlstrom


We could use the bitwise OR hack in serialize:

public String serialize() {
        return "" + button + DELIM + (clientX|0) + DELIM + (clientY|0) + DELIM + altKey
                + DELIM + ctrlKey + DELIM + metaKey + DELIM + shiftKey + DELIM
                + type + DELIM + (relativeX|0) + DELIM + (relativeY|0);
    }

Perhaps we should have an utility method for doing that somewhere.

vaadin-bot commented 11 years ago

Originally by @Artur-


Would be even better to fix it as far up as we can go in the Vaadin code, i.e. Util.getTouchOrMouseClientX/Util.getTouchOrMouseClientY/MouseEventDetails.getRelativeX/MouseEventDetails.getRelativeY. Then it will possibly fix some other issue also.

vaadin-bot commented 11 years ago

Originally by @johndevs


The actual problem is in MouseEventDetails.getRelativeX() and MouseEventDetails.getRelativeY() which are calling DOM methods which are returning double values.

We cannot really affect the DOM methods without replacing the GWT DOM implementations with our own which might be an option for #9463 but would bring in a lot of classes from GWT to Vaadin which is not that optimal.

What we could do now however is:

It will not solve every IE10 issue but would alleviate it somewhat. To fix this issue completely an upgrade to a GWT version where DOM methods no longer return double values has been solved (i.e. when http://code.google.com/p/google-web-toolkit/issues/detail?id=6130 has been implemented in GWT) would be needed.

vaadin-bot commented 11 years ago

Originally by @johndevs


Fixed as mentioned above. Reviewed by Johannes Dahlstrom.