(cm, viewPort, forced)
| 534 | // unless forced is true. |
| 535 | // Returns true if an actual update happened, false otherwise. |
| 536 | function updateDisplay(cm, viewPort, forced) { |
| 537 | var oldFrom = cm.display.viewFrom, oldTo = cm.display.viewTo, updated; |
| 538 | var visible = visibleLines(cm.display, cm.doc, viewPort); |
| 539 | for (var first = true;; first = false) { |
| 540 | var oldWidth = cm.display.scroller.clientWidth; |
| 541 | if (!updateDisplayInner(cm, visible, forced)) break; |
| 542 | updated = true; |
| 543 | |
| 544 | // If the max line changed since it was last measured, measure it, |
| 545 | // and ensure the document's width matches it. |
| 546 | if (cm.display.maxLineChanged && !cm.options.lineWrapping) |
| 547 | adjustContentWidth(cm); |
| 548 | |
| 549 | var barMeasure = measureForScrollbars(cm); |
| 550 | updateSelection(cm); |
| 551 | setDocumentHeight(cm, barMeasure); |
| 552 | updateScrollbars(cm, barMeasure); |
| 553 | if (webkit && cm.options.lineWrapping) |
| 554 | checkForWebkitWidthBug(cm, barMeasure); // (Issue #2420) |
| 555 | if (first && cm.options.lineWrapping && oldWidth != cm.display.scroller.clientWidth) { |
| 556 | forced = true; |
| 557 | continue; |
| 558 | } |
| 559 | forced = false; |
| 560 | |
| 561 | // Clip forced viewport to actual scrollable area. |
| 562 | if (viewPort && viewPort.top != null) |
| 563 | viewPort = {top: Math.min(barMeasure.docHeight - scrollerCutOff - barMeasure.clientHeight, viewPort.top)}; |
| 564 | // Updated line heights might result in the drawn area not |
| 565 | // actually covering the viewport. Keep looping until it does. |
| 566 | visible = visibleLines(cm.display, cm.doc, viewPort); |
| 567 | if (visible.from >= cm.display.viewFrom && visible.to <= cm.display.viewTo) |
| 568 | break; |
| 569 | } |
| 570 | |
| 571 | cm.display.updateLineNumbers = null; |
| 572 | if (updated) { |
| 573 | signalLater(cm, "update", cm); |
| 574 | if (cm.display.viewFrom != oldFrom || cm.display.viewTo != oldTo) |
| 575 | signalLater(cm, "viewportChange", cm, cm.display.viewFrom, cm.display.viewTo); |
| 576 | } |
| 577 | return updated; |
| 578 | } |
| 579 | |
| 580 | // Does the actual updating of the line display. Bails out |
| 581 | // (returning false) when there is nothing to be done and forced is |
no test coverage detected
searching dependent graphs…