haikuwebkit/LayoutTests/animations/animation-shorthand-removed...

113 lines
3.1 KiB
HTML
Raw Permalink Normal View History

<html>
<head>
<title>Test removal of animation shorthand property</title>
<style type="text/css" media="screen">
.box {
height: 10px;
width: 10px;
background-color: blue;
}
@-webkit-keyframes anim1 { }
</style>
<script type="text/javascript" charset="utf-8">
Use testRunner instead of layoutTestController in animations tests https://bugs.webkit.org/show_bug.cgi?id=88757 Reviewed by Tony Chang. * animations/3d/change-transform-in-end-event.html: * animations/3d/replace-filling-transform.html: * animations/3d/state-at-end-event-transform.html: * animations/3d/transform-origin-vs-functions.html: * animations/animation-add-events-in-handler.html: * animations/animation-border-overflow.html: * animations/animation-controller-drt-api.html: * animations/animation-direction-reverse-fill-mode-hardware.html: * animations/animation-direction-reverse-fill-mode.html: * animations/animation-drt-api-multiple-keyframes.html: * animations/animation-drt-api.html: * animations/animation-end-event-destroy-renderer.html: * animations/animation-end-event-short-iterations.html: * animations/animation-hit-test-transform.html: * animations/animation-hit-test.html: * animations/animation-iteration-event-destroy-renderer.html: * animations/animation-matrix-negative-scale-unmatrix.html: * animations/animation-on-inline-crash.html: * animations/animation-shorthand-overriding.html: * animations/animation-shorthand-removed.html: * animations/animation-shorthand.html: * animations/animation-start-event-destroy-renderer.html: * animations/animation-welcome-safari.html: * animations/body-removal-crash.html: * animations/change-keyframes-name.html: * animations/change-transform-style-during-animation.html: * animations/combo-transform-translate+scale.html: * animations/empty-keyframes.html: * animations/fill-mode-forwards.html: * animations/fill-mode-iteration-count-non-integer.html: * animations/fill-mode-missing-from-to-keyframes.html: * animations/fill-mode-multiple-keyframes.html: * animations/fill-mode-removed.html: * animations/fill-mode-reverse.html: * animations/fill-mode-transform.html: * animations/fill-mode.html: * animations/fill-unset-properties.html: * animations/font-size-using-ems.html-disabled: * animations/import-crash.html: * animations/keyframe-timing-functions-transform.html: * animations/keyframe-timing-functions2.html: * animations/keyframes-iteration-count-non-integer.html: * animations/longhand-timing-function.html: * animations/missing-from-to-transforms.html: * animations/missing-from-to.html: * animations/pause-crash.html: * animations/resources/animation-test-helpers.js: (checkExpectedValue): (endTest): * animations/state-at-end-event.html: * animations/suspend-resume-animation-events.html: * animations/suspend-transform-animation.html: * animations/transition-and-animation-3.html: * animations/unanimated-style.html: Canonical link: https://commits.webkit.org/106621@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@119985 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-06-11 17:22:07 +00:00
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
const kProperties = [
"webkitAnimationName",
"webkitAnimationDuration",
"webkitAnimationTimingFunction",
"webkitAnimationDelay",
"webkitAnimationIterationCount",
"webkitAnimationDirection",
"webkitAnimationFillMode"
];
const kElements = [
{ id: "a",
values: [ ]
},
{ id: "b",
values: [ "none", "0s", "ease", "0s", "1", "normal", "none" ]
},
{ id: "c",
values: [ "anim1", "10s" ]
},
{ id: "d",
values: [ "anim1", "10s", "linear" ]
},
{ id: "e",
values: [ "anim1", "10s", "linear", "5s" ]
},
{ id: "f",
values: [ "anim1", "10s", "linear", "5s", "3" ]
},
{ id: "g",
values: [ "anim1", "10s", "linear", "5s", "infinite", "alternate" ]
},
{ id: "h",
values: [ "anim1", "10s", "linear", "5s", "infinite", "alternate", "forwards" ]
}
];
Querying transition-timing-function value on the computed style does not return keywords when it should. https://bugs.webkit.org/show_bug.cgi?id=105442 Reviewed by Simon Fraser. Source/WebCore: http://www.w3.org/TR/css3-transitions/#transition-timing-function-property contains a set of predefined timing functions which under the hood are implemented using cubic-bezier but it's an implementation detail that should not be exposed. It seems to be more clear to return a CSS keyword rather than the cubic-bezier form when querying the value of the property on the computed style. In fact the spec even say that for example the initial value is "ease" and not cubic-bezier(0.25, 0.1, 0.25, 1.0). We could also imagine that in the future these predefined values could contain other values not represented by a cubic-bezier form. This behavior also align with the "linear" keyword which return "linear" rather than cubic-bezier(0.0, 0.0, 1.0, 1.0). Test: transitions/transitions-parsing.html has been updated to cover the new behavior as well as making sure that an explicitly set value of cubic-bezier(0.25, 0.1, 0.25, 1.0) does not return "ease" but the cubic-bezier() form. * css/CSSComputedStyleDeclaration.cpp: (WebCore::createAnimationValue): (WebCore): (WebCore::getTimingFunctionValue): * css/CSSToStyleMap.cpp: (WebCore::CSSToStyleMap::mapAnimationTimingFunction): * platform/animation/TimingFunction.h: (WebCore::CubicBezierTimingFunction::create): (CubicBezierTimingFunction): (WebCore::CubicBezierTimingFunction::operator==): (WebCore::CubicBezierTimingFunction::timingFunctionPreset): Store the preset value of the timing function if it is one when creating it so we can use it later from the computed style. (WebCore::CubicBezierTimingFunction::CubicBezierTimingFunction): Source/WebKit2: Update the code to pass the animations from one process to another as the constructor of TimingFunction changed to take an extra parameter holding the type of the cubic-bezier form. * Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.cpp: (CoreIPC::encodeTimingFunction): (CoreIPC::decodeTimingFunction): LayoutTests: Update the tests to match the correct behavior of returning a keyword rather than a cubic-bezier() form when using predefined values for the transition-timing-function property. * animations/animation-shorthand-name-order-expected.txt: * animations/animation-shorthand-name-order.html: * animations/animation-shorthand-removed.html: * animations/animation-shorthand.html: * animations/computed-style-expected.txt: * animations/computed-style.html: * fast/css/getComputedStyle/computed-style-expected.txt: * fast/css/getComputedStyle/computed-style-without-renderer-expected.txt: * svg/css/getComputedStyle-basic-expected.txt: * transitions/inherit-other-props-expected.txt: * transitions/inherit-other-props.html: * transitions/transitions-parsing-expected.txt: * transitions/transitions-parsing.html: Canonical link: https://commits.webkit.org/124207@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@138728 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-01-03 20:22:47 +00:00
const kExpectedResults = [ "none", "0s", "ease", "0s", "1", "normal", "none" ];
function start() {
kElements.forEach(function(curEl) {
var el = document.getElementById(curEl.id);
for (var i=0; i < curEl.values.length; i++) {
el.style[kProperties[i]] = curEl.values[i];
}
});
setTimeout(remove, 0);
}
function remove() {
kElements.forEach(function(curEl) {
var el = document.getElementById(curEl.id);
el.style.removeProperty("-webkit-animation");
});
setTimeout(test, 0);
}
function test() {
var resultsString = "";
kElements.forEach(function(curEl) {
var el = document.getElementById(curEl.id);
var elStyle = window.getComputedStyle(el);
for (var i=0; i < kProperties.length; i++) {
var computedValue = elStyle[kProperties[i]];
var expectedValue = kExpectedResults[i];
if (computedValue == expectedValue)
resultsString += "Testing " + kProperties[i] + " on " + curEl.id + ": PASS" + "<br>";
else
resultsString += "Testing " + kProperties[i] + " on " + curEl.id + " expected <code>" + expectedValue + "</code> got <code>" + computedValue + "</code>: FAIL" + "<br>";
}
});
var results = document.getElementById('result');
results.innerHTML = resultsString;
Use testRunner instead of layoutTestController in animations tests https://bugs.webkit.org/show_bug.cgi?id=88757 Reviewed by Tony Chang. * animations/3d/change-transform-in-end-event.html: * animations/3d/replace-filling-transform.html: * animations/3d/state-at-end-event-transform.html: * animations/3d/transform-origin-vs-functions.html: * animations/animation-add-events-in-handler.html: * animations/animation-border-overflow.html: * animations/animation-controller-drt-api.html: * animations/animation-direction-reverse-fill-mode-hardware.html: * animations/animation-direction-reverse-fill-mode.html: * animations/animation-drt-api-multiple-keyframes.html: * animations/animation-drt-api.html: * animations/animation-end-event-destroy-renderer.html: * animations/animation-end-event-short-iterations.html: * animations/animation-hit-test-transform.html: * animations/animation-hit-test.html: * animations/animation-iteration-event-destroy-renderer.html: * animations/animation-matrix-negative-scale-unmatrix.html: * animations/animation-on-inline-crash.html: * animations/animation-shorthand-overriding.html: * animations/animation-shorthand-removed.html: * animations/animation-shorthand.html: * animations/animation-start-event-destroy-renderer.html: * animations/animation-welcome-safari.html: * animations/body-removal-crash.html: * animations/change-keyframes-name.html: * animations/change-transform-style-during-animation.html: * animations/combo-transform-translate+scale.html: * animations/empty-keyframes.html: * animations/fill-mode-forwards.html: * animations/fill-mode-iteration-count-non-integer.html: * animations/fill-mode-missing-from-to-keyframes.html: * animations/fill-mode-multiple-keyframes.html: * animations/fill-mode-removed.html: * animations/fill-mode-reverse.html: * animations/fill-mode-transform.html: * animations/fill-mode.html: * animations/fill-unset-properties.html: * animations/font-size-using-ems.html-disabled: * animations/import-crash.html: * animations/keyframe-timing-functions-transform.html: * animations/keyframe-timing-functions2.html: * animations/keyframes-iteration-count-non-integer.html: * animations/longhand-timing-function.html: * animations/missing-from-to-transforms.html: * animations/missing-from-to.html: * animations/pause-crash.html: * animations/resources/animation-test-helpers.js: (checkExpectedValue): (endTest): * animations/state-at-end-event.html: * animations/suspend-resume-animation-events.html: * animations/suspend-transform-animation.html: * animations/transition-and-animation-3.html: * animations/unanimated-style.html: Canonical link: https://commits.webkit.org/106621@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@119985 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-06-11 17:22:07 +00:00
if (window.testRunner)
testRunner.notifyDone();
}
window.addEventListener('load', start, false);
</script>
</head>
<body>
<div id="a" class="box"></div>
<div id="b" class="box"></div>
<div id="c" class="box"></div>
<div id="d" class="box"></div>
<div id="e" class="box"></div>
<div id="f" class="box"></div>
<div id="g" class="box"></div>
<div id="h" class="box"></div>
<div id="result">
</div>
</body>
</html>