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

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

Issue 2490163002: Reland of "Tracking reference filter mutation via SVGElementProxy" (Closed)
Patch Set: Fix double observer unregistration; simplify scope selection; add tests Created 4 years, 1 month 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 18 matching lines...) Expand all
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" 35 #include "core/css/CSSShadowValue.h"
36 #include "core/css/CSSURIValue.h" 36 #include "core/css/CSSURIValue.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 #include "core/layout/svg/ReferenceFilterBuilder.h"
40 #include "core/svg/SVGURIReference.h"
41 39
42 namespace blink { 40 namespace blink {
43 41
44 FilterOperation::OperationType FilterOperationResolver::filterOperationForType( 42 FilterOperation::OperationType FilterOperationResolver::filterOperationForType(
45 CSSValueID type) { 43 CSSValueID type) {
46 switch (type) { 44 switch (type) {
47 case CSSValueGrayscale: 45 case CSSValueGrayscale:
48 return FilterOperation::GRAYSCALE; 46 return FilterOperation::GRAYSCALE;
49 case CSSValueSepia: 47 case CSSValueSepia:
50 return FilterOperation::SEPIA; 48 return FilterOperation::SEPIA;
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 return operations; 126 return operations;
129 } 127 }
130 128
131 const CSSToLengthConversionData& conversionData = 129 const CSSToLengthConversionData& conversionData =
132 state.cssToLengthConversionData(); 130 state.cssToLengthConversionData();
133 for (auto& currValue : toCSSValueList(inValue)) { 131 for (auto& currValue : toCSSValueList(inValue)) {
134 if (currValue->isURIValue()) { 132 if (currValue->isURIValue()) {
135 countFilterUse(FilterOperation::REFERENCE, state.document()); 133 countFilterUse(FilterOperation::REFERENCE, state.document());
136 134
137 const CSSURIValue& urlValue = toCSSURIValue(*currValue); 135 const CSSURIValue& urlValue = toCSSURIValue(*currValue);
138 SVGURLReferenceResolver resolver(urlValue.value(), state.document()); 136 SVGElementProxy& elementProxy =
139 ReferenceFilterOperation* operation = ReferenceFilterOperation::create( 137 state.elementStyleResources().cachedOrPendingFromValue(urlValue);
140 urlValue.value(), resolver.fragmentIdentifier()); 138 operations.operations().append(
141 if (!resolver.isLocal()) { 139 ReferenceFilterOperation::create(urlValue.value(), elementProxy));
142 if (!urlValue.loadRequested())
143 state.elementStyleResources().addPendingSVGDocument(operation,
144 &urlValue);
145 else if (urlValue.cachedDocument())
146 ReferenceFilterBuilder::setDocumentResourceReference(
147 operation,
148 new DocumentResourceReference(urlValue.cachedDocument()));
149 }
150 operations.operations().append(operation);
151 continue; 140 continue;
152 } 141 }
153 142
154 const CSSFunctionValue* filterValue = toCSSFunctionValue(currValue.get()); 143 const CSSFunctionValue* filterValue = toCSSFunctionValue(currValue.get());
155 FilterOperation::OperationType operationType = 144 FilterOperation::OperationType operationType =
156 filterOperationForType(filterValue->functionType()); 145 filterOperationForType(filterValue->functionType());
157 countFilterUse(operationType, state.document()); 146 countFilterUse(operationType, state.document());
158 DCHECK_LE(filterValue->length(), 1u); 147 DCHECK_LE(filterValue->length(), 1u);
159 148
160 const CSSPrimitiveValue* firstValue = 149 const CSSPrimitiveValue* firstValue =
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 default: 217 default:
229 ASSERT_NOT_REACHED(); 218 ASSERT_NOT_REACHED();
230 break; 219 break;
231 } 220 }
232 } 221 }
233 222
234 return operations; 223 return operations;
235 } 224 }
236 225
237 } // namespace blink 226 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/resolver/ElementStyleResources.cpp ('k') | third_party/WebKit/Source/core/dom/Document.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698