Reviewers: jgw, t.broyer, Message: Okay, we'll back off from this one.
Please review this at http://gwt-code-reviews.appspot.com/97807 Affected files: M user/src/com/google/gwt/user/client/ui/impl/PopupImplIE6.java Index: user/src/com/google/gwt/user/client/ui/impl/PopupImplIE6.java diff --git a/user/src/com/google/gwt/user/client/ui/impl/PopupImplIE6.java b/user/src/com/google/gwt/user/client/ui/impl/PopupImplIE6.java index 74d28b3811c4d4d2b58de6322024900e4c5a82f4..9d7a696598c4eb74322bca932c7c178282833a64 100644 --- a/user/src/com/google/gwt/user/client/ui/impl/PopupImplIE6.java +++ b/user/src/com/google/gwt/user/client/ui/impl/PopupImplIE6.java @@ -22,9 +22,53 @@ import com.google.gwt.user.client.Element; * {...@link com.google.gwt.user.client.ui.impl.PopupImpl}. */ public class PopupImplIE6 extends PopupImpl { + private static boolean isIE6 = isIE6(); + + // Stolen and modified from UserAgent.gwt.xml. + // TODO(jgw): Get rid of this method, and switch to using soft permutations + // once they land in trunk. + private static native boolean isIE6() /*-{ + function makeVersion(result) { + return (parseInt(result[1]) * 1000) + parseInt(result[2]); + } + + var ua = navigator.userAgent.toLowerCase(); + if (ua.indexOf("msie") != -1) { + var result = /msie ([0-9]+)\.([0-9]+)/.exec(ua); + if (result && result.length == 3) { + var v = makeVersion(result); + if (v < 7000) { + return true; + } + } + } + + return false; + }-*/; + + + @Override + public void onHide(Element popup) { + if (isIE6) { + do_onHide(popup); + } + } + + @Override + public void onShow(Element popup) { + if (isIE6) { + do_onShow(popup); + } + } @Override - public native void onHide(Element popup) /*-{ + public void setVisible(Element popup, boolean visible) { + if (isIE6){ + do_setVisible(popup, visible); + } + } + + private native void do_onHide(Element popup) /*-{ // It is at least rarely possible to get an onHide() without a matching // onShow(), usually because of timing issues created by animations. So // we're careful not to assume the existence of '__frame' here. @@ -35,9 +79,8 @@ public class PopupImplIE6 extends PopupImpl { popup.__frame = null; } }-*/; - - @Override - public native void onShow(Element popup) /*-{ + + private native void do_onShow(Element popup) /*-{ // TODO: make this more Java and less JSNI? var frame = $doc.createElement('iframe'); @@ -82,8 +125,7 @@ public class PopupImplIE6 extends PopupImpl { popup.parentElement.insertBefore(frame, popup); }-*/; - @Override - public native void setVisible(Element popup, boolean visible) /*-{ + private native void do_setVisible(Element popup, boolean visible) /*-{ if (popup.__frame) { popup.__frame.style.visibility = visible ? 'visible' : 'hidden'; } --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~----------~----~----~----~------~----~------~--~---
