Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2179)

Unified Diff: Source/core/svg/animation/SVGSMILElement.cpp

Issue 206013003: Cache all the results in SVGSMILElement::repeatCount() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/svg/animation/SVGSMILElement.cpp
diff --git a/Source/core/svg/animation/SVGSMILElement.cpp b/Source/core/svg/animation/SVGSMILElement.cpp
index 1142df3d684c3433ba5e37b6294c1681ec998fab..11286db7836e00eea565e6789d61beba01645b29 100644
--- a/Source/core/svg/animation/SVGSMILElement.cpp
+++ b/Source/core/svg/animation/SVGSMILElement.cpp
@@ -745,16 +745,21 @@ SMILTime SVGSMILElement::repeatCount() const
{
if (m_cachedRepeatCount != invalidCachedTime)
return m_cachedRepeatCount;
+ SMILTime computedRepeatCount = SMILTime::unresolved();
const AtomicString& value = fastGetAttribute(SVGNames::repeatCountAttr);
- if (value.isNull())
- return SMILTime::unresolved();
-
- DEFINE_STATIC_LOCAL(const AtomicString, indefiniteValue, ("indefinite", AtomicString::ConstructFromLiteral));
- if (value == indefiniteValue)
- return SMILTime::indefinite();
- bool ok;
- double result = value.string().toDouble(&ok);
- return m_cachedRepeatCount = ok && result > 0 ? result : SMILTime::unresolved();
+ if (!value.isNull()) {
+ DEFINE_STATIC_LOCAL(const AtomicString, indefiniteValue, ("indefinite", AtomicString::ConstructFromLiteral));
+ if (value == indefiniteValue) {
+ computedRepeatCount = SMILTime::indefinite();
+ } else {
+ bool ok;
+ double result = value.string().toDouble(&ok);
+ if (ok && result > 0)
+ computedRepeatCount = result;
+ }
+ }
+ m_cachedRepeatCount = computedRepeatCount;
+ return m_cachedRepeatCount;
}
SMILTime SVGSMILElement::maxValue() const
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698