blankImageUrl is no longer needed for image tiles

This commit is contained in:
ahocevar
2012-11-05 10:40:05 +01:00
parent 7e5e221c8d
commit ebeb49b5e7
3 changed files with 13 additions and 19 deletions

View File

@@ -60,14 +60,6 @@ OpenLayers.Tile.Image = OpenLayers.Class(OpenLayers.Tile, {
*/
asyncRequestId: null,
/**
* Property: blankImageUrl
* {String} Using a data scheme url is not supported by all browsers, but
* we don't care because we either set it as css backgroundImage, or the
* image's display style is set to "none" when we use it.
*/
blankImageUrl: "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAQAIBRAA7",
/**
* APIProperty: maxGetUrlLength
* {Number} If set, requests that would result in GET urls with more
@@ -297,11 +289,9 @@ OpenLayers.Tile.Image = OpenLayers.Class(OpenLayers.Tile, {
if (this.url && img.getAttribute("src") == this.url) {
this.onImageLoad();
} else {
if (img.getAttribute("src") !== this.blankImageUrl) {
OpenLayers.Event.stopObservingElement(img);
if (this.crossOriginKeyword) {
img.removeAttribute("crossorigin");
}
OpenLayers.Event.stopObservingElement(img);
if (this.crossOriginKeyword) {
img.removeAttribute("crossorigin");
}
OpenLayers.Event.observe(img, "load",
OpenLayers.Function.bind(this.onImageLoad, this)

View File

@@ -25,6 +25,14 @@ OpenLayers.Tile.Image.IFrame = {
*/
useIFrame: null,
/**
* Property: blankImageUrl
* {String} Using a data scheme url is not supported by all browsers, but
* we don't care because we either set it as css backgroundImage, or the
* image's display style is set to "none" when we use it.
*/
blankImageUrl: "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAQAIBRAA7",
/**
* Method: draw
* Set useIFrame in the instance, and operate the image/iframe switch.
@@ -65,11 +73,7 @@ OpenLayers.Tile.Image.IFrame = {
// And if we had an iframe we also remove the event pane.
if(fromIFrame) {
this.blankImageUrl = this._blankImageUrl;
this.frame.removeChild(this.frame.firstChild);
} else {
this._blankImageUrl = this.blankImageUrl;
this.blankImageUrl = "about:blank";
}
}
}
@@ -89,7 +93,7 @@ OpenLayers.Tile.Image.IFrame = {
style.width = "100%";
style.height = "100%";
style.zIndex = 1;
style.backgroundImage = "url(" + this._blankImageUrl + ")";
style.backgroundImage = "url(" + this.blankImageUrl + ")";
this.frame.appendChild(eventPane);
}

View File

@@ -96,7 +96,7 @@
var eventPane = tile.frame.childNodes[0];
t.ok(OpenLayers.String.contains(eventPane.style.backgroundImage,
tile._blankImageUrl),
tile.blankImageUrl),
"backgroundImage of eventPane is set.");
t.eq(parseInt(eventPane.style.zIndex, 10), 1, "zIndex of eventPane is set.");
if(isIElt9) {