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

Unified Diff: Source/core/rendering/style/ShadowList.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/rendering/style/ShadowList.h ('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/ShadowList.cpp
diff --git a/Source/core/rendering/style/ShadowList.cpp b/Source/core/rendering/style/ShadowList.cpp
index 34b4c1637280e1e92a83784e4f5134b49c1a06d8..675effec90bcd16241bfcfb6b90478343ebb3a90 100644
--- a/Source/core/rendering/style/ShadowList.cpp
+++ b/Source/core/rendering/style/ShadowList.cpp
@@ -78,4 +78,30 @@ void ShadowList::adjustRectForShadow(FloatRect& rect, int additionalOutlineSize)
rect.setHeight(rect.height() - shadowTop + shadowBottom);
}
+PassRefPtr<ShadowList> ShadowList::blend(const ShadowList* from, const ShadowList* to, double progress)
+{
+ size_t fromLength = from ? from->shadows().size() : 0;
+ size_t toLength = to ? to->shadows().size() : 0;
+ if (!fromLength && !toLength)
+ return 0;
+
+ ShadowDataVector shadows;
+
+ DEFINE_STATIC_LOCAL(ShadowData, defaultShadowData, (IntPoint(), 0, 0, Normal, Color::transparent));
+ DEFINE_STATIC_LOCAL(ShadowData, defaultInsetShadowData, (IntPoint(), 0, 0, Inset, Color::transparent));
+
+ size_t maxLength = std::max(fromLength, toLength);
+ for (size_t i = 0; i < maxLength; ++i) {
+ const ShadowData* fromShadow = i < fromLength ? &from->shadows()[i] : 0;
+ const ShadowData* toShadow = i < toLength ? &to->shadows()[i] : 0;
+ if (!fromShadow)
+ fromShadow = toShadow->style() == Inset ? &defaultInsetShadowData : &defaultShadowData;
+ else if (!toShadow)
+ toShadow = fromShadow->style() == Inset ? &defaultInsetShadowData : &defaultShadowData;
+ shadows.append(toShadow->blend(*fromShadow, progress));
+ }
+
+ return ShadowList::adopt(shadows);
+}
+
} // namespace WebCore
« no previous file with comments | « Source/core/rendering/style/ShadowList.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698