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

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

Issue 1708303002: Revert of Add additive animation support for CSS property background-position (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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/CSSLengthListInterpolationType.cpp
diff --git a/third_party/WebKit/Source/core/animation/CSSLengthListInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSLengthListInterpolationType.cpp
index a99f580c3ff366fe1958fa1b11c4990cf4b728f0..f70a66c1f08e7d63de69de62c239cdbc480bac24 100644
--- a/third_party/WebKit/Source/core/animation/CSSLengthListInterpolationType.cpp
+++ b/third_party/WebKit/Source/core/animation/CSSLengthListInterpolationType.cpp
@@ -33,43 +33,48 @@
});
}
-static InterpolationValue maybeConvertLengthList(const Vector<Length>& lengthList, float zoom)
-{
- if (lengthList.isEmpty())
- return nullptr;
-
- return ListInterpolationFunctions::createList(lengthList.size(), [&lengthList, zoom](size_t index) {
- return CSSLengthInterpolationType::maybeConvertLength(lengthList[index], zoom);
- });
-}
-
InterpolationValue CSSLengthListInterpolationType::maybeConvertInitial() const
{
return maybeConvertLengthList(LengthListPropertyFunctions::getInitialLengthList(cssProperty()), 1);
+}
+
+InterpolationValue CSSLengthListInterpolationType::maybeConvertLengthList(const RefVector<Length>* lengthList, float zoom) const
+{
+ if (!lengthList || lengthList->size() == 0)
+ return nullptr;
+
+ return ListInterpolationFunctions::createList(lengthList->size(), [lengthList, zoom](size_t index) {
+ return CSSLengthInterpolationType::maybeConvertLength(lengthList->at(index), zoom);
+ });
}
class ParentLengthListChecker : public InterpolationType::ConversionChecker {
public:
~ParentLengthListChecker() final {}
- static PassOwnPtr<ParentLengthListChecker> create(CSSPropertyID property, const Vector<Length>& inheritedLengthList)
+ static PassOwnPtr<ParentLengthListChecker> create(CSSPropertyID property, PassRefPtr<RefVector<Length>> inheritedLengthList)
{
return adoptPtr(new ParentLengthListChecker(property, inheritedLengthList));
}
private:
- ParentLengthListChecker(CSSPropertyID property, const Vector<Length>& inheritedLengthList)
+ ParentLengthListChecker(CSSPropertyID property, PassRefPtr<RefVector<Length>> inheritedLengthList)
: m_property(property)
, m_inheritedLengthList(inheritedLengthList)
{ }
bool isValid(const InterpolationEnvironment& environment, const InterpolationValue& underlying) const final
{
- return m_inheritedLengthList == LengthListPropertyFunctions::getLengthList(m_property, *environment.state().parentStyle());
+ const RefVector<Length>* lengthList = LengthListPropertyFunctions::getLengthList(m_property, *environment.state().parentStyle());
+ if (!lengthList && !m_inheritedLengthList)
+ return true;
+ if (!lengthList || !m_inheritedLengthList)
+ return false;
+ return *m_inheritedLengthList == *lengthList;
}
CSSPropertyID m_property;
- Vector<Length> m_inheritedLengthList;
+ RefPtr<RefVector<Length>> m_inheritedLengthList;
};
InterpolationValue CSSLengthListInterpolationType::maybeConvertInherit(const StyleResolverState& state, ConversionCheckers& conversionCheckers) const
@@ -77,8 +82,9 @@
if (!state.parentStyle())
return nullptr;
- Vector<Length> inheritedLengthList = LengthListPropertyFunctions::getLengthList(cssProperty(), *state.parentStyle());
- conversionCheckers.append(ParentLengthListChecker::create(cssProperty(), inheritedLengthList));
+ const RefVector<Length>* inheritedLengthList = LengthListPropertyFunctions::getLengthList(cssProperty(), *state.parentStyle());
+ conversionCheckers.append(ParentLengthListChecker::create(cssProperty(),
+ const_cast<RefVector<Length>*>(inheritedLengthList))); // Take ref.
return maybeConvertLengthList(inheritedLengthList, state.parentStyle()->effectiveZoom());
}
@@ -100,7 +106,7 @@
InterpolationValue CSSLengthListInterpolationType::maybeConvertUnderlyingValue(const InterpolationEnvironment& environment) const
{
- Vector<Length> underlyingLengthList = LengthListPropertyFunctions::getLengthList(cssProperty(), *environment.state().style());
+ const RefVector<Length>* underlyingLengthList = LengthListPropertyFunctions::getLengthList(cssProperty(), *environment.state().style());
return maybeConvertLengthList(underlyingLengthList, environment.state().style()->effectiveZoom());
}
@@ -118,15 +124,15 @@
ASSERT(length > 0);
const NonInterpolableList& nonInterpolableList = toNonInterpolableList(*nonInterpolableValue);
ASSERT(nonInterpolableList.length() == length);
- Vector<Length> result(length);
+ RefPtr<RefVector<Length>> result = RefVector<Length>::create();
for (size_t i = 0; i < length; i++) {
- result[i] = (CSSLengthInterpolationType::resolveInterpolableLength(
+ result->append(CSSLengthInterpolationType::resolveInterpolableLength(
*interpolableList.get(i),
nonInterpolableList.get(i),
environment.state().cssToLengthConversionData(),
m_valueRange));
}
- LengthListPropertyFunctions::setLengthList(cssProperty(), *environment.state().style(), std::move(result));
+ LengthListPropertyFunctions::setLengthList(cssProperty(), *environment.state().style(), result.release());
}
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698