Title: [91002] trunk/Source/WebCore
- Revision
- 91002
- Author
- [email protected]
- Date
- 2011-07-14 09:20:01 -0700 (Thu, 14 Jul 2011)
Log Message
Patch by Young Han Lee <[email protected]> on 2011-07-14
Reviewed by Dirk Schulze.
REGRESSION (r89774): svg/W3C-SVG-1.1/animate-elem-82-t.svg hits assertion failure.
https://bugs.webkit.org/show_bug.cgi?id=63911
Some functions assumed calculateKeyTimesIndex() does not return the last index of
the keyTimes, but it would be right behavior for calculateKeyTimesIndex() when it
accepts 1 as the percent argument.
To avoid the assumption, and for more efficiency, this patch allows the functions
using calculateKeyTimesIndex() to return early when it accepts 1 as the percent argument.
These functions have always returned the last element of the corresponding vector
in that situation.
* svg/SVGAnimationElement.cpp:
(WebCore::SVGAnimationElement::calculatePercentFromKeyPoints):
(WebCore::SVGAnimationElement::currentValuesForValuesAnimation):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (91001 => 91002)
--- trunk/Source/WebCore/ChangeLog 2011-07-14 16:00:43 UTC (rev 91001)
+++ trunk/Source/WebCore/ChangeLog 2011-07-14 16:20:01 UTC (rev 91002)
@@ -1,3 +1,23 @@
+2011-07-14 Young Han Lee <[email protected]>
+
+ Reviewed by Dirk Schulze.
+
+ REGRESSION (r89774): svg/W3C-SVG-1.1/animate-elem-82-t.svg hits assertion failure.
+ https://bugs.webkit.org/show_bug.cgi?id=63911
+
+ Some functions assumed calculateKeyTimesIndex() does not return the last index of
+ the keyTimes, but it would be right behavior for calculateKeyTimesIndex() when it
+ accepts 1 as the percent argument.
+
+ To avoid the assumption, and for more efficiency, this patch allows the functions
+ using calculateKeyTimesIndex() to return early when it accepts 1 as the percent argument.
+ These functions have always returned the last element of the corresponding vector
+ in that situation.
+
+ * svg/SVGAnimationElement.cpp:
+ (WebCore::SVGAnimationElement::calculatePercentFromKeyPoints):
+ (WebCore::SVGAnimationElement::currentValuesForValuesAnimation):
+
2011-07-14 Andrey Kosyakov <[email protected]>
Web Inspector: remove more dead code
Modified: trunk/Source/WebCore/svg/SVGAnimationElement.cpp (91001 => 91002)
--- trunk/Source/WebCore/svg/SVGAnimationElement.cpp 2011-07-14 16:00:43 UTC (rev 91001)
+++ trunk/Source/WebCore/svg/SVGAnimationElement.cpp 2011-07-14 16:20:01 UTC (rev 91002)
@@ -438,6 +438,9 @@
ASSERT(m_keyTimes.size() > 1);
ASSERT(m_keyPoints.size() == m_keyTimes.size());
+ if (percent == 1)
+ return m_keyPoints[m_keyPoints.size() - 1];
+
unsigned index = calculateKeyTimesIndex(percent);
float fromPercent = m_keyTimes[index];
float toPercent = m_keyTimes[index + 1];
@@ -445,9 +448,9 @@
float toKeyPoint = m_keyPoints[index + 1];
if (calcMode() == CalcModeDiscrete)
- return percent == 1 ? toKeyPoint : fromKeyPoint;
+ return fromKeyPoint;
- float keyPointPercent = percent == 1 ? 1 : (percent - fromPercent) / (toPercent - fromPercent);
+ float keyPointPercent = (percent - fromPercent) / (toPercent - fromPercent);
if (calcMode() == CalcModeSpline) {
ASSERT(m_keySplines.size() == m_keyPoints.size() - 1);
@@ -473,6 +476,13 @@
ASSERT(m_animationValid);
ASSERT(valuesCount > 1);
+ if (percent == 1) {
+ from = m_values[valuesCount - 1];
+ to = m_values[valuesCount - 1];
+ effectivePercent = 1;
+ return;
+ }
+
CalcMode calcMode = this->calcMode();
if (hasTagName(SVGNames::animateTag) || hasTagName(SVGNames::animateColorTag)) {
const SVGAnimateElement* animateElement = static_cast<const SVGAnimateElement*>(this);
@@ -494,7 +504,7 @@
unsigned index = calculateKeyTimesIndex(percent);
if (calcMode == CalcModeDiscrete) {
if (!keyTimesCount)
- index = percent == 1 ? valuesCount - 1 : static_cast<unsigned>(percent * valuesCount);
+ index = static_cast<unsigned>(percent * valuesCount);
from = m_values[index];
to = m_values[index];
effectivePercent = 0;
@@ -517,7 +527,7 @@
from = m_values[index];
to = m_values[index + 1];
ASSERT(toPercent > fromPercent);
- effectivePercent = percent == 1 ? 1 : (percent - fromPercent) / (toPercent - fromPercent);
+ effectivePercent = (percent - fromPercent) / (toPercent - fromPercent);
if (calcMode == CalcModeSpline) {
ASSERT(m_keySplines.size() == m_values.size() - 1);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes