Changeset 89907 in webkit


Ignore:
Timestamp:
Jun 28, 2011 1:58:29 AM (13 years ago)
Author:
commit-queue@webkit.org
Message:

2011-06-28 Felician Marton <marton.felician.zoltan@stud.u-szeged.hu>

Reviewed by Nikolas Zimmermann.

SVG animation flickers when restarting
https://bugs.webkit.org/show_bug.cgi?id=18450

Add new parameter to the following methods. The new parameter is the time of adding a "begin" or "end" time to the SVG animation.

  • WebCore::SVGSMILElement::addBeginTime
  • WebCore::SVGSMILElement::beginListChanged
  • WebCore::SVGSMILElement::addEndTime
  • WebCore::SVGSMILElement::endListChanged

In case of beginTime and beginListChanged it's necessary, because the delay between the event of adding a new begin time
(in WebCore::SVGAnimationElement::beginElementAt) and the actual processing (in WebCore::SVGSMILElement::endListChanged)
is significant. In lack of event time we can't decide that we should consider the new time or not.
If the new begin time is smaller than the event time, we musn't begin the animation, else we shoud do further calculations.

The following methods just modified for consistency:

  • WebCore::SVGSMILElement::addEndTime
  • WebCore::SVGSMILElement::endListChanged

No new tests, because currently there is no way to test SVG flickering at zero time.

  • svg/SVGAnimationElement.cpp: (WebCore::SVGAnimationElement::beginElementAt): (WebCore::SVGAnimationElement::endElementAt):
  • svg/animation/SVGSMILElement.cpp: (WebCore::SVGSMILElement::attributeChanged): (WebCore::SVGSMILElement::addBeginTime): (WebCore::SVGSMILElement::addEndTime): (WebCore::SVGSMILElement::beginListChanged): (WebCore::SVGSMILElement::endListChanged): The body changed:
    • Use new parameter, the time of adding the new begin time.
    • Cancel some incorrect optimalization. We should also do further calculations when elapsed >= m_intervalBegin.

(WebCore::SVGSMILElement::createInstanceTimesFromSyncbase):
(WebCore::SVGSMILElement::handleConditionEvent):
(WebCore::SVGSMILElement::beginByLinkActivation):

  • svg/animation/SVGSMILElement.h:
Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r89904 r89907  
     12011-06-28  Felician Marton  <marton.felician.zoltan@stud.u-szeged.hu>
     2
     3        Reviewed by Nikolas Zimmermann.
     4
     5        SVG animation flickers when restarting
     6        https://bugs.webkit.org/show_bug.cgi?id=18450
     7
     8        Add new parameter to the following methods. The new parameter is the time of adding a "begin" or "end" time to the SVG animation.
     9         - WebCore::SVGSMILElement::addBeginTime
     10         - WebCore::SVGSMILElement::beginListChanged
     11         - WebCore::SVGSMILElement::addEndTime
     12         - WebCore::SVGSMILElement::endListChanged
     13        In case of beginTime and beginListChanged it's necessary, because the delay between the event of adding a new begin time
     14        (in WebCore::SVGAnimationElement::beginElementAt) and the actual processing (in WebCore::SVGSMILElement::endListChanged)
     15        is significant. In lack of event time we can't decide that we should consider the new time or not.
     16        If the new begin time is smaller than the event time, we musn't begin the animation, else we shoud do further calculations.
     17
     18        The following methods just modified for consistency:
     19         - WebCore::SVGSMILElement::addEndTime
     20         - WebCore::SVGSMILElement::endListChanged
     21
     22        No new tests, because currently there is no way to test SVG flickering at zero time.
     23
     24        * svg/SVGAnimationElement.cpp:
     25        (WebCore::SVGAnimationElement::beginElementAt):
     26        (WebCore::SVGAnimationElement::endElementAt):
     27        * svg/animation/SVGSMILElement.cpp:
     28        (WebCore::SVGSMILElement::attributeChanged):
     29        (WebCore::SVGSMILElement::addBeginTime):
     30        (WebCore::SVGSMILElement::addEndTime):
     31        (WebCore::SVGSMILElement::beginListChanged):
     32        (WebCore::SVGSMILElement::endListChanged):
     33          The body changed:
     34           - Use new parameter, the time of adding the new begin time.
     35           - Cancel some incorrect optimalization. We should also do further calculations when elapsed >= m_intervalBegin.
     36        (WebCore::SVGSMILElement::createInstanceTimesFromSyncbase):
     37        (WebCore::SVGSMILElement::handleConditionEvent):
     38        (WebCore::SVGSMILElement::beginByLinkActivation):
     39        * svg/animation/SVGSMILElement.h:
     40
    1412011-06-28  Csaba Osztrogonác  <ossy@webkit.org>
    242
  • trunk/Source/WebCore/svg/SVGAnimationElement.cpp

    r89774 r89907  
    242242void SVGAnimationElement::beginElementAt(float offset)
    243243{
    244     addBeginTime(elapsed() + offset);
     244    SMILTime elapsed = this->elapsed();
     245    addBeginTime(elapsed, elapsed + offset);
    245246}
    246247
     
    252253void SVGAnimationElement::endElementAt(float offset)
    253254{
    254     addEndTime(elapsed() + offset);
     255    SMILTime elapsed = this->elapsed();
     256    addEndTime(elapsed, elapsed + offset);
    255257}
    256258
  • trunk/Source/WebCore/svg/animation/SVGSMILElement.cpp

    r88989 r89907  
    414414    if (inDocument()) {
    415415        if (attrName == SVGNames::beginAttr)
    416             beginListChanged();
     416            beginListChanged(elapsed());
    417417        else if (attrName == SVGNames::endAttr)
    418             endListChanged();
     418            endListChanged(elapsed());
    419419    }
    420420}
     
    603603}
    604604   
    605 void SVGSMILElement::addBeginTime(SMILTime time)
    606 {
    607     m_beginTimes.append(time);
     605void SVGSMILElement::addBeginTime(SMILTime eventTime, SMILTime beginTime)
     606{
     607    m_beginTimes.append(beginTime);
    608608    sortTimeList(m_beginTimes);
    609     beginListChanged();
    610 }
    611    
    612 void SVGSMILElement::addEndTime(SMILTime time)
    613 {
    614     m_endTimes.append(time);
     609    beginListChanged(eventTime);
     610}
     611   
     612void SVGSMILElement::addEndTime(SMILTime eventTime, SMILTime endTime)
     613{
     614    m_endTimes.append(endTime);
    615615    sortTimeList(m_endTimes);
    616     endListChanged();
     616    endListChanged(eventTime);
    617617}
    618618   
     
    749749}
    750750   
    751 void SVGSMILElement::beginListChanged()
    752 {
    753     SMILTime elapsed = this->elapsed();
     751void SVGSMILElement::beginListChanged(SMILTime eventTime)
     752{
    754753    if (m_isWaitingForFirstInterval)
    755754        resolveFirstInterval();
    756     else if (elapsed < m_intervalBegin) {
    757         SMILTime newBegin = findInstanceTime(Begin, elapsed, false);
    758         if (newBegin < m_intervalBegin) {
     755    else {
     756        SMILTime newBegin = findInstanceTime(Begin, eventTime, true);
     757        if (newBegin.isFinite() && (m_intervalEnd <= eventTime || newBegin < m_intervalBegin)) {
    759758            // Begin time changed, re-resolve the interval.
    760759            SMILTime oldBegin = m_intervalBegin;
    761             m_intervalBegin = elapsed;
     760            m_intervalEnd = eventTime;
    762761            resolveInterval(false, m_intervalBegin, m_intervalEnd); 
    763762            ASSERT(!m_intervalBegin.isUnresolved());
     
    766765        }
    767766    }
    768     m_nextProgressTime = elapsed;
     767    m_nextProgressTime = elapsed();
    769768    reschedule();
    770769}
    771770
    772 void SVGSMILElement::endListChanged()
     771void SVGSMILElement::endListChanged(SMILTime eventTime)
    773772{
    774773    SMILTime elapsed = this->elapsed();
     
    957956            ASSERT(time.isFinite());
    958957            if (condition.m_beginOrEnd == Begin)
    959                 addBeginTime(time);
     958                addBeginTime(elapsed(), time);
    960959            else
    961                 addEndTime(time);
     960                addEndTime(elapsed(), time);
    962961        }
    963962    }
     
    978977void SVGSMILElement::handleConditionEvent(Event*, Condition* condition)
    979978{
     979    SMILTime elapsed = this->elapsed();
    980980    if (condition->m_beginOrEnd == Begin)
    981         addBeginTime(elapsed() + condition->m_offset);
     981        addBeginTime(elapsed, elapsed + condition->m_offset);
    982982    else
    983         addEndTime(elapsed() + condition->m_offset);
     983        addEndTime(elapsed, elapsed + condition->m_offset);
    984984}
    985985
    986986void SVGSMILElement::beginByLinkActivation()
    987987{
    988     addBeginTime(elapsed());
     988    SMILTime elapsed = this->elapsed();
     989    addBeginTime(elapsed, elapsed);
    989990}
    990991   
  • trunk/Source/WebCore/svg/animation/SVGSMILElement.h

    r88039 r89907  
    108108
    109109protected:
    110     void addBeginTime(SMILTime);
    111     void addEndTime(SMILTime);
     110    void addBeginTime(SMILTime eventTime, SMILTime endTime);
     111    void addEndTime(SMILTime eventTime, SMILTime endTime);
    112112
    113113    void setInactive() { m_activeState = Inactive; }
     
    130130    SMILTime repeatingDuration() const;
    131131    void checkRestart(SMILTime elapsed);
    132     void beginListChanged();
    133     void endListChanged();
     132    void beginListChanged(SMILTime eventTime);
     133    void endListChanged(SMILTime eventTime);
    134134    void reschedule();
    135135
Note: See TracChangeset for help on using the changeset viewer.