Changeset 57390 in webkit


Ignore:
Timestamp:
Apr 9, 2010 6:00:18 PM (14 years ago)
Author:
cmarrin@apple.com
Message:

Reviewed by Simon Fraser.

Fixed bug where animation time was not updated when dynamically loading a style sheet
https://bugs.webkit.org/show_bug.cgi?id=37352

A dynamically loaded style sheet kicks off its own styleRecalc cycle. This was not
bracketed with a beginAnimationUpdate/endAnimationUpdate which wasn't resetting the
animation time. In some time-dependent cases this was causing a negative elapsedTime
to be sent to the keyframe animator. This is an invalid case which destroys the
animation prematurely. I not only added the brackets, but I also added an assert
and protection for when the elapsedTime comes up negative.

Test: animations/dynamic-stylesheet-loading.html

  • dom/Document.cpp: Added brackets (WebCore::Document::updateStyleSelector):
  • page/animation/KeyframeAnimation.cpp: Added assert and protection (WebCore::KeyframeAnimation::getKeyframeAnimationInterval):
Location:
trunk
Files:
4 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r57386 r57390  
     12010-04-09  Chris Marrin  <cmarrin@apple.com>
     2
     3        Reviewed by Simon Fraser.
     4
     5        Fixed bug where animation time was not updated when dynamically loading a style sheet
     6        https://bugs.webkit.org/show_bug.cgi?id=37352
     7
     8        LayoutTest showing problem.
     9
     10        * animations/dynamic-stylesheet-loading-expected.txt: Added.
     11        * animations/dynamic-stylesheet-loading.html: Added.
     12        * animations/resources/dynamic-stylesheet-insertion-inserted.css: Added.
     13        * animations/resources/dynamic-stylesheet-insertion-main.css: Added.
     14
    1152010-04-09  Abhishek Arya  <inferno@chromium.org>
    216
  • trunk/WebCore/ChangeLog

    r57387 r57390  
     12010-04-09  Chris Marrin  <cmarrin@apple.com>
     2
     3        Reviewed by Simon Fraser.
     4
     5        Fixed bug where animation time was not updated when dynamically loading a style sheet
     6        https://bugs.webkit.org/show_bug.cgi?id=37352
     7
     8        A dynamically loaded style sheet kicks off its own styleRecalc cycle. This was not
     9        bracketed with a beginAnimationUpdate/endAnimationUpdate which wasn't resetting the
     10        animation time. In some time-dependent cases this was causing a negative elapsedTime
     11        to be sent to the keyframe animator. This is an invalid case which destroys the
     12        animation prematurely. I not only added the brackets, but I also added an assert
     13        and protection for when the elapsedTime comes up negative.
     14
     15        Test: animations/dynamic-stylesheet-loading.html
     16
     17        * dom/Document.cpp: Added brackets
     18        (WebCore::Document::updateStyleSelector):
     19        * page/animation/KeyframeAnimation.cpp: Added assert and protection
     20        (WebCore::KeyframeAnimation::getKeyframeAnimationInterval):
     21
    1222010-04-09  Jaime Yap  <jaimeyap@google.com>
    223
  • trunk/WebCore/dom/Document.cpp

    r57299 r57390  
    24842484
    24852485    recalcStyleSelector();
     2486    // This recalcStyle initiates a new recalc cycle. We need to bracket it to
     2487    // make sure animations get the correct update time
     2488    if (m_frame)
     2489        m_frame->animation()->beginAnimationUpdate();
    24862490    recalcStyle(Force);
     2491    if (m_frame)
     2492        m_frame->animation()->endAnimationUpdate();
    24872493
    24882494#ifdef INSTRUMENT_LAYOUT_SCHEDULING
  • trunk/WebCore/page/animation/KeyframeAnimation.cpp

    r56543 r57390  
    6969
    7070    double t = m_animation->duration() ? (elapsedTime / m_animation->duration()) : 1;
     71
     72    ASSERT(t >= 0);
     73    if (t < 0)
     74        t = 0;
     75
    7176    int i = static_cast<int>(t);
    7277    t -= i;
Note: See TracChangeset for help on using the changeset viewer.