MCPcopy
hub / github.com/witheve/Eve / textHeight

Function textHeight

src/codemirror.js:2968–2985  ·  view source on GitHub ↗
(display)

Source from the content-addressed store, hash-verified

2966 var measureText;
2967 // Compute the default text height.
2968 function textHeight(display) {
2969 if (display.cachedTextHeight != null) return display.cachedTextHeight;
2970 if (measureText == null) {
2971 measureText = elt("pre");
2972 // Measure a bunch of lines, for browsers that compute
2973 // fractional heights.
2974 for (var i = 0; i < 49; ++i) {
2975 measureText.appendChild(document.createTextNode("x"));
2976 measureText.appendChild(elt("br"));
2977 }
2978 measureText.appendChild(document.createTextNode("x"));
2979 }
2980 removeChildrenAndAdd(display.measure, measureText);
2981 var height = measureText.offsetHeight / 50;
2982 if (height > 3) display.cachedTextHeight = height;
2983 removeChildren(display.measure);
2984 return height || 1;
2985 }
2986
2987 // Compute the default character width.
2988 function charWidth(display) {

Callers 5

estimateHeightFunction · 0.85
updateHeightsInViewportFunction · 0.85
calculateScrollPosFunction · 0.85
findPosVFunction · 0.85
codemirror.jsFile · 0.85

Calls 3

eltFunction · 0.85
removeChildrenAndAddFunction · 0.85
removeChildrenFunction · 0.85

Tested by

no test coverage detected