(cm, lineView, rect)
| 2320 | // line. When lineWrapping is on, there might be more than one |
| 2321 | // height. |
| 2322 | function ensureLineHeights(cm, lineView, rect) { |
| 2323 | var wrapping = cm.options.lineWrapping; |
| 2324 | var curWidth = wrapping && displayWidth(cm); |
| 2325 | if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) { |
| 2326 | var heights = lineView.measure.heights = []; |
| 2327 | if (wrapping) { |
| 2328 | lineView.measure.width = curWidth; |
| 2329 | var rects = lineView.text.firstChild.getClientRects(); |
| 2330 | for (var i = 0; i < rects.length - 1; i++) { |
| 2331 | var cur = rects[i], next = rects[i + 1]; |
| 2332 | if (Math.abs(cur.bottom - next.bottom) > 2) |
| 2333 | { heights.push((cur.bottom + next.top) / 2 - rect.top); } |
| 2334 | } |
| 2335 | } |
| 2336 | heights.push(rect.bottom - rect.top); |
| 2337 | } |
| 2338 | } |
| 2339 | |
| 2340 | // Find a line map (mapping character offsets to text nodes) and a |
| 2341 | // measurement cache for the given line number. (A line view might |
no test coverage detected