(display)
| 2867 | var measureText; |
| 2868 | // Compute the default text height. |
| 2869 | function textHeight(display) { |
| 2870 | if (display.cachedTextHeight != null) { return display.cachedTextHeight } |
| 2871 | if (measureText == null) { |
| 2872 | measureText = elt("pre", null, "CodeMirror-line-like"); |
| 2873 | // Measure a bunch of lines, for browsers that compute |
| 2874 | // fractional heights. |
| 2875 | for (var i = 0; i < 49; ++i) { |
| 2876 | measureText.appendChild(document.createTextNode("x")); |
| 2877 | measureText.appendChild(elt("br")); |
| 2878 | } |
| 2879 | measureText.appendChild(document.createTextNode("x")); |
| 2880 | } |
| 2881 | removeChildrenAndAdd(display.measure, measureText); |
| 2882 | var height = measureText.offsetHeight / 50; |
| 2883 | if (height > 3) { display.cachedTextHeight = height; } |
| 2884 | removeChildren(display.measure); |
| 2885 | return height || 1 |
| 2886 | } |
| 2887 | |
| 2888 | // Compute the default character width. |
| 2889 | function charWidth(display) { |
no test coverage detected