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

Unified Diff: Source/core/frame/animation/CSSPropertyAnimation.cpp

Issue 38823002: Web Animations CSS: Support animation of {text,box,-webkit-box}-shadow and fix blur clamping (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: use 0 instead of PassRefPtr<..>() Created 7 years, 2 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 | « Source/core/css/resolver/AnimatedStyleBuilder.cpp ('k') | Source/core/rendering/style/ShadowData.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/frame/animation/CSSPropertyAnimation.cpp
diff --git a/Source/core/frame/animation/CSSPropertyAnimation.cpp b/Source/core/frame/animation/CSSPropertyAnimation.cpp
index b233c262862b9720f79a4fc5363ee9a25f046fe4..7b234941731d3555669dae17e7659e3fc7e0e0dc 100644
--- a/Source/core/frame/animation/CSSPropertyAnimation.cpp
+++ b/Source/core/frame/animation/CSSPropertyAnimation.cpp
@@ -88,29 +88,6 @@ static inline IntSize blendFunc(const AnimationBase* anim, const IntSize& from,
blendFunc(anim, from.height(), to.height(), progress));
}
-static inline ShadowStyle blendFunc(const AnimationBase* anim, ShadowStyle from, ShadowStyle to, double progress)
-{
- if (from == to)
- return to;
-
- double fromVal = from == Normal ? 1 : 0;
- double toVal = to == Normal ? 1 : 0;
- double result = blendFunc(anim, fromVal, toVal, progress);
- return result > 0 ? Normal : Inset;
-}
-
-static inline ShadowData blendFunc(const AnimationBase* anim, const ShadowData& from, const ShadowData& to, double progress)
-{
- if (from.style() != to.style())
- return to;
-
- return ShadowData(blend(from.location(), to.location(), progress),
- blend(from.blur(), to.blur(), progress),
- blend(from.spread(), to.spread(), progress),
- blendFunc(anim, from.style(), to.style(), progress),
- blend(from.color(), to.color(), progress));
-}
-
static inline TransformOperations blendFunc(const AnimationBase* anim, const TransformOperations& from, const TransformOperations& to, double progress)
{
if (anim->isTransformFunctionListValid())
@@ -523,22 +500,6 @@ public:
}
};
-static inline size_t shadowListLength(const ShadowList* shadowList)
-{
- return shadowList ? shadowList->shadows().size() : 0;
-}
-
-static inline const ShadowData& shadowForBlending(const ShadowData* srcShadow, const ShadowData* otherShadow)
-{
- DEFINE_STATIC_LOCAL(ShadowData, defaultShadowData, (IntPoint(), 0, 0, Normal, Color::transparent));
- DEFINE_STATIC_LOCAL(ShadowData, defaultInsetShadowData, (IntPoint(), 0, 0, Inset, Color::transparent));
-
- if (srcShadow)
- return *srcShadow;
-
- return otherShadow->style() == Inset ? defaultInsetShadowData : defaultShadowData;
-}
-
class PropertyWrapperShadow : public AnimationPropertyWrapperBase {
public:
PropertyWrapperShadow(CSSPropertyID prop, ShadowList* (RenderStyle::*getter)() const, void (RenderStyle::*setter)(PassRefPtr<ShadowList>))
@@ -561,29 +522,7 @@ public:
virtual void blend(const AnimationBase* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const
{
- const ShadowList* shadowA = (a->*m_getter)();
- const ShadowList* shadowB = (b->*m_getter)();
-
- size_t fromLength = shadowListLength(shadowA);
- size_t toLength = shadowListLength(shadowB);
- if (!fromLength && !toLength) {
- (dst->*m_setter)(0);
- return;
- }
-
- ShadowDataVector shadows;
-
- size_t maxLength = max(fromLength, toLength);
- for (size_t i = 0; i < maxLength; ++i) {
- const ShadowData* fromShadow = i < fromLength ? &shadowA->shadows()[i] : 0;
- const ShadowData* toShadow = i < toLength ? &shadowB->shadows()[i] : 0;
- const ShadowData& srcShadow = shadowForBlending(fromShadow, toShadow);
- const ShadowData& dstShadow = shadowForBlending(toShadow, fromShadow);
-
- shadows.append(blendFunc(anim, srcShadow, dstShadow, progress));
- }
-
- (dst->*m_setter)(ShadowList::adopt(shadows));
+ (dst->*m_setter)(ShadowList::blend((a->*m_getter)(), (b->*m_getter)(), progress));
}
ShadowList* (RenderStyle::*m_getter)() const;
« no previous file with comments | « Source/core/css/resolver/AnimatedStyleBuilder.cpp ('k') | Source/core/rendering/style/ShadowData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698