| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 { | 46 { |
| 47 visitor->trace(m_diffuseConstant); | 47 visitor->trace(m_diffuseConstant); |
| 48 visitor->trace(m_surfaceScale); | 48 visitor->trace(m_surfaceScale); |
| 49 visitor->trace(m_kernelUnitLength); | 49 visitor->trace(m_kernelUnitLength); |
| 50 visitor->trace(m_in1); | 50 visitor->trace(m_in1); |
| 51 SVGFilterPrimitiveStandardAttributes::trace(visitor); | 51 SVGFilterPrimitiveStandardAttributes::trace(visitor); |
| 52 } | 52 } |
| 53 | 53 |
| 54 DEFINE_NODE_FACTORY(SVGFEDiffuseLightingElement) | 54 DEFINE_NODE_FACTORY(SVGFEDiffuseLightingElement) |
| 55 | 55 |
| 56 bool SVGFEDiffuseLightingElement::isSupportedAttribute(const QualifiedName& attr
Name) | |
| 57 { | |
| 58 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | |
| 59 if (supportedAttributes.isEmpty()) { | |
| 60 supportedAttributes.add(SVGNames::inAttr); | |
| 61 supportedAttributes.add(SVGNames::diffuseConstantAttr); | |
| 62 supportedAttributes.add(SVGNames::surfaceScaleAttr); | |
| 63 supportedAttributes.add(SVGNames::kernelUnitLengthAttr); | |
| 64 supportedAttributes.add(SVGNames::lighting_colorAttr); // Even though it
's a SVG-CSS property, we override its handling here. | |
| 65 } | |
| 66 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | |
| 67 } | |
| 68 | |
| 69 bool SVGFEDiffuseLightingElement::setFilterEffectAttribute(FilterEffect* effect,
const QualifiedName& attrName) | 56 bool SVGFEDiffuseLightingElement::setFilterEffectAttribute(FilterEffect* effect,
const QualifiedName& attrName) |
| 70 { | 57 { |
| 71 FEDiffuseLighting* diffuseLighting = static_cast<FEDiffuseLighting*>(effect)
; | 58 FEDiffuseLighting* diffuseLighting = static_cast<FEDiffuseLighting*>(effect)
; |
| 72 | 59 |
| 73 if (attrName == SVGNames::lighting_colorAttr) { | 60 if (attrName == SVGNames::lighting_colorAttr) { |
| 74 LayoutObject* renderer = this->layoutObject(); | 61 LayoutObject* renderer = this->layoutObject(); |
| 75 ASSERT(renderer); | 62 ASSERT(renderer); |
| 76 ASSERT(renderer->style()); | 63 ASSERT(renderer->style()); |
| 77 return diffuseLighting->setLightingColor(renderer->style()->svgStyle().l
ightingColor()); | 64 return diffuseLighting->setLightingColor(renderer->style()->svgStyle().l
ightingColor()); |
| 78 } | 65 } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 104 return lightSource->setSpecularExponent(lightElement->specularExponent()
->currentValue()->value()); | 91 return lightSource->setSpecularExponent(lightElement->specularExponent()
->currentValue()->value()); |
| 105 if (attrName == SVGNames::limitingConeAngleAttr) | 92 if (attrName == SVGNames::limitingConeAngleAttr) |
| 106 return lightSource->setLimitingConeAngle(lightElement->limitingConeAngle
()->currentValue()->value()); | 93 return lightSource->setLimitingConeAngle(lightElement->limitingConeAngle
()->currentValue()->value()); |
| 107 | 94 |
| 108 ASSERT_NOT_REACHED(); | 95 ASSERT_NOT_REACHED(); |
| 109 return false; | 96 return false; |
| 110 } | 97 } |
| 111 | 98 |
| 112 void SVGFEDiffuseLightingElement::svgAttributeChanged(const QualifiedName& attrN
ame) | 99 void SVGFEDiffuseLightingElement::svgAttributeChanged(const QualifiedName& attrN
ame) |
| 113 { | 100 { |
| 114 if (!isSupportedAttribute(attrName)) { | |
| 115 SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName); | |
| 116 return; | |
| 117 } | |
| 118 | |
| 119 SVGElement::InvalidationGuard invalidationGuard(this); | |
| 120 | |
| 121 if (attrName == SVGNames::surfaceScaleAttr | 101 if (attrName == SVGNames::surfaceScaleAttr |
| 122 || attrName == SVGNames::diffuseConstantAttr | 102 || attrName == SVGNames::diffuseConstantAttr |
| 123 || attrName == SVGNames::kernelUnitLengthAttr | 103 || attrName == SVGNames::kernelUnitLengthAttr |
| 124 || attrName == SVGNames::lighting_colorAttr) { | 104 || attrName == SVGNames::lighting_colorAttr) { |
| 105 SVGElement::InvalidationGuard invalidationGuard(this); |
| 125 primitiveAttributeChanged(attrName); | 106 primitiveAttributeChanged(attrName); |
| 126 return; | 107 return; |
| 127 } | 108 } |
| 128 | 109 |
| 129 if (attrName == SVGNames::inAttr) { | 110 if (attrName == SVGNames::inAttr) { |
| 111 SVGElement::InvalidationGuard invalidationGuard(this); |
| 130 invalidate(); | 112 invalidate(); |
| 131 return; | 113 return; |
| 132 } | 114 } |
| 133 | 115 |
| 134 ASSERT_NOT_REACHED(); | 116 SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName); |
| 135 } | 117 } |
| 136 | 118 |
| 137 void SVGFEDiffuseLightingElement::lightElementAttributeChanged(const SVGFELightE
lement* lightElement, const QualifiedName& attrName) | 119 void SVGFEDiffuseLightingElement::lightElementAttributeChanged(const SVGFELightE
lement* lightElement, const QualifiedName& attrName) |
| 138 { | 120 { |
| 139 if (SVGFELightElement::findLightElement(*this) != lightElement) | 121 if (SVGFELightElement::findLightElement(*this) != lightElement) |
| 140 return; | 122 return; |
| 141 | 123 |
| 142 // The light element has different attribute names. | 124 // The light element has different attribute names. |
| 143 primitiveAttributeChanged(attrName); | 125 primitiveAttributeChanged(attrName); |
| 144 } | 126 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 162 Color color = renderer->style()->svgStyle().lightingColor(); | 144 Color color = renderer->style()->svgStyle().lightingColor(); |
| 163 | 145 |
| 164 RefPtr<LightSource> lightSource = lightNode->lightSource(filter); | 146 RefPtr<LightSource> lightSource = lightNode->lightSource(filter); |
| 165 RefPtrWillBeRawPtr<FilterEffect> effect = FEDiffuseLighting::create(filter,
color, m_surfaceScale->currentValue()->value(), m_diffuseConstant->currentValue(
)->value(), | 147 RefPtrWillBeRawPtr<FilterEffect> effect = FEDiffuseLighting::create(filter,
color, m_surfaceScale->currentValue()->value(), m_diffuseConstant->currentValue(
)->value(), |
| 166 kernelUnitLengthX()->currentValue()->value(), kernelUnitLengthY()->curre
ntValue()->value(), lightSource.release()); | 148 kernelUnitLengthX()->currentValue()->value(), kernelUnitLengthY()->curre
ntValue()->value(), lightSource.release()); |
| 167 effect->inputEffects().append(input1); | 149 effect->inputEffects().append(input1); |
| 168 return effect.release(); | 150 return effect.release(); |
| 169 } | 151 } |
| 170 | 152 |
| 171 } // namespace blink | 153 } // namespace blink |
| OLD | NEW |