Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 Loading... | |
| 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 = |
|
pdr.
2016/10/20 03:11:05
Is the CSSURIValue lifetime guaranteed to last as
fs
2016/10/20 11:28:00
Both have strong references, so technically speaki
| |
| 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 Loading... | |
| 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 |
| OLD | NEW |