Thu, 15 Jan 2015 21:03:48 +0100
Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)
michael@0 | 1 | <!DOCTYPE HTML> |
michael@0 | 2 | <html> |
michael@0 | 3 | <!-- |
michael@0 | 4 | https://bugzilla.mozilla.org/show_bug.cgi?id=696253 |
michael@0 | 5 | --> |
michael@0 | 6 | <head> |
michael@0 | 7 | <meta charset="utf-8"> |
michael@0 | 8 | <title>Test for flex-grow and flex-shrink animation (Bug 696253)</title> |
michael@0 | 9 | <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 10 | <script type="application/javascript" src="animation_utils.js"></script> |
michael@0 | 11 | <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> |
michael@0 | 12 | <style type="text/css"> |
michael@0 | 13 | |
michael@0 | 14 | /* Set flex-grow and flex-shrink to nonzero values, |
michael@0 | 15 | when no animations are applied. */ |
michael@0 | 16 | |
michael@0 | 17 | * { flex-grow: 10; flex-shrink: 20 } |
michael@0 | 18 | |
michael@0 | 19 | /* These animations SHOULD affect computed style */ |
michael@0 | 20 | @keyframes flexGrowTwoToThree { |
michael@0 | 21 | 0% { flex-grow: 2 } |
michael@0 | 22 | 100% { flex-grow: 3 } |
michael@0 | 23 | } |
michael@0 | 24 | @keyframes flexShrinkTwoToThree { |
michael@0 | 25 | 0% { flex-shrink: 2 } |
michael@0 | 26 | 100% { flex-shrink: 3 } |
michael@0 | 27 | } |
michael@0 | 28 | @keyframes flexGrowZeroToZero { |
michael@0 | 29 | 0% { flex-grow: 0 } |
michael@0 | 30 | 100% { flex-grow: 0 } |
michael@0 | 31 | } |
michael@0 | 32 | @keyframes flexShrinkZeroToZero { |
michael@0 | 33 | 0% { flex-shrink: 0 } |
michael@0 | 34 | 100% { flex-shrink: 0 } |
michael@0 | 35 | } |
michael@0 | 36 | |
michael@0 | 37 | /* These animations SHOULD NOT affect computed style. (flex-grow and |
michael@0 | 38 | flex-shrink are animatable "except between '0' and other values") */ |
michael@0 | 39 | @keyframes flexGrowZeroToOne { |
michael@0 | 40 | 0% { flex-grow: 0 } |
michael@0 | 41 | 100% { flex-grow: 1 } |
michael@0 | 42 | } |
michael@0 | 43 | @keyframes flexShrinkZeroToOne { |
michael@0 | 44 | 0% { flex-shrink: 0 } |
michael@0 | 45 | 100% { flex-shrink: 1 } |
michael@0 | 46 | } |
michael@0 | 47 | @keyframes flexGrowOneToZero { |
michael@0 | 48 | 0% { flex-grow: 1 } |
michael@0 | 49 | 100% { flex-grow: 0 } |
michael@0 | 50 | } |
michael@0 | 51 | @keyframes flexShrinkOneToZero { |
michael@0 | 52 | 0% { flex-shrink: 1 } |
michael@0 | 53 | 100% { flex-shrink: 0 } |
michael@0 | 54 | } |
michael@0 | 55 | |
michael@0 | 56 | </style> |
michael@0 | 57 | </head> |
michael@0 | 58 | <body> |
michael@0 | 59 | <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=696253">Mozilla Bug 696253</a> |
michael@0 | 60 | <div id="display"> |
michael@0 | 61 | <div id="myDiv"></div> |
michael@0 | 62 | </div> |
michael@0 | 63 | <pre id="test"> |
michael@0 | 64 | <script type="application/javascript"> |
michael@0 | 65 | "use strict"; |
michael@0 | 66 | |
michael@0 | 67 | /** Test for flex-grow and flex-shrink animation (Bug 696253) **/ |
michael@0 | 68 | |
michael@0 | 69 | function advance_clock(milliseconds) { |
michael@0 | 70 | SpecialPowers.DOMWindowUtils.advanceTimeAndRefresh(milliseconds); |
michael@0 | 71 | } |
michael@0 | 72 | |
michael@0 | 73 | var display = document.getElementById("display"); |
michael@0 | 74 | var div = null; |
michael@0 | 75 | var cs = null; |
michael@0 | 76 | function new_div(style) { |
michael@0 | 77 | return new_element("div", style); |
michael@0 | 78 | } |
michael@0 | 79 | function new_element(tagname, style) { |
michael@0 | 80 | if (div != null || cs != null) { |
michael@0 | 81 | ok(false, "test author forgot to call done_div"); |
michael@0 | 82 | } |
michael@0 | 83 | if (typeof(style) != "string") { |
michael@0 | 84 | ok(false, "test author forgot to pass argument"); |
michael@0 | 85 | } |
michael@0 | 86 | div = document.createElement(tagname); |
michael@0 | 87 | div.setAttribute("style", style); |
michael@0 | 88 | display.appendChild(div); |
michael@0 | 89 | cs = getComputedStyle(div, ""); |
michael@0 | 90 | } |
michael@0 | 91 | |
michael@0 | 92 | function done_div() { |
michael@0 | 93 | display.removeChild(div); |
michael@0 | 94 | div = null; |
michael@0 | 95 | cs = null; |
michael@0 | 96 | } |
michael@0 | 97 | // take over the refresh driver |
michael@0 | 98 | advance_clock(0); |
michael@0 | 99 | |
michael@0 | 100 | // ANIMATIONS THAT SHOULD AFFECT COMPUTED STYLE |
michael@0 | 101 | // -------------------------------------------- |
michael@0 | 102 | |
michael@0 | 103 | // flexGrowTwoToThree: 2.0 at 0%, 2.5 at 50%, 10 after animation is over |
michael@0 | 104 | new_div("animation: flexGrowTwoToThree linear 1s"); |
michael@0 | 105 | is_approx(cs.flexGrow, 2, 0.01, "flexGrowTwoToThree at 0.0s"); |
michael@0 | 106 | advance_clock(500); |
michael@0 | 107 | is_approx(cs.flexGrow, 2.5, 0.01, "flexGrowTwoToThree at 0.5s"); |
michael@0 | 108 | advance_clock(1000); |
michael@0 | 109 | is(cs.flexGrow, 10, "flexGrowTwoToThree at 1.5s"); |
michael@0 | 110 | done_div(); |
michael@0 | 111 | |
michael@0 | 112 | // flexShrinkTwoToThree: 2.0 at 0%, 2.5 at 50%, 20 after animation is over |
michael@0 | 113 | new_div("animation: flexShrinkTwoToThree linear 1s"); |
michael@0 | 114 | is_approx(cs.flexShrink, 2, 0.01, "flexShrinkTwoToThree at 0.0s"); |
michael@0 | 115 | advance_clock(500); |
michael@0 | 116 | is_approx(cs.flexShrink, 2.5, 0.01, "flexShrinkTwoToThree at 0.5s"); |
michael@0 | 117 | advance_clock(1000); |
michael@0 | 118 | is(cs.flexShrink, 20, "flexShrinkTwoToThree at 1.5s"); |
michael@0 | 119 | done_div(); |
michael@0 | 120 | |
michael@0 | 121 | // flexGrowZeroToZero: 0 at 0%, 0 at 50%, 10 after animation is over |
michael@0 | 122 | new_div("animation: flexGrowZeroToZero linear 1s"); |
michael@0 | 123 | is(cs.flexGrow, 0, "flexGrowZeroToZero at 0.0s"); |
michael@0 | 124 | advance_clock(500); |
michael@0 | 125 | is(cs.flexGrow, 0, "flexGrowZeroToZero at 0.5s"); |
michael@0 | 126 | advance_clock(1000); |
michael@0 | 127 | is(cs.flexGrow, 10, "flexGrowZeroToZero at 1.5s"); |
michael@0 | 128 | done_div(); |
michael@0 | 129 | |
michael@0 | 130 | // flexShrinkZeroToZero: 0 at 0%, 0 at 50%, 20 after animation is over |
michael@0 | 131 | new_div("animation: flexShrinkZeroToZero linear 1s"); |
michael@0 | 132 | is(cs.flexShrink, 0, "flexShrinkZeroToZero at 0.0s"); |
michael@0 | 133 | advance_clock(500); |
michael@0 | 134 | is(cs.flexShrink, 0, "flexShrinkZeroToZero at 0.5s"); |
michael@0 | 135 | advance_clock(1000); |
michael@0 | 136 | is(cs.flexShrink, 20, "flexShrinkZeroToZero at 1.5s"); |
michael@0 | 137 | done_div(); |
michael@0 | 138 | |
michael@0 | 139 | // ANIMATIONS THAT SHOULD NOT AFFECT COMPUTED STYLE |
michael@0 | 140 | // ------------------------------------------------ |
michael@0 | 141 | |
michael@0 | 142 | // flexGrowZeroToOne: no effect on computed style. 10 all the way through. |
michael@0 | 143 | new_div("animation: flexGrowZeroToOne linear 1s"); |
michael@0 | 144 | is(cs.flexGrow, 10, "flexGrowZeroToOne at 0.0s"); |
michael@0 | 145 | advance_clock(500); |
michael@0 | 146 | is(cs.flexGrow, 10, "flexGrowZeroToOne at 0.5s"); |
michael@0 | 147 | advance_clock(1000); |
michael@0 | 148 | is(cs.flexGrow, 10, "flexGrowZeroToOne at 1.5s"); |
michael@0 | 149 | done_div(); |
michael@0 | 150 | |
michael@0 | 151 | // flexShrinkZeroToOne: no effect on computed style. 20 all the way through. |
michael@0 | 152 | new_div("animation: flexShrinkZeroToOne linear 1s"); |
michael@0 | 153 | is(cs.flexShrink, 20, "flexShrinkZeroToOne at 0.0s"); |
michael@0 | 154 | advance_clock(500); |
michael@0 | 155 | is(cs.flexShrink, 20, "flexShrinkZeroToOne at 0.5s"); |
michael@0 | 156 | advance_clock(1000); |
michael@0 | 157 | is(cs.flexShrink, 20, "flexShrinkZeroToOne at 1.5s"); |
michael@0 | 158 | done_div(); |
michael@0 | 159 | |
michael@0 | 160 | // flexGrowOneToZero: no effect on computed style. 10 all the way through. |
michael@0 | 161 | new_div("animation: flexGrowOneToZero linear 1s"); |
michael@0 | 162 | is(cs.flexGrow, 10, "flexGrowOneToZero at 0.0s"); |
michael@0 | 163 | advance_clock(500); |
michael@0 | 164 | is(cs.flexGrow, 10, "flexGrowOneToZero at 0.5s"); |
michael@0 | 165 | advance_clock(1000); |
michael@0 | 166 | is(cs.flexGrow, 10, "flexGrowOneToZero at 1.5s"); |
michael@0 | 167 | done_div(); |
michael@0 | 168 | |
michael@0 | 169 | // flexShrinkOneToZero: no effect on computed style. 20 all the way through. |
michael@0 | 170 | new_div("animation: flexShrinkOneToZero linear 1s"); |
michael@0 | 171 | is(cs.flexShrink, 20, "flexShrinkOneToZero at 0.0s"); |
michael@0 | 172 | advance_clock(500); |
michael@0 | 173 | is(cs.flexShrink, 20, "flexShrinkOneToZero at 0.5s"); |
michael@0 | 174 | advance_clock(1000); |
michael@0 | 175 | is(cs.flexShrink, 20, "flexShrinkOneToZero at 1.5s"); |
michael@0 | 176 | done_div(); |
michael@0 | 177 | |
michael@0 | 178 | SpecialPowers.DOMWindowUtils.restoreNormalRefresh(); |
michael@0 | 179 | |
michael@0 | 180 | </script> |
michael@0 | 181 | </pre> |
michael@0 | 182 | </body> |
michael@0 | 183 | </html> |