- Revision
- 89907
- Author
- [email protected]
- Date
- 2011-06-28 01:58:29 -0700 (Tue, 28 Jun 2011)
Log Message
2011-06-28 Felician Marton <[email protected]>
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:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (89906 => 89907)
--- trunk/Source/WebCore/ChangeLog 2011-06-28 08:53:59 UTC (rev 89906)
+++ trunk/Source/WebCore/ChangeLog 2011-06-28 08:58:29 UTC (rev 89907)
@@ -1,3 +1,43 @@
+2011-06-28 Felician Marton <[email protected]>
+
+ 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:
+
2011-06-28 Csaba Osztrogonác <[email protected]>
Reviewed by Andreas Kling.
Modified: trunk/Source/WebCore/svg/SVGAnimationElement.cpp (89906 => 89907)
--- trunk/Source/WebCore/svg/SVGAnimationElement.cpp 2011-06-28 08:53:59 UTC (rev 89906)
+++ trunk/Source/WebCore/svg/SVGAnimationElement.cpp 2011-06-28 08:58:29 UTC (rev 89907)
@@ -241,7 +241,8 @@
void SVGAnimationElement::beginElementAt(float offset)
{
- addBeginTime(elapsed() + offset);
+ SMILTime elapsed = this->elapsed();
+ addBeginTime(elapsed, elapsed + offset);
}
void SVGAnimationElement::endElement()
@@ -251,7 +252,8 @@
void SVGAnimationElement::endElementAt(float offset)
{
- addEndTime(elapsed() + offset);
+ SMILTime elapsed = this->elapsed();
+ addEndTime(elapsed, elapsed + offset);
}
AnimationMode SVGAnimationElement::animationMode() const
Modified: trunk/Source/WebCore/svg/animation/SVGSMILElement.cpp (89906 => 89907)
--- trunk/Source/WebCore/svg/animation/SVGSMILElement.cpp 2011-06-28 08:53:59 UTC (rev 89906)
+++ trunk/Source/WebCore/svg/animation/SVGSMILElement.cpp 2011-06-28 08:58:29 UTC (rev 89907)
@@ -413,9 +413,9 @@
if (inDocument()) {
if (attrName == SVGNames::beginAttr)
- beginListChanged();
+ beginListChanged(elapsed());
else if (attrName == SVGNames::endAttr)
- endListChanged();
+ endListChanged(elapsed());
}
}
@@ -602,18 +602,18 @@
return min(dur(), SMILTime::indefinite());
}
-void SVGSMILElement::addBeginTime(SMILTime time)
+void SVGSMILElement::addBeginTime(SMILTime eventTime, SMILTime beginTime)
{
- m_beginTimes.append(time);
+ m_beginTimes.append(beginTime);
sortTimeList(m_beginTimes);
- beginListChanged();
+ beginListChanged(eventTime);
}
-void SVGSMILElement::addEndTime(SMILTime time)
+void SVGSMILElement::addEndTime(SMILTime eventTime, SMILTime endTime)
{
- m_endTimes.append(time);
+ m_endTimes.append(endTime);
sortTimeList(m_endTimes);
- endListChanged();
+ endListChanged(eventTime);
}
SMILTime SVGSMILElement::findInstanceTime(BeginOrEnd beginOrEnd, SMILTime minimumTime, bool equalsMinimumOK) const
@@ -748,28 +748,27 @@
return m_nextProgressTime;
}
-void SVGSMILElement::beginListChanged()
+void SVGSMILElement::beginListChanged(SMILTime eventTime)
{
- SMILTime elapsed = this->elapsed();
if (m_isWaitingForFirstInterval)
resolveFirstInterval();
- else if (elapsed < m_intervalBegin) {
- SMILTime newBegin = findInstanceTime(Begin, elapsed, false);
- if (newBegin < m_intervalBegin) {
+ else {
+ SMILTime newBegin = findInstanceTime(Begin, eventTime, true);
+ if (newBegin.isFinite() && (m_intervalEnd <= eventTime || newBegin < m_intervalBegin)) {
// Begin time changed, re-resolve the interval.
SMILTime oldBegin = m_intervalBegin;
- m_intervalBegin = elapsed;
+ m_intervalEnd = eventTime;
resolveInterval(false, m_intervalBegin, m_intervalEnd);
ASSERT(!m_intervalBegin.isUnresolved());
if (m_intervalBegin != oldBegin)
notifyDependentsIntervalChanged(ExistingInterval);
}
}
- m_nextProgressTime = elapsed;
+ m_nextProgressTime = elapsed();
reschedule();
}
-void SVGSMILElement::endListChanged()
+void SVGSMILElement::endListChanged(SMILTime eventTime)
{
SMILTime elapsed = this->elapsed();
if (m_isWaitingForFirstInterval)
@@ -956,9 +955,9 @@
time = syncbase->m_intervalEnd + condition.m_offset;
ASSERT(time.isFinite());
if (condition.m_beginOrEnd == Begin)
- addBeginTime(time);
+ addBeginTime(elapsed(), time);
else
- addEndTime(time);
+ addEndTime(elapsed(), time);
}
}
}
@@ -977,15 +976,17 @@
void SVGSMILElement::handleConditionEvent(Event*, Condition* condition)
{
+ SMILTime elapsed = this->elapsed();
if (condition->m_beginOrEnd == Begin)
- addBeginTime(elapsed() + condition->m_offset);
+ addBeginTime(elapsed, elapsed + condition->m_offset);
else
- addEndTime(elapsed() + condition->m_offset);
+ addEndTime(elapsed, elapsed + condition->m_offset);
}
void SVGSMILElement::beginByLinkActivation()
{
- addBeginTime(elapsed());
+ SMILTime elapsed = this->elapsed();
+ addBeginTime(elapsed, elapsed);
}
}
Modified: trunk/Source/WebCore/svg/animation/SVGSMILElement.h (89906 => 89907)
--- trunk/Source/WebCore/svg/animation/SVGSMILElement.h 2011-06-28 08:53:59 UTC (rev 89906)
+++ trunk/Source/WebCore/svg/animation/SVGSMILElement.h 2011-06-28 08:58:29 UTC (rev 89907)
@@ -107,8 +107,8 @@
virtual void applyResultsToTarget() = 0;
protected:
- void addBeginTime(SMILTime);
- void addEndTime(SMILTime);
+ void addBeginTime(SMILTime eventTime, SMILTime endTime);
+ void addEndTime(SMILTime eventTime, SMILTime endTime);
void setInactive() { m_activeState = Inactive; }
@@ -129,8 +129,8 @@
SMILTime resolveActiveEnd(SMILTime resolvedBegin, SMILTime resolvedEnd) const;
SMILTime repeatingDuration() const;
void checkRestart(SMILTime elapsed);
- void beginListChanged();
- void endListChanged();
+ void beginListChanged(SMILTime eventTime);
+ void endListChanged(SMILTime eventTime);
void reschedule();
// This represents conditions on elements begin or end list that need to be resolved on runtime