(cm, lineView)
| 5707 | // The returned object contains the DOM node, this map, and |
| 5708 | // information about line-wide styles that were set by the mode. |
| 5709 | function buildLineContent(cm, lineView) { |
| 5710 | // The padding-right forces the element to have a 'border', which |
| 5711 | // is needed on Webkit to be able to get line-level bounding |
| 5712 | // rectangles for it (in measureChar). |
| 5713 | var content = elt("span", null, null, webkit ? "padding-right: .1px" : null); |
| 5714 | var builder = {pre: elt("pre", [content]), content: content, col: 0, pos: 0, cm: cm}; |
| 5715 | lineView.measure = {}; |
| 5716 | |
| 5717 | // Iterate over the logical lines that make up this visual line. |
| 5718 | for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) { |
| 5719 | var line = i ? lineView.rest[i - 1] : lineView.line, order; |
| 5720 | builder.pos = 0; |
| 5721 | builder.addToken = buildToken; |
| 5722 | // Optionally wire in some hacks into the token-rendering |
| 5723 | // algorithm, to deal with browser quirks. |
| 5724 | if ((ie || webkit) && cm.getOption("lineWrapping")) |
| 5725 | builder.addToken = buildTokenSplitSpaces(builder.addToken); |
| 5726 | if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line))) |
| 5727 | builder.addToken = buildTokenBadBidi(builder.addToken, order); |
| 5728 | builder.map = []; |
| 5729 | insertLineContent(line, builder, getLineStyles(cm, line)); |
| 5730 | if (line.styleClasses) { |
| 5731 | if (line.styleClasses.bgClass) |
| 5732 | builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || ""); |
| 5733 | if (line.styleClasses.textClass) |
| 5734 | builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || ""); |
| 5735 | } |
| 5736 | |
| 5737 | // Ensure at least a single node is present, for measuring. |
| 5738 | if (builder.map.length == 0) |
| 5739 | builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); |
| 5740 | |
| 5741 | // Store the map and a cache object for the current logical line |
| 5742 | if (i == 0) { |
| 5743 | lineView.measure.map = builder.map; |
| 5744 | lineView.measure.cache = {}; |
| 5745 | } else { |
| 5746 | (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map); |
| 5747 | (lineView.measure.caches || (lineView.measure.caches = [])).push({}); |
| 5748 | } |
| 5749 | } |
| 5750 | |
| 5751 | signal(cm, "renderLine", cm, lineView.line, builder.pre); |
| 5752 | return builder; |
| 5753 | } |
| 5754 | |
| 5755 | function defaultSpecialCharPlaceholder(ch) { |
| 5756 | var token = elt("span", "\u2022", "cm-invalidchar"); |
no test coverage detected
searching dependent graphs…