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

Side by Side Diff: third_party/WebKit/Source/core/css/resolver/FilterOperationResolver.cpp

Issue 2609803002: Use ShadowData in DropShadowFilterOperation (Closed)
Patch Set: Fix blend(...) order Created 3 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com)
4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com)
5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc.
6 * All rights reserved. 6 * All rights reserved.
7 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 7 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
8 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> 8 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org>
9 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 9 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
10 * (http://www.torchmobile.com/) 10 * (http://www.torchmobile.com/)
(...skipping 14 matching lines...) Expand all
25 * You should have received a copy of the GNU Library General Public License 25 * You should have received a copy of the GNU Library General Public License
26 * along with this library; see the file COPYING.LIB. If not, write to 26 * along with this library; see the file COPYING.LIB. If not, write to
27 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 27 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
28 * Boston, MA 02110-1301, USA. 28 * Boston, MA 02110-1301, USA.
29 */ 29 */
30 30
31 #include "core/css/resolver/FilterOperationResolver.h" 31 #include "core/css/resolver/FilterOperationResolver.h"
32 32
33 #include "core/css/CSSFunctionValue.h" 33 #include "core/css/CSSFunctionValue.h"
34 #include "core/css/CSSPrimitiveValueMappings.h" 34 #include "core/css/CSSPrimitiveValueMappings.h"
35 #include "core/css/CSSShadowValue.h"
36 #include "core/css/CSSURIValue.h" 35 #include "core/css/CSSURIValue.h"
36 #include "core/css/resolver/StyleBuilderConverter.h"
37 #include "core/css/resolver/StyleResolverState.h" 37 #include "core/css/resolver/StyleResolverState.h"
38 #include "core/frame/UseCounter.h" 38 #include "core/frame/UseCounter.h"
39 39
40 namespace blink { 40 namespace blink {
41 41
42 FilterOperation::OperationType FilterOperationResolver::filterOperationForType( 42 FilterOperation::OperationType FilterOperationResolver::filterOperationForType(
43 CSSValueID type) { 43 CSSValueID type) {
44 switch (type) { 44 switch (type) {
45 case CSSValueGrayscale: 45 case CSSValueGrayscale:
46 return FilterOperation::GRAYSCALE; 46 return FilterOperation::GRAYSCALE;
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 } 193 }
194 case CSSValueBlur: { 194 case CSSValueBlur: {
195 Length stdDeviation = Length(0, Fixed); 195 Length stdDeviation = Length(0, Fixed);
196 if (filterValue->length() >= 1) 196 if (filterValue->length() >= 1)
197 stdDeviation = firstValue->convertToLength(conversionData); 197 stdDeviation = firstValue->convertToLength(conversionData);
198 operations.operations().push_back( 198 operations.operations().push_back(
199 BlurFilterOperation::create(stdDeviation)); 199 BlurFilterOperation::create(stdDeviation));
200 break; 200 break;
201 } 201 }
202 case CSSValueDropShadow: { 202 case CSSValueDropShadow: {
203 const CSSShadowValue& item = toCSSShadowValue(filterValue->item(0)); 203 ShadowData shadow =
204 IntPoint location(item.x->computeLength<int>(conversionData), 204 StyleBuilderConverter::convertShadow(state, filterValue->item(0));
205 item.y->computeLength<int>(conversionData)); 205 // TODO(fs): Resolve 'currentcolor' when constructing the filter chain.
206 int blur = 206 if (shadow.color().isCurrentColor())
207 item.blur ? item.blur->computeLength<int>(conversionData) : 0; 207 shadow.overrideColor(state.style()->color());
208 Color shadowColor = Color::black;
209 if (item.color)
210 shadowColor = state.document().textLinkColors().colorFromCSSValue(
211 *item.color, state.style()->color());
212
213 operations.operations().push_back( 208 operations.operations().push_back(
214 DropShadowFilterOperation::create(location, blur, shadowColor)); 209 DropShadowFilterOperation::create(shadow));
215 break; 210 break;
216 } 211 }
217 default: 212 default:
218 ASSERT_NOT_REACHED(); 213 ASSERT_NOT_REACHED();
219 break; 214 break;
220 } 215 }
221 } 216 }
222 217
223 return operations; 218 return operations;
224 } 219 }
225 220
226 } // namespace blink 221 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698