[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor-browser/esr24] Bug 541855 - Add in the error tolerance before calling the timing function, so that we allow more error for steeper functions, and less error for most. r=dholbert, a=test-only



commit 82fe694f1304ccbcb83c8ec478e05045426b39a1
Author: L. David Baron <dbaron@xxxxxxxxxx>
Date:   Fri Feb 14 21:29:12 2014 -0800

    Bug 541855 - Add in the error tolerance before calling the timing function, so that we allow more error for steeper functions, and less error for most. r=dholbert, a=test-only
---
 layout/style/test/test_transitions.html |   15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/layout/style/test/test_transitions.html b/layout/style/test/test_transitions.html
index 75b90a2..d00c28d 100644
--- a/layout/style/test/test_transitions.html
+++ b/layout/style/test/test_transitions.html
@@ -430,6 +430,19 @@ function check_transition_value(func, start_time, end_time,
                                 start_value, end_value, cval, desc,
                                 xfail)
 {
+    /**
+     * Compute the value at a given time |elapsed|, by normalizing the
+     * input to the timing function using start_time and end_time and
+     * then turning the output into a value using start_value and
+     * end_value.
+     *
+     * The |error_direction| argument should be either -1, 0, or 1,
+     * suggesting adding on a little bit of error, to allow for the
+     * cubic-bezier calculation being an approximation.  The amount of
+     * error is proportional to the slope of the timing function, since
+     * the error is added to the *input* of the timing function (after
+     * normalization to 0-1 based on start_time and end_time).
+     */
     function value_at(elapsed, error_direction) {
         var time_portion = (elapsed - start_time) / (end_time - start_time);
         if (time_portion < 0)
@@ -438,7 +451,7 @@ function check_transition_value(func, start_time, end_time,
             time_portion = 1;
         // Assume a small error since bezier computation can be off slightly.
         // (This test's computation is probably more accurate than Mozilla's.)
-        var value_portion = func(time_portion) + error_direction * 0.0015;
+        var value_portion = func(time_portion + error_direction * 0.0005);
         if (value_portion < 0)
             value_portion = 0;
         else if (value_portion > 1)



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits