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

Function updateHeightsInViewport

src/codemirror.js:799–822  ·  view source on GitHub ↗
(cm)

Source from the content-addressed store, hash-verified

797 // Read the actual heights of the rendered lines, and update their
798 // stored heights to match.
799 function updateHeightsInViewport(cm) {
800 var display = cm.display;
801 var prevBottom = display.lineDiv.offsetTop;
802 for (var i = 0; i < display.view.length; i++) {
803 var cur = display.view[i], height;
804 if (cur.hidden) continue;
805 if (ie && ie_version < 8) {
806 var bot = cur.node.offsetTop + cur.node.offsetHeight;
807 height = bot - prevBottom;
808 prevBottom = bot;
809 } else {
810 var box = cur.node.getBoundingClientRect();
811 height = box.bottom - box.top;
812 }
813 var diff = cur.line.height - height;
814 if (height < 2) height = textHeight(display);
815 if (diff > .001 || diff < -.001) {
816 updateLineHeight(cur.line, height);
817 updateWidgetHeight(cur.line);
818 if (cur.rest) for (var j = 0; j < cur.rest.length; j++)
819 updateWidgetHeight(cur.rest[j]);
820 }
821 }
822 }
823
824 // Read and store the height of line widgets associated with the
825 // given line.

Callers 4

updateScrollbarsFunction · 0.85
postUpdateDisplayFunction · 0.85
updateDisplaySimpleFunction · 0.85
endOperation_R2Function · 0.85

Calls 3

textHeightFunction · 0.85
updateLineHeightFunction · 0.85
updateWidgetHeightFunction · 0.85

Tested by

no test coverage detected