(cm, lineView, rect)
| 2543 | // line. When lineWrapping is on, there might be more than one |
| 2544 | // height. |
| 2545 | function ensureLineHeights(cm, lineView, rect) { |
| 2546 | var wrapping = cm.options.lineWrapping; |
| 2547 | var curWidth = wrapping && displayWidth(cm); |
| 2548 | if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) { |
| 2549 | var heights = lineView.measure.heights = []; |
| 2550 | if (wrapping) { |
| 2551 | lineView.measure.width = curWidth; |
| 2552 | var rects = lineView.text.firstChild.getClientRects(); |
| 2553 | for (var i = 0; i < rects.length - 1; i++) { |
| 2554 | var cur = rects[i], next = rects[i + 1]; |
| 2555 | if (Math.abs(cur.bottom - next.bottom) > 2) |
| 2556 | heights.push((cur.bottom + next.top) / 2 - rect.top); |
| 2557 | } |
| 2558 | } |
| 2559 | heights.push(rect.bottom - rect.top); |
| 2560 | } |
| 2561 | } |
| 2562 | |
| 2563 | // Find a line map (mapping character offsets to text nodes) and a |
| 2564 | // measurement cache for the given line number. (A line view might |
no test coverage detected