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

Unified Diff: Source/core/animation/LengthBoxStyleInterpolation.cpp

Issue 995253002: Web Animations: Split image slice interpolation out of LengthBoxStyleInterpolation (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: crbug.com/466536 Created 5 years, 9 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: Source/core/animation/LengthBoxStyleInterpolation.cpp
diff --git a/Source/core/animation/LengthBoxStyleInterpolation.cpp b/Source/core/animation/LengthBoxStyleInterpolation.cpp
index e16a79ebcdd0b95fc5a9cc571ce15308ba930561..53440c0aae4c8741b248d0a92d6d43adae1c025b 100644
--- a/Source/core/animation/LengthBoxStyleInterpolation.cpp
+++ b/Source/core/animation/LengthBoxStyleInterpolation.cpp
@@ -26,13 +26,8 @@ PassRefPtrWillBeRawPtr<LengthBoxStyleInterpolation> LengthBoxStyleInterpolation:
bool startRect = start.isPrimitiveValue() && toCSSPrimitiveValue(start).isRect();
bool endRect = end.isPrimitiveValue() && toCSSPrimitiveValue(end).isRect();
- if (startRect && endRect) {
- return adoptRefWillBeNoop(new LengthBoxStyleInterpolation(lengthBoxtoInterpolableValue(start, end, false), lengthBoxtoInterpolableValue(end, start, true), id, false, &start, &end));
- }
- if (start.isBorderImageSliceValue() && toCSSBorderImageSliceValue(start).slices()
- && end.isBorderImageSliceValue() && toCSSBorderImageSliceValue(end).slices()
- && toCSSBorderImageSliceValue(start).m_fill == toCSSBorderImageSliceValue(end).m_fill)
- return adoptRefWillBeNoop(new LengthBoxStyleInterpolation(borderImageSlicetoInterpolableValue(start), borderImageSlicetoInterpolableValue(end), id, toCSSBorderImageSliceValue(start).m_fill, &start, &end));
+ if (startRect && endRect)
+ return adoptRefWillBeNoop(new LengthBoxStyleInterpolation(lengthBoxtoInterpolableValue(start, end, false), lengthBoxtoInterpolableValue(end, start, true), id, &start, &end));
return nullptr;
}
@@ -99,41 +94,12 @@ PassRefPtrWillBeRawPtr<CSSValue> LengthBoxStyleInterpolation::interpolableValueT
return CSSPrimitiveValue::create(result.release());
}
-PassOwnPtrWillBeRawPtr<InterpolableValue> LengthBoxStyleInterpolation::borderImageSlicetoInterpolableValue(const CSSValue& value)
-{
- const int numberOfSides = 4;
- OwnPtrWillBeRawPtr<InterpolableList> result = InterpolableList::create(numberOfSides);
- Quad* quad = toCSSBorderImageSliceValue(value).slices();
- CSSPrimitiveValue* side[numberOfSides] = { quad->left(), quad->right(), quad->top(), quad->bottom() };
-
- for (size_t i = 0; i < numberOfSides; i++) {
- result->set(i, LengthStyleInterpolation::toInterpolableValue(*side[i]));
- }
- return result.release();
-}
-
-PassRefPtrWillBeRawPtr<CSSValue> LengthBoxStyleInterpolation::interpolableValueToBorderImageSlice(InterpolableValue* value, bool fill)
-{
- InterpolableList* lengthBox = toInterpolableList(value);
- RefPtrWillBeRawPtr<Quad> quad = Quad::create();
-
- quad->setLeft(LengthStyleInterpolation::fromInterpolableValue(*lengthBox->get(0), RangeNonNegative));
- quad->setRight(LengthStyleInterpolation::fromInterpolableValue(*lengthBox->get(1), RangeNonNegative));
- quad->setTop(LengthStyleInterpolation::fromInterpolableValue(*lengthBox->get(2), RangeNonNegative));
- quad->setBottom(LengthStyleInterpolation::fromInterpolableValue(*lengthBox->get(3), RangeNonNegative));
-
- return CSSBorderImageSliceValue::create(CSSPrimitiveValue::create(quad.release()), fill);
-}
-
void LengthBoxStyleInterpolation::apply(StyleResolverState& state) const
{
- if (m_id == CSSPropertyWebkitMaskBoxImageSlice || m_id == CSSPropertyBorderImageSlice) {
- StyleBuilder::applyProperty(m_id, state, interpolableValueToBorderImageSlice(m_cachedValue.get(), m_fill).get());
- } else if (m_cachedValue.get()->isBool()) {
+ if (m_cachedValue.get()->isBool())
StyleBuilder::applyProperty(m_id, state, toInterpolableBool(m_cachedValue.get())->value() ? m_endCSSValue.get() : m_startCSSValue.get());
- } else {
+ else
StyleBuilder::applyProperty(m_id, state, interpolableValueToLengthBox(m_cachedValue.get(), *m_startCSSValue, *m_endCSSValue).get());
- }
}
DEFINE_TRACE(LengthBoxStyleInterpolation)
« no previous file with comments | « Source/core/animation/LengthBoxStyleInterpolation.h ('k') | Source/core/animation/LengthBoxStyleInterpolationTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698