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

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: 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') | Source/web/tests/WebFrameTest.cpp » ('J')
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 ab0864fa0e9ed5b4cbd8e77859449c1b3a9666a7..e109c5b76a8022fc5c85e7bd8f7db3c6f6b1a3cb 100644
--- a/Source/core/input/EventHandler.cpp
+++ b/Source/core/input/EventHandler.cpp
@@ -97,6 +97,22 @@
namespace blink {
+const float kEpsilon = 0.1;
majidvp 2015/07/09 15:02:46 Please add a comment explaining why 0.1. I suppose
MuVen 2015/07/09 17:51:34 Done.
+
+bool IsApproxZero(float value)
majidvp 2015/07/09 15:02:46 This function is superfluous as it is only used on
MuVen 2015/07/09 17:51:35 Done.
+{
+ return std::abs(value) < kEpsilon;
+}
+
+FloatSize ZeroSmallComponents(FloatSize unUsedDelta)
majidvp 2015/07/09 15:02:46 I think the name should reflect that it is meant t
MuVen 2015/07/09 17:51:35 Done.
+{
+ if (IsApproxZero(unUsedDelta.width()))
majidvp 2015/07/09 15:02:46 s/unUsedDelta/unusedDelta/ for consistency
MuVen 2015/07/09 17:51:35 Done.
+ unUsedDelta.setWidth(0);
+ if (IsApproxZero(unUsedDelta.height()))
+ unUsedDelta.setHeight(0);
+ return unUsedDelta;
+}
+
using namespace HTMLNames;
// The link drag hysteresis is much larger than the others because there
@@ -2243,6 +2259,7 @@ void EventHandler::resetOverscroll(bool didScrollX, bool didScrollY)
void EventHandler::handleOverscroll(const ScrollResult& scrollResult, const FloatPoint& position, const FloatSize& velocity)
{
FloatSize unusedDelta(scrollResult.unusedScrollDeltaX, scrollResult.unusedScrollDeltaY);
+ unusedDelta = ZeroSmallComponents(unusedDelta);
resetOverscroll(scrollResult.didScrollX, scrollResult.didScrollY);
if (unusedDelta != FloatSize()) {
m_accumulatedRootOverscroll += unusedDelta;
@@ -2255,6 +2272,7 @@ bool EventHandler::handleGestureScrollUpdate(const PlatformGestureEvent& gesture
ASSERT(gestureEvent.type() == PlatformEvent::GestureScrollUpdate);
FloatSize delta(gestureEvent.deltaX(), gestureEvent.deltaY());
+
majidvp 2015/07/09 15:02:46 unnecessary blank line.
MuVen 2015/07/09 17:51:35 Done.
if (delta.isZero())
return false;
« no previous file with comments | « no previous file | Source/web/tests/WebFrameTest.cpp » ('j') | Source/web/tests/WebFrameTest.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698