Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / animations / dynamic-stylesheet-loading.html
blobd33de9c68de14e3d26da187e31073fc959975ce7
1 <!DOCTYPE html>
3 <html lang="en">
4 <head>
5 <title>Test of dynamic stylesheet loading</title>
6 <link rel="stylesheet" href="resources/dynamic-stylesheet-insertion-main.css">
7 <script src="resources/animation-test-helpers.js" type="text/javascript" charset="utf-8"></script>
8 <script type="text/javascript" charset="utf-8">
10 const expectedValues = [
11 // [time, element-id, property, expected-value, tolerance]
12 [0.3, "splash", "webkitTransform.5", 100, 0.1],
15 var controller = {};
17 controller.init = function () {
18 // put a listener on the initial splash animation
19 this.splash = document.getElementById('splash');
20 this.splash.addEventListener('webkitAnimationStart', this, false);
21 this.splash.addEventListener('webkitAnimationEnd', this, false);
23 runAnimationTest(expectedValues, undefined, undefined, true);
26 controller.handleEvent = function (event) {
27 if (event.type == 'webkitAnimationStart') {
28 // pre-load the stylesheet
29 var link = document.createElement('link');
30 link.rel = 'stylesheet';
31 link.href = 'resources/dynamic-stylesheet-insertion-inserted.css';
32 document.head.appendChild(link);
36 window.addEventListener('DOMContentLoaded', function () {
37 controller.init();
38 }, false);
40 </script>
41 </head>
42 <body>
43 This test performs an animation and then dynamically loads a new stylesheet (which is empty). It should start
44 animating after a 100ms delay and then stop halfway through the animation at which point we see if it is at the
45 correct position. The loading of the stylesheet should not prevent the animation from running.
46 <div id="splash"></div>
47 <div id="result">
48 </div>
49 </body>
50 </html>