Changed OpenLayers.BROWSER_NAME to be 'chrome' for Google Chrome instead of 'safari'. Added OpenLayers.IS_WEBKIT and changed tests where necessary.

This commit is contained in:
Gregers Gram Rygg
2012-05-29 13:23:40 +02:00
parent 12931612ea
commit a1dff8ad9b
3 changed files with 15 additions and 4 deletions
+12 -1
View File
@@ -1439,13 +1439,22 @@ 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 ua.indexOf("webkit") == -1 && ua.indexOf("gecko") != -1; return !OpenLayers.IS_WEBKIT && ua.indexOf("gecko") !== -1;
})(); })();
/** /**
@@ -1475,6 +1484,8 @@ 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) {
+2 -2
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.BROWSER_NAME == "safari") { if (OpenLayers.BROWSER_NAME == "opera" || OpenLayers.IS_WEBKIT) {
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 WebKit.");
} else if(validkey) { } else if(validkey) {
t.plan(5); t.plan(5);
var map = new OpenLayers.Map('map'); var map = new OpenLayers.Map('map');
+1 -1
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.BROWSER_NAME == "safari") { if (OpenLayers.BROWSER_NAME == "opera" || OpenLayers.IS_WEBKIT) {
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) {