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

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

Issue 2174833002: Make fragment-only URLs always be document-local references (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove isExternal...; add additional test 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
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 17 matching lines...) Expand all
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/CSSURIValue.h" 34 #include "core/css/CSSURIValue.h"
35 #include "core/css/resolver/StyleResolverState.h" 35 #include "core/css/resolver/StyleResolverState.h"
36 #include "core/frame/UseCounter.h" 36 #include "core/frame/UseCounter.h"
37 #include "core/layout/svg/ReferenceFilterBuilder.h" 37 #include "core/layout/svg/ReferenceFilterBuilder.h"
38 #include "core/svg/SVGURIReference.h"
38 39
39 namespace blink { 40 namespace blink {
40 41
41 FilterOperation::OperationType FilterOperationResolver::filterOperationForType(C SSValueID type) 42 FilterOperation::OperationType FilterOperationResolver::filterOperationForType(C SSValueID type)
42 { 43 {
43 switch (type) { 44 switch (type) {
44 case CSSValueGrayscale: 45 case CSSValueGrayscale:
45 return FilterOperation::GRAYSCALE; 46 return FilterOperation::GRAYSCALE;
46 case CSSValueSepia: 47 case CSSValueSepia:
47 return FilterOperation::SEPIA; 48 return FilterOperation::SEPIA;
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 ASSERT(toCSSPrimitiveValue(inValue).getValueID() == CSSValueNone); 124 ASSERT(toCSSPrimitiveValue(inValue).getValueID() == CSSValueNone);
124 return operations; 125 return operations;
125 } 126 }
126 127
127 const CSSToLengthConversionData& conversionData = state.cssToLengthConversio nData(); 128 const CSSToLengthConversionData& conversionData = state.cssToLengthConversio nData();
128 for (auto& currValue : toCSSValueList(inValue)) { 129 for (auto& currValue : toCSSValueList(inValue)) {
129 if (currValue->isURIValue()) { 130 if (currValue->isURIValue()) {
130 countFilterUse(FilterOperation::REFERENCE, state.document()); 131 countFilterUse(FilterOperation::REFERENCE, state.document());
131 132
132 const CSSURIValue& urlValue = toCSSURIValue(*currValue); 133 const CSSURIValue& urlValue = toCSSURIValue(*currValue);
133 KURL url = state.document().completeURL(urlValue.url()); 134 SVGURLReferenceResolver resolver(urlValue.value(), state.document()) ;
134 135 ReferenceFilterOperation* operation = ReferenceFilterOperation::crea te(urlValue.value(), resolver.fragmentIdentifier());
135 ReferenceFilterOperation* operation = ReferenceFilterOperation::crea te(urlValue.url(), AtomicString(url.fragmentIdentifier())); 136 if (!resolver.isLocal()) {
136 if (!equalIgnoringFragmentIdentifier(url, state.document().url())) {
137 if (!urlValue.loadRequested()) 137 if (!urlValue.loadRequested())
138 state.elementStyleResources().addPendingSVGDocument(operatio n, &urlValue); 138 state.elementStyleResources().addPendingSVGDocument(operatio n, &urlValue);
139 else if (urlValue.cachedDocument()) 139 else if (urlValue.cachedDocument())
140 ReferenceFilterBuilder::setDocumentResourceReference(operati on, new DocumentResourceReference(urlValue.cachedDocument())); 140 ReferenceFilterBuilder::setDocumentResourceReference(operati on, new DocumentResourceReference(urlValue.cachedDocument()));
141 } 141 }
142 operations.operations().append(operation); 142 operations.operations().append(operation);
143 continue; 143 continue;
144 } 144 }
145 145
146 const CSSFunctionValue* filterValue = toCSSFunctionValue(currValue.get() ); 146 const CSSFunctionValue* filterValue = toCSSFunctionValue(currValue.get() );
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 default: 206 default:
207 ASSERT_NOT_REACHED(); 207 ASSERT_NOT_REACHED();
208 break; 208 break;
209 } 209 }
210 } 210 }
211 211
212 return operations; 212 return operations;
213 } 213 }
214 214
215 } // namespace blink 215 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698