(cm, lineView, rect)
| 3581 | // line. When lineWrapping is on, there might be more than one |
| 3582 | // height. |
| 3583 | function ensureLineHeights(cm, lineView, rect) { |
| 3584 | var wrapping = cm.options.lineWrapping |
| 3585 | var curWidth = wrapping && displayWidth(cm) |
| 3586 | if (!lineView.measure.heights || (wrapping && lineView.measure.width != curWidth)) { |
| 3587 | var heights = (lineView.measure.heights = []) |
| 3588 | if (wrapping) { |
| 3589 | lineView.measure.width = curWidth |
| 3590 | var rects = lineView.text.firstChild.getClientRects() |
| 3591 | for (var i = 0; i < rects.length - 1; i++) { |
| 3592 | var cur = rects[i], |
| 3593 | next = rects[i + 1] |
| 3594 | if (Math.abs(cur.bottom - next.bottom) > 2) { |
| 3595 | heights.push((cur.bottom + next.top) / 2 - rect.top) |
| 3596 | } |
| 3597 | } |
| 3598 | } |
| 3599 | heights.push(rect.bottom - rect.top) |
| 3600 | } |
| 3601 | } |
| 3602 | |
| 3603 | // Find a line map (mapping character offsets to text nodes) and a |
| 3604 | // measurement cache for the given line number. (A line view might |
no test coverage detected