Reverted chrome added to BROWSER_NAME

This commit is contained in:
Gregers Gram Rygg
2012-05-30 15:01:25 +02:00
parent f7f763d1d3
commit 2725cd93f6
4 changed files with 6 additions and 25 deletions

View File

@@ -1233,7 +1233,7 @@ OpenLayers.Util.pagePosition = function(forElement) {
var browser = OpenLayers.BROWSER_NAME; var browser = OpenLayers.BROWSER_NAME;
// opera & (safari absolute) incorrectly account for body offsetTop // opera & (safari absolute) incorrectly account for body offsetTop
if (browser == "opera" || ((browser == "safari" || browser == "chrome") && if (browser == "opera" || (browser == "safari" &&
OpenLayers.Element.getStyle(forElement, 'position') == 'absolute')) { OpenLayers.Element.getStyle(forElement, 'position') == 'absolute')) {
pos[1] -= document.body.offsetTop; pos[1] -= document.body.offsetTop;
} }
@@ -1439,22 +1439,13 @@ OpenLayers.Util.removeTail = function(url) {
return head; return head;
}; };
/**
* Constant: IS_WEBKIT
* {Boolean} True if the userAgent reports the browser to use the WebKit engine
*/
OpenLayers.IS_WEBKIT = (function() {
var ua = navigator.userAgent.toLowerCase();
return ua.indexOf("webkit") !== -1;
})();
/** /**
* Constant: IS_GECKO * Constant: IS_GECKO
* {Boolean} True if the userAgent reports the browser to use the Gecko engine * {Boolean} True if the userAgent reports the browser to use the Gecko engine
*/ */
OpenLayers.IS_GECKO = (function() { OpenLayers.IS_GECKO = (function() {
var ua = navigator.userAgent.toLowerCase(); var ua = navigator.userAgent.toLowerCase();
return !OpenLayers.IS_WEBKIT && ua.indexOf("gecko") !== -1; return ua.indexOf("webkit") == -1 && ua.indexOf("gecko") != -1;
})(); })();
/** /**
@@ -1484,8 +1475,6 @@ OpenLayers.BROWSER_NAME = (function() {
name = "opera"; name = "opera";
} else if (ua.indexOf("msie") != -1) { } else if (ua.indexOf("msie") != -1) {
name = "msie"; name = "msie";
} else if(ua.indexOf("chrome") != -1) {
name = "chrome";
} else if (ua.indexOf("safari") != -1) { } else if (ua.indexOf("safari") != -1) {
name = "safari"; name = "safari";
} else if (ua.indexOf("mozilla") != -1) { } else if (ua.indexOf("mozilla") != -1) {

View File

@@ -14,12 +14,4 @@ Removed rounding of zoom level for maps with fractionalZoom == true. So users wi
Corresponding issues/pull requests: Corresponding issues/pull requests:
* https://github.com/openlayers/openlayers/pull/483 * https://github.com/openlayers/openlayers/pull/483
## "chrome" added to OpenLayers.BROWSER_NAME
Chrome was incorrectly detected as "safari". Code that expect OpenLayers.BROWSER_NAME to be "safari" in Google Chrome will cause problems. Test for "chrome" as well, or use the new OpenLayers.IS_WEBKIT.
Corresponding issues/pull requests:
* https://github.com/openlayers/openlayers/pull/483

View File

@@ -18,9 +18,9 @@
(window.location.host == "localhost") || (window.location.host == "localhost") ||
(window.location.host == "openlayers.org"); (window.location.host == "openlayers.org");
if (OpenLayers.BROWSER_NAME == "opera" || OpenLayers.IS_WEBKIT) { if (OpenLayers.BROWSER_NAME == "opera" || OpenLayers.BROWSER_NAME == "safari") {
t.plan(1); t.plan(1);
t.debug_print("Can't test google reprojection in Opera or WebKit."); t.debug_print("Can't test google reprojection in Opera or Safari.");
} else if(validkey) { } else if(validkey) {
t.plan(5); t.plan(5);
var map = new OpenLayers.Map('map'); var map = new OpenLayers.Map('map');

View File

@@ -16,7 +16,7 @@
var validkey = (window.location.protocol == "file:") || var validkey = (window.location.protocol == "file:") ||
(window.location.host == "localhost") || (window.location.host == "localhost") ||
(window.location.host == "openlayers.org"); (window.location.host == "openlayers.org");
if (OpenLayers.BROWSER_NAME == "opera" || OpenLayers.IS_WEBKIT) { if (OpenLayers.BROWSER_NAME == "opera" || OpenLayers.BROWSER_NAME == "safari") {
t.plan(1); t.plan(1);
t.debug_print("Can't test google reprojection in Opera or Safari."); t.debug_print("Can't test google reprojection in Opera or Safari.");
} else if(validkey) { } else if(validkey) {