attenuationFactor should be in range [0,1]
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 6 Jun 2018 16:36:12 +0000 (16:36 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 6 Jun 2018 16:36:12 +0000 (16:36 +0000)
https://bugs.webkit.org/show_bug.cgi?id=186320
rdar://problem/40821456

Patch by Jeremy Jones <jeremyj@apple.com> on 2018-06-06
Reviewed by Jer Noble.

If attenuationFactor is outside of this range it can cause false positives.

* UIProcess/ios/fullscreen/FullscreenTouchSecheuristic.cpp:
(WebKit::FullscreenTouchSecheuristic::attenuationFactor):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@232545 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/ChangeLog
Source/WebKit/UIProcess/ios/fullscreen/FullscreenTouchSecheuristic.cpp

index f02f1d5..de52060 100644 (file)
@@ -1,3 +1,16 @@
+2018-06-06  Jeremy Jones  <jeremyj@apple.com>
+
+        attenuationFactor should be in range [0,1]
+        https://bugs.webkit.org/show_bug.cgi?id=186320
+        rdar://problem/40821456
+
+        Reviewed by Jer Noble.
+
+        If attenuationFactor is outside of this range it can cause false positives.
+
+        * UIProcess/ios/fullscreen/FullscreenTouchSecheuristic.cpp:
+        (WebKit::FullscreenTouchSecheuristic::attenuationFactor):
+
 2018-06-06  Tim Horton  <timothy_horton@apple.com>
 
         Move animated resize into the layer tree transaction, and make it asynchronous
index 9e90701..d0cf7a9 100644 (file)
@@ -78,7 +78,7 @@ double FullscreenTouchSecheuristic::distanceScore(const CGPoint& nextLocation, c
 double FullscreenTouchSecheuristic::attenuationFactor(Seconds delta)
 {
     double normalizedTimeDelta = delta / m_rampDownSpeed;
-    return normalizedTimeDelta * m_weight;
+    return std::max(std::min(normalizedTimeDelta * m_weight, 1.0), 0.0);
 }
 
 }