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

Unified Diff: third_party/WebKit/Source/core/animation/StringKeyframe.cpp

Issue 1701813002: Make Keyframe::PropertySpecificKeyframes RefCounted (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: InvalidatableInterpolation RefPtrs Created 4 years, 10 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
Index: third_party/WebKit/Source/core/animation/StringKeyframe.cpp
diff --git a/third_party/WebKit/Source/core/animation/StringKeyframe.cpp b/third_party/WebKit/Source/core/animation/StringKeyframe.cpp
index 15628a5a428bae15546a6daaea1702f623c7c26b..fede64bc40798a7910c658a4798accee376826dd 100644
--- a/third_party/WebKit/Source/core/animation/StringKeyframe.cpp
+++ b/third_party/WebKit/Source/core/animation/StringKeyframe.cpp
@@ -87,28 +87,16 @@ PassRefPtr<Keyframe> StringKeyframe::clone() const
return adoptRef(new StringKeyframe(*this));
}
-PassOwnPtr<Keyframe::PropertySpecificKeyframe> StringKeyframe::createPropertySpecificKeyframe(PropertyHandle property) const
+PassRefPtr<Keyframe::PropertySpecificKeyframe> StringKeyframe::createPropertySpecificKeyframe(PropertyHandle property) const
{
if (property.isCSSProperty())
- return adoptPtr(new CSSPropertySpecificKeyframe(offset(), &easing(), cssPropertyValue(property.cssProperty()), composite()));
+ return CSSPropertySpecificKeyframe::create(offset(), &easing(), cssPropertyValue(property.cssProperty()), composite());
if (property.isPresentationAttribute())
- return adoptPtr(new CSSPropertySpecificKeyframe(offset(), &easing(), presentationAttributeValue(property.presentationAttribute()), composite()));
+ return CSSPropertySpecificKeyframe::create(offset(), &easing(), presentationAttributeValue(property.presentationAttribute()), composite());
ASSERT(property.isSVGAttribute());
- return adoptPtr(new SVGPropertySpecificKeyframe(offset(), &easing(), svgPropertyValue(property.svgAttribute()), composite()));
-}
-
-StringKeyframe::CSSPropertySpecificKeyframe::CSSPropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easing, CSSValue* value, EffectModel::CompositeOperation op)
- : Keyframe::PropertySpecificKeyframe(offset, easing, op)
- , m_value(value)
-{ }
-
-StringKeyframe::CSSPropertySpecificKeyframe::CSSPropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easing, CSSValue* value)
- : Keyframe::PropertySpecificKeyframe(offset, easing, EffectModel::CompositeReplace)
- , m_value(value)
-{
- ASSERT(!isNull(m_offset));
+ return SVGPropertySpecificKeyframe::create(offset(), &easing(), svgPropertyValue(property.svgAttribute()), composite());
}
bool StringKeyframe::CSSPropertySpecificKeyframe::populateAnimatableValue(CSSPropertyID property, Element& element, const ComputedStyle* baseStyle, bool force) const
@@ -143,7 +131,7 @@ PassRefPtr<Interpolation> StringKeyframe::CSSPropertySpecificKeyframe::maybeCrea
{
const InterpolationTypes* applicableTypes = PropertyInterpolationTypesMapping::get(propertyHandle);
if (applicableTypes)
- return InvalidatableInterpolation::create(propertyHandle, *applicableTypes, *this, end);
+ return InvalidatableInterpolation::create(propertyHandle, *applicableTypes, const_cast<CSSPropertySpecificKeyframe*>(this), &end);
// TODO(alancutter): Remove the remainder of this function.
@@ -284,46 +272,33 @@ PassRefPtr<Interpolation> StringKeyframe::CSSPropertySpecificKeyframe::maybeCrea
}
-PassOwnPtr<Keyframe::PropertySpecificKeyframe> StringKeyframe::CSSPropertySpecificKeyframe::neutralKeyframe(double offset, PassRefPtr<TimingFunction> easing) const
-{
- return adoptPtr(new CSSPropertySpecificKeyframe(offset, easing, static_cast<CSSValue*>(0), EffectModel::CompositeAdd));
-}
-
-PassOwnPtr<Keyframe::PropertySpecificKeyframe> StringKeyframe::CSSPropertySpecificKeyframe::cloneWithOffset(double offset) const
-{
- Keyframe::PropertySpecificKeyframe* theClone = new CSSPropertySpecificKeyframe(offset, m_easing, m_value.get());
- toCSSPropertySpecificKeyframe(theClone)->m_animatableValueCache = m_animatableValueCache;
- return adoptPtr(theClone);
-}
-
-SVGPropertySpecificKeyframe::SVGPropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easing, const String& value, EffectModel::CompositeOperation op)
- : Keyframe::PropertySpecificKeyframe(offset, easing, op)
- , m_value(value)
+PassRefPtr<Keyframe::PropertySpecificKeyframe> StringKeyframe::CSSPropertySpecificKeyframe::neutralKeyframe(double offset, PassRefPtr<TimingFunction> easing) const
{
+ return create(offset, easing, nullptr, EffectModel::CompositeAdd);
}
-SVGPropertySpecificKeyframe::SVGPropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easing, const String& value)
- : Keyframe::PropertySpecificKeyframe(offset, easing, EffectModel::CompositeReplace)
- , m_value(value)
+PassRefPtr<Keyframe::PropertySpecificKeyframe> StringKeyframe::CSSPropertySpecificKeyframe::cloneWithOffset(double offset) const
{
- ASSERT(!isNull(m_offset));
+ RefPtr<CSSPropertySpecificKeyframe> clone = create(offset, m_easing, m_value.get(), m_composite);
+ clone->m_animatableValueCache = m_animatableValueCache;
+ return clone.release();
}
-PassOwnPtr<Keyframe::PropertySpecificKeyframe> SVGPropertySpecificKeyframe::cloneWithOffset(double offset) const
+PassRefPtr<Keyframe::PropertySpecificKeyframe> SVGPropertySpecificKeyframe::cloneWithOffset(double offset) const
{
- return adoptPtr(new SVGPropertySpecificKeyframe(offset, m_easing, m_value));
+ return create(offset, m_easing, m_value, m_composite);
}
-PassOwnPtr<Keyframe::PropertySpecificKeyframe> SVGPropertySpecificKeyframe::neutralKeyframe(double offset, PassRefPtr<TimingFunction> easing) const
+PassRefPtr<Keyframe::PropertySpecificKeyframe> SVGPropertySpecificKeyframe::neutralKeyframe(double offset, PassRefPtr<TimingFunction> easing) const
{
- return adoptPtr(new SVGPropertySpecificKeyframe(offset, easing, String(), EffectModel::CompositeAdd));
+ return create(offset, easing, String(), EffectModel::CompositeAdd);
}
PassRefPtr<Interpolation> SVGPropertySpecificKeyframe::maybeCreateInterpolation(PropertyHandle propertyHandle, Keyframe::PropertySpecificKeyframe& end, Element*, const ComputedStyle*) const
{
const InterpolationTypes* applicableTypes = PropertyInterpolationTypesMapping::get(propertyHandle);
ASSERT(applicableTypes);
- return InvalidatableInterpolation::create(propertyHandle, *applicableTypes, *this, end);
+ return InvalidatableInterpolation::create(propertyHandle, *applicableTypes, const_cast<SVGPropertySpecificKeyframe*>(this), &end);
}
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698