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

Unified Diff: third_party/WebKit/Source/platform/scroll/ScrollAnimatorBase.cpp

Issue 1496693005: Update RootFrameViewport::userScroll to distribute scrolls between viewports. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed remaining review comments Created 5 years 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: third_party/WebKit/Source/platform/scroll/ScrollAnimatorBase.cpp
diff --git a/third_party/WebKit/Source/platform/scroll/ScrollAnimatorBase.cpp b/third_party/WebKit/Source/platform/scroll/ScrollAnimatorBase.cpp
index 78d359c2dea59e08db13134140b32ded8441d8f4..bb3fdf41af4dc0c80c5bec332a2bf80682ab8f1f 100644
--- a/third_party/WebKit/Source/platform/scroll/ScrollAnimatorBase.cpp
+++ b/third_party/WebKit/Source/platform/scroll/ScrollAnimatorBase.cpp
@@ -50,6 +50,13 @@ ScrollAnimatorBase::~ScrollAnimatorBase()
{
}
+float ScrollAnimatorBase::usedScrollDelta(ScrollbarOrientation orientation, float pixelDelta) const
+{
+ float currentPos = (orientation == HorizontalScrollbar) ? m_currentPosX : m_currentPosY;
+ float newPos = clampScrollPosition(orientation, currentPos + pixelDelta);
+ return (currentPos == newPos) ? 0.0f : (newPos - currentPos);
+}
+
ScrollResultOneDimensional ScrollAnimatorBase::userScroll(ScrollbarOrientation orientation, ScrollGranularity, float step, float delta)
{
float& currentPos = (orientation == HorizontalScrollbar) ? m_currentPosX : m_currentPosY;
@@ -88,7 +95,7 @@ void ScrollAnimatorBase::notifyPositionChanged()
m_scrollableArea->scrollPositionChanged(DoublePoint(m_currentPosX, m_currentPosY), UserScroll);
}
-float ScrollAnimatorBase::clampScrollPosition(ScrollbarOrientation orientation, float pos)
+float ScrollAnimatorBase::clampScrollPosition(ScrollbarOrientation orientation, float pos) const
{
float maxScrollPos = m_scrollableArea->maximumScrollPosition(orientation);
float minScrollPos = m_scrollableArea->minimumScrollPosition(orientation);

Powered by Google App Engine
This is Rietveld 408576698