haikuwebkit/LayoutTests/animations/unprefixed-events-mixed-wit...

68 lines
1.7 KiB
HTML
Raw Permalink Normal View History

Support unprefixed animation event types https://bugs.webkit.org/show_bug.cgi?id=138931 <rdar://problem/18943167> Reviewed by Simon Fraser. Source/WebCore: Tests: animations/unprefixed-events-mixed-with-prefixed.html animations/unprefixed-events.html Support the unprefixed animation event names: - animationstart (was webkitAnimationStart) - animationiteration (was webkitAnimationIteration) - animationend (was webkitAnimationEnd) (Yes, event types are case sensitive and yes, this will likely cause some head-scratching as people change content) The approach here is to follow what transitions does: - listener only for old event name -> fire old event name - listener for both old and new event name -> fire new event name - listener only for new event name -> fire new event name That way pages that were trying to anticipate the new event name won't get duplicate events. * CMakeLists.txt: Add new AnimationEvent* stuff. * DerivedSources.make: Ditto. * WebCore.vcxproj/WebCore.vcxproj: Ditto. * WebCore.vcxproj/WebCore.vcxproj.filters: Ditto. * WebCore.xcodeproj/project.pbxproj: Ditto. * bindings/js/JSBindingsAllInOne.cpp: New files for all in one builds. * dom/DOMAllInOne.cpp: * dom/AnimationEvent.cpp: Added. Copied from WebKitAnimationEvent.cpp. (WebCore::AnimationEventInit::AnimationEventInit): (WebCore::AnimationEvent::AnimationEvent): (WebCore::AnimationEvent::~AnimationEvent): (WebCore::AnimationEvent::animationName): (WebCore::AnimationEvent::elapsedTime): (WebCore::AnimationEvent::eventInterface): * dom/AnimationEvent.h: Added. Copied from WebKitAnimationEvent.h. * dom/AnimationEvent.idl: Added. Copied from WebKitAnimationEvent.idl. * dom/Document.cpp: (WebCore::Document::addListenerTypeIfNeeded): Handle new event types. * dom/EventNames.h: New names. * dom/EventNames.in: * dom/EventTarget.cpp: (WebCore::legacyType): Provide a mapping from the new names to the older prefixed forms. * html/HTMLAttributeNames.in: Support the on* attributes, even though I hate them and wish this approach would die. * html/HTMLElement.cpp: (WebCore::HTMLElement::populateEventNameForAttributeLocalNameMap): * page/DOMWindow.h: New names, and constructors. * page/DOMWindow.idl: * page/animation/AnimationController.cpp: (WebCore::AnimationControllerPrivate::fireEventsAndUpdateStyle): Fire new type. * page/animation/KeyframeAnimation.cpp: Fire the new types of events. (WebCore::KeyframeAnimation::onAnimationStart): (WebCore::KeyframeAnimation::onAnimationIteration): (WebCore::KeyframeAnimation::onAnimationEnd): (WebCore::KeyframeAnimation::sendAnimationEvent): LayoutTests: Add a test for unprefixed animation event names, as well as a test that ensures we don't get multiple dispatches if we're still listening for the old events. And for the older tests, just add the new things from the window namespace. * animations/unprefixed-events-expected.txt: Added. * animations/unprefixed-events-mixed-with-prefixed-expected.txt: Added. * animations/unprefixed-events-mixed-with-prefixed.html: Added. * animations/unprefixed-events.html: Added. * fast/events/event-creation-expected.txt: * fast/events/event-creation.html: * js/dom/constructor-length.html: * js/dom/global-constructors-attributes-expected.txt: * platform/efl/js/dom/constructor-length-expected.txt: * platform/efl/js/dom/global-constructors-attributes-expected.txt: * platform/gtk/js/dom/constructor-length-expected.txt: * platform/gtk/js/dom/global-constructors-attributes-expected.txt: * platform/mac-mavericks/js/dom/global-constructors-attributes-expected.txt: * platform/mac-mountainlion/js/dom/global-constructors-attributes-expected.txt: * platform/mac/js/dom/constructor-length-expected.txt: * platform/mac/js/dom/global-constructors-attributes-expected.txt: * platform/win/js/dom/global-constructors-attributes-expected.txt: Canonical link: https://commits.webkit.org/156809@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@176423 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-11-20 23:26:29 +00:00
<!DOCTYPE html>
<html>
<head>
<title>Test mixing prefixed and unprefixed events</title>
<style>
#box {
position: absolute;
left: 0;
top: 200px;
height: 100px;
width: 100px;
background-color: blue;
animation-duration: 200ms;
Support unprefixed animation event types https://bugs.webkit.org/show_bug.cgi?id=138931 <rdar://problem/18943167> Reviewed by Simon Fraser. Source/WebCore: Tests: animations/unprefixed-events-mixed-with-prefixed.html animations/unprefixed-events.html Support the unprefixed animation event names: - animationstart (was webkitAnimationStart) - animationiteration (was webkitAnimationIteration) - animationend (was webkitAnimationEnd) (Yes, event types are case sensitive and yes, this will likely cause some head-scratching as people change content) The approach here is to follow what transitions does: - listener only for old event name -> fire old event name - listener for both old and new event name -> fire new event name - listener only for new event name -> fire new event name That way pages that were trying to anticipate the new event name won't get duplicate events. * CMakeLists.txt: Add new AnimationEvent* stuff. * DerivedSources.make: Ditto. * WebCore.vcxproj/WebCore.vcxproj: Ditto. * WebCore.vcxproj/WebCore.vcxproj.filters: Ditto. * WebCore.xcodeproj/project.pbxproj: Ditto. * bindings/js/JSBindingsAllInOne.cpp: New files for all in one builds. * dom/DOMAllInOne.cpp: * dom/AnimationEvent.cpp: Added. Copied from WebKitAnimationEvent.cpp. (WebCore::AnimationEventInit::AnimationEventInit): (WebCore::AnimationEvent::AnimationEvent): (WebCore::AnimationEvent::~AnimationEvent): (WebCore::AnimationEvent::animationName): (WebCore::AnimationEvent::elapsedTime): (WebCore::AnimationEvent::eventInterface): * dom/AnimationEvent.h: Added. Copied from WebKitAnimationEvent.h. * dom/AnimationEvent.idl: Added. Copied from WebKitAnimationEvent.idl. * dom/Document.cpp: (WebCore::Document::addListenerTypeIfNeeded): Handle new event types. * dom/EventNames.h: New names. * dom/EventNames.in: * dom/EventTarget.cpp: (WebCore::legacyType): Provide a mapping from the new names to the older prefixed forms. * html/HTMLAttributeNames.in: Support the on* attributes, even though I hate them and wish this approach would die. * html/HTMLElement.cpp: (WebCore::HTMLElement::populateEventNameForAttributeLocalNameMap): * page/DOMWindow.h: New names, and constructors. * page/DOMWindow.idl: * page/animation/AnimationController.cpp: (WebCore::AnimationControllerPrivate::fireEventsAndUpdateStyle): Fire new type. * page/animation/KeyframeAnimation.cpp: Fire the new types of events. (WebCore::KeyframeAnimation::onAnimationStart): (WebCore::KeyframeAnimation::onAnimationIteration): (WebCore::KeyframeAnimation::onAnimationEnd): (WebCore::KeyframeAnimation::sendAnimationEvent): LayoutTests: Add a test for unprefixed animation event names, as well as a test that ensures we don't get multiple dispatches if we're still listening for the old events. And for the older tests, just add the new things from the window namespace. * animations/unprefixed-events-expected.txt: Added. * animations/unprefixed-events-mixed-with-prefixed-expected.txt: Added. * animations/unprefixed-events-mixed-with-prefixed.html: Added. * animations/unprefixed-events.html: Added. * fast/events/event-creation-expected.txt: * fast/events/event-creation.html: * js/dom/constructor-length.html: * js/dom/global-constructors-attributes-expected.txt: * platform/efl/js/dom/constructor-length-expected.txt: * platform/efl/js/dom/global-constructors-attributes-expected.txt: * platform/gtk/js/dom/constructor-length-expected.txt: * platform/gtk/js/dom/global-constructors-attributes-expected.txt: * platform/mac-mavericks/js/dom/global-constructors-attributes-expected.txt: * platform/mac-mountainlion/js/dom/global-constructors-attributes-expected.txt: * platform/mac/js/dom/constructor-length-expected.txt: * platform/mac/js/dom/global-constructors-attributes-expected.txt: * platform/win/js/dom/global-constructors-attributes-expected.txt: Canonical link: https://commits.webkit.org/156809@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@176423 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-11-20 23:26:29 +00:00
animation-iteration-count: 2;
}
@keyframes move {
from { left: 0px; }
to { left: 100px; }
}
</style>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
var results;
function dump(msg) {
results.innerHTML += msg + "<br/>";
}
function handleEvent(event) {
dump(event.type + ": " + event.animationName);
if (event.type == "animationend" && window.testRunner)
testRunner.notifyDone();
}
function handlePrefixedEvent(event) {
dump("FAIL -- " + event.type + ": " + event.animationName);
}
function init() {
results = document.getElementById("results");
var box = document.getElementById("box");
box.addEventListener("animationstart", handleEvent, false);
box.addEventListener("animationiteration", handleEvent, false);
box.addEventListener("animationend", handleEvent, false);
box.addEventListener("webkitAnimationStart", handlePrefixedEvent, false);
box.addEventListener("webkitAnimationIteration", handlePrefixedEvent, false);
box.addEventListener("webkitAnimationEnd", handlePrefixedEvent, false);
box.style.animationName = "move";
}
window.addEventListener("load", init, false);
</script>
</head>
<body>
This test performs two iterations of an animation. The animation should fire all three events (start, iteration, end).
<div id="box">
</div>
<div id="results">
</div>
</body>
</html>