OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> |
3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> |
4 * Copyright (C) 2005 Oliver Hunt <oliver@nerget.com> | 4 * Copyright (C) 2005 Oliver Hunt <oliver@nerget.com> |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 visitor->trace(m_specularConstant); | 50 visitor->trace(m_specularConstant); |
51 visitor->trace(m_specularExponent); | 51 visitor->trace(m_specularExponent); |
52 visitor->trace(m_surfaceScale); | 52 visitor->trace(m_surfaceScale); |
53 visitor->trace(m_kernelUnitLength); | 53 visitor->trace(m_kernelUnitLength); |
54 visitor->trace(m_in1); | 54 visitor->trace(m_in1); |
55 SVGFilterPrimitiveStandardAttributes::trace(visitor); | 55 SVGFilterPrimitiveStandardAttributes::trace(visitor); |
56 } | 56 } |
57 | 57 |
58 DEFINE_NODE_FACTORY(SVGFESpecularLightingElement) | 58 DEFINE_NODE_FACTORY(SVGFESpecularLightingElement) |
59 | 59 |
60 bool SVGFESpecularLightingElement::isSupportedAttribute(const QualifiedName& att
rName) | |
61 { | |
62 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | |
63 if (supportedAttributes.isEmpty()) { | |
64 supportedAttributes.add(SVGNames::inAttr); | |
65 supportedAttributes.add(SVGNames::specularConstantAttr); | |
66 supportedAttributes.add(SVGNames::specularExponentAttr); | |
67 supportedAttributes.add(SVGNames::surfaceScaleAttr); | |
68 supportedAttributes.add(SVGNames::kernelUnitLengthAttr); | |
69 } | |
70 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | |
71 } | |
72 | |
73 bool SVGFESpecularLightingElement::setFilterEffectAttribute(FilterEffect* effect
, const QualifiedName& attrName) | 60 bool SVGFESpecularLightingElement::setFilterEffectAttribute(FilterEffect* effect
, const QualifiedName& attrName) |
74 { | 61 { |
75 FESpecularLighting* specularLighting = static_cast<FESpecularLighting*>(effe
ct); | 62 FESpecularLighting* specularLighting = static_cast<FESpecularLighting*>(effe
ct); |
76 | 63 |
77 if (attrName == SVGNames::lighting_colorAttr) { | 64 if (attrName == SVGNames::lighting_colorAttr) { |
78 LayoutObject* renderer = this->layoutObject(); | 65 LayoutObject* renderer = this->layoutObject(); |
79 ASSERT(renderer); | 66 ASSERT(renderer); |
80 ASSERT(renderer->style()); | 67 ASSERT(renderer->style()); |
81 return specularLighting->setLightingColor(renderer->style()->svgStyle().
lightingColor()); | 68 return specularLighting->setLightingColor(renderer->style()->svgStyle().
lightingColor()); |
82 } | 69 } |
(...skipping 27 matching lines...) Expand all Loading... |
110 return lightSource->setSpecularExponent(lightElement->specularExponent()
->currentValue()->value()); | 97 return lightSource->setSpecularExponent(lightElement->specularExponent()
->currentValue()->value()); |
111 if (attrName == SVGNames::limitingConeAngleAttr) | 98 if (attrName == SVGNames::limitingConeAngleAttr) |
112 return lightSource->setLimitingConeAngle(lightElement->limitingConeAngle
()->currentValue()->value()); | 99 return lightSource->setLimitingConeAngle(lightElement->limitingConeAngle
()->currentValue()->value()); |
113 | 100 |
114 ASSERT_NOT_REACHED(); | 101 ASSERT_NOT_REACHED(); |
115 return false; | 102 return false; |
116 } | 103 } |
117 | 104 |
118 void SVGFESpecularLightingElement::svgAttributeChanged(const QualifiedName& attr
Name) | 105 void SVGFESpecularLightingElement::svgAttributeChanged(const QualifiedName& attr
Name) |
119 { | 106 { |
120 if (!isSupportedAttribute(attrName)) { | |
121 SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName); | |
122 return; | |
123 } | |
124 | |
125 SVGElement::InvalidationGuard invalidationGuard(this); | |
126 | |
127 if (attrName == SVGNames::surfaceScaleAttr | 107 if (attrName == SVGNames::surfaceScaleAttr |
128 || attrName == SVGNames::specularConstantAttr | 108 || attrName == SVGNames::specularConstantAttr |
129 || attrName == SVGNames::specularExponentAttr | 109 || attrName == SVGNames::specularExponentAttr |
130 || attrName == SVGNames::kernelUnitLengthAttr) { | 110 || attrName == SVGNames::kernelUnitLengthAttr) { |
| 111 SVGElement::InvalidationGuard invalidationGuard(this); |
131 primitiveAttributeChanged(attrName); | 112 primitiveAttributeChanged(attrName); |
132 return; | 113 return; |
133 } | 114 } |
134 | 115 |
135 if (attrName == SVGNames::inAttr) { | 116 if (attrName == SVGNames::inAttr) { |
| 117 SVGElement::InvalidationGuard invalidationGuard(this); |
136 invalidate(); | 118 invalidate(); |
137 return; | 119 return; |
138 } | 120 } |
139 | 121 |
140 ASSERT_NOT_REACHED(); | 122 SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName); |
141 } | 123 } |
142 | 124 |
143 void SVGFESpecularLightingElement::lightElementAttributeChanged(const SVGFELight
Element* lightElement, const QualifiedName& attrName) | 125 void SVGFESpecularLightingElement::lightElementAttributeChanged(const SVGFELight
Element* lightElement, const QualifiedName& attrName) |
144 { | 126 { |
145 if (SVGFELightElement::findLightElement(*this) != lightElement) | 127 if (SVGFELightElement::findLightElement(*this) != lightElement) |
146 return; | 128 return; |
147 | 129 |
148 // The light element has different attribute names so attrName can identify
the requested attribute. | 130 // The light element has different attribute names so attrName can identify
the requested attribute. |
149 primitiveAttributeChanged(attrName); | 131 primitiveAttributeChanged(attrName); |
150 } | 132 } |
(...skipping 17 matching lines...) Expand all Loading... |
168 Color color = renderer->style()->svgStyle().lightingColor(); | 150 Color color = renderer->style()->svgStyle().lightingColor(); |
169 | 151 |
170 RefPtr<LightSource> lightSource = lightNode->lightSource(filter); | 152 RefPtr<LightSource> lightSource = lightNode->lightSource(filter); |
171 RefPtrWillBeRawPtr<FilterEffect> effect = FESpecularLighting::create(filter,
color, m_surfaceScale->currentValue()->value(), m_specularConstant->currentValu
e()->value(), | 153 RefPtrWillBeRawPtr<FilterEffect> effect = FESpecularLighting::create(filter,
color, m_surfaceScale->currentValue()->value(), m_specularConstant->currentValu
e()->value(), |
172 m_specularExponent->currentValue()->value(), kernelUnitLengthX()->curren
tValue()->value(), kernelUnitLengthY()->currentValue()->value(), lightSource.rel
ease()); | 154 m_specularExponent->currentValue()->value(), kernelUnitLengthX()->curren
tValue()->value(), kernelUnitLengthY()->currentValue()->value(), lightSource.rel
ease()); |
173 effect->inputEffects().append(input1); | 155 effect->inputEffects().append(input1); |
174 return effect.release(); | 156 return effect.release(); |
175 } | 157 } |
176 | 158 |
177 } // namespace blink | 159 } // namespace blink |
OLD | NEW |