(cm, lineView, rect)
| 2431 | // line. When lineWrapping is on, there might be more than one |
| 2432 | // height. |
| 2433 | function ensureLineHeights(cm, lineView, rect) { |
| 2434 | var wrapping = cm.options.lineWrapping; |
| 2435 | var curWidth = wrapping && displayWidth(cm); |
| 2436 | if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) { |
| 2437 | var heights = lineView.measure.heights = []; |
| 2438 | if (wrapping) { |
| 2439 | lineView.measure.width = curWidth; |
| 2440 | var rects = lineView.text.firstChild.getClientRects(); |
| 2441 | for (var i = 0; i < rects.length - 1; i++) { |
| 2442 | var cur = rects[i], next = rects[i + 1]; |
| 2443 | if (Math.abs(cur.bottom - next.bottom) > 2) |
| 2444 | heights.push((cur.bottom + next.top) / 2 - rect.top); |
| 2445 | } |
| 2446 | } |
| 2447 | heights.push(rect.bottom - rect.top); |
| 2448 | } |
| 2449 | } |
| 2450 | |
| 2451 | // Find a line map (mapping character offsets to text nodes) and a |
| 2452 | // measurement cache for the given line number. (A line view might |
no test coverage detected