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 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 DEFINE_TRACE(SVGFEColorMatrixElement) | 54 DEFINE_TRACE(SVGFEColorMatrixElement) |
55 { | 55 { |
56 visitor->trace(m_values); | 56 visitor->trace(m_values); |
57 visitor->trace(m_in1); | 57 visitor->trace(m_in1); |
58 visitor->trace(m_type); | 58 visitor->trace(m_type); |
59 SVGFilterPrimitiveStandardAttributes::trace(visitor); | 59 SVGFilterPrimitiveStandardAttributes::trace(visitor); |
60 } | 60 } |
61 | 61 |
62 DEFINE_NODE_FACTORY(SVGFEColorMatrixElement) | 62 DEFINE_NODE_FACTORY(SVGFEColorMatrixElement) |
63 | 63 |
64 bool SVGFEColorMatrixElement::isSupportedAttribute(const QualifiedName& attrName
) | |
65 { | |
66 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | |
67 if (supportedAttributes.isEmpty()) { | |
68 supportedAttributes.add(SVGNames::typeAttr); | |
69 supportedAttributes.add(SVGNames::valuesAttr); | |
70 supportedAttributes.add(SVGNames::inAttr); | |
71 } | |
72 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | |
73 } | |
74 | |
75 bool SVGFEColorMatrixElement::setFilterEffectAttribute(FilterEffect* effect, con
st QualifiedName& attrName) | 64 bool SVGFEColorMatrixElement::setFilterEffectAttribute(FilterEffect* effect, con
st QualifiedName& attrName) |
76 { | 65 { |
77 FEColorMatrix* colorMatrix = static_cast<FEColorMatrix*>(effect); | 66 FEColorMatrix* colorMatrix = static_cast<FEColorMatrix*>(effect); |
78 if (attrName == SVGNames::typeAttr) | 67 if (attrName == SVGNames::typeAttr) |
79 return colorMatrix->setType(m_type->currentValue()->enumValue()); | 68 return colorMatrix->setType(m_type->currentValue()->enumValue()); |
80 if (attrName == SVGNames::valuesAttr) | 69 if (attrName == SVGNames::valuesAttr) |
81 return colorMatrix->setValues(m_values->currentValue()->toFloatVector())
; | 70 return colorMatrix->setValues(m_values->currentValue()->toFloatVector())
; |
82 | 71 |
83 ASSERT_NOT_REACHED(); | 72 ASSERT_NOT_REACHED(); |
84 return false; | 73 return false; |
85 } | 74 } |
86 | 75 |
87 void SVGFEColorMatrixElement::svgAttributeChanged(const QualifiedName& attrName) | 76 void SVGFEColorMatrixElement::svgAttributeChanged(const QualifiedName& attrName) |
88 { | 77 { |
89 if (!isSupportedAttribute(attrName)) { | |
90 SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName); | |
91 return; | |
92 } | |
93 | |
94 SVGElement::InvalidationGuard invalidationGuard(this); | |
95 | |
96 if (attrName == SVGNames::typeAttr || attrName == SVGNames::valuesAttr) { | 78 if (attrName == SVGNames::typeAttr || attrName == SVGNames::valuesAttr) { |
| 79 SVGElement::InvalidationGuard invalidationGuard(this); |
97 primitiveAttributeChanged(attrName); | 80 primitiveAttributeChanged(attrName); |
98 return; | 81 return; |
99 } | 82 } |
100 | 83 |
101 if (attrName == SVGNames::inAttr) { | 84 if (attrName == SVGNames::inAttr) { |
| 85 SVGElement::InvalidationGuard invalidationGuard(this); |
102 invalidate(); | 86 invalidate(); |
103 return; | 87 return; |
104 } | 88 } |
105 | 89 |
106 ASSERT_NOT_REACHED(); | 90 SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName); |
107 } | 91 } |
108 | 92 |
109 PassRefPtrWillBeRawPtr<FilterEffect> SVGFEColorMatrixElement::build(SVGFilterBui
lder* filterBuilder, Filter* filter) | 93 PassRefPtrWillBeRawPtr<FilterEffect> SVGFEColorMatrixElement::build(SVGFilterBui
lder* filterBuilder, Filter* filter) |
110 { | 94 { |
111 FilterEffect* input1 = filterBuilder->getEffectById(AtomicString(m_in1->curr
entValue()->value())); | 95 FilterEffect* input1 = filterBuilder->getEffectById(AtomicString(m_in1->curr
entValue()->value())); |
112 | 96 |
113 if (!input1) | 97 if (!input1) |
114 return nullptr; | 98 return nullptr; |
115 | 99 |
116 Vector<float> filterValues; | 100 Vector<float> filterValues; |
(...skipping 26 matching lines...) Expand all Loading... |
143 | 127 |
144 filterValues = values->toFloatVector(); | 128 filterValues = values->toFloatVector(); |
145 } | 129 } |
146 | 130 |
147 RefPtrWillBeRawPtr<FilterEffect> effect = FEColorMatrix::create(filter, filt
erType, filterValues); | 131 RefPtrWillBeRawPtr<FilterEffect> effect = FEColorMatrix::create(filter, filt
erType, filterValues); |
148 effect->inputEffects().append(input1); | 132 effect->inputEffects().append(input1); |
149 return effect.release(); | 133 return effect.release(); |
150 } | 134 } |
151 | 135 |
152 } // namespace blink | 136 } // namespace blink |
OLD | NEW |