Fix from gregers, patch cleaned up by Erik for, "Util.getRenderedSize does not
calculate with inherited style". Includes manual regression test. r=me, (Closes #1906). CLA on file. git-svn-id: http://svn.openlayers.org/trunk/openlayers@8906 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -1478,6 +1478,8 @@ OpenLayers.Util.getBrowserName = function() {
|
||||
* options - {Object}
|
||||
* displayClass - {String} Optional parameter. A CSS class name(s) string
|
||||
* to provide the CSS context of the rendered content.
|
||||
* containerElement - {DOMElement} Optional parameter. Insert the HTML to
|
||||
* this node instead of the body root when calculating dimensions.
|
||||
*
|
||||
* Returns:
|
||||
* {OpenLayers.Size}
|
||||
@@ -1492,6 +1494,9 @@ OpenLayers.Util.getRenderedDimensions = function(contentHTML, size, options) {
|
||||
container.style.position = "absolute";
|
||||
container.style.left = "-9999px";
|
||||
|
||||
var containerElement = (options && options.containerElement)
|
||||
? options.containerElement : document.body;
|
||||
|
||||
//fix a dimension, if specified.
|
||||
if (size) {
|
||||
if (size.w) {
|
||||
@@ -1516,7 +1521,7 @@ OpenLayers.Util.getRenderedDimensions = function(contentHTML, size, options) {
|
||||
container.appendChild(content);
|
||||
|
||||
// append container to body for rendering
|
||||
document.body.appendChild(container);
|
||||
containerElement.appendChild(container);
|
||||
|
||||
// calculate scroll width of content and add corners and shadow width
|
||||
if (!w) {
|
||||
@@ -1532,7 +1537,7 @@ OpenLayers.Util.getRenderedDimensions = function(contentHTML, size, options) {
|
||||
|
||||
// remove elements
|
||||
container.removeChild(content);
|
||||
document.body.removeChild(container);
|
||||
containerElement.removeChild(container);
|
||||
|
||||
return new OpenLayers.Size(w, h);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user