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

Unified Diff: Source/core/rendering/style/BasicShapes.cpp

Issue 851693005: [CSS Shapes] Implement BasicShapeInset blending (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 5 years, 11 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
« no previous file with comments | « LayoutTests/animations/interpolation/webkit-clip-path-interpolation-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/style/BasicShapes.cpp
diff --git a/Source/core/rendering/style/BasicShapes.cpp b/Source/core/rendering/style/BasicShapes.cpp
index d19be121e2071061defeda2e936d2ec75eb40325..74c13eeb3f878146efb57a048123a9f828902b0b 100644
--- a/Source/core/rendering/style/BasicShapes.cpp
+++ b/Source/core/rendering/style/BasicShapes.cpp
@@ -241,11 +241,29 @@ void BasicShapeInset::path(Path& path, const FloatRect& boundingBox)
);
}
-PassRefPtr<BasicShape> BasicShapeInset::blend(const BasicShape* other, double) const
+static inline LengthSize blendLengthSize(const LengthSize& to, const LengthSize& from, double progress)
{
- ASSERT(type() == other->type());
- // FIXME: Implement blend for BasicShapeInset (see: crbug.com/448295).
- return nullptr;
+ return LengthSize(to.width().blend(from.width(), progress, ValueRangeAll),
+ to.height().blend(from.height(), progress, ValueRangeAll));
+}
+
+PassRefPtr<BasicShape> BasicShapeInset::blend(const BasicShape* other, double progress) const
+{
+ ASSERT(other && isSameType(*other));
+
+ const BasicShapeInset& otherInset = toBasicShapeInset(*other);
+ RefPtr<BasicShapeInset> result = BasicShapeInset::create();
+ result->setTop(m_top.blend(otherInset.top(), progress, ValueRangeAll));
+ result->setRight(m_right.blend(otherInset.right(), progress, ValueRangeAll));
+ result->setBottom(m_bottom.blend(otherInset.bottom(), progress, ValueRangeAll));
+ result->setLeft(m_left.blend(otherInset.left(), progress, ValueRangeAll));
+
+ result->setTopLeftRadius(blendLengthSize(m_topLeftRadius, otherInset.topLeftRadius(), progress));
+ result->setTopRightRadius(blendLengthSize(m_topRightRadius, otherInset.topRightRadius(), progress));
+ result->setBottomRightRadius(blendLengthSize(m_bottomRightRadius, otherInset.bottomRightRadius(), progress));
+ result->setBottomLeftRadius(blendLengthSize(m_bottomLeftRadius, otherInset.bottomLeftRadius(), progress));
+
+ return result.release();
}
bool BasicShapeInset::operator==(const BasicShape& o) const
« no previous file with comments | « LayoutTests/animations/interpolation/webkit-clip-path-interpolation-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698