Skip to content
  • alexis@webkit.org's avatar
    Unprefixed transitionend event doesn't seem to be implemented, which breaks many sites · 278e78c7
    alexis@webkit.org authored
    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: http://svn.webkit.org/repository/webkit/trunk@139762 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    278e78c7