Improve getRenderedDimensions to take into account a CSS class. Refactor some

popup code to take advantage of this, to provide a better hint to the
getRenderedDimensions call as to what is going on. Patch from sbenthall, r=me,
includes a manual acceptance test (only because the testing framework makes
these kinds of things hard). Manually confirmed to work with the sundials.html
example, tested with that and manual test in IE6, IE7, FF2-Win FF3-Mac FF2-Mac
Safari-Mac Opera-Win, and in all browsers it worked. (Hooray!) Nice one,
sbenthall. (Closes #1500)


git-svn-id: http://svn.openlayers.org/trunk/openlayers@7684 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
crschmidt
2008-08-03 18:47:52 +00:00
parent cdd4c864ea
commit 91f3c5e652
4 changed files with 66 additions and 8 deletions

View File

@@ -1374,15 +1374,19 @@ OpenLayers.Util.getBrowserName = function() {
* scrollbars do not flicker
*
* Parameters:
* contentHTML
* size - {<OpenLayers.Size>} If either the 'w' or 'h' properties is
* specified, we fix that dimension of the div to be measured. This is
* useful in the case where we have a limit in one dimension and must
* therefore meaure the flow in the other dimension.
* options - {Object}
* displayClass - {String} Optional parameter. A CSS class name(s) string
* to provide the CSS context of the rendered content.
*
* Returns:
* {OpenLayers.Size}
*/
OpenLayers.Util.getRenderedDimensions = function(contentHTML, size) {
OpenLayers.Util.getRenderedDimensions = function(contentHTML, size, options) {
var w, h;
@@ -1402,6 +1406,11 @@ OpenLayers.Util.getRenderedDimensions = function(contentHTML, size) {
container.style.height = h + "px";
}
}
//add css classes, if specified
if (options && options.displayClass) {
container.className = options.displayClass;
}
// create temp content div and assign content
var content = document.createElement("div");