Commit 7f6d8085 authored by fs@opera.com's avatar fs@opera.com

Cache all the results in SVGSMILElement::repeatCount()

The null-attribute and 'indefinite' cases were not cached, which made
this method do some unnecessary work for each animation update.

BUG=354520

Review URL: https://codereview.chromium.org/206013003

git-svn-id: svn://svn.chromium.org/blink/trunk@169755 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 20027158
...@@ -745,16 +745,21 @@ SMILTime SVGSMILElement::repeatCount() const ...@@ -745,16 +745,21 @@ SMILTime SVGSMILElement::repeatCount() const
{ {
if (m_cachedRepeatCount != invalidCachedTime) if (m_cachedRepeatCount != invalidCachedTime)
return m_cachedRepeatCount; return m_cachedRepeatCount;
SMILTime computedRepeatCount = SMILTime::unresolved();
const AtomicString& value = fastGetAttribute(SVGNames::repeatCountAttr); const AtomicString& value = fastGetAttribute(SVGNames::repeatCountAttr);
if (value.isNull()) if (!value.isNull()) {
return SMILTime::unresolved();
DEFINE_STATIC_LOCAL(const AtomicString, indefiniteValue, ("indefinite", AtomicString::ConstructFromLiteral)); DEFINE_STATIC_LOCAL(const AtomicString, indefiniteValue, ("indefinite", AtomicString::ConstructFromLiteral));
if (value == indefiniteValue) if (value == indefiniteValue) {
return SMILTime::indefinite(); computedRepeatCount = SMILTime::indefinite();
} else {
bool ok; bool ok;
double result = value.string().toDouble(&ok); double result = value.string().toDouble(&ok);
return m_cachedRepeatCount = ok && result > 0 ? result : SMILTime::unresolved(); if (ok && result > 0)
computedRepeatCount = result;
}
}
m_cachedRepeatCount = computedRepeatCount;
return m_cachedRepeatCount;
} }
SMILTime SVGSMILElement::maxValue() const SMILTime SVGSMILElement::maxValue() const
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment