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

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

Issue 2167733002: Simplify "is external URL" in filter operations resolving (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 | « no previous file | 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) 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. All rights reserved. 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org>
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
(...skipping 16 matching lines...) Expand all
27 */ 27 */
28 28
29 #include "core/css/resolver/FilterOperationResolver.h" 29 #include "core/css/resolver/FilterOperationResolver.h"
30 30
31 #include "core/css/CSSFunctionValue.h" 31 #include "core/css/CSSFunctionValue.h"
32 #include "core/css/CSSPrimitiveValueMappings.h" 32 #include "core/css/CSSPrimitiveValueMappings.h"
33 #include "core/css/CSSShadowValue.h" 33 #include "core/css/CSSShadowValue.h"
34 #include "core/css/resolver/StyleResolverState.h" 34 #include "core/css/resolver/StyleResolverState.h"
35 #include "core/frame/UseCounter.h" 35 #include "core/frame/UseCounter.h"
36 #include "core/layout/svg/ReferenceFilterBuilder.h" 36 #include "core/layout/svg/ReferenceFilterBuilder.h"
37 #include "core/svg/SVGElement.h"
38 #include "core/svg/SVGURIReference.h"
39 37
40 namespace blink { 38 namespace blink {
41 39
42 FilterOperation::OperationType FilterOperationResolver::filterOperationForType(C SSValueID type) 40 FilterOperation::OperationType FilterOperationResolver::filterOperationForType(C SSValueID type)
43 { 41 {
44 switch (type) { 42 switch (type) {
45 case CSSValueUrl: 43 case CSSValueUrl:
46 return FilterOperation::REFERENCE; 44 return FilterOperation::REFERENCE;
47 case CSSValueGrayscale: 45 case CSSValueGrayscale:
48 return FilterOperation::GRAYSCALE; 46 return FilterOperation::GRAYSCALE;
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 const CSSFunctionValue* filterValue = toCSSFunctionValue(currValue.get() ); 130 const CSSFunctionValue* filterValue = toCSSFunctionValue(currValue.get() );
133 FilterOperation::OperationType operationType = filterOperationForType(fi lterValue->functionType()); 131 FilterOperation::OperationType operationType = filterOperationForType(fi lterValue->functionType());
134 countFilterUse(operationType, state.document()); 132 countFilterUse(operationType, state.document());
135 ASSERT(filterValue->length() <= 1); 133 ASSERT(filterValue->length() <= 1);
136 134
137 if (operationType == FilterOperation::REFERENCE) { 135 if (operationType == FilterOperation::REFERENCE) {
138 const CSSSVGDocumentValue& svgDocumentValue = toCSSSVGDocumentValue( filterValue->item(0)); 136 const CSSSVGDocumentValue& svgDocumentValue = toCSSSVGDocumentValue( filterValue->item(0));
139 KURL url = state.document().completeURL(svgDocumentValue.url()); 137 KURL url = state.document().completeURL(svgDocumentValue.url());
140 138
141 ReferenceFilterOperation* operation = ReferenceFilterOperation::crea te(svgDocumentValue.url(), AtomicString(url.fragmentIdentifier())); 139 ReferenceFilterOperation* operation = ReferenceFilterOperation::crea te(svgDocumentValue.url(), AtomicString(url.fragmentIdentifier()));
142 if (SVGURIReference::isExternalURIReference(svgDocumentValue.url(), state.document())) { 140 if (!equalIgnoringFragmentIdentifier(url, state.document().url())) {
143 if (!svgDocumentValue.loadRequested()) 141 if (!svgDocumentValue.loadRequested())
144 state.elementStyleResources().addPendingSVGDocument(operatio n, &svgDocumentValue); 142 state.elementStyleResources().addPendingSVGDocument(operatio n, &svgDocumentValue);
145 else if (svgDocumentValue.cachedSVGDocument()) 143 else if (svgDocumentValue.cachedSVGDocument())
146 ReferenceFilterBuilder::setDocumentResourceReference(operati on, new DocumentResourceReference(svgDocumentValue.cachedSVGDocument())); 144 ReferenceFilterBuilder::setDocumentResourceReference(operati on, new DocumentResourceReference(svgDocumentValue.cachedSVGDocument()));
147 } 145 }
148 operations.operations().append(operation); 146 operations.operations().append(operation);
149 continue; 147 continue;
150 } 148 }
151 149
152 const CSSPrimitiveValue* firstValue = filterValue->length() && filterVal ue->item(0).isPrimitiveValue() ? &toCSSPrimitiveValue(filterValue->item(0)) : nu llptr; 150 const CSSPrimitiveValue* firstValue = filterValue->length() && filterVal ue->item(0).isPrimitiveValue() ? &toCSSPrimitiveValue(filterValue->item(0)) : nu llptr;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 default: 205 default:
208 ASSERT_NOT_REACHED(); 206 ASSERT_NOT_REACHED();
209 break; 207 break;
210 } 208 }
211 } 209 }
212 210
213 return operations; 211 return operations;
214 } 212 }
215 213
216 } // namespace blink 214 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698