| 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 DEFINE_TRACE(SVGFEBlendElement) | 102 DEFINE_TRACE(SVGFEBlendElement) |
| 103 { | 103 { |
| 104 visitor->trace(m_in1); | 104 visitor->trace(m_in1); |
| 105 visitor->trace(m_in2); | 105 visitor->trace(m_in2); |
| 106 visitor->trace(m_mode); | 106 visitor->trace(m_mode); |
| 107 SVGFilterPrimitiveStandardAttributes::trace(visitor); | 107 SVGFilterPrimitiveStandardAttributes::trace(visitor); |
| 108 } | 108 } |
| 109 | 109 |
| 110 DEFINE_NODE_FACTORY(SVGFEBlendElement) | 110 DEFINE_NODE_FACTORY(SVGFEBlendElement) |
| 111 | 111 |
| 112 bool SVGFEBlendElement::isSupportedAttribute(const QualifiedName& attrName) | |
| 113 { | |
| 114 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | |
| 115 if (supportedAttributes.isEmpty()) { | |
| 116 supportedAttributes.add(SVGNames::modeAttr); | |
| 117 supportedAttributes.add(SVGNames::inAttr); | |
| 118 supportedAttributes.add(SVGNames::in2Attr); | |
| 119 } | |
| 120 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | |
| 121 } | |
| 122 | |
| 123 bool SVGFEBlendElement::setFilterEffectAttribute(FilterEffect* effect, const Qua
lifiedName& attrName) | 112 bool SVGFEBlendElement::setFilterEffectAttribute(FilterEffect* effect, const Qua
lifiedName& attrName) |
| 124 { | 113 { |
| 125 FEBlend* blend = static_cast<FEBlend*>(effect); | 114 FEBlend* blend = static_cast<FEBlend*>(effect); |
| 126 if (attrName == SVGNames::modeAttr) | 115 if (attrName == SVGNames::modeAttr) |
| 127 return blend->setBlendMode(toWebBlendMode(m_mode->currentValue()->enumVa
lue())); | 116 return blend->setBlendMode(toWebBlendMode(m_mode->currentValue()->enumVa
lue())); |
| 128 | 117 |
| 129 ASSERT_NOT_REACHED(); | 118 ASSERT_NOT_REACHED(); |
| 130 return false; | 119 return false; |
| 131 } | 120 } |
| 132 | 121 |
| 133 void SVGFEBlendElement::svgAttributeChanged(const QualifiedName& attrName) | 122 void SVGFEBlendElement::svgAttributeChanged(const QualifiedName& attrName) |
| 134 { | 123 { |
| 135 if (!isSupportedAttribute(attrName)) { | |
| 136 SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName); | |
| 137 return; | |
| 138 } | |
| 139 | |
| 140 SVGElement::InvalidationGuard invalidationGuard(this); | |
| 141 | |
| 142 if (attrName == SVGNames::modeAttr) { | 124 if (attrName == SVGNames::modeAttr) { |
| 125 SVGElement::InvalidationGuard invalidationGuard(this); |
| 143 primitiveAttributeChanged(attrName); | 126 primitiveAttributeChanged(attrName); |
| 144 return; | 127 return; |
| 145 } | 128 } |
| 146 | 129 |
| 147 if (attrName == SVGNames::inAttr || attrName == SVGNames::in2Attr) { | 130 if (attrName == SVGNames::inAttr || attrName == SVGNames::in2Attr) { |
| 131 SVGElement::InvalidationGuard invalidationGuard(this); |
| 148 invalidate(); | 132 invalidate(); |
| 149 return; | 133 return; |
| 150 } | 134 } |
| 151 | 135 |
| 152 ASSERT_NOT_REACHED(); | 136 SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName); |
| 153 } | 137 } |
| 154 | 138 |
| 155 PassRefPtrWillBeRawPtr<FilterEffect> SVGFEBlendElement::build(SVGFilterBuilder*
filterBuilder, Filter* filter) | 139 PassRefPtrWillBeRawPtr<FilterEffect> SVGFEBlendElement::build(SVGFilterBuilder*
filterBuilder, Filter* filter) |
| 156 { | 140 { |
| 157 FilterEffect* input1 = filterBuilder->getEffectById(AtomicString(m_in1->curr
entValue()->value())); | 141 FilterEffect* input1 = filterBuilder->getEffectById(AtomicString(m_in1->curr
entValue()->value())); |
| 158 FilterEffect* input2 = filterBuilder->getEffectById(AtomicString(m_in2->curr
entValue()->value())); | 142 FilterEffect* input2 = filterBuilder->getEffectById(AtomicString(m_in2->curr
entValue()->value())); |
| 159 | 143 |
| 160 if (!input1 || !input2) | 144 if (!input1 || !input2) |
| 161 return nullptr; | 145 return nullptr; |
| 162 | 146 |
| 163 RefPtrWillBeRawPtr<FilterEffect> effect = FEBlend::create(filter, toWebBlend
Mode(m_mode->currentValue()->enumValue())); | 147 RefPtrWillBeRawPtr<FilterEffect> effect = FEBlend::create(filter, toWebBlend
Mode(m_mode->currentValue()->enumValue())); |
| 164 FilterEffectVector& inputEffects = effect->inputEffects(); | 148 FilterEffectVector& inputEffects = effect->inputEffects(); |
| 165 inputEffects.reserveCapacity(2); | 149 inputEffects.reserveCapacity(2); |
| 166 inputEffects.append(input1); | 150 inputEffects.append(input1); |
| 167 inputEffects.append(input2); | 151 inputEffects.append(input2); |
| 168 return effect.release(); | 152 return effect.release(); |
| 169 } | 153 } |
| 170 | 154 |
| 171 } | 155 } |
| OLD | NEW |