layout/style/test/test_transitions_cancel_near_end.html

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

michael@0 1 <!DOCTYPE HTML>
michael@0 2 <html>
michael@0 3 <!--
michael@0 4 https://bugzilla.mozilla.org/show_bug.cgi?id=613888
michael@0 5 -->
michael@0 6 <head>
michael@0 7 <title>Test for Bug 613888</title>
michael@0 8 <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
michael@0 9 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
michael@0 10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
michael@0 11 <style type="text/css">
michael@0 12 #animated-elements-container > span {
michael@0 13 color: black;
michael@0 14 background: white;
michael@0 15 transition:
michael@0 16 color 10s ease-out,
michael@0 17 background 1s ease-out;
michael@0 18 }
michael@0 19 #animated-elements-container > span.another {
michael@0 20 color: white;
michael@0 21 background: black;
michael@0 22 }
michael@0 23 </style>
michael@0 24 </head>
michael@0 25 <body>
michael@0 26 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=613888">Mozilla Bug 613888</a>
michael@0 27 <pre id="animated-elements-container">
michael@0 28 <span should-restyle="true">canceled on a half of the animation</span>
michael@0 29 <span should-restyle="true">canceled too fast, and restyled on transitionend</span>
michael@0 30 <span>canceled too fast, but not restyled on transitionend</span>
michael@0 31 </pre>
michael@0 32 <pre id="test">
michael@0 33 <script class="testbody" type="text/javascript">
michael@0 34
michael@0 35 /** Test for Bug 613888: that we don't cancel transitions when they're
michael@0 36 about to end (current interpolated value rounds to ending value) and
michael@0 37 they get an unrelated style change. **/
michael@0 38
michael@0 39 var count_remaining = 6;
michael@0 40
michael@0 41 window.addEventListener('load', function() {
michael@0 42 var cases = Array.slice(document.querySelectorAll('#animated-elements-container > span'));
michael@0 43
michael@0 44 cases.forEach(function(aTarget) {
michael@0 45 aTarget.addEventListener('transitionend', function(aEvent) {
michael@0 46 if (aTarget.hasAttribute('should-restyle'))
michael@0 47 aTarget.style.outline = '1px solid';
michael@0 48 var attr = 'transitionend-' + aEvent.propertyName;
michael@0 49 if (aTarget.hasAttribute(attr)) {
michael@0 50 // It's possible, given bad timers, that we might get a
michael@0 51 // transition that completed before we reversed it, which could
michael@0 52 // lead to two transitionend events for the same thing. We
michael@0 53 // don't want to decrement count_remaining in this case.
michael@0 54 return;
michael@0 55 }
michael@0 56 aTarget.setAttribute(attr, "true");
michael@0 57 if (--count_remaining == 0) {
michael@0 58 cases.forEach(function(aCase, aIndex) {
michael@0 59 ok(aCase.hasAttribute('transitionend-color'),
michael@0 60 "transitionend for color was fired for case "+aIndex);
michael@0 61 ok(aCase.hasAttribute('transitionend-background-color'),
michael@0 62 "transitionend for background-color was fired for case "+aIndex);
michael@0 63 });
michael@0 64 SimpleTest.finish();
michael@0 65 }
michael@0 66 }, false);
michael@0 67 });
michael@0 68
michael@0 69 cases.forEach(function(aCase) aCase.className = 'another' );
michael@0 70
michael@0 71 window.setTimeout(function() cases[0].className = '', 500);
michael@0 72 window.setTimeout(function() cases[1].className = cases[2].className = '', 250);
michael@0 73
michael@0 74 }, false);
michael@0 75
michael@0 76 SimpleTest.waitForExplicitFinish();
michael@0 77
michael@0 78 </script>
michael@0 79 </pre>
michael@0 80 </body>
michael@0 81 </html>

mercurial