| 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 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005 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 12 matching lines...) Expand all Loading... |
| 23 #include "core/svg/SVGFETileElement.h" | 23 #include "core/svg/SVGFETileElement.h" |
| 24 | 24 |
| 25 #include "SVGNames.h" | 25 #include "SVGNames.h" |
| 26 #include "platform/graphics/filters/FilterEffect.h" | 26 #include "platform/graphics/filters/FilterEffect.h" |
| 27 #include "core/svg/SVGElementInstance.h" | 27 #include "core/svg/SVGElementInstance.h" |
| 28 #include "core/svg/graphics/filters/SVGFilterBuilder.h" | 28 #include "core/svg/graphics/filters/SVGFilterBuilder.h" |
| 29 | 29 |
| 30 namespace WebCore { | 30 namespace WebCore { |
| 31 | 31 |
| 32 // Animated property definitions | 32 // Animated property definitions |
| 33 DEFINE_ANIMATED_STRING(SVGFETileElement, SVGNames::inAttr, In1, in1) | |
| 34 | 33 |
| 35 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFETileElement) | 34 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFETileElement) |
| 36 REGISTER_LOCAL_ANIMATED_PROPERTY(in1) | |
| 37 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes) | 35 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes) |
| 38 END_REGISTER_ANIMATED_PROPERTIES | 36 END_REGISTER_ANIMATED_PROPERTIES |
| 39 | 37 |
| 40 inline SVGFETileElement::SVGFETileElement(Document& document) | 38 inline SVGFETileElement::SVGFETileElement(Document& document) |
| 41 : SVGFilterPrimitiveStandardAttributes(SVGNames::feTileTag, document) | 39 : SVGFilterPrimitiveStandardAttributes(SVGNames::feTileTag, document) |
| 40 , m_in1(SVGAnimatedString::create(this, SVGNames::inAttr, SVGString::create(
))) |
| 42 { | 41 { |
| 43 ScriptWrappable::init(this); | 42 ScriptWrappable::init(this); |
| 43 addToPropertyMap(m_in1); |
| 44 registerAnimatedPropertiesForSVGFETileElement(); | 44 registerAnimatedPropertiesForSVGFETileElement(); |
| 45 } | 45 } |
| 46 | 46 |
| 47 PassRefPtr<SVGFETileElement> SVGFETileElement::create(Document& document) | 47 PassRefPtr<SVGFETileElement> SVGFETileElement::create(Document& document) |
| 48 { | 48 { |
| 49 return adoptRef(new SVGFETileElement(document)); | 49 return adoptRef(new SVGFETileElement(document)); |
| 50 } | 50 } |
| 51 | 51 |
| 52 bool SVGFETileElement::isSupportedAttribute(const QualifiedName& attrName) | 52 bool SVGFETileElement::isSupportedAttribute(const QualifiedName& attrName) |
| 53 { | 53 { |
| 54 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | 54 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); |
| 55 if (supportedAttributes.isEmpty()) | 55 if (supportedAttributes.isEmpty()) |
| 56 supportedAttributes.add(SVGNames::inAttr); | 56 supportedAttributes.add(SVGNames::inAttr); |
| 57 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | 57 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); |
| 58 } | 58 } |
| 59 | 59 |
| 60 void SVGFETileElement::parseAttribute(const QualifiedName& name, const AtomicStr
ing& value) | 60 void SVGFETileElement::parseAttribute(const QualifiedName& name, const AtomicStr
ing& value) |
| 61 { | 61 { |
| 62 if (!isSupportedAttribute(name)) { | 62 if (!isSupportedAttribute(name)) { |
| 63 SVGFilterPrimitiveStandardAttributes::parseAttribute(name, value); | 63 SVGFilterPrimitiveStandardAttributes::parseAttribute(name, value); |
| 64 return; | 64 return; |
| 65 } | 65 } |
| 66 | 66 |
| 67 if (name == SVGNames::inAttr) { | 67 SVGParsingError parseError = NoError; |
| 68 setIn1BaseValue(value); | |
| 69 return; | |
| 70 } | |
| 71 | 68 |
| 72 ASSERT_NOT_REACHED(); | 69 if (name == SVGNames::inAttr) |
| 70 m_in1->setBaseValueAsString(value, parseError); |
| 71 else |
| 72 ASSERT_NOT_REACHED(); |
| 73 |
| 74 reportAttributeParsingError(parseError, name, value); |
| 73 } | 75 } |
| 74 | 76 |
| 75 void SVGFETileElement::svgAttributeChanged(const QualifiedName& attrName) | 77 void SVGFETileElement::svgAttributeChanged(const QualifiedName& attrName) |
| 76 { | 78 { |
| 77 if (!isSupportedAttribute(attrName)) { | 79 if (!isSupportedAttribute(attrName)) { |
| 78 SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName); | 80 SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName); |
| 79 return; | 81 return; |
| 80 } | 82 } |
| 81 | 83 |
| 82 SVGElementInstance::InvalidationGuard invalidationGuard(this); | 84 SVGElementInstance::InvalidationGuard invalidationGuard(this); |
| 83 | 85 |
| 84 if (attrName == SVGNames::inAttr) { | 86 if (attrName == SVGNames::inAttr) { |
| 85 invalidate(); | 87 invalidate(); |
| 86 return; | 88 return; |
| 87 } | 89 } |
| 88 | 90 |
| 89 ASSERT_NOT_REACHED(); | 91 ASSERT_NOT_REACHED(); |
| 90 } | 92 } |
| 91 | 93 |
| 92 PassRefPtr<FilterEffect> SVGFETileElement::build(SVGFilterBuilder* filterBuilder
, Filter* filter) | 94 PassRefPtr<FilterEffect> SVGFETileElement::build(SVGFilterBuilder* filterBuilder
, Filter* filter) |
| 93 { | 95 { |
| 94 FilterEffect* input1 = filterBuilder->getEffectById(AtomicString(in1CurrentV
alue())); | 96 FilterEffect* input1 = filterBuilder->getEffectById(AtomicString(m_in1->curr
entValue()->value())); |
| 95 | 97 |
| 96 if (!input1) | 98 if (!input1) |
| 97 return 0; | 99 return 0; |
| 98 | 100 |
| 99 RefPtr<FilterEffect> effect = FETile::create(filter); | 101 RefPtr<FilterEffect> effect = FETile::create(filter); |
| 100 effect->inputEffects().append(input1); | 102 effect->inputEffects().append(input1); |
| 101 return effect.release(); | 103 return effect.release(); |
| 102 } | 104 } |
| 103 | 105 |
| 104 } | 106 } |
| OLD | NEW |