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; |