2010-11-17 Andreas Kling <kling@webkit.org>
Reviewed by Kenneth Rohde Christiansen.
ScrollView: Avoid unnecessary work in setScrollPosition() when scrolling is delegated.
* platform/ScrollView.cpp:
(WebCore::ScrollView::setScrollPosition): If delegatesScrolling(), we never use the
newScrollPosition, so move that calculation below the delegation path.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72238 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/platform/ScrollView.cpp b/WebCore/platform/ScrollView.cpp
index bd75b83..4ef0e2b 100644
--- a/WebCore/platform/ScrollView.cpp
+++ b/WebCore/platform/ScrollView.cpp
@@ -333,9 +333,6 @@
return;
}
- IntPoint newScrollPosition = scrollPoint.shrunkTo(maximumScrollPosition());
- newScrollPosition.clampNegativeToZero();
-
#if ENABLE(TILED_BACKING_STORE)
if (delegatesScrolling()) {
hostWindow()->delegatedScrollRequested(IntSize(scrollPoint.x(), scrollPoint.y()));
@@ -343,6 +340,9 @@
}
#endif
+ IntPoint newScrollPosition = scrollPoint.shrunkTo(maximumScrollPosition());
+ newScrollPosition.clampNegativeToZero();
+
if (newScrollPosition == scrollPosition())
return;