summaryrefslogtreecommitdiff
path: root/Source/WebCore/page/FrameView.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2012-11-09 12:15:52 +0100
committerSimon Hausmann <simon.hausmann@digia.com>2012-11-09 12:16:06 +0100
commitde4f791e30be4e4239b381c11745ffa4d87ddb8b (patch)
tree885e3a5d6670828b454cf676b4d42f78e28b1f0e /Source/WebCore/page/FrameView.cpp
parentb022df48697d40cdabdeafb2c29bb14fe489b6fe (diff)
downloadqtwebkit-de4f791e30be4e4239b381c11745ffa4d87ddb8b.tar.gz
Imported WebKit commit e2c32e2f53e02d388e70b9db88b91d8d9d28fc84 (http://svn.webkit.org/repository/webkit/trunk@133952)
Revert back to an older snapshot that should build on ARM
Diffstat (limited to 'Source/WebCore/page/FrameView.cpp')
-rw-r--r--Source/WebCore/page/FrameView.cpp33
1 files changed, 32 insertions, 1 deletions
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