Index: Source/core/animation/SVGLengthStyleInterpolation.cpp |
diff --git a/Source/core/animation/SVGLengthStyleInterpolation.cpp b/Source/core/animation/SVGLengthStyleInterpolation.cpp |
deleted file mode 100644 |
index c217e94680e3fcc3c0fad6158bfc2980d0b640db..0000000000000000000000000000000000000000 |
--- a/Source/core/animation/SVGLengthStyleInterpolation.cpp |
+++ /dev/null |
@@ -1,85 +0,0 @@ |
-// Copyright 2015 The Chromium Authors. All rights reserved. |
-// Use of this source code is governed by a BSD-style license that can be |
-// found in the LICENSE file. |
- |
-#include "config.h" |
-#include "core/animation/SVGLengthStyleInterpolation.h" |
- |
-#include "core/css/resolver/StyleBuilder.h" |
- |
-namespace blink { |
- |
-bool SVGLengthStyleInterpolation::canCreateFrom(const CSSValue& value) |
-{ |
- if (!value.isPrimitiveValue()) |
- return false; |
- |
- switch (toCSSPrimitiveValue(value).primitiveType()) { |
- case CSSPrimitiveValue::CSS_NUMBER: |
- case CSSPrimitiveValue::CSS_PERCENTAGE: |
- case CSSPrimitiveValue::CSS_EMS: |
- case CSSPrimitiveValue::CSS_EXS: |
- case CSSPrimitiveValue::CSS_PX: |
- case CSSPrimitiveValue::CSS_CM: |
- case CSSPrimitiveValue::CSS_MM: |
- case CSSPrimitiveValue::CSS_IN: |
- case CSSPrimitiveValue::CSS_PT: |
- case CSSPrimitiveValue::CSS_PC: |
- return true; |
- |
- default: |
- return false; |
- } |
-} |
- |
-PassOwnPtrWillBeRawPtr<InterpolableValue> SVGLengthStyleInterpolation::lengthToInterpolableValue(const CSSPrimitiveValue& length) |
-{ |
- ASSERT(canCreateFrom(length)); |
- return InterpolableNumber::create(length.getDoubleValue()); |
-} |
- |
-PassRefPtrWillBeRawPtr<CSSPrimitiveValue> SVGLengthStyleInterpolation::interpolableValueToLength(const InterpolableValue& interpolableValue, CSSPrimitiveValue::UnitType type, InterpolationRange range) |
-{ |
- double value = toInterpolableNumber(interpolableValue).value(); |
- if (range == RangeNonNegative && value < 0) |
- value = 0; |
- |
- return CSSPrimitiveValue::create(value, type); |
-} |
- |
-PassRefPtrWillBeRawPtr<SVGLengthStyleInterpolation> SVGLengthStyleInterpolation::maybeCreate(const CSSValue& start, const CSSValue& end, CSSPropertyID id, InterpolationRange range) |
-{ |
- if (!canCreateFrom(start) || !canCreateFrom(end)) |
- return nullptr; |
- |
- const CSSPrimitiveValue& primitiveStart = toCSSPrimitiveValue(start); |
- const CSSPrimitiveValue& primitiveEnd = toCSSPrimitiveValue(end); |
- |
- CSSPrimitiveValue::UnitType type = commonUnitType(primitiveStart, primitiveEnd); |
- if (type == CSSPrimitiveValue::CSS_UNKNOWN) |
- return nullptr; |
- return adoptRefWillBeNoop(new SVGLengthStyleInterpolation(primitiveStart, primitiveEnd, id, type, range)); |
-} |
- |
-CSSPrimitiveValue::UnitType SVGLengthStyleInterpolation::commonUnitType(const CSSPrimitiveValue& start, const CSSPrimitiveValue& end) |
-{ |
- if (start.getDoubleValue() == 0 || start.primitiveType() == end.primitiveType()) |
- return end.primitiveType(); |
- if (end.getDoubleValue() == 0) |
- return start.primitiveType(); |
- return CSSPrimitiveValue::CSS_UNKNOWN; |
-} |
- |
-SVGLengthStyleInterpolation::SVGLengthStyleInterpolation(const CSSPrimitiveValue& start, const CSSPrimitiveValue& end, CSSPropertyID id, CSSPrimitiveValue::UnitType type, InterpolationRange range) |
- : StyleInterpolation(lengthToInterpolableValue(start), lengthToInterpolableValue(end), id) |
- , m_type(type) |
- , m_range(range) |
-{ |
-} |
- |
-void SVGLengthStyleInterpolation::apply(StyleResolverState& state) const |
-{ |
- StyleBuilder::applyProperty(m_id, state, interpolableValueToLength(*m_cachedValue, m_type, m_range).get()); |
-} |
- |
-} |