MCPcopy Index your code
hub / github.com/csev/py4e / textHeight

Function textHeight

tools/pythonauto/static/codemirror/codemirror.js:1322–1339  ·  view source on GitHub ↗
(display)

Source from the content-addressed store, hash-verified

1320
1321 var measureText;
1322 function textHeight(display) {
1323 if (display.cachedTextHeight != null) return display.cachedTextHeight;
1324 if (measureText == null) {
1325 measureText = elt("pre");
1326 // Measure a bunch of lines, for browsers that compute
1327 // fractional heights.
1328 for (var i = 0; i < 49; ++i) {
1329 measureText.appendChild(document.createTextNode("x"));
1330 measureText.appendChild(elt("br"));
1331 }
1332 measureText.appendChild(document.createTextNode("x"));
1333 }
1334 removeChildrenAndAdd(display.measure, measureText);
1335 var height = measureText.offsetHeight / 50;
1336 if (height > 3) display.cachedTextHeight = height;
1337 removeChildren(display.measure);
1338 return height || 1;
1339 }
1340
1341 function charWidth(display) {
1342 if (display.cachedCharWidth != null) return display.cachedCharWidth;

Callers 5

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

Calls 4

eltFunction · 0.70
removeChildrenAndAddFunction · 0.70
removeChildrenFunction · 0.70
appendChildMethod · 0.45

Tested by

no test coverage detected