Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(830)

Unified Diff: Source/core/platform/Scrollbar.cpp

Issue 14703004: Reland "Unifies ScrollView and RenderLayer to use non-shi..." (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebased Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/platform/Scrollbar.cpp
diff --git a/Source/core/platform/Scrollbar.cpp b/Source/core/platform/Scrollbar.cpp
index 1811023455171fb5b196ef4d5d7a59d51cbf57a2..9c4c104157c1d10134717db2916fdbba43c27c00 100644
--- a/Source/core/platform/Scrollbar.cpp
+++ b/Source/core/platform/Scrollbar.cpp
@@ -295,11 +295,8 @@ void Scrollbar::moveThumb(int pos, bool draggingDocument)
delta = pos - m_documentDragPos;
m_draggingDocument = true;
FloatPoint currentPosition = m_scrollableArea->scrollAnimator()->currentPosition();
- int destinationPosition = (m_orientation == HorizontalScrollbar ? currentPosition.x() : currentPosition.y()) + delta;
- if (delta > 0)
- destinationPosition = min(destinationPosition + delta, maximum());
- else if (delta < 0)
- destinationPosition = max(destinationPosition + delta, 0);
+ float destinationPosition = (m_orientation == HorizontalScrollbar ? currentPosition.x() : currentPosition.y()) + delta;
+ destinationPosition = m_scrollableArea->clampScrollPosition(m_orientation, destinationPosition);
m_scrollableArea->scrollToOffsetWithoutAnimation(m_orientation, destinationPosition);
m_documentDragPos = pos;
return;
@@ -314,14 +311,15 @@ void Scrollbar::moveThumb(int pos, bool draggingDocument)
int thumbPos = theme()->thumbPosition(this);
int thumbLen = theme()->thumbLength(this);
int trackLen = theme()->trackLength(this);
- int maxPos = trackLen - thumbLen;
if (delta > 0)
- delta = min(maxPos - thumbPos, delta);
+ delta = min(trackLen - thumbLen - thumbPos, delta);
else if (delta < 0)
delta = max(-thumbPos, delta);
+ float minPos = m_scrollableArea->minimumScrollPosition(m_orientation);
+ float maxPos = m_scrollableArea->maximumScrollPosition(m_orientation);
if (delta) {
- float newPosition = static_cast<float>(thumbPos + delta) * maximum() / (trackLen - thumbLen);
+ float newPosition = static_cast<float>(thumbPos + delta) * (maxPos - minPos) / (trackLen - thumbLen) + minPos;
m_scrollableArea->scrollToOffsetWithoutAnimation(m_orientation, newPosition);
}
}
« no previous file with comments | « Source/core/platform/ScrollableArea.h ('k') | Source/core/platform/graphics/chromium/GraphicsLayerChromium.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698