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

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

Issue 2387883002: Use float for scroll offset. (Closed)
Patch Set: Fix README.md Created 4 years, 2 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: 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 bf67103422317bc1334d165b7f7a35247b5c0ee4..22ed0da8bbc5724abb8481a8576e1d3b096b87c4 100644
--- a/third_party/WebKit/Source/platform/scroll/ScrollAnimatorBase.cpp
+++ b/third_party/WebKit/Source/platform/scroll/ScrollAnimatorBase.cpp
@@ -31,7 +31,6 @@
#include "platform/scroll/ScrollAnimatorBase.h"
#include "platform/RuntimeEnabledFeatures.h"
-#include "platform/geometry/FloatPoint.h"
#include "platform/scroll/ScrollableArea.h"
#include "wtf/MathExtras.h"
@@ -42,23 +41,23 @@ ScrollAnimatorBase::ScrollAnimatorBase(ScrollableArea* scrollableArea)
ScrollAnimatorBase::~ScrollAnimatorBase() {}
-FloatSize ScrollAnimatorBase::computeDeltaToConsume(
- const FloatSize& delta) const {
- FloatPoint newPos =
- toFloatPoint(m_scrollableArea->clampScrollPosition(m_currentPos + delta));
- return newPos - m_currentPos;
+ScrollOffset ScrollAnimatorBase::computeDeltaToConsume(
+ const ScrollOffset& delta) const {
+ ScrollOffset newPos =
+ m_scrollableArea->clampScrollOffset(m_currentOffset + delta);
+ return newPos - m_currentOffset;
}
ScrollResult ScrollAnimatorBase::userScroll(ScrollGranularity,
- const FloatSize& delta) {
- FloatSize consumedDelta = computeDeltaToConsume(delta);
- FloatPoint newPos = m_currentPos + consumedDelta;
- if (m_currentPos == newPos)
+ const ScrollOffset& delta) {
+ ScrollOffset consumedDelta = computeDeltaToConsume(delta);
+ ScrollOffset newPos = m_currentOffset + consumedDelta;
+ if (m_currentOffset == newPos)
return ScrollResult(false, false, delta.width(), delta.height());
- m_currentPos = newPos;
+ m_currentOffset = newPos;
- notifyPositionChanged();
+ notifyOffsetChanged();
return ScrollResult(consumedDelta.width(), consumedDelta.height(),
delta.width() - consumedDelta.width(),
@@ -66,21 +65,21 @@ ScrollResult ScrollAnimatorBase::userScroll(ScrollGranularity,
}
void ScrollAnimatorBase::scrollToOffsetWithoutAnimation(
- const FloatPoint& offset) {
- m_currentPos = offset;
- notifyPositionChanged();
+ const ScrollOffset& offset) {
+ m_currentOffset = offset;
+ notifyOffsetChanged();
}
-void ScrollAnimatorBase::setCurrentPosition(const FloatPoint& position) {
- m_currentPos = position;
+void ScrollAnimatorBase::setCurrentOffset(const ScrollOffset& offset) {
+ m_currentOffset = offset;
}
-FloatPoint ScrollAnimatorBase::currentPosition() const {
- return m_currentPos;
+ScrollOffset ScrollAnimatorBase::currentOffset() const {
+ return m_currentOffset;
}
-void ScrollAnimatorBase::notifyPositionChanged() {
- scrollPositionChanged(m_currentPos, UserScroll);
+void ScrollAnimatorBase::notifyOffsetChanged() {
+ scrollOffsetChanged(m_currentOffset, UserScroll);
}
DEFINE_TRACE(ScrollAnimatorBase) {

Powered by Google App Engine
This is Rietveld 408576698