diff --git a/mobile/components/promptService.js b/mobile/components/promptService.js index 2ebda7e434e..8791add40af 100644 --- a/mobile/components/promptService.js +++ b/mobile/components/promptService.js @@ -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";