Home | History | Annotate | Download | only in svg
      1 /*
      2  * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann (at) kde.org>
      3  * Copyright (C) 2004, 2005, 2006 Rob Buis <buis (at) kde.org>
      4  *
      5  * This library is free software; you can redistribute it and/or
      6  * modify it under the terms of the GNU Library General Public
      7  * License as published by the Free Software Foundation; either
      8  * version 2 of the License, or (at your option) any later version.
      9  *
     10  * This library is distributed in the hope that it will be useful,
     11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
     12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     13  * Library General Public License for more details.
     14  *
     15  * You should have received a copy of the GNU Library General Public License
     16  * along with this library; see the file COPYING.LIB.  If not, write to
     17  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
     18  * Boston, MA 02110-1301, USA.
     19  */
     20 
     21 #include "config.h"
     22 
     23 #include "core/svg/SVGFEMergeNodeElement.h"
     24 
     25 #include "SVGNames.h"
     26 #include "core/svg/SVGElementInstance.h"
     27 #include "core/svg/SVGFilterPrimitiveStandardAttributes.h"
     28 
     29 namespace WebCore {
     30 
     31 // Animated property definitions
     32 DEFINE_ANIMATED_STRING(SVGFEMergeNodeElement, SVGNames::inAttr, In1, in1)
     33 
     34 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFEMergeNodeElement)
     35     REGISTER_LOCAL_ANIMATED_PROPERTY(in1)
     36 END_REGISTER_ANIMATED_PROPERTIES
     37 
     38 inline SVGFEMergeNodeElement::SVGFEMergeNodeElement(const QualifiedName& tagName, Document* document)
     39     : SVGElement(tagName, document)
     40 {
     41     ASSERT(hasTagName(SVGNames::feMergeNodeTag));
     42     ScriptWrappable::init(this);
     43     registerAnimatedPropertiesForSVGFEMergeNodeElement();
     44 }
     45 
     46 PassRefPtr<SVGFEMergeNodeElement> SVGFEMergeNodeElement::create(const QualifiedName& tagName, Document* document)
     47 {
     48     return adoptRef(new SVGFEMergeNodeElement(tagName, document));
     49 }
     50 
     51 bool SVGFEMergeNodeElement::isSupportedAttribute(const QualifiedName& attrName)
     52 {
     53     DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ());
     54     if (supportedAttributes.isEmpty())
     55         supportedAttributes.add(SVGNames::inAttr);
     56     return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName);
     57 }
     58 
     59 void SVGFEMergeNodeElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
     60 {
     61     if (!isSupportedAttribute(name)) {
     62         SVGElement::parseAttribute(name, value);
     63         return;
     64     }
     65 
     66     if (name == SVGNames::inAttr) {
     67         setIn1BaseValue(value);
     68         return;
     69     }
     70 
     71     ASSERT_NOT_REACHED();
     72 }
     73 
     74 void SVGFEMergeNodeElement::svgAttributeChanged(const QualifiedName& attrName)
     75 {
     76     if (!isSupportedAttribute(attrName)) {
     77         SVGElement::svgAttributeChanged(attrName);
     78         return;
     79     }
     80 
     81     SVGElementInstance::InvalidationGuard invalidationGuard(this);
     82 
     83     if (attrName == SVGNames::inAttr) {
     84         invalidateFilterPrimitiveParent(this);
     85         return;
     86     }
     87 
     88     ASSERT_NOT_REACHED();
     89 }
     90 
     91 }
     92