(cm, measure)
| 403 | // Re-synchronize the fake scrollbars with the actual size of the |
| 404 | // content. |
| 405 | function updateScrollbars(cm, measure) { |
| 406 | if (!measure) measure = measureForScrollbars(cm); |
| 407 | var d = cm.display; |
| 408 | var scrollHeight = measure.docHeight + scrollerCutOff; |
| 409 | var needsH = measure.scrollWidth > measure.clientWidth; |
| 410 | var needsV = scrollHeight > measure.clientHeight; |
| 411 | if (needsV) { |
| 412 | d.scrollbarV.style.display = "block"; |
| 413 | d.scrollbarV.style.bottom = needsH ? scrollbarWidth(d.measure) + "px" : "0"; |
| 414 | // A bug in IE8 can cause this value to be negative, so guard it. |
| 415 | d.scrollbarV.firstChild.style.height = |
| 416 | Math.max(0, scrollHeight - measure.clientHeight + (measure.barHeight || d.scrollbarV.clientHeight)) + "px"; |
| 417 | } else { |
| 418 | d.scrollbarV.style.display = ""; |
| 419 | d.scrollbarV.firstChild.style.height = "0"; |
| 420 | } |
| 421 | if (needsH) { |
| 422 | d.scrollbarH.style.display = "block"; |
| 423 | d.scrollbarH.style.right = needsV ? scrollbarWidth(d.measure) + "px" : "0"; |
| 424 | d.scrollbarH.firstChild.style.width = |
| 425 | (measure.scrollWidth - measure.clientWidth + (measure.barWidth || d.scrollbarH.clientWidth)) + "px"; |
| 426 | } else { |
| 427 | d.scrollbarH.style.display = ""; |
| 428 | d.scrollbarH.firstChild.style.width = "0"; |
| 429 | } |
| 430 | if (needsH && needsV) { |
| 431 | d.scrollbarFiller.style.display = "block"; |
| 432 | d.scrollbarFiller.style.height = d.scrollbarFiller.style.width = scrollbarWidth(d.measure) + "px"; |
| 433 | } else d.scrollbarFiller.style.display = ""; |
| 434 | if (needsH && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) { |
| 435 | d.gutterFiller.style.display = "block"; |
| 436 | d.gutterFiller.style.height = scrollbarWidth(d.measure) + "px"; |
| 437 | d.gutterFiller.style.width = d.gutters.offsetWidth + "px"; |
| 438 | } else d.gutterFiller.style.display = ""; |
| 439 | |
| 440 | if (mac_geLion && scrollbarWidth(d.measure) === 0) { |
| 441 | d.scrollbarV.style.minWidth = d.scrollbarH.style.minHeight = mac_geMountainLion ? "18px" : "12px"; |
| 442 | var barMouseDown = function(e) { |
| 443 | if (e_target(e) != d.scrollbarV && e_target(e) != d.scrollbarH) |
| 444 | operation(cm, onMouseDown)(e); |
| 445 | }; |
| 446 | on(d.scrollbarV, "mousedown", barMouseDown); |
| 447 | on(d.scrollbarH, "mousedown", barMouseDown); |
| 448 | } |
| 449 | } |
| 450 | |
| 451 | // Compute the lines that are visible in a given viewport (defaults |
| 452 | // the the current scroll position). viewPort may contain top, |
no test coverage detected