MCPcopy
hub / github.com/csev/py4e / updateHeightsInViewport

Function updateHeightsInViewport

tools/pythonauto/static/codemirrorepl/codemirror.js:659–682  ·  view source on GitHub ↗
(cm)

Source from the content-addressed store, hash-verified

657 // Read the actual heights of the rendered lines, and update their
658 // stored heights to match.
659 function updateHeightsInViewport(cm) {
660 var display = cm.display;
661 var prevBottom = display.lineDiv.offsetTop;
662 for (var i = 0; i < display.view.length; i++) {
663 var cur = display.view[i], height;
664 if (cur.hidden) continue;
665 if (ie_upto7) {
666 var bot = cur.node.offsetTop + cur.node.offsetHeight;
667 height = bot - prevBottom;
668 prevBottom = bot;
669 } else {
670 var box = cur.node.getBoundingClientRect();
671 height = box.bottom - box.top;
672 }
673 var diff = cur.line.height - height;
674 if (height < 2) height = textHeight(display);
675 if (diff > .001 || diff < -.001) {
676 updateLineHeight(cur.line, height);
677 updateWidgetHeight(cur.line);
678 if (cur.rest) for (var j = 0; j < cur.rest.length; j++)
679 updateWidgetHeight(cur.rest[j]);
680 }
681 }
682 }
683
684 // Read and store the height of line widgets associated with the
685 // given line.

Callers 1

updateDisplayInnerFunction · 0.70

Calls 3

updateWidgetHeightFunction · 0.85
textHeightFunction · 0.70
updateLineHeightFunction · 0.70

Tested by

no test coverage detected