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

Unified Diff: Source/core/input/EventHandler.cpp

Issue 1214673006: Reset unusedDelta on Onverscroll for residual values. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebased to the latest Created 5 years, 5 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
« no previous file with comments | « no previous file | Source/web/tests/WebFrameTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/input/EventHandler.cpp
diff --git a/Source/core/input/EventHandler.cpp b/Source/core/input/EventHandler.cpp
index d16e9e2e4ef679e408209463115845eef5fa68ce..db3a58d4879e2ba88fd0f68d1f4bae1ab32bf01e 100644
--- a/Source/core/input/EventHandler.cpp
+++ b/Source/core/input/EventHandler.cpp
@@ -132,6 +132,10 @@ static const double TextDragDelay = 0.15;
static const double TextDragDelay = 0.0;
#endif
+// Report Overscroll if OverscrollDelta is greater than minimumOverscrollDelta
+// to maintain consistency as did in compositor.
+static const float minimumOverscrollDelta = 0.1;
+
enum NoCursorChangeType { NoCursorChange };
enum class DragInitiator { Mouse, Touch };
@@ -2241,9 +2245,20 @@ void EventHandler::resetOverscroll(bool didScrollX, bool didScrollY)
m_accumulatedRootOverscroll.setHeight(0);
}
+static inline FloatSize adjustOverscoll(FloatSize unusedDelta)
+{
+ if (std::abs(unusedDelta.width()) < minimumOverscrollDelta)
+ unusedDelta.setWidth(0);
+ if (std::abs(unusedDelta.height()) < minimumOverscrollDelta)
+ unusedDelta.setHeight(0);
+
+ return unusedDelta;
+}
+
void EventHandler::handleOverscroll(const ScrollResult& scrollResult, const FloatPoint& position, const FloatSize& velocity)
{
FloatSize unusedDelta(scrollResult.unusedScrollDeltaX, scrollResult.unusedScrollDeltaY);
+ unusedDelta = adjustOverscoll(unusedDelta);
resetOverscroll(scrollResult.didScrollX, scrollResult.didScrollY);
if (unusedDelta != FloatSize()) {
m_accumulatedRootOverscroll += unusedDelta;
« no previous file with comments | « no previous file | Source/web/tests/WebFrameTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698