| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2005 Oliver Hunt <ojh16@student.canterbury.ac.nz> | 2 * Copyright (C) 2005 Oliver Hunt <ojh16@student.canterbury.ac.nz> |
| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 supportedAttributes.add(SVGNames::diffuseConstantAttr); | 52 supportedAttributes.add(SVGNames::diffuseConstantAttr); |
| 53 supportedAttributes.add(SVGNames::surfaceScaleAttr); | 53 supportedAttributes.add(SVGNames::surfaceScaleAttr); |
| 54 supportedAttributes.add(SVGNames::kernelUnitLengthAttr); | 54 supportedAttributes.add(SVGNames::kernelUnitLengthAttr); |
| 55 supportedAttributes.add(SVGNames::lighting_colorAttr); // Even though it
's a SVG-CSS property, we override its handling here. | 55 supportedAttributes.add(SVGNames::lighting_colorAttr); // Even though it
's a SVG-CSS property, we override its handling here. |
| 56 } | 56 } |
| 57 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | 57 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); |
| 58 } | 58 } |
| 59 | 59 |
| 60 void SVGFEDiffuseLightingElement::parseAttribute(const QualifiedName& name, cons
t AtomicString& value) | 60 void SVGFEDiffuseLightingElement::parseAttribute(const QualifiedName& name, cons
t AtomicString& value) |
| 61 { | 61 { |
| 62 if (!isSupportedAttribute(name) || name == SVGNames::lighting_colorAttr) { | 62 parseAttributeNew(name, value); |
| 63 SVGFilterPrimitiveStandardAttributes::parseAttribute(name, value); | |
| 64 return; | |
| 65 } | |
| 66 | |
| 67 SVGParsingError parseError = NoError; | |
| 68 | |
| 69 if (name == SVGNames::inAttr) | |
| 70 m_in1->setBaseValueAsString(value, parseError); | |
| 71 else if (name == SVGNames::diffuseConstantAttr) | |
| 72 m_diffuseConstant->setBaseValueAsString(value, parseError); | |
| 73 else if (name == SVGNames::surfaceScaleAttr) | |
| 74 m_surfaceScale->setBaseValueAsString(value, parseError); | |
| 75 else if (name == SVGNames::kernelUnitLengthAttr) | |
| 76 m_kernelUnitLength->setBaseValueAsString(value, parseError); | |
| 77 else | |
| 78 ASSERT_NOT_REACHED(); | |
| 79 | |
| 80 reportAttributeParsingError(parseError, name, value); | |
| 81 } | 63 } |
| 82 | 64 |
| 83 bool SVGFEDiffuseLightingElement::setFilterEffectAttribute(FilterEffect* effect,
const QualifiedName& attrName) | 65 bool SVGFEDiffuseLightingElement::setFilterEffectAttribute(FilterEffect* effect,
const QualifiedName& attrName) |
| 84 { | 66 { |
| 85 FEDiffuseLighting* diffuseLighting = static_cast<FEDiffuseLighting*>(effect)
; | 67 FEDiffuseLighting* diffuseLighting = static_cast<FEDiffuseLighting*>(effect)
; |
| 86 | 68 |
| 87 if (attrName == SVGNames::lighting_colorAttr) { | 69 if (attrName == SVGNames::lighting_colorAttr) { |
| 88 RenderObject* renderer = this->renderer(); | 70 RenderObject* renderer = this->renderer(); |
| 89 ASSERT(renderer); | 71 ASSERT(renderer); |
| 90 ASSERT(renderer->style()); | 72 ASSERT(renderer->style()); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 Color color = renderer->style()->svgStyle().lightingColor(); | 153 Color color = renderer->style()->svgStyle().lightingColor(); |
| 172 | 154 |
| 173 RefPtr<LightSource> lightSource = lightNode->lightSource(filter); | 155 RefPtr<LightSource> lightSource = lightNode->lightSource(filter); |
| 174 RefPtr<FilterEffect> effect = FEDiffuseLighting::create(filter, color, m_sur
faceScale->currentValue()->value(), m_diffuseConstant->currentValue()->value(), | 156 RefPtr<FilterEffect> effect = FEDiffuseLighting::create(filter, color, m_sur
faceScale->currentValue()->value(), m_diffuseConstant->currentValue()->value(), |
| 175 kernelUnitLengthX()->currentValue()->value(), kernelUnitLengthY()->curre
ntValue()->value(), lightSource.release()); | 157 kernelUnitLengthX()->currentValue()->value(), kernelUnitLengthY()->curre
ntValue()->value(), lightSource.release()); |
| 176 effect->inputEffects().append(input1); | 158 effect->inputEffects().append(input1); |
| 177 return effect.release(); | 159 return effect.release(); |
| 178 } | 160 } |
| 179 | 161 |
| 180 } // namespace blink | 162 } // namespace blink |
| OLD | NEW |