Bug 522043: Text in nsPromptService authentication dialog is pannable [r=fabrice.desre]

This commit is contained in:
Mark Finkle 2009-10-14 09:42:54 -04:00
parent d48c6d644f
commit 2e0c7d08df

View File

@ -65,11 +65,16 @@ promptService.prototype = {
// size the height of the scrollable message. this assumes the given element
// is a child of a scrollbox
sizeScrollableMsg: function(id, percent) {
let screenH = this.getDocument().getElementById("main-window").getBoundingClientRect().height;
let doc = this.getDocument();
let screenH = doc.getElementById("main-window").getBoundingClientRect().height;
let maxHeight = screenH * percent / 100;
let elem = this.getDocument().getElementById(id);
let height = elem.getBoundingClientRect().height;
let elem = doc.getElementById(id);
let style = doc.defaultView.getComputedStyle(elem, null);
let height = Math.ceil(elem.getBoundingClientRect().height) +
parseInt(style.marginTop) +
parseInt(style.marginBottom);
if (height > maxHeight)
height = maxHeight;
elem.parentNode.style.height = height + "px";