From: Michael M Slusarz Date: Fri, 29 Oct 2010 04:33:01 +0000 (-0600) Subject: This algorithm seems to work better on FF for compose resizing X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=d8190a141b26d78d635090eff2761f104748f1d6;p=horde.git This algorithm seems to work better on FF for compose resizing --- diff --git a/imp/js/compose-dimp.js b/imp/js/compose-dimp.js index 59dc8fc2f..4023bfc0f 100644 --- a/imp/js/compose-dimp.js +++ b/imp/js/compose-dimp.js @@ -766,7 +766,7 @@ var DimpCompose = { resizeMsgArea: function() { - var mah, rows, + var lh, mah, rows, cmp = $('composeMessageParent'), de = document.documentElement, msg = $('composeMessage'), @@ -799,10 +799,14 @@ var DimpCompose = { this.rte.resize('99%', mah - pad - 1, false); } else { - /* Logic: Determine the size of a given textarea row, divide that - * size by the available height, round down to the lowest integer - * row, and resize the textarea. */ - rows = parseInt(mah / (msg.clientHeight / msg.readAttribute('rows')), 10); + /* If the line-height CSS value exists, use that. */ + if (!(lh = msg.getStyle('line-height'))) { + /* Logic: Determine the size of a given textarea row, divide + * that size by the available height, round down to the lowest + * integer row, and resize the textarea. */ + lh = msg.clientHeight / msg.readAttribute('rows'); + } + rows = parseInt(mah / parseInt(lh, 10), 10); if (!isNaN(rows)) { /* Due to the funky (broken) way some browsers (FF) count * rows, we need to overshoot row estimate and increment