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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « Source/core/rendering/style/ShadowList.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 int shadowRight = 0; 71 int shadowRight = 0;
72 int shadowTop = 0; 72 int shadowTop = 0;
73 int shadowBottom = 0; 73 int shadowBottom = 0;
74 calculateShadowExtent(this, additionalOutlineSize, shadowLeft, shadowRight, shadowTop, shadowBottom); 74 calculateShadowExtent(this, additionalOutlineSize, shadowLeft, shadowRight, shadowTop, shadowBottom);
75 75
76 rect.move(shadowLeft, shadowTop); 76 rect.move(shadowLeft, shadowTop);
77 rect.setWidth(rect.width() - shadowLeft + shadowRight); 77 rect.setWidth(rect.width() - shadowLeft + shadowRight);
78 rect.setHeight(rect.height() - shadowTop + shadowBottom); 78 rect.setHeight(rect.height() - shadowTop + shadowBottom);
79 } 79 }
80 80
81 PassRefPtr<ShadowList> ShadowList::blend(const ShadowList* from, const ShadowLis t* to, double progress)
82 {
83 size_t fromLength = from ? from->shadows().size() : 0;
84 size_t toLength = to ? to->shadows().size() : 0;
85 if (!fromLength && !toLength)
86 return 0;
87
88 ShadowDataVector shadows;
89
90 DEFINE_STATIC_LOCAL(ShadowData, defaultShadowData, (IntPoint(), 0, 0, Normal , Color::transparent));
91 DEFINE_STATIC_LOCAL(ShadowData, defaultInsetShadowData, (IntPoint(), 0, 0, I nset, Color::transparent));
92
93 size_t maxLength = std::max(fromLength, toLength);
94 for (size_t i = 0; i < maxLength; ++i) {
95 const ShadowData* fromShadow = i < fromLength ? &from->shadows()[i] : 0;
96 const ShadowData* toShadow = i < toLength ? &to->shadows()[i] : 0;
97 if (!fromShadow)
98 fromShadow = toShadow->style() == Inset ? &defaultInsetShadowData : &defaultShadowData;
99 else if (!toShadow)
100 toShadow = fromShadow->style() == Inset ? &defaultInsetShadowData : &defaultShadowData;
101 shadows.append(toShadow->blend(*fromShadow, progress));
102 }
103
104 return ShadowList::adopt(shadows);
105 }
106
81 } // namespace WebCore 107 } // namespace WebCore
OLDNEW
« 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