(display)
| 1320 | |
| 1321 | var measureText; |
| 1322 | function textHeight(display) { |
| 1323 | if (display.cachedTextHeight != null) return display.cachedTextHeight; |
| 1324 | if (measureText == null) { |
| 1325 | measureText = elt("pre"); |
| 1326 | // Measure a bunch of lines, for browsers that compute |
| 1327 | // fractional heights. |
| 1328 | for (var i = 0; i < 49; ++i) { |
| 1329 | measureText.appendChild(document.createTextNode("x")); |
| 1330 | measureText.appendChild(elt("br")); |
| 1331 | } |
| 1332 | measureText.appendChild(document.createTextNode("x")); |
| 1333 | } |
| 1334 | removeChildrenAndAdd(display.measure, measureText); |
| 1335 | var height = measureText.offsetHeight / 50; |
| 1336 | if (height > 3) display.cachedTextHeight = height; |
| 1337 | removeChildren(display.measure); |
| 1338 | return height || 1; |
| 1339 | } |
| 1340 | |
| 1341 | function charWidth(display) { |
| 1342 | if (display.cachedCharWidth != null) return display.cachedCharWidth; |
no test coverage detected