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.
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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 FilterOperations operations; | 121 FilterOperations operations; |
122 | 122 |
123 if (inValue.isPrimitiveValue()) { | 123 if (inValue.isPrimitiveValue()) { |
124 ASSERT(toCSSPrimitiveValue(inValue).getValueID() == CSSValueNone); | 124 ASSERT(toCSSPrimitiveValue(inValue).getValueID() == CSSValueNone); |
125 return operations; | 125 return operations; |
126 } | 126 } |
127 | 127 |
128 const CSSToLengthConversionData& conversionData = state.cssToLengthConversio
nData(); | 128 const CSSToLengthConversionData& conversionData = state.cssToLengthConversio
nData(); |
129 for (auto& currValue : toCSSValueList(inValue)) { | 129 for (auto& currValue : toCSSValueList(inValue)) { |
130 if (currValue->isURIValue()) { | 130 if (currValue->isURIValue()) { |
131 countFilterUse(FilterOperation::REFERENCE, state.document()); | 131 if (state.hasDocument()) |
| 132 countFilterUse(FilterOperation::REFERENCE, state.document()); |
132 | 133 |
133 const CSSURIValue& urlValue = toCSSURIValue(*currValue); | 134 const CSSURIValue& urlValue = toCSSURIValue(*currValue); |
134 SVGURLReferenceResolver resolver(urlValue.value(), state.document())
; | 135 SVGURLReferenceResolver resolver(urlValue.value(), state.document())
; |
135 ReferenceFilterOperation* operation = ReferenceFilterOperation::crea
te(urlValue.value(), resolver.fragmentIdentifier()); | 136 ReferenceFilterOperation* operation = ReferenceFilterOperation::crea
te(urlValue.value(), resolver.fragmentIdentifier()); |
136 if (!resolver.isLocal()) { | 137 if (!resolver.isLocal()) { |
137 if (!urlValue.loadRequested()) | 138 if (!urlValue.loadRequested()) |
138 state.elementStyleResources().addPendingSVGDocument(operatio
n, &urlValue); | 139 state.elementStyleResources().addPendingSVGDocument(operatio
n, &urlValue); |
139 else if (urlValue.cachedDocument()) | 140 else if (urlValue.cachedDocument()) |
140 ReferenceFilterBuilder::setDocumentResourceReference(operati
on, new DocumentResourceReference(urlValue.cachedDocument())); | 141 ReferenceFilterBuilder::setDocumentResourceReference(operati
on, new DocumentResourceReference(urlValue.cachedDocument())); |
141 } | 142 } |
142 operations.operations().append(operation); | 143 operations.operations().append(operation); |
143 continue; | 144 continue; |
144 } | 145 } |
145 | 146 |
146 const CSSFunctionValue* filterValue = toCSSFunctionValue(currValue.get()
); | 147 const CSSFunctionValue* filterValue = toCSSFunctionValue(currValue.get()
); |
147 FilterOperation::OperationType operationType = filterOperationForType(fi
lterValue->functionType()); | 148 FilterOperation::OperationType operationType = filterOperationForType(fi
lterValue->functionType()); |
148 countFilterUse(operationType, state.document()); | 149 if (state.hasDocument()) |
| 150 countFilterUse(operationType, state.document()); |
149 DCHECK_LE(filterValue->length(), 1u); | 151 DCHECK_LE(filterValue->length(), 1u); |
150 | 152 |
151 const CSSPrimitiveValue* firstValue = filterValue->length() && filterVal
ue->item(0).isPrimitiveValue() ? &toCSSPrimitiveValue(filterValue->item(0)) : nu
llptr; | 153 const CSSPrimitiveValue* firstValue = filterValue->length() && filterVal
ue->item(0).isPrimitiveValue() ? &toCSSPrimitiveValue(filterValue->item(0)) : nu
llptr; |
152 switch (filterValue->functionType()) { | 154 switch (filterValue->functionType()) { |
153 case CSSValueGrayscale: | 155 case CSSValueGrayscale: |
154 case CSSValueSepia: | 156 case CSSValueSepia: |
155 case CSSValueSaturate: { | 157 case CSSValueSaturate: { |
156 double amount = 1; | 158 double amount = 1; |
157 if (filterValue->length() == 1) { | 159 if (filterValue->length() == 1) { |
158 amount = firstValue->getDoubleValue(); | 160 amount = firstValue->getDoubleValue(); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 default: | 208 default: |
207 ASSERT_NOT_REACHED(); | 209 ASSERT_NOT_REACHED(); |
208 break; | 210 break; |
209 } | 211 } |
210 } | 212 } |
211 | 213 |
212 return operations; | 214 return operations; |
213 } | 215 } |
214 | 216 |
215 } // namespace blink | 217 } // namespace blink |
OLD | NEW |