Changeset 91002 in webkit
- Timestamp:
- Jul 14, 2011 9:20:01 AM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r90996 r91002 1 2011-07-14 Young Han Lee <joybro@company100.net> 2 3 Reviewed by Dirk Schulze. 4 5 REGRESSION (r89774): svg/W3C-SVG-1.1/animate-elem-82-t.svg hits assertion failure. 6 https://bugs.webkit.org/show_bug.cgi?id=63911 7 8 Some functions assumed calculateKeyTimesIndex() does not return the last index of 9 the keyTimes, but it would be right behavior for calculateKeyTimesIndex() when it 10 accepts 1 as the percent argument. 11 12 To avoid the assumption, and for more efficiency, this patch allows the functions 13 using calculateKeyTimesIndex() to return early when it accepts 1 as the percent argument. 14 These functions have always returned the last element of the corresponding vector 15 in that situation. 16 17 * svg/SVGAnimationElement.cpp: 18 (WebCore::SVGAnimationElement::calculatePercentFromKeyPoints): 19 (WebCore::SVGAnimationElement::currentValuesForValuesAnimation): 20 1 21 2011-07-14 Andrey Kosyakov <caseq@chromium.org> 2 22 -
trunk/Source/WebCore/svg/SVGAnimationElement.cpp
r90680 r91002 439 439 ASSERT(m_keyPoints.size() == m_keyTimes.size()); 440 440 441 if (percent == 1) 442 return m_keyPoints[m_keyPoints.size() - 1]; 443 441 444 unsigned index = calculateKeyTimesIndex(percent); 442 445 float fromPercent = m_keyTimes[index]; … … 446 449 447 450 if (calcMode() == CalcModeDiscrete) 448 return percent == 1 ? toKeyPoint :fromKeyPoint;449 450 float keyPointPercent = percent == 1 ? 1 :(percent - fromPercent) / (toPercent - fromPercent);451 return fromKeyPoint; 452 453 float keyPointPercent = (percent - fromPercent) / (toPercent - fromPercent); 451 454 452 455 if (calcMode() == CalcModeSpline) { … … 474 477 ASSERT(valuesCount > 1); 475 478 479 if (percent == 1) { 480 from = m_values[valuesCount - 1]; 481 to = m_values[valuesCount - 1]; 482 effectivePercent = 1; 483 return; 484 } 485 476 486 CalcMode calcMode = this->calcMode(); 477 487 if (hasTagName(SVGNames::animateTag) || hasTagName(SVGNames::animateColorTag)) { … … 495 505 if (calcMode == CalcModeDiscrete) { 496 506 if (!keyTimesCount) 497 index = percent == 1 ? valuesCount - 1 :static_cast<unsigned>(percent * valuesCount);507 index = static_cast<unsigned>(percent * valuesCount); 498 508 from = m_values[index]; 499 509 to = m_values[index]; … … 518 528 to = m_values[index + 1]; 519 529 ASSERT(toPercent > fromPercent); 520 effectivePercent = percent == 1 ? 1 :(percent - fromPercent) / (toPercent - fromPercent);530 effectivePercent = (percent - fromPercent) / (toPercent - fromPercent); 521 531 522 532 if (calcMode == CalcModeSpline) {
Note: See TracChangeset
for help on using the changeset viewer.