If the scroll view isn't sized correctly on start, wait until we have at least some size
429219
function() {
    var self = this;

    clearTimeout(self.__sizerTimeout);

    var sizer = function() {
      self.resize();

      // if ((self.options.scrollingX && !self.__maxScrollLeft) || (self.options.scrollingY && !self.__maxScrollTop)) {
      //   //self.__sizerTimeout = setTimeout(sizer, 1000);
      // }
    };

    sizer();
    self.__sizerTimeout = setTimeout(sizer, 1000);
  }
58539
function handleScroll() {
        // if we are just starting scrolling, fire scrollstart event
        if (!scrollingStarted) {
            scrollingStarted = true;
            scope.broadcast('scrollstart', buildEventData());
        }
        clearTimeout(scrollendTID);
        scrollendTID = setTimeout(handleScrollEnd, SCROLL_END_TIMEOUT);
        fireScroll();
    }
239243
def on_scroll(self):
        """"""
        try:
            sw = self.view['sw_scroller']
        except KeyError:
            return False # destroyed!        
        vadj = sw.get_vadjustment()
        if vadj is None: return False
        val = vadj.get_value()
        
        # is scrolling over?
        if val >= vadj.upper - vadj.page_size:
            self.view.show_vscrollbar()
            return False
        
        vadj.set_value(val+0.5)
        return True
1259031
private void init() {
		setLayout(new BorderLayout(0, 0));

		int rows = model.getRows();
		int bufferSize = model.getBufferSize();

		if (bufferSize > rows) {
			scrollBar = new JScrollBar(JScrollBar.VERTICAL, 0, rows, 0, bufferSize + 1);
			scrollBar.addAdjustmentListener(new AdjustmentListener() {
				@Override
				public void adjustmentValueChanged(AdjustmentEvent evt) {
					repaint();
				}
			});
			add(BorderLayout.LINE_END, scrollBar);
		}

		add(BorderLayout.CENTER, new Terminal());

		repaint();
	}
632999
def set_scrollbar_position(self, position):
        """"""
        # Scrollbars will be restored after the expanded state
        self._scrollbar_positions = position
        if self._to_be_loaded is not None and len(self._to_be_loaded) == 0:
            self.restore_scrollbar_positions()
220224
@Override
	public boolean onStartNestedScroll(View child, View target, int nestedScrollAxes) {
		return (nestedScrollAxes & ViewCompat.SCROLL_AXIS_VERTICAL) != 0;
	}
1188338
private void changeHeight() {

        int firstHeight = MIN_CONTENT_HEIGHT + m_firstInfoHeight + m_firstSummaryHeight + 2;
        int currentHeight = CmsDomUtil.getCurrentStyleInt(m_mainPanel.getElement(), CmsDomUtil.Style.height);
        int targetHeight = firstHeight - m_dialogInfo.getOffsetHeight() - m_selectionSummary.getOffsetHeight();
        if (currentHeight > firstHeight) {
            CmsChangeHeightAnimation.change(m_scrollPanel.getElement(), targetHeight, new Command() {

                public void execute() {

                    doResize();
                }
            }, 750);
        }
    }
669472
protected void scrollToPreset() {

        final ScrollPanel scrollPanel = getList();
        if (m_preset != null) {
            Widget child = scrollPanel.getWidget();
            if (child instanceof CmsList<?>) {
                @SuppressWarnings("unchecked")
                CmsList<I_CmsListItem> list = (CmsList<I_CmsListItem>)child;
                if (list.getWidgetCount() > 0) {
                    final Widget first = (Widget)list.getItem(0);
                    Timer timer = new Timer() {

                        @Override
                        public void run() {

                            int firstTop = first.getElement().getAbsoluteTop();
                            int presetTop = m_preset.getElement().getAbsoluteTop();
                            final int offset = presetTop - firstTop;
                            if (offset >= 0) {
                                scrollPanel.setVerticalScrollPosition(offset);
                            } else {
                                // something is seriously wrong with the positioning if this case occurs
                                scrollPanel.scrollToBottom();
                            }
                        }
                    };
                    timer.schedule(10);
                }
            }
        }
    }
114611
private void adaptAreaPadding() {
        if (areas != null) {
            boolean paddingTopApplied = false;
            Area previousArea = null;
            View previousView = null;
            int scrollViewPaddingTop = 0;
            int scrollViewMarginBottom = 0;
            Iterator<Map.Entry<Area, View>> iterator = areas.entrySet().iterator();

            while (iterator.hasNext()) {
                Map.Entry<Area, View> entry = iterator.next();
                Area area = entry.getKey();
                View view = entry.getValue();

                applyDialogPaddingLeft(area, view);
                applyDialogPaddingRight(area, view);

                if (!paddingTopApplied) {
                    paddingTopApplied = applyDialogPaddingTop(area, view);
                }

                if (!iterator.hasNext()) {
                    applyDialogPaddingBottom(area, view);
                }

                if (previousArea != null) {
                    if (area == Area.BUTTON_BAR) {
                        applyDialogPaddingBottom(previousArea, previousView);
                    }

                    Pair<Integer, Integer> pair = addViewSpacing(previousArea, previousView, area);
                    scrollViewPaddingTop += pair.first != null ? pair.first : 0;
                    scrollViewMarginBottom += pair.second != null ? pair.second : 0;
                }

                previousArea = area;
                previousView = view;
            }

            if (scrollView != null) {
                LinearLayout.LayoutParams layoutParams =
                        (LayoutParams) scrollView.getLayoutParams();
                layoutParams.bottomMargin = scrollViewMarginBottom;
                scrollView.setPadding(scrollView.getPaddingLeft(),
                        scrollView.getPaddingTop() + scrollViewPaddingTop,
                        scrollView.getPaddingRight(), scrollView.getPaddingBottom());
            }
        }
    }
943081
private void checkScrollBar(AdjustmentEvent e) {
        //  The scroll bar listModel contains information needed to determine
        //  whether the viewport should be repositioned or not.
        JScrollBar jsb = (JScrollBar) e.getSource();
        BoundedRangeModel listModel = jsb.getModel();
        int value = listModel.getValue();
        int extent = listModel.getExtent();
        int maximum = listModel.getMaximum();
        boolean valueChanged = previousValue != value;
        boolean maximumChanged = previousMaximum != maximum;
        //  Check if the user has manually repositioned the scrollbar
        if (valueChanged && !maximumChanged) {
            if (viewportPosition == START) {
                adjustScrollBar = value != 0;
            } else {
                adjustScrollBar = value + extent >= maximum;
            }
        }
        //  Reset the "value" so we can reposition the viewport and
        //  distinguish between a user scroll and a program scroll.
        //  (ie. valueChanged will be false on a program scroll)
        if (adjustScrollBar && viewportPosition == END) {
            //  Scroll the viewport to the end.
            jsb.removeAdjustmentListener(this);
            value = maximum - extent;
            jsb.setValue(value);
            jsb.addAdjustmentListener(this);
        }
        if (adjustScrollBar && viewportPosition == START) {
            //  Keep the viewport at the same relative viewportPosition
            jsb.removeAdjustmentListener(this);
            value = value + maximum - previousMaximum;
            jsb.setValue(value);
            jsb.addAdjustmentListener(this);
        }
        previousValue = value;
        previousMaximum = maximum;
    }
215232
def startEdit( self ):
        
        self._originalText = self.text()
        self.scrollWidget().hide()
        self.setFocus()
        self.selectAll()
48273
def scroll_up(self, n, pre_dl=None, post_dl=None):
        
        self.delay(pre_dl)
        self.m.scroll(vertical=n)
        self.delay(post_dl)
1029913
function(e) {

		e.preventDefault();

		if(_pointerEventEnabled) {
			var pointerIndex = framework.arraySearch(_currPointers, e.pointerId, 'id');
			if(pointerIndex > -1) {
				var p = _currPointers[pointerIndex];
				p.x = e.pageX;
				p.y = e.pageY; 
			}
		}

		if(_isDragging) {
			var touchesList = _getTouchPoints(e);
			if(!_direction && !_moved && !_isZooming) {

				if(_mainScrollPos.x !== _slideSize.x * _currPositionIndex) {
					// if main scroll position is shifted – direction is always horizontal
					_direction = 'h';
				} else {
					var diff = Math.abs(touchesList[0].x - _currPoint.x) - Math.abs(touchesList[0].y - _currPoint.y);
					// check the direction of movement
					if(Math.abs(diff) >= DIRECTION_CHECK_OFFSET) {
						_direction = diff > 0 ? 'h' : 'v';
						_currentPoints = touchesList;
					}
				}
				
			} else {
				_currentPoints = touchesList;
			}
		}	
	}
163454
private void onScrollingUp() {
        if (hidden) {
            hidden = false;

            if (animatedView.getAnimation() == null) {
                ObjectAnimator animator = createAnimator(false);
                animator.start();
            }
        }
    }
238605
function () {
        if (__autoresizes == null && layout._listeners && layout._listeners['viewportResized']) {
            __init();
        } else if (__autoresizes != null && __autoresizes.length === 0
                && (layout._listeners == null || layout._listeners['viewportResized'] == null)) {
            __reset();
        }
    }
845187
function initTouch()
      {
        var startX,
          startY,
          touchStartX,
          touchStartY,
          moved,
          moving = false;
  
        container.unbind('touchstart.jsp touchmove.jsp touchend.jsp click.jsp-touchclick').bind(
          'touchstart.jsp',
          function(e)
          {
            var touch = e.originalEvent.touches[0];
            startX = contentPositionX();
            startY = contentPositionY();
            touchStartX = touch.pageX;
            touchStartY = touch.pageY;
            moved = false;
            moving = true;
          }
        ).bind(
          'touchmove.jsp',
          function(ev)
          {
            if(!moving) {
              return;
            }
            
            var touchPos = ev.originalEvent.touches[0],
              dX = horizontalDragPosition, dY = verticalDragPosition;
            
            jsp.scrollTo(startX + touchStartX - touchPos.pageX, startY + touchStartY - touchPos.pageY);
            
            moved = moved || Math.abs(touchStartX - touchPos.pageX) > 5 || Math.abs(touchStartY - touchPos.pageY) > 5;
            
            // return true if there was no movement so rest of screen can scroll
            return dX == horizontalDragPosition && dY == verticalDragPosition;
          }
        ).bind(
          'touchend.jsp',
          function(e)
          {
            moving = false;
            /*if(moved) {
              return false;
            }*/
          }
        ).bind(
          'click.jsp-touchclick',
          function(e)
          {
            if(moved) {
              moved = false;
              return false;
            }
          }
        );
      }
1126660
def _on_resize(self):
        
        # Erase, request position (when cursor is at the start position)
        # and redraw again. -- The order is important.
        self.renderer.erase(leave_alternate_screen=False, erase_title=False)
        self.renderer.request_absolute_cursor_position()
        self._redraw()