MCPcopy
hub / github.com/DHTMLX/gantt / textHeight

Function textHeight

samples/common/codehighlight/codemirror.js:2869–2886  ·  view source on GitHub ↗
(display)

Source from the content-addressed store, hash-verified

2867 var measureText;
2868 // Compute the default text height.
2869 function textHeight(display) {
2870 if (display.cachedTextHeight != null) { return display.cachedTextHeight }
2871 if (measureText == null) {
2872 measureText = elt("pre", null, "CodeMirror-line-like");
2873 // Measure a bunch of lines, for browsers that compute
2874 // fractional heights.
2875 for (var i = 0; i < 49; ++i) {
2876 measureText.appendChild(document.createTextNode("x"));
2877 measureText.appendChild(elt("br"));
2878 }
2879 measureText.appendChild(document.createTextNode("x"));
2880 }
2881 removeChildrenAndAdd(display.measure, measureText);
2882 var height = measureText.offsetHeight / 50;
2883 if (height > 3) { display.cachedTextHeight = height; }
2884 removeChildren(display.measure);
2885 return height || 1
2886 }
2887
2888 // Compute the default character width.
2889 function charWidth(display) {

Callers 5

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

Calls 3

eltFunction · 0.85
removeChildrenAndAddFunction · 0.85
removeChildrenFunction · 0.85

Tested by

no test coverage detected