If we scrolled and have virtual mode enabled, compute the window
of active elements in order to figure out the viewport to render.
199909
function(e) {
      if (this.isVirtual) {
        var itemHeight = this.itemHeight;

        // TODO: This would be inaccurate if we are windowed
        var totalItems = this.listEl.children.length;

        // Grab the total height of the list
        var scrollHeight = e.target.scrollHeight;

        // Get the viewport height
        var viewportHeight = this.el.parentNode.offsetHeight;

        // scrollTop is the current scroll position
        var scrollTop = e.scrollTop;

        // High water is the pixel position of the first element to include (everything before
        // that will be removed)
        var highWater = Math.max(0, e.scrollTop + this.virtualRemoveThreshold);

        // Low water is the pixel position of the last element to include (everything after
        // that will be removed)
        var lowWater = Math.min(scrollHeight, Math.abs(e.scrollTop) + viewportHeight + this.virtualAddThreshold);

        // Compute how many items per viewport size can show
        var itemsPerViewport = Math.floor((lowWater - highWater) / itemHeight);

        // Get the first and last elements in the list based on how many can fit
        // between the pixel range of lowWater and highWater
        var first = parseInt(Math.abs(highWater / itemHeight), 10);
        var last = parseInt(Math.abs(lowWater / itemHeight), 10);

        // Get the items we need to remove
        this._virtualItemsToRemove = Array.prototype.slice.call(this.listEl.children, 0, first);

        // Grab the nodes we will be showing
        var nodes = Array.prototype.slice.call(this.listEl.children, first, first + itemsPerViewport);

        this.renderViewport && this.renderViewport(highWater, lowWater, first, last);
      }
    }
1181949
function computeVisibleArea(el){
            var state = getState(el);
            state.visibleArea = (state.el2.clientHeight / state.el2.scrollHeight);
        }
1357791
function(ev) {
                var y = ev.pageY;
                if (!y && 0 !== y) {
                    y = ev.clientY || 0;

                    if ( this.isIE ) {
                        y += this._getScrollTop();
                    }
                }


                return y;
            }
907962
function () {
            // vertical stuff
            var state = this.state,
                zoom = state.zoomState.zoom,
                zoomedWidth,
                docWidth;

            zoomedWidth = Math.floor(state.widestPage.totalActualWidth * zoom);

            // use clientWidth for the doc (prevent scrollbar)
            // use width:auto when possible
            if (zoomedWidth <= state.viewportDimensions.clientWidth) {
                docWidth = 'auto';
            } else {
                docWidth = zoomedWidth;
            }

            this.$doc.css({
                width: docWidth
            });
        }
866795
function ContentDialog_renderForInputPane() {
                    var rendered = this._rendered;
                    
                    if (!rendered.registeredForResize) {
                        _ElementUtilities._resizeNotifier.subscribe(this._dom.root, this._onUpdateInputPaneRenderingBound);
                        rendered.registeredForResize = true;
                    }
                    
                    if (this._shouldResizeForInputPane()) {
                        // Lay the dialog out using its normal rules but restrict it to the *visible document*
                        // rather than the *visual viewport*.
                        // Essentially, the dialog should be in the center of the part of the app that the user
                        // can see regardless of the state of the input pane.
                        
                        var top = _KeyboardInfo._KeyboardInfo._visibleDocTop + "px";
                        var bottom = _KeyboardInfo._KeyboardInfo._visibleDocBottomOffset + "px";
                        
                        if (rendered.top !== top) {
                            this._dom.root.style.top = top;
                            rendered.top = top;
                        }
                        
                        if (rendered.bottom !== bottom) {
                            this._dom.root.style.bottom = bottom;
                            rendered.bottom = bottom;
                        }
                        
                        if (!rendered.resizedForInputPane) {
                            // Put title into scroller so there's more screen real estate for the content
                            this._dom.scroller.insertBefore(this._dom.title, this._dom.content);
                            this._dom.root.style.height = "auto"; // Height will be determined by setting top & bottom
                            // Ensure activeElement is scrolled into view
                            var activeElement = _Global.document.activeElement;
                            if (activeElement && this._dom.scroller.contains(activeElement)) {
                                activeElement.scrollIntoView();
                            }
                            rendered.resizedForInputPane = true;
                        }
                    }
                }
619996
function updateDisplay(changes, suppressCallback, scrollTop) {
      if (!scroller.clientWidth) {
        showingFrom = showingTo = displayOffset = 0;
        return;
      }
      // Compute the new visible window
      // If scrollTop is specified, use that to determine which lines
      // to render instead of the current scrollbar position.
      var visible = visibleLines(scrollTop);
      // Bail out if the visible area is already rendered and nothing changed.
      if (changes !== true && changes.length == 0 && visible.from > showingFrom && visible.to < showingTo) {
        updateVerticalScroll(scrollTop);
        return;
      }
      var from = Math.max(visible.from - 100, 0), to = Math.min(doc.size, visible.to + 100);
      if (showingFrom < from && from - showingFrom < 20) from = showingFrom;
      if (showingTo > to && showingTo - to < 20) to = Math.min(doc.size, showingTo);

      // Create a range of theoretically intact lines, and punch holes
      // in that using the change info.
      var intact = changes === true ? [] :
        computeIntact([{from: showingFrom, to: showingTo, domStart: 0}], changes);
      // Clip off the parts that won't be visible
      var intactLines = 0;
      for (var i = 0; i < intact.length; ++i) {
        var range = intact[i];
        if (range.from < from) {range.domStart += (from - range.from); range.from = from;}
        if (range.to > to) range.to = to;
        if (range.from >= range.to) intact.splice(i--, 1);
        else intactLines += range.to - range.from;
      }
      if (intactLines == to - from && from == showingFrom && to == showingTo) {
        updateVerticalScroll(scrollTop);
        return;
      }
      intact.sort(function(a, b) {return a.domStart - b.domStart;});

      var th = textHeight(), gutterDisplay = gutter.style.display;
      lineDiv.style.display = "none";
      patchDisplay(from, to, intact);
      lineDiv.style.display = gutter.style.display = "";

      var different = from != showingFrom || to != showingTo || lastSizeC != scroller.clientHeight + th;
      // This is just a bogus formula that detects when the editor is
      // resized or the font size changes.
      if (different) lastSizeC = scroller.clientHeight + th;
      if (from != showingFrom || to != showingTo && options.onViewportChange)
        setTimeout(function(){
          if (options.onViewportChange) options.onViewportChange(instance, from, to);
        });
      showingFrom = from; showingTo = to;
      displayOffset = heightAtLine(doc, from);
      startWorker(100);

      // Since this is all rather error prone, it is honoured with the
      // only assertion in the whole file.
      if (lineDiv.childNodes.length != showingTo - showingFrom)
        throw new Error("BAD PATCH! " + JSON.stringify(intact) + " size=" + (showingTo - showingFrom) +
                        " nodes=" + lineDiv.childNodes.length);

      function checkHeights() {
        var curNode = lineDiv.firstChild, heightChanged = false;
        doc.iter(showingFrom, showingTo, function(line) {
          // Work around bizarro IE7 bug where, sometimes, our curNode
          // is magically replaced with a new node in the DOM, leaving
          // us with a reference to an orphan (nextSibling-less) node.
          if (!curNode) return;
          if (!line.hidden) {
            var height = Math.round(curNode.offsetHeight / th) || 1;
            if (line.height != height) {
              updateLineHeight(line, height);
              gutterDirty = heightChanged = true;
            }
          }
          curNode = curNode.nextSibling;
        });
        return heightChanged;
      }

      if (options.lineWrapping) checkHeights();

      gutter.style.display = gutterDisplay;
      if (different || gutterDirty) {
        // If the gutter grew in size, re-check heights. If those changed, re-draw gutter.
        updateGutter() && options.lineWrapping && checkHeights() && updateGutter();
      }
      updateVerticalScroll(scrollTop);
      updateSelection();
      if (!suppressCallback && options.onUpdate) options.onUpdate(instance);
      return true;
    }
746577
def viewport(self) -> Tuple[int, int, int, int]:
        '''
            
        '''

        return self.mglo.viewport
772402
function renderView(vm) {
		var viewElms = vm.$el.querySelectorAll(".dev-menu-view");
		for (var i = 0; i < viewElms.length; i++) {
			var el = viewElms[i];
			el.style.display = data.views[el.id].show ? "block" : "none";
		}
	}
407334
def _mouse_scroll_v(self, event):
        """"""
        args = (int(-1 * (event.delta / 120)), "units")
        self._canvas_scroll.yview_scroll(*args)
        self._canvas_categories.yview_scroll(*args)
1029878
function (t) {
        var o_p = this.offsetParent(),
            o = o_p.offset(),
            p = t.offset();

        p.top -= o.top;
        p.left -= o.left;

        //set some flags on the p object to pass along
        p.missRight = false;
        p.missTop = false;
        p.missLeft = false;
        p.leftRightFlag = false;

        //lets see if the panel will be off the screen
        //get the actual width of the page and store it
        var actualBodyWidth;
        if (document.getElementsByClassName('row')[0]) {
          actualBodyWidth = document.getElementsByClassName('row')[0].clientWidth;
        } else {
          actualBodyWidth = window.outerWidth;
        }

        var actualMarginWidth = (window.outerWidth - actualBodyWidth) / 2;
        var actualBoundary = actualBodyWidth;

        if (!this.hasClass('mega')) {
          //miss top
          if (t.offset().top <= this.outerHeight()) {
            p.missTop = true;
            actualBoundary = window.outerWidth - actualMarginWidth;
            p.leftRightFlag = true;
          }

          //miss right
          if (t.offset().left + this.outerWidth() > t.offset().left + actualMarginWidth && t.offset().left - actualMarginWidth > this.outerWidth()) {
            p.missRight = true;
            p.missLeft = false;
          }

          //miss left
          if (t.offset().left - this.outerWidth() <= 0) {
            p.missLeft = true;
            p.missRight = false;
          }
        }

        return p;
      }
212028
function () {
			var oViewport = {};
			oViewport.width = window.innerWidth;
			oViewport.height = window.innerHeight;
			oViewport.top = parseInt(jQuery(".type_standalone").css("height")) || 0;
			oViewport.bottom = oViewport.top + oViewport.height;

			return oViewport;
		}
407445
function prepareView() {
    _(this).el = document.createElement('div');
    _(this).el.setAttribute('class', 'VirtualScrollingTree');

    let contentDiv = `<div class="VirtualScrollingTree-content"></div>`;

    _(this).el.innerHTML = `
        ${_(this).smoothScrolling? '' : contentDiv}
        <div class="VirtualScrollingTree-scrollbar ${_(this).scrollbarClass}">
            ${_(this).smoothScrolling? contentDiv : ''}
            <div class="VirtualScrollingTree-scrollbarContent"></div>
        </div>
    `.replace(/\n\s+/g, '');

    _(this).view = {
        content: _(this).el.querySelector('.VirtualScrollingTree-content'),
        scrollbar:  _(this).el.querySelector('.VirtualScrollingTree-scrollbar'),
        scrollbarContent: _(this).el.querySelector('.VirtualScrollingTree-scrollbarContent')
    };

    if (!_(this).smoothScrolling) {
        _(this).view.content.addEventListener('wheel', e => {
            _(this).view.scrollbar.scrollTop += e.deltaY;
        }, true);
    } 

    // Scrolling either the content with the middle mouse wheel, or manually
    // scrolling the scrollbar directly should accomplish the same thing.
    // Note it's important for this to come after the transform above.
    // If it's not, when the DOM is being manipulated the scrollbar will jump.
    let lastScrollTop = 0;
    _(this).view.scrollbar.addEventListener('scroll', (e) => {
        if (_(this).scrollLocked) {
            return;
        }

        let newScrollTop = parseInt(_(this).view.scrollbar.scrollTop / _(this).itemHeight);

        if (lastScrollTop !== newScrollTop) {
            lastScrollTop = newScrollTop;
            if (_(this).smoothScrolling) {
                _(this).view.content.style.transform = `translateY(${newScrollTop * _(this).itemHeight}px)`;
            }

            requestData.call(this);
        }
    }, true);

    _(this).parent.appendChild(_(this).el);
}
383519
function render() {
      var checked = rgCtrl.getViewValue() == attr.value;

      if (checked === lastChecked) return;

      if (element[0].parentNode.nodeName.toLowerCase() !== 'md-radio-group') {
        // If the radioButton is inside a div, then add class so highlighting will work
        element.parent().toggleClass(CHECKED_CSS, checked);
      }

      if (checked) {
        rgCtrl.setActiveDescendant(element.attr('id'));
      }

      lastChecked = checked;

      element
        .attr('aria-checked', checked)
        .toggleClass(CHECKED_CSS, checked);
    }
234184
function () {
            if (this.isInPresentationMode) {
              // Fixes the case when PDF has different page sizes.
              this._setScale(this._currentScaleValue, true);
            }
            var pageView = this._pages[this._currentPageNumber - 1];
            scrollIntoView(pageView.div);
          }
1030871
function buildRequest(scrollPos, viewport) {
    // Variables
    let queries = [];
    let requestedTotal = 0;
    let expanded = _(this).expansions;

    sortExpansions.call(this);
    calculateExpansions.call(this);

    // One-dimensional collision detection. 
    // It checks to see if start/end are both either before 
    // the viewport, and after. If it's not before or after, it's colliding.
    let inViewPort = function(v1, v2, e1, e2) {
        return !((e1 < v1 && e2 < v1) || (e1 > v2 && e2 > v2));
    };

    let calculateExpansionQueries = function(expansions, parentQuery) {

        expansions.forEach((e) => {

            if (inViewPort(scrollPos, scrollPos + viewport, e._start, e._end)) {
                
                // We want to find out how many items for this expansion are 
                // visible in the view port. To do this we find the first item that's
                // visible, the last item that's visible, subtract them and cap it to the viewport size.
                let start = Math.max(scrollPos, e._start);
                let end = Math.min(scrollPos + viewport - 1, e._end);
                let visible = Math.max(0, Math.min(end - start + 1, viewport));

                if (parentQuery) {
                    // If there are nested children visible, we need to subtract 
                    // this from the parent. Note that visible also includes any expanded
                    // children nested further because we're using the _start and _end 
                    // values we've already calculated.
                    parentQuery.limit -= visible;

                    if (scrollPos > e._start) {
                        let notVisible = (e._end - e._start + 1) - visible;
                        if (notVisible > 0) {
                            parentQuery.offset -= notVisible;
                        }
                    }
                }

                // This query object is what's given to the end user.
                // The parent represents who we want the children of.
                // The offset is based on how much we've scrolled past the beginning.
                // The limit is total items that are visible in the viewport.
                let query = {
                    parent: e.id,
                    offset: scrollPos > e._start? scrollPos - e._start : 0,
                    limit: Math.min(visible, viewport)
                };

                queries.push(query);
                calculateExpansionQueries(e.expansions, query);
            } else if (scrollPos > e._end && parentQuery) {
                // If we've completely scrolled past this object, just substract all of its expanded children from the parent offset.
                parentQuery.offset -= (e._end - e._start + 1);
            }
            
        });
    };
    
    calculateExpansionQueries(_(this).expansions);
    return queries;

}
451786
function () {

            var nViewportOffset = Overlay.VIEWPORT_OFFSET,
                elementWidth = this.element.offsetWidth,
                elementHeight = this.element.offsetHeight,
                viewPortWidth = Dom.getViewportWidth(),
                viewPortHeight = Dom.getViewportHeight(),
                x,
                y;

            if (elementWidth < viewPortWidth) {
                x = (viewPortWidth / 2) - (elementWidth / 2) + Dom.getDocumentScrollLeft();
            } else {
                x = nViewportOffset + Dom.getDocumentScrollLeft();
            }

            if (elementHeight < viewPortHeight) {
                y = (viewPortHeight / 2) - (elementHeight / 2) + Dom.getDocumentScrollTop();
            } else {
                y = nViewportOffset + Dom.getDocumentScrollTop();
            }

            this.cfg.setProperty("xy", [parseInt(x, 10), parseInt(y, 10)]);
            this.cfg.refireEvent("iframe");

            if (UA.webkit) {
                this.forceContainerRedraw();
            }
        }
1131584
def scroll_element_into_view(self):
        
        x = self.web_element.location['x']
        y = self.web_element.location['y']
        self.driver.execute_script('window.scrollTo({0}, {1})'.format(x, y))
        return self