author | L. David Baron <dbaron@dbaron.org> |
Mon, 11 Apr 2011 23:18:43 -0700 | |
changeset 67984 | 6ab8e5df08ec2ed73b65c62a210014e8dea48d77 |
parent 67983 | 618c5d784dace564d9fdb4dabba2a1582214c321 |
child 67985 | 1c17ed72040cc82505821c7267ac8e683bd9d33d |
push id | 19461 |
push user | dbaron@mozilla.com |
push date | Tue, 12 Apr 2011 06:21:43 +0000 |
treeherder | mozilla-central@b48ebf9695bb [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | bzbarsky |
bugs | 435442 |
milestone | 2.2a1pre |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/layout/style/test/Makefile.in +++ b/layout/style/test/Makefile.in @@ -191,16 +191,17 @@ GARBAGE += css_properties.js test_value_cloning.html \ test_value_computation.html \ test_value_storage.html \ test_visited_image_loading.html \ test_visited_image_loading_empty.html \ test_visited_lying.html \ test_visited_pref.html \ test_visited_reftests.html \ + animation_utils.js \ css_properties.js \ property_database.js \ descriptor_database.js \ unstyled.xml \ unstyled.css \ unstyled-frame.xml \ unstyled-frame.css \ redirect.sjs \
new file mode 100644 --- /dev/null +++ b/layout/style/test/animation_utils.js @@ -0,0 +1,34 @@ +function px_to_num(str) +{ + return Number(String(str).match(/^([\d.]+)px$/)[1]); +} + +function bezier(x1, y1, x2, y2) { + // Cubic bezier with control points (0, 0), (x1, y1), (x2, y2), and (1, 1). + function x_for_t(t) { + var omt = 1-t; + return 3 * omt * omt * t * x1 + 3 * omt * t * t * x2 + t * t * t; + } + function y_for_t(t) { + var omt = 1-t; + return 3 * omt * omt * t * y1 + 3 * omt * t * t * y2 + t * t * t; + } + function t_for_x(x) { + // Binary subdivision. + var mint = 0, maxt = 1; + for (var i = 0; i < 30; ++i) { + var guesst = (mint + maxt) / 2; + var guessx = x_for_t(guesst); + if (x < guessx) + maxt = guesst; + else + mint = guesst; + } + return (mint + maxt) / 2; + } + return function bezier_closure(x) { + if (x == 0) return 0; + if (x == 1) return 1; + return y_for_t(t_for_x(x)); + } +}
--- a/layout/style/test/test_transitions.html +++ b/layout/style/test/test_transitions.html @@ -2,16 +2,17 @@ <html> <!-- https://bugzilla.mozilla.org/show_bug.cgi?id=435441 --> <head> <title>Test for Bug 435441</title> <script type="application/javascript" src="/MochiKit/packed.js"></script> <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> + <script type="application/javascript" src="animation_utils.js"></script> <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> <style type="text/css"> #display p { margin-top: 0; margin-bottom: 0; } #display .before, #display .after { width: -moz-fit-content; border: 1px solid black; } #display .before::before, #display .after::after { @@ -38,21 +39,16 @@ https://bugzilla.mozilla.org/show_bug.cg <div id="display"> </div> <pre id="test"> <script type="application/javascript"> /** Test for Bug 435441 **/ -function px_to_num(str) -{ - return Number(String(str).match(/^([\d.]+)px$/)[1]); -} - // Run tests simultaneously so we don't have to take up too much time. SimpleTest.waitForExplicitFinish(); var gTestsRunning = 0; function TestStarted() { ++gTestsRunning; } function TestFinished() { if (--gTestsRunning == 0) SimpleTest.finish(); } // An array of arrays of functions to be called at the outer index number // of seconds after the present. @@ -77,46 +73,16 @@ function process_future_calls(index) return; gCurrentTime = Date.now(); for (var i = 0; i < calls.length; ++i) { calls[i](); TestFinished(); } } -function bezier(x1, y1, x2, y2) { - // Cubic bezier with control points (0, 0), (x1, y1), (x2, y2), and (1, 1). - function x_for_t(t) { - var omt = 1-t; - return 3 * omt * omt * t * x1 + 3 * omt * t * t * x2 + t * t * t; - } - function y_for_t(t) { - var omt = 1-t; - return 3 * omt * omt * t * y1 + 3 * omt * t * t * y2 + t * t * t; - } - function t_for_x(x) { - // Binary subdivision. - var mint = 0, maxt = 1; - for (var i = 0; i < 30; ++i) { - var guesst = (mint + maxt) / 2; - var guessx = x_for_t(guesst); - if (x < guessx) - maxt = guesst; - else - mint = guesst; - } - return (mint + maxt) / 2; - } - return function bezier_closure(x) { - if (x == 0) return 0; - if (x == 1) return 1; - return y_for_t(t_for_x(x)); - } -} - var timingFunctions = { // a map from the value of 'transition-timing-function' to an array of // the portions this function yields at 0 (always 0), 1/4, 1/2, and // 3/4 and all (always 1) of the way through the time of the // transition. Each portion is represented as a value and an // acceptable error tolerance (based on a time error of 1%) for that // value.
--- a/layout/style/test/test_transitions_step_functions.html +++ b/layout/style/test/test_transitions_step_functions.html @@ -2,16 +2,17 @@ <html> <!-- https://bugzilla.mozilla.org/show_bug.cgi?id=435441 --> <head> <title>Test for Bug 435441</title> <script type="application/javascript" src="/MochiKit/packed.js"></script> <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> + <script type="application/javascript" src="animation_utils.js"></script> <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> <style type="text/css"> p.transition { -moz-transition: margin-top 100s linear; } </style> @@ -20,21 +21,16 @@ https://bugzilla.mozilla.org/show_bug.cg <div id="display"> </div> <pre id="test"> <script type="application/javascript"> /** Test for transition step functions **/ -function px_to_num(str) -{ - return Number(String(str).match(/^([\d.]+)px$/)[1]); -} - var display = document.getElementById("display"); function run_test(tf, percent, value) { var p = document.createElement("p"); p.className = "transition"; p.style.marginTop = "0px"; // be this percent of the way through a 100s transition