Revision: 9434
Author: [email protected]
Date: Wed Dec 15 10:08:15 2010
Log: Copying the DOMImplIE6 setOpacity implementation into DOMImplIE8
because IE8 does not support the opacity style attribute. I added a runtime
check to differentiate IE8, which only supports the alpha filter, from IE9,
which supports opacity.
Review at http://gwt-code-reviews.appspot.com/1211801
Review by: [email protected]
http://code.google.com/p/google-web-toolkit/source/detail?r=9434
Modified:
/trunk/user/src/com/google/gwt/dom/client/DOMImplIE8.java
=======================================
--- /trunk/user/src/com/google/gwt/dom/client/DOMImplIE8.java Wed Oct 28
09:10:53 2009
+++ /trunk/user/src/com/google/gwt/dom/client/DOMImplIE8.java Wed Dec 15
10:08:15 2010
@@ -17,6 +17,41 @@
class DOMImplIE8 extends DOMImplTrident {
+ private static boolean isIE8;
+ private static boolean isIE8Detected;
+
+ /**
+ * Check if the browser is IE8 or IE9.
+ *
+ * @return <code>true</code> if the browser is IE8, <code>false</code>
if IE9
+ * or any other browser
+ */
+ static boolean isIE8() {
+ if (!isIE8Detected) {
+ isIE8 = isIE8Impl();
+ isIE8Detected = true;
+ }
+ return isIE8;
+ }
+
+ // Stolen and modified from UserAgent.gwt.xml.
+ private static native boolean isIE8Impl() /*-{
+ var ua = navigator.userAgent.toLowerCase();
+ if (ua.indexOf("msie") != -1 && $doc.documentMode == 8) {
+ return true;
+ }
+ return false;
+ }-*/;
+
+ @Override
+ public void cssSetOpacity(Style style, double value) {
+ if (isIE8()) {
+ cssSetOpacityImpl(style, value);
+ } else {
+ super.cssSetOpacity(style, value);
+ }
+ }
+
@Override
public int getAbsoluteLeft(Element elem) {
Document doc = elem.getOwnerDocument();
@@ -46,4 +81,8 @@
}
super.setScrollLeft(elem, left);
}
-}
+
+ private native void cssSetOpacityImpl(Style style, double value) /*-{
+ style.filter = 'alpha(opacity=' + (value * 100) + ')';
+ }-*/;
+}
--
http://groups.google.com/group/Google-Web-Toolkit-Contributors