| Index: Source/core/animation/ListStyleInterpolation.h
|
| diff --git a/Source/core/animation/ListStyleInterpolation.h b/Source/core/animation/ListStyleInterpolation.h
|
| index 344d772a09f76f67c82e243f1d8363446b9957a7..280f5eeb1288a84f6b40707a9dfcf02810d7e354 100644
|
| --- a/Source/core/animation/ListStyleInterpolation.h
|
| +++ b/Source/core/animation/ListStyleInterpolation.h
|
| @@ -15,22 +15,19 @@ namespace blink {
|
| template<typename InterpolationType, typename NonInterpolableData>
|
| class ListStyleInterpolationImpl : public StyleInterpolation {
|
| public:
|
| - static PassRefPtrWillBeRawPtr<ListStyleInterpolationImpl<InterpolationType, NonInterpolableData>> maybeCreateFromList(const CSSValue& start, const CSSValue& end, CSSPropertyID id, InterpolationRange range = RangeAll)
|
| + static PassRefPtrWillBeRawPtr<ListStyleInterpolationImpl<InterpolationType, NonInterpolableData>> maybeCreateFromList(const CSSValueList& startList, const CSSValueList& endList, CSSPropertyID id, InterpolationRange range = RangeAll)
|
| {
|
| - if (start.isValueList() && end.isValueList() && toCSSValueList(start).length() == toCSSValueList(end).length()) {
|
| - const CSSValueList& startList = toCSSValueList(start);
|
| - const CSSValueList& endList = toCSSValueList(end);
|
| -
|
| - for (size_t i = 0; i < toCSSValueList(start).length(); i++) {
|
| - if (!InterpolationType::canCreateFrom(*startList.item(i), *endList.item(i))) {
|
| + if (startList.length() == endList.length()) {
|
| + for (size_t i = 0; i < startList.length(); i++) {
|
| + if (!InterpolationType::canCreateFrom(startList.item(i), endList.item(i))) {
|
| return nullptr;
|
| }
|
| }
|
|
|
| Vector<typename InterpolationType::NonInterpolableType> startNonInterpolableData;
|
|
|
| - OwnPtrWillBeRawPtr<InterpolableValue> startValue = listToInterpolableValue(start, &startNonInterpolableData);
|
| - OwnPtrWillBeRawPtr<InterpolableValue> endValue = listToInterpolableValue(end);
|
| + OwnPtrWillBeRawPtr<InterpolableValue> startValue = listToInterpolableValue(startList, &startNonInterpolableData);
|
| + OwnPtrWillBeRawPtr<InterpolableValue> endValue = listToInterpolableValue(endList);
|
|
|
| return adoptRefWillBeNoop(new ListStyleInterpolationImpl<InterpolationType, NonInterpolableData>(startValue.release(), endValue.release(), id, startNonInterpolableData, range));
|
| }
|
| @@ -39,7 +36,7 @@ public:
|
|
|
| virtual void apply(StyleResolverState& state) const override
|
| {
|
| - StyleBuilder::applyProperty(m_id, state, interpolableValueToList(m_cachedValue.get(), m_nonInterpolableData, m_range).get());
|
| + StyleBuilder::applyProperty(m_id, state, interpolableValueToList(m_cachedValue.get(), m_nonInterpolableData, m_range));
|
| }
|
|
|
| private:
|
| @@ -55,22 +52,21 @@ private:
|
|
|
| Vector<typename InterpolationType::NonInterpolableType> m_nonInterpolableData;
|
|
|
| - static PassOwnPtrWillBeRawPtr<InterpolableValue> listToInterpolableValue(const CSSValue& value, Vector<typename InterpolationType::NonInterpolableType>* nonInterpolableData = nullptr)
|
| + static PassOwnPtrWillBeRawPtr<InterpolableValue> listToInterpolableValue(const CSSValueList& listValue, Vector<typename InterpolationType::NonInterpolableType>* nonInterpolableData = nullptr)
|
| {
|
| - const CSSValueList& listValue = toCSSValueList(value);
|
| if (nonInterpolableData)
|
| nonInterpolableData->reserveCapacity(listValue.length());
|
| OwnPtrWillBeRawPtr<InterpolableList> result = InterpolableList::create(listValue.length());
|
| typename InterpolationType::NonInterpolableType elementData = typename InterpolationType::NonInterpolableType();
|
| for (size_t i = 0; i < listValue.length(); i++) {
|
| - result->set(i, InterpolationType::toInterpolableValue(*listValue.item(i), elementData));
|
| + result->set(i, InterpolationType::toInterpolableValue(listValue.item(i), elementData));
|
| if (nonInterpolableData)
|
| nonInterpolableData->append(elementData);
|
| }
|
| return result.release();
|
| }
|
|
|
| - static PassRefPtrWillBeRawPtr<CSSValue> interpolableValueToList(InterpolableValue* value, const Vector<typename InterpolationType::NonInterpolableType>& nonInterpolableData, InterpolationRange range = RangeAll)
|
| + static CSSValue interpolableValueToList(InterpolableValue* value, const Vector<typename InterpolationType::NonInterpolableType>& nonInterpolableData, InterpolationRange range = RangeAll)
|
| {
|
| InterpolableList* listValue = toInterpolableList(value);
|
| RefPtrWillBeRawPtr<CSSValueList> result = CSSValueList::createCommaSeparated();
|
| @@ -88,23 +84,19 @@ private:
|
| template<typename InterpolationType>
|
| class ListStyleInterpolationImpl<InterpolationType, void> : public StyleInterpolation {
|
| public:
|
| - static PassRefPtrWillBeRawPtr<ListStyleInterpolationImpl<InterpolationType, void>> maybeCreateFromList(const CSSValue& start, const CSSValue& end, CSSPropertyID id, InterpolationRange range = RangeAll)
|
| + static PassRefPtrWillBeRawPtr<ListStyleInterpolationImpl<InterpolationType, void>> maybeCreateFromList(const CSSValueList& startList, const CSSValueList& endList, CSSPropertyID id, InterpolationRange range = RangeAll)
|
| {
|
| - if (!start.isValueList() || !end.isValueList())
|
| - return nullptr;
|
| - const CSSValueList& startList = toCSSValueList(start);
|
| - const CSSValueList& endList = toCSSValueList(end);
|
| if (startList.length() != endList.length())
|
| return nullptr;
|
| for (const auto& value : startList) {
|
| - if (!InterpolationType::canCreateFrom(*value))
|
| + if (!InterpolationType::canCreateFrom(value))
|
| return nullptr;
|
| }
|
| for (const auto& value : endList) {
|
| - if (!InterpolationType::canCreateFrom(*value))
|
| + if (!InterpolationType::canCreateFrom(value))
|
| return nullptr;
|
| }
|
| - return adoptRefWillBeNoop(new ListStyleInterpolationImpl<InterpolationType, void>(listToInterpolableValue(start), listToInterpolableValue(end), id, range));
|
| + return adoptRefWillBeNoop(new ListStyleInterpolationImpl<InterpolationType, void>(listToInterpolableValue(startList), listToInterpolableValue(endList), id, range));
|
| }
|
|
|
| private:
|
| @@ -115,16 +107,15 @@ private:
|
|
|
| InterpolationRange m_range;
|
|
|
| - static PassOwnPtrWillBeRawPtr<InterpolableValue> listToInterpolableValue(const CSSValue& value)
|
| + static PassOwnPtrWillBeRawPtr<InterpolableValue> listToInterpolableValue(const CSSValueList& listValue)
|
| {
|
| - const CSSValueList& listValue = toCSSValueList(value);
|
| OwnPtrWillBeRawPtr<InterpolableList> result = InterpolableList::create(listValue.length());
|
| for (size_t i = 0; i < listValue.length(); i++)
|
| - result->set(i, InterpolationType::toInterpolableValue(*listValue.item(i)));
|
| + result->set(i, InterpolationType::toInterpolableValue(listValue.item(i)));
|
| return result.release();
|
| }
|
|
|
| - static PassRefPtrWillBeRawPtr<CSSValue> interpolableValueToList(InterpolableValue* value, InterpolationRange range = RangeAll)
|
| + static CSSValue interpolableValueToList(InterpolableValue* value, InterpolationRange range = RangeAll)
|
| {
|
| InterpolableList* listValue = toInterpolableList(value);
|
| RefPtrWillBeRawPtr<CSSValueList> result = CSSValueList::createCommaSeparated();
|
| @@ -136,7 +127,7 @@ private:
|
|
|
| virtual void apply(StyleResolverState& state) const override
|
| {
|
| - StyleBuilder::applyProperty(m_id, state, interpolableValueToList(m_cachedValue.get(), m_range).get());
|
| + StyleBuilder::applyProperty(m_id, state, interpolableValueToList(m_cachedValue.get(), m_range));
|
| }
|
|
|
| friend class ListStyleInterpolationTest;
|
| @@ -146,7 +137,7 @@ private:
|
| template<typename InterpolationType>
|
| class ListStyleInterpolation {
|
| public:
|
| - static PassRefPtrWillBeRawPtr<ListStyleInterpolationImpl<InterpolationType, typename InterpolationType::NonInterpolableType>> maybeCreateFromList(const CSSValue& start, const CSSValue& end, CSSPropertyID id, InterpolationRange range = RangeAll)
|
| + static PassRefPtrWillBeRawPtr<ListStyleInterpolationImpl<InterpolationType, typename InterpolationType::NonInterpolableType>> maybeCreateFromList(const CSSValueList& start, const CSSValueList& end, CSSPropertyID id, InterpolationRange range = RangeAll)
|
| {
|
| return ListStyleInterpolationImpl<InterpolationType, typename InterpolationType::NonInterpolableType>::maybeCreateFromList(start, end, id, range);
|
| }
|
|
|