reverted r10125, which does not fix the described issue, and store style.display instead (first patch attached to #2414). r=bartvde,elemoine (pullup #2414)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@10276 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
ahocevar
2010-05-04 09:41:25 +00:00
parent c7e840876c
commit f66607a6e8
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);