haikuwebkit/LayoutTests/animations/dynamic-stylesheet-loading....

54 lines
2.0 KiB
HTML
Raw Permalink Normal View History

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>Test of dynamic stylesheet loading</title>
<link rel="stylesheet" href="resources/dynamic-stylesheet-insertion-main.css">
2011-04-25 Simon Fraser <simon.fraser@apple.com> Reviewed by Daniel Bates. Move animation-test-helpers.js into resources directory https://bugs.webkit.org/show_bug.cgi?id=59365 Move animation-test-helpers.js and fix the tests accordingly. * animations/3d/matrix-transform-type-animation.html: * animations/3d/transform-perspective.html: * animations/animation-direction.html: * animations/animation-drt-api-multiple-keyframes.html: * animations/animation-drt-api.html: * animations/animation-hit-test-transform.html: * animations/animation-hit-test.html: * animations/big-rotation.html: * animations/change-keyframes-name.html: * animations/change-keyframes.html: * animations/change-one-anim.html: * animations/combo-transform-rotate+scale.html: * animations/dynamic-stylesheet-loading.html: * animations/generic-from-to.html: * animations/import.html: * animations/keyframe-timing-functions-transform.html: * animations/keyframe-timing-functions.html: * animations/keyframe-timing-functions2.html: * animations/keyframes-comma-separated.html: * animations/keyframes-out-of-order.html: * animations/keyframes.html: * animations/lineheight-animation.html: * animations/longhand-timing-function.html: * animations/matrix-anim.html: * animations/missing-from-to-transforms.html: * animations/missing-from-to.html: * animations/missing-keyframe-properties-repeating.html: * animations/missing-keyframe-properties-timing-function.html: * animations/missing-keyframe-properties.html: * animations/missing-values-first-keyframe.html: * animations/missing-values-last-keyframe.html: * animations/multiple-animations.html: * animations/multiple-keyframes.html: * animations/negative-delay.html: * animations/opacity-transform-animation.html: * animations/play-state-suspend.html: * animations/play-state.html: * animations/resources/animation-test-helpers.js: (isCloseEnough): (matrixStringToArray): (checkExpectedValue): (endTest): (startTest): (runAnimationTest.else): (runAnimationTest): (waitForAnimationToStart): * animations/simultaneous-start-left.html: * animations/simultaneous-start-transform.html: * animations/stop-animation-on-suspend.html: * animations/suspend-resume-animation.html: * animations/timing-functions.html: * animations/transition-and-animation-1.html: * animations/transition-and-animation-2.html: * animations/transition-and-animation-3.html: * animations/unanimated-style.html: * animations/width-using-ems.html: Canonical link: https://commits.webkit.org/74594@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@84872 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2011-04-26 03:16:31 +00:00
<script src="resources/animation-test-helpers.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
const expectedValues = [
// [animation-name, time, element-id, property, expected-value, tolerance]
["splashdown", 0.3, "splash", "webkitTransform.5", 100, 0.1],
];
var controller = {};
controller.init = function () {
// put a listener on the initial splash animation
this.splash = document.getElementById('splash');
this.splash.addEventListener('webkitAnimationStart', this, false);
this.splash.addEventListener('webkitAnimationEnd', this, false);
runAnimationTest(expectedValues, undefined, undefined, true);
};
controller.handleEvent = function (event) {
if (event.type == 'webkitAnimationStart') {
// pre-load the stylesheet
var link = document.createElement('link');
link.rel = 'stylesheet';
link.href = 'resources/dynamic-stylesheet-insertion-inserted.css';
document.head.appendChild(link);
}
};
window.addEventListener('DOMContentLoaded', function () {
controller.init();
}, false);
</script>
</head>
<body>
This test performs an animation and then dynamically loads a new stylesheet (which is empty). It should start
animating after a 100ms delay and then stop halfway through the animation at which point we see if it is at the
correct position. The loading of the stylesheet should not prevent the animation from running.
<div id="splash"></div>
<div id="result">
</div>
</body>
</html>