void ScrollableArea::scrollPositionChanged(const DoublePoint& position, ScrollType scrollType) { TRACE_EVENT0("blink", "ScrollableArea::scrollPositionChanged"); DoublePoint oldPosition = scrollPositionDouble(); DoublePoint truncatedPosition = shouldUseIntegerScrollOffset() ? flooredIntPoint(position) : position; // Tell the derived class to scroll its contents. setScrollOffset(truncatedPosition, scrollType); Scrollbar* verticalScrollbar = this->verticalScrollbar(); // Tell the scrollbars to update their thumb postions. if (Scrollbar* horizontalScrollbar = this->horizontalScrollbar()) { horizontalScrollbar->offsetDidChange(); if (horizontalScrollbar->isOverlayScrollbar() && !hasLayerForHorizontalScrollbar()) { if (!verticalScrollbar) horizontalScrollbar->invalidate(); else { // If there is both a horizontalScrollbar and a verticalScrollbar, // then we must also invalidate the corner between them. IntRect boundsAndCorner = horizontalScrollbar->boundsRect(); boundsAndCorner.setWidth(boundsAndCorner.width() + verticalScrollbar->width()); horizontalScrollbar->invalidateRect(boundsAndCorner); } } } if (verticalScrollbar) { verticalScrollbar->offsetDidChange(); if (verticalScrollbar->isOverlayScrollbar() && !hasLayerForVerticalScrollbar()) verticalScrollbar->invalidate(); } if (scrollPositionDouble() != oldPosition) { // FIXME: Pass in DoubleSize. crbug.com/414283. scrollAnimator()->notifyContentAreaScrolled(toFloatSize(scrollPositionDouble() - oldPosition)); } scrollAnimator()->setCurrentPosition(toFloatPoint(position)); }
DoubleRect RootFrameViewport::visibleContentRectDouble(IncludeScrollbarsInRect scrollbarInclusion) const { return DoubleRect(scrollPositionDouble(), visualViewport().visibleContentRectDouble(scrollbarInclusion).size()); }
void ScrollableArea::scrollBy(const DoubleSize& delta, ScrollType type, ScrollBehavior behavior) { setScrollPosition(scrollPositionDouble() + delta, type, behavior); }
IntPoint RootFrameViewport::scrollPosition() const { return flooredIntPoint(scrollPositionDouble()); }