From de4f791e30be4e4239b381c11745ffa4d87ddb8b Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Fri, 9 Nov 2012 12:15:52 +0100 Subject: Imported WebKit commit e2c32e2f53e02d388e70b9db88b91d8d9d28fc84 (http://svn.webkit.org/repository/webkit/trunk@133952) Revert back to an older snapshot that should build on ARM --- Source/WebCore/page/FrameView.cpp | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) (limited to 'Source/WebCore/page/FrameView.cpp') diff --git a/Source/WebCore/page/FrameView.cpp b/Source/WebCore/page/FrameView.cpp index 768d5d256..6acd1087f 100644 --- a/Source/WebCore/page/FrameView.cpp +++ b/Source/WebCore/page/FrameView.cpp @@ -1465,14 +1465,45 @@ void FrameView::removeViewportConstrainedObject(RenderObject* object) } } +static int fixedPositionScrollOffset(int scrollPosition, int maxValue, int scrollOrigin, float dragFactor) +{ + if (!maxValue) + return 0; + + if (!scrollOrigin) { + if (scrollPosition < 0) + scrollPosition = 0; + else if (scrollPosition > maxValue) + scrollPosition = maxValue; + } else { + if (scrollPosition > 0) + scrollPosition = 0; + else if (scrollPosition < -maxValue) + scrollPosition = -maxValue; + } + + return scrollPosition * dragFactor; +} + IntSize FrameView::scrollOffsetForFixedPosition() const { IntRect visibleContentRect = this->visibleContentRect(); IntSize contentsSize = this->contentsSize(); IntPoint scrollPosition = this->scrollPosition(); IntPoint scrollOrigin = this->scrollOrigin(); + + IntSize maxOffset(contentsSize.width() - visibleContentRect.width(), contentsSize.height() - visibleContentRect.height()); + float frameScaleFactor = m_frame ? m_frame->frameScaleFactor() : 1; - return WebCore::scrollOffsetForFixedPosition(visibleContentRect, contentsSize, scrollPosition, scrollOrigin, frameScaleFactor, fixedElementsLayoutRelativeToFrame()); + + FloatSize dragFactor = fixedElementsLayoutRelativeToFrame() ? FloatSize(1, 1) : FloatSize( + (contentsSize.width() - visibleContentRect.width() * frameScaleFactor) / maxOffset.width(), + (contentsSize.height() - visibleContentRect.height() * frameScaleFactor) / maxOffset.height()); + + int x = fixedPositionScrollOffset(scrollPosition.x(), maxOffset.width(), scrollOrigin.x(), dragFactor.width() / frameScaleFactor); + int y = fixedPositionScrollOffset(scrollPosition.y(), maxOffset.height(), scrollOrigin.y(), dragFactor.height() / frameScaleFactor); + + return IntSize(x, y); } bool FrameView::fixedElementsLayoutRelativeToFrame() const -- cgit v1.2.1