| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> | 2 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> |
| 3 * | 3 * |
| 4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
| 5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
| 6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
| 7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
| 8 * | 8 * |
| 9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 if (name == SVGNames::inAttr) { | 128 if (name == SVGNames::inAttr) { |
| 129 setIn1BaseValue(value); | 129 setIn1BaseValue(value); |
| 130 return; | 130 return; |
| 131 } | 131 } |
| 132 | 132 |
| 133 if (name == SVGNames::orderAttr) { | 133 if (name == SVGNames::orderAttr) { |
| 134 float x, y; | 134 float x, y; |
| 135 if (parseNumberOptionalNumber(value, x, y) && x >= 1 && y >= 1) { | 135 if (parseNumberOptionalNumber(value, x, y) && x >= 1 && y >= 1) { |
| 136 setOrderXBaseValue(x); | 136 setOrderXBaseValue(x); |
| 137 setOrderYBaseValue(y); | 137 setOrderYBaseValue(y); |
| 138 } else | 138 } else { |
| 139 document()->accessSVGExtensions()->reportWarning( | 139 document().accessSVGExtensions()->reportWarning( |
| 140 "feConvolveMatrix: problem parsing order=\"" + value | 140 "feConvolveMatrix: problem parsing order=\"" + value |
| 141 + "\". Filtered element will not be displayed."); | 141 + "\". Filtered element will not be displayed."); |
| 142 } |
| 142 return; | 143 return; |
| 143 } | 144 } |
| 144 | 145 |
| 145 if (name == SVGNames::edgeModeAttr) { | 146 if (name == SVGNames::edgeModeAttr) { |
| 146 EdgeModeType propertyValue = SVGPropertyTraits<EdgeModeType>::fromString
(value); | 147 EdgeModeType propertyValue = SVGPropertyTraits<EdgeModeType>::fromString
(value); |
| 147 if (propertyValue > 0) | 148 if (propertyValue > 0) |
| 148 setEdgeModeBaseValue(propertyValue); | 149 setEdgeModeBaseValue(propertyValue); |
| 149 else | 150 else |
| 150 document()->accessSVGExtensions()->reportWarning( | 151 document().accessSVGExtensions()->reportWarning( |
| 151 "feConvolveMatrix: problem parsing edgeMode=\"" + value | 152 "feConvolveMatrix: problem parsing edgeMode=\"" + value |
| 152 + "\". Filtered element will not be displayed."); | 153 + "\". Filtered element will not be displayed."); |
| 153 return; | 154 return; |
| 154 } | 155 } |
| 155 | 156 |
| 156 if (name == SVGNames::kernelMatrixAttr) { | 157 if (name == SVGNames::kernelMatrixAttr) { |
| 157 SVGNumberList newList; | 158 SVGNumberList newList; |
| 158 newList.parse(value); | 159 newList.parse(value); |
| 159 detachAnimatedKernelMatrixListWrappers(newList.size()); | 160 detachAnimatedKernelMatrixListWrappers(newList.size()); |
| 160 setKernelMatrixBaseValue(newList); | 161 setKernelMatrixBaseValue(newList); |
| 161 return; | 162 return; |
| 162 } | 163 } |
| 163 | 164 |
| 164 if (name == SVGNames::divisorAttr) { | 165 if (name == SVGNames::divisorAttr) { |
| 165 float divisor = value.toFloat(); | 166 float divisor = value.toFloat(); |
| 166 if (divisor) | 167 if (divisor) |
| 167 setDivisorBaseValue(divisor); | 168 setDivisorBaseValue(divisor); |
| 168 else | 169 else |
| 169 document()->accessSVGExtensions()->reportWarning( | 170 document().accessSVGExtensions()->reportWarning( |
| 170 "feConvolveMatrix: problem parsing divisor=\"" + value | 171 "feConvolveMatrix: problem parsing divisor=\"" + value |
| 171 + "\". Filtered element will not be displayed."); | 172 + "\". Filtered element will not be displayed."); |
| 172 return; | 173 return; |
| 173 } | 174 } |
| 174 | 175 |
| 175 if (name == SVGNames::biasAttr) { | 176 if (name == SVGNames::biasAttr) { |
| 176 setBiasBaseValue(value.toFloat()); | 177 setBiasBaseValue(value.toFloat()); |
| 177 return; | 178 return; |
| 178 } | 179 } |
| 179 | 180 |
| 180 if (name == SVGNames::targetXAttr) { | 181 if (name == SVGNames::targetXAttr) { |
| 181 setTargetXBaseValue(value.string().toUIntStrict()); | 182 setTargetXBaseValue(value.string().toUIntStrict()); |
| 182 return; | 183 return; |
| 183 } | 184 } |
| 184 | 185 |
| 185 if (name == SVGNames::targetYAttr) { | 186 if (name == SVGNames::targetYAttr) { |
| 186 setTargetYBaseValue(value.string().toUIntStrict()); | 187 setTargetYBaseValue(value.string().toUIntStrict()); |
| 187 return; | 188 return; |
| 188 } | 189 } |
| 189 | 190 |
| 190 if (name == SVGNames::kernelUnitLengthAttr) { | 191 if (name == SVGNames::kernelUnitLengthAttr) { |
| 191 float x, y; | 192 float x, y; |
| 192 if (parseNumberOptionalNumber(value, x, y) && x > 0 && y > 0) { | 193 if (parseNumberOptionalNumber(value, x, y) && x > 0 && y > 0) { |
| 193 setKernelUnitLengthXBaseValue(x); | 194 setKernelUnitLengthXBaseValue(x); |
| 194 setKernelUnitLengthYBaseValue(y); | 195 setKernelUnitLengthYBaseValue(y); |
| 195 } else | 196 } else { |
| 196 document()->accessSVGExtensions()->reportWarning( | 197 document().accessSVGExtensions()->reportWarning( |
| 197 "feConvolveMatrix: problem parsing kernelUnitLength=\"" + value | 198 "feConvolveMatrix: problem parsing kernelUnitLength=\"" + value |
| 198 + "\". Filtered element will not be displayed."); | 199 + "\". Filtered element will not be displayed."); |
| 200 } |
| 199 return; | 201 return; |
| 200 } | 202 } |
| 201 | 203 |
| 202 if (name == SVGNames::preserveAlphaAttr) { | 204 if (name == SVGNames::preserveAlphaAttr) { |
| 203 if (value == "true") | 205 if (value == "true") |
| 204 setPreserveAlphaBaseValue(true); | 206 setPreserveAlphaBaseValue(true); |
| 205 else if (value == "false") | 207 else if (value == "false") |
| 206 setPreserveAlphaBaseValue(false); | 208 setPreserveAlphaBaseValue(false); |
| 207 else | 209 else |
| 208 document()->accessSVGExtensions()->reportWarning( | 210 document().accessSVGExtensions()->reportWarning( |
| 209 "feConvolveMatrix: problem parsing preserveAlphaAttr=\"" + value | 211 "feConvolveMatrix: problem parsing preserveAlphaAttr=\"" + value |
| 210 + "\". Filtered element will not be displayed."); | 212 + "\". Filtered element will not be displayed."); |
| 211 return; | 213 return; |
| 212 } | 214 } |
| 213 | 215 |
| 214 ASSERT_NOT_REACHED(); | 216 ASSERT_NOT_REACHED(); |
| 215 } | 217 } |
| 216 | 218 |
| 217 bool SVGFEConvolveMatrixElement::setFilterEffectAttribute(FilterEffect* effect,
const QualifiedName& attrName) | 219 bool SVGFEConvolveMatrixElement::setFilterEffectAttribute(FilterEffect* effect,
const QualifiedName& attrName) |
| 218 { | 220 { |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 | 339 |
| 338 RefPtr<FilterEffect> effect = FEConvolveMatrix::create(filter, | 340 RefPtr<FilterEffect> effect = FEConvolveMatrix::create(filter, |
| 339 IntSize(orderXValue, orderYValue), divisorValue, | 341 IntSize(orderXValue, orderYValue), divisorValue, |
| 340 biasCurrentValue(), IntPoint(targetXValue, targetYValue), ed
geModeCurrentValue(), | 342 biasCurrentValue(), IntPoint(targetXValue, targetYValue), ed
geModeCurrentValue(), |
| 341 FloatPoint(kernelUnitLengthXValue, kernelUnitLengthYValue),
preserveAlphaCurrentValue(), kernelMatrix.toFloatVector()); | 343 FloatPoint(kernelUnitLengthXValue, kernelUnitLengthYValue),
preserveAlphaCurrentValue(), kernelMatrix.toFloatVector()); |
| 342 effect->inputEffects().append(input1); | 344 effect->inputEffects().append(input1); |
| 343 return effect.release(); | 345 return effect.release(); |
| 344 } | 346 } |
| 345 | 347 |
| 346 } // namespace WebCore | 348 } // namespace WebCore |
| OLD | NEW |