-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ enableCSSAnimationsAndCSSTransitionsBackedByWebAnimations=true ] -->
<script src="../../resources/js-test-pre.js"></script>
// FIXME: This test should be modified so subpixel doesn't cause off by one
// below and it no longer needs shouldBeCloseTo.
+function pauseAnimationAtTimeOnPseudoElement(animationName, time, element, pseudoId)
+{
+ const pseudoElement = internals.pseudoElement(element, pseudoId);
+ if (!pseudoElement) {
+ console.log("Failed to find pseudo element");
+ return;
+ }
+
+ const animations = pseudoElement.getAnimations();
+ for (let animation of animations) {
+ if (animation instanceof CSSAnimation && animation.animationName == animationName && animation.effect.getKeyframes().length) {
+ animation.currentTime = time * 1000;
+ animation.pause();
+ return true;
+ }
+ }
+ return false;
+}
+
function testAnimation(id)
{
var div = document.getElementById(id);
window.div = div;
shouldBe('div.offsetWidth', '52');
if (window.internals) {
- internals.pauseAnimationAtTimeOnPseudoElement('example', 1.0, div, id);
+ pauseAnimationAtTimeOnPseudoElement('example', 1.0, div, id);
shouldBeCloseTo('div.offsetWidth', 20, 1);
computedTop = getPseudoComputedTop(id);
shouldBeCloseTo('computedTop', 170, 1);
- internals.pauseAnimationAtTimeOnPseudoElement('example', 2.0, div, id);
+ pauseAnimationAtTimeOnPseudoElement('example', 2.0, div, id);
shouldBeCloseTo('div.offsetWidth', 12, 1);
computedTop = getPseudoComputedTop(id);
shouldBeCloseTo('computedTop', 200, 1);