Chromium Code Reviews| 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..ec87b4ce51cf57458222bfd85e7280261ccc4501 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 PassRefPtr<ShadowList>(); |
|
dstockwell
2013/10/24 03:23:38
doesn't one of these work?: return 0; or return nu
Timothy Loh
2013/10/24 04:16:24
Replaced with return 0. I had tried nullptr earlie
|
| + |
| + 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 |