summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorArtur Signell <artur.signell@itmill.com>2011-04-21 07:27:37 +0000
committerArtur Signell <artur.signell@itmill.com>2011-04-21 07:27:37 +0000
commit159dcf5e9407d37d49647cf88afa1a1e0969a2bc (patch)
treecee5afed79677f07855055c6496c73583d4899b7 /src
parent522f4c3dbe60746f1140a2605ff8842620252ada (diff)
downloadvaadin-framework-159dcf5e9407d37d49647cf88afa1a1e0969a2bc.tar.gz
vaadin-framework-159dcf5e9407d37d49647cf88afa1a1e0969a2bc.zip
#6787 Use document mode in IE to detect browser version
svn changeset:18425/svn branch:6.6
Diffstat (limited to 'src')
-rw-r--r--src/com/vaadin/terminal/gwt/client/BrowserInfo.java18
-rw-r--r--src/com/vaadin/terminal/gwt/client/VBrowserDetails.java23
2 files changed, 22 insertions, 19 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/BrowserInfo.java b/src/com/vaadin/terminal/gwt/client/BrowserInfo.java
index 141a05ffdb..8c80f1f530 100644
--- a/src/com/vaadin/terminal/gwt/client/BrowserInfo.java
+++ b/src/com/vaadin/terminal/gwt/client/BrowserInfo.java
@@ -55,20 +55,22 @@ public class BrowserInfo {
private BrowserInfo() {
browserDetails = new VBrowserDetails(getBrowserString());
- if (browserDetails.isIE()
- && browserDetails.getBrowserMajorVersion() == 8
- && isIE8InIE7CompatibilityMode()) {
- browserDetails.setIE8InCompatibilityMode();
+ if (browserDetails.isIE()) {
+ // Use document mode instead user agent to accurately detect how we
+ // are rendering
+ int documentMode = getIEDocumentMode();
+ if (documentMode != -1) {
+ browserDetails.setIEMode(documentMode);
+ }
}
-
}
- private native boolean isIE8InIE7CompatibilityMode()
+ private native int getIEDocumentMode()
/*-{
var mode = $wnd.document.documentMode;
if (!mode)
- return false;
- return (mode == 7);
+ return -1;
+ return mode;
}-*/;
/**
diff --git a/src/com/vaadin/terminal/gwt/client/VBrowserDetails.java b/src/com/vaadin/terminal/gwt/client/VBrowserDetails.java
index 92b3dedf1f..2b55c96125 100644
--- a/src/com/vaadin/terminal/gwt/client/VBrowserDetails.java
+++ b/src/com/vaadin/terminal/gwt/client/VBrowserDetails.java
@@ -237,10 +237,10 @@ public class VBrowserDetails implements Serializable {
/**
* Returns the browser major version e.g., 3 for Firefox 3.5, 4 for Chrome
* 4, 8 for Internet Explorer 8.
- *
- * <pre>
- * Note that Internet Explorer 8 in compatibility mode will return 7.
- * </pre>
+ * <p>
+ * Note that Internet Explorer 8 and newer will return the document mode so
+ * IE8 rendering as IE7 will return 7.
+ * </p>
*
* @return The major version of the browser.
*/
@@ -260,15 +260,16 @@ public class VBrowserDetails implements Serializable {
}
/**
- * Marks that IE8 is used in compatibility mode. This forces the browser
- * version to 7 even if it otherwise was detected as 8.
+ * Sets the version for IE based on the documentMode. This is used to return
+ * the correct the correct IE version when the version from the user agent
+ * string and the value of the documentMode property do not match.
*
+ * @param documentMode
+ * The current document mode
*/
- public void setIE8InCompatibilityMode() {
- if (isIE && browserMajorVersion == 8) {
- browserMajorVersion = 7;
- browserMinorVersion = 0;
- }
+ public void setIEMode(int documentMode) {
+ browserMajorVersion = documentMode;
+ browserMinorVersion = 0;
}
/**