haikuwebkit/LayoutTests/transitions/transition-end-event-unpref...

47 lines
1.0 KiB
HTML
Raw Permalink Normal View History

Unprefixed transitionend event doesn't seem to be implemented, which breaks many sites https://bugs.webkit.org/show_bug.cgi?id=105647 Reviewed by Julien Chaffraix. Source/WebCore: Add support for transitionend event delivery as part as the unprefixing work on CSS Transitions. This patch adds some code in EventTarget to figure out if the current event to dispatch has a prefixed version or not. Then from the list of listeners we deduce which event should be delivered (prefixed or unprefixed). In the case of the CSS Transitions, WebKit will now behave as follow : if an event listener is attached to the prefixed version of the transition end event then only the prefixed event will be send. If an event listener is attached to the unprefixed version of the transition end event then only the unprefixed event will be send. If there are event listeners on both unprefixed and prefixed events then only the unprefixed event will be send. The behavior was discussed here : http://lists.webkit.org/pipermail/webkit-dev/2013-January/023301.html. Tests: transitions/transition-end-event-unprefixed-01.html transitions/transition-end-event-unprefixed-02.html * dom/Document.cpp: (WebCore::Document::addListenerTypeIfNeeded): Register the prefixed listener too as transitionend listeners so that we properly dispatch events for them. * dom/EventNames.h: (WebCore): Add the new transitionend name. * dom/EventTarget.cpp: (WebCore::createMatchingPrefixedEvent): (WebCore::prefixedType): (WebCore::EventTarget::fireEventListeners): Find out if somebody is listening for unprefixed events, if so we always send the unprefixed event, if not then we create a prefixed event and send it. * page/animation/AnimationController.cpp: (WebCore::AnimationControllerPrivate::fireEventsAndUpdateStyle): * page/animation/ImplicitAnimation.cpp: (WebCore::ImplicitAnimation::sendTransitionEvent): Always create by default unprefixed events. LayoutTests: Cover that event delivery is correct : we received unprefixed events. * transitions/transition-end-event-helpers.js: (recordTransitionEndEvent): * transitions/transition-end-event-unprefixed-01-expected.txt: Added. * transitions/transition-end-event-unprefixed-01.html: Added. * transitions/transition-end-event-unprefixed-02-expected.txt: Added. * transitions/transition-end-event-unprefixed-02.html: Added. Canonical link: https://commits.webkit.org/125145@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@139762 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-01-15 19:17:42 +00:00
<!DOCTYPE html>
<html>
<head>
<style>
.box {
position: relative;
left: 0;
height: 100px;
width: 100px;
margin: 10px;
background-color: blue;
transition-property: left;
transition-duration: 0.5s;
-webkit-transition-property: left;
-webkit-transition-duration: 0.5s;
}
</style>
<script src="transition-end-event-helpers.js"></script>
<script type="text/javascript">
var expectedEndEvents = [
// [property-name, element-id, elapsed-time, listen]
["left", "box1", 0.5, false]
];
function setupTest()
{
var box = document.getElementById('box1');
document.addEventListener('transitionend', recordTransitionEndEvent, false);
box.style.left = '200px';
}
runTransitionTest(expectedEndEvents, setupTest);
</script>
</head>
<body>
<p>Initiating a transition and catching the transition unprefixed event.</p>
<div id="container">
<div id="box1" class="box"></div>
</div>
<div id="result"></div>
</body>
</html>