(cm)
| 2924 | // first approximation until the line becomes visible (and is thus |
| 2925 | // properly measurable). |
| 2926 | function estimateHeight(cm) { |
| 2927 | var th = textHeight(cm.display), wrapping = cm.options.lineWrapping; |
| 2928 | var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3); |
| 2929 | return function (line) { |
| 2930 | if (lineIsHidden(cm.doc, line)) { return 0 } |
| 2931 | |
| 2932 | var widgetsHeight = 0; |
| 2933 | if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) { |
| 2934 | if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height; } |
| 2935 | } } |
| 2936 | |
| 2937 | if (wrapping) |
| 2938 | { return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th } |
| 2939 | else |
| 2940 | { return widgetsHeight + th } |
| 2941 | } |
| 2942 | } |
| 2943 | |
| 2944 | function estimateLineHeights(cm) { |
| 2945 | var doc = cm.doc, est = estimateHeight(cm); |
no test coverage detected