Changeset 30319 in webkit


Ignore:
Timestamp:
Feb 15, 2008 1:08:05 PM (16 years ago)
Author:
mitz@apple.com
Message:

Reviewed by Dave Hyatt.

  • manual-tests/transitions.html: Added.
  • page/AnimationController.cpp: (WebCore::CompositeImplicitAnimation::animate): Changed to use the transition properties of the current style rather than the target style. (WebCore::AnimationControllerPrivate::get): Changed to not create an animation if the style does not have transitions. (WebCore::AnimationController::updateImplicitAnimations): Added code to return the target style if the current style is not animating.
  • rendering/RenderObject.cpp: (WebCore::RenderObject::setAnimatableStyle): Changed to call updateImplicitAnimations() even if the current style does not have transitions, because we may be animating out of a style that had them.
Location:
trunk/WebCore
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r30306 r30319  
     12008-02-15  Dan Bernstein  <mitz@apple.com>
     2
     3        Reviewed by Dave Hyatt.
     4
     5        - fix http://bugs.webkit.org/show_bug.cgi?id=17306
     6          <rdar://problem/5737923> Transitions between styles that have different transition-* properties behave inconsistently
     7
     8        * manual-tests/transitions.html: Added.
     9        * page/AnimationController.cpp:
     10        (WebCore::CompositeImplicitAnimation::animate): Changed to use the
     11        transition properties of the current style rather than the target style.
     12        (WebCore::AnimationControllerPrivate::get): Changed to not create an
     13        animation if the style does not have transitions.
     14        (WebCore::AnimationController::updateImplicitAnimations): Added code to
     15        return the target style if the current style is not animating.
     16        * rendering/RenderObject.cpp:
     17        (WebCore::RenderObject::setAnimatableStyle): Changed to call
     18        updateImplicitAnimations() even if the current style does not have
     19        transitions, because we may be animating out of a style that had them.
     20
    1212008-02-15  Alexey Proskuryakov  <ap@webkit.org>
    222
  • trunk/WebCore/page/AnimationController.cpp

    r30039 r30319  
    428428RenderStyle* CompositeImplicitAnimation::animate(RenderObject* renderer, RenderStyle* currentStyle, RenderStyle* targetStyle)
    429429{
     430    const Transition* currentTransitions = currentStyle->transitions();
     431    const Transition* targetTransitions = targetStyle->transitions();
     432    if (currentTransitions != targetTransitions && !(currentTransitions && targetTransitions && *currentTransitions == *targetTransitions)) {
     433        reset(renderer);
     434        deleteAllValues(m_animations);
     435        m_animations.clear();
     436    }
     437
    430438    // Get the animation layers from the target style.
    431439    // For each one, we need to create a new animation unless one exists already (later occurrences of duplicate
    432440    // triggers in the layer list get ignored).
    433441    if (m_animations.isEmpty()) {
    434         for (const Transition* transition = targetStyle->transitions(); transition; transition = transition->next()) {
     442        for (const Transition* transition = currentTransitions; transition; transition = transition->next()) {
    435443            int property = transition->transitionProperty();
    436444            int duration = transition->transitionDuration();
     
    449457    for (HashMap<int, ImplicitAnimation*>::iterator it = m_animations.begin(); it != end; ++it)
    450458        it->second->animate(this, renderer, currentStyle, targetStyle, result);
    451    
     459
    452460    if (result)
    453461        return result;
     
    505513{
    506514    CompositeImplicitAnimation* animation = m_animations.get(renderer);
    507     if (!animation) {
     515    if (!animation && renderer->style()->transitions()) {
    508516        animation = new CompositeImplicitAnimation();
    509517        m_animations.set(renderer, animation);
     
    585593    // a new style.
    586594    ASSERT(renderer->element()); // FIXME: We do not animate generated content yet.
    587    
     595
    588596    CompositeImplicitAnimation* animation = m_data->get(renderer);
     597    if (!animation)
     598        return newStyle;
     599
    589600    RenderStyle* result = animation->animate(renderer, renderer->style(), newStyle);
    590601    m_data->updateTimer();
  • trunk/WebCore/rendering/RenderObject.cpp

    r30243 r30319  
    21472147void RenderObject::setAnimatableStyle(RenderStyle* style)
    21482148{
    2149     if (!isText() && m_style && style) {
    2150         if (!m_style->transitions())
    2151             animationController()->cancelImplicitAnimations(this);
    2152         else
    2153             style = animationController()->updateImplicitAnimations(this, style);
    2154     }
     2149    if (!isText() && m_style && style)
     2150        style = animationController()->updateImplicitAnimations(this, style);
     2151
    21552152    setStyle(style);
    21562153}
Note: See TracChangeset for help on using the changeset viewer.