Index: Source/core/animation/LengthBoxStyleInterpolation.cpp |
diff --git a/Source/core/animation/LengthBoxStyleInterpolation.cpp b/Source/core/animation/LengthBoxStyleInterpolation.cpp |
index 08778ab378f9cd347ef5a4f98c3ea138324e6400..d3484cf945175b524d9eb77b6ea17c9cd412fcd1 100644 |
--- a/Source/core/animation/LengthBoxStyleInterpolation.cpp |
+++ b/Source/core/animation/LengthBoxStyleInterpolation.cpp |
@@ -10,9 +10,15 @@ |
namespace blink { |
-bool LengthBoxStyleInterpolation::canCreateFrom(const CSSValue& value) |
+bool LengthBoxStyleInterpolation::isAutoValue(const CSSValue& value) |
{ |
- return value.isPrimitiveValue() && toCSSPrimitiveValue(value).isRect(); |
+ if (value.isPrimitiveValue() && toCSSPrimitiveValue(value).isRect() |
+ && (toCSSPrimitiveValue(value).getRectValue()->left()->isValueID() |
+ || toCSSPrimitiveValue(value).getRectValue()->right()->isValueID() |
+ || toCSSPrimitiveValue(value).getRectValue()->top()->isValueID() |
+ || toCSSPrimitiveValue(value).getRectValue()->bottom()->isValueID())) |
+ return true; |
+ return false; |
} |
PassOwnPtrWillBeRawPtr<InterpolableValue> LengthBoxStyleInterpolation::lengthBoxtoInterpolableValue(const CSSValue& lengthBox) |
@@ -28,7 +34,7 @@ PassOwnPtrWillBeRawPtr<InterpolableValue> LengthBoxStyleInterpolation::lengthBox |
return result.release(); |
} |
-PassRefPtrWillBeRawPtr<CSSValue> LengthBoxStyleInterpolation::interpolableValueToLengthBox(InterpolableValue* value, InterpolationRange range) |
+PassRefPtrWillBeRawPtr<CSSValue> LengthBoxStyleInterpolation::interpolableValueToLengthBox(InterpolableValue* value) |
{ |
InterpolableList* lengthBox = toInterpolableList(value); |
RefPtrWillBeRawPtr<Rect> result = Rect::create(); |
@@ -41,30 +47,7 @@ PassRefPtrWillBeRawPtr<CSSValue> LengthBoxStyleInterpolation::interpolableValueT |
return CSSPrimitiveValue::create(result.release()); |
} |
-void LengthBoxStyleInterpolation::apply(StyleResolverState& state) const |
-{ |
- if (m_id == CSSPropertyWebkitMaskBoxImageSlice) |
- StyleBuilder::applyProperty(m_id, state, interpolableValueToBorderImageSlice(m_cachedValue.get(), m_fill).get()); |
- else |
- StyleBuilder::applyProperty(m_id, state, interpolableValueToLengthBox(m_cachedValue.get()).get()); |
-} |
- |
-void LengthBoxStyleInterpolation::trace(Visitor* visitor) |
-{ |
- StyleInterpolation::trace(visitor); |
-} |
- |
-bool LengthBoxStyleInterpolation::matchingFill(CSSValue& start, CSSValue& end) |
-{ |
- return toCSSBorderImageSliceValue(start).m_fill == toCSSBorderImageSliceValue(end).m_fill; |
-} |
- |
-bool LengthBoxStyleInterpolation::canCreateFromBorderImageSlice(CSSValue& value) |
-{ |
- return value.isBorderImageSliceValue() && toCSSBorderImageSliceValue(value).slices(); |
-} |
- |
-PassOwnPtrWillBeRawPtr<InterpolableValue> LengthBoxStyleInterpolation::borderImageSlicetoInterpolableValue(CSSValue& value) |
+PassOwnPtrWillBeRawPtr<InterpolableValue> LengthBoxStyleInterpolation::borderImageSlicetoInterpolableValue(const CSSValue& value) |
{ |
const int numberOfSides = 4; |
OwnPtrWillBeRawPtr<InterpolableList> result = InterpolableList::create(numberOfSides); |
@@ -77,22 +60,30 @@ PassOwnPtrWillBeRawPtr<InterpolableValue> LengthBoxStyleInterpolation::borderIma |
return result.release(); |
} |
-static inline PassRefPtrWillBeRawPtr<CSSPrimitiveValue> toPrimitiveValue(PassRefPtrWillBeRawPtr<CSSValue> value) |
-{ |
- return adoptRefWillBeNoop(toCSSPrimitiveValue(value.leakRef())); |
-} |
- |
PassRefPtrWillBeRawPtr<CSSValue> LengthBoxStyleInterpolation::interpolableValueToBorderImageSlice(InterpolableValue* value, bool fill) |
{ |
InterpolableList* lengthBox = toInterpolableList(value); |
RefPtrWillBeRawPtr<Quad> quad = Quad::create(); |
- quad->setLeft(toPrimitiveValue(LengthStyleInterpolation::interpolableValueToLength(lengthBox->get(0), RangeNonNegative))); |
- quad->setRight(toPrimitiveValue(LengthStyleInterpolation::interpolableValueToLength(lengthBox->get(1), RangeNonNegative))); |
- quad->setTop(toPrimitiveValue(LengthStyleInterpolation::interpolableValueToLength(lengthBox->get(2), RangeNonNegative))); |
- quad->setBottom(toPrimitiveValue(LengthStyleInterpolation::interpolableValueToLength(lengthBox->get(3), RangeNonNegative))); |
+ quad->setLeft(LengthStyleInterpolation::interpolableValueToLength(lengthBox->get(0), RangeNonNegative)); |
+ quad->setRight(LengthStyleInterpolation::interpolableValueToLength(lengthBox->get(1), RangeNonNegative)); |
+ quad->setTop(LengthStyleInterpolation::interpolableValueToLength(lengthBox->get(2), RangeNonNegative)); |
+ quad->setBottom(LengthStyleInterpolation::interpolableValueToLength(lengthBox->get(3), RangeNonNegative)); |
return CSSBorderImageSliceValue::create(CSSPrimitiveValue::create(quad.release()), fill); |
} |
+void LengthBoxStyleInterpolation::apply(StyleResolverState& state) const |
Eric Willigers
2015/01/27 23:21:14
If you move apply and trace to before borderImageS
|
+{ |
+ if (m_id == CSSPropertyWebkitMaskBoxImageSlice || m_id == CSSPropertyBorderImageSlice) |
+ StyleBuilder::applyProperty(m_id, state, interpolableValueToBorderImageSlice(m_cachedValue.get(), m_fill).get()); |
+ else |
+ StyleBuilder::applyProperty(m_id, state, interpolableValueToLengthBox(m_cachedValue.get()).get()); |
+} |
+ |
+void LengthBoxStyleInterpolation::trace(Visitor* visitor) |
+{ |
+ StyleInterpolation::trace(visitor); |
+} |
+ |
} |