pullup fix for reopened ticket:2414 to 2.9 branch

git-svn-id: http://svn.openlayers.org/branches/openlayers/2.9@10277 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
bartvde
2010-05-04 09:48:34 +00:00
parent 31225b5e3b
commit 2db48d9bea
3 changed files with 37 additions and 1 deletions

View File

@@ -93,7 +93,6 @@ OpenLayers.Element = {
/**
* APIFunction: getDimensions
* *Deprecated*. Returns dimensions of the element passed in.
*
* Parameters:
* element - {DOMElement}

View File

@@ -1402,6 +1402,12 @@ OpenLayers.Map = OpenLayers.Class({
var size = new OpenLayers.Size(this.div.clientWidth,
this.div.clientHeight);
// Workaround for the fact that hidden elements return 0 for size.
if (size.w == 0 && size.h == 0 || isNaN(size.w) && isNaN(size.h)) {
var dim = OpenLayers.Element.getDimensions(this.div);
size.w = dim.width;
size.h = dim.height;
}
if (size.w == 0 && size.h == 0 || isNaN(size.w) && isNaN(size.h)) {
size.w = parseInt(this.div.style.width);
size.h = parseInt(this.div.style.height);