Unprefixed transitionend event doesn't seem to be implemented, which breaks many...
authoralexis@webkit.org <alexis@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 15 Jan 2013 19:17:42 +0000 (19:17 +0000)
committeralexis@webkit.org <alexis@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 15 Jan 2013 19:17:42 +0000 (19:17 +0000)
commit735c72bcea5a1774147d09b87c3ae6e416c9ef16
tree531e28aba27b1a05373774fd7d8740a5c2d2cd59
parent4ddddcc514325fad8e7ca3ea6a925a7392962674
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.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@139762 268f45cc-cd09-0410-ab3c-d52691b4dbfc
12 files changed:
LayoutTests/ChangeLog
LayoutTests/transitions/transition-end-event-helpers.js
LayoutTests/transitions/transition-end-event-unprefixed-01-expected.txt [new file with mode: 0644]
LayoutTests/transitions/transition-end-event-unprefixed-01.html [new file with mode: 0644]
LayoutTests/transitions/transition-end-event-unprefixed-02-expected.txt [new file with mode: 0644]
LayoutTests/transitions/transition-end-event-unprefixed-02.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/EventNames.h
Source/WebCore/dom/EventTarget.cpp
Source/WebCore/page/animation/AnimationController.cpp
Source/WebCore/page/animation/ImplicitAnimation.cpp