Home | History | Annotate | Download | only in svg
      1 /*
      2  * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann (at) kde.org>
      3  * Copyright (C) 2004, 2005, 2006 Rob Buis <buis (at) kde.org>
      4  * Copyright (C) 2006 Samuel Weinig <sam.weinig (at) gmail.com>
      5  * Copyright (C) Research In Motion Limited 2010. All rights reserved.
      6  *
      7  * This library is free software; you can redistribute it and/or
      8  * modify it under the terms of the GNU Library General Public
      9  * License as published by the Free Software Foundation; either
     10  * version 2 of the License, or (at your option) any later version.
     11  *
     12  * This library is distributed in the hope that it will be useful,
     13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     15  * Library General Public License for more details.
     16  *
     17  * You should have received a copy of the GNU Library General Public License
     18  * along with this library; see the file COPYING.LIB.  If not, write to
     19  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
     20  * Boston, MA 02110-1301, USA.
     21  */
     22 
     23 #ifndef SVGFilterElement_h
     24 #define SVGFilterElement_h
     25 
     26 #include "SVGNames.h"
     27 #include "core/svg/SVGAnimatedBoolean.h"
     28 #include "core/svg/SVGAnimatedEnumeration.h"
     29 #include "core/svg/SVGAnimatedInteger.h"
     30 #include "core/svg/SVGAnimatedLength.h"
     31 #include "core/svg/SVGElement.h"
     32 #include "core/svg/SVGExternalResourcesRequired.h"
     33 #include "core/svg/SVGURIReference.h"
     34 #include "core/svg/SVGUnitTypes.h"
     35 
     36 namespace WebCore {
     37 
     38 class SVGFilterElement FINAL : public SVGElement,
     39                                public SVGURIReference,
     40                                public SVGExternalResourcesRequired {
     41 public:
     42     static PassRefPtr<SVGFilterElement> create(const QualifiedName&, Document*);
     43 
     44     void setFilterRes(unsigned filterResX, unsigned filterResY);
     45 
     46 private:
     47     SVGFilterElement(const QualifiedName&, Document*);
     48 
     49     virtual bool needsPendingResourceHandling() const { return false; }
     50 
     51     bool isSupportedAttribute(const QualifiedName&);
     52     virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE;
     53     virtual void svgAttributeChanged(const QualifiedName&);
     54     virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
     55 
     56     virtual RenderObject* createRenderer(RenderStyle*) OVERRIDE;
     57     virtual bool childShouldCreateRenderer(const NodeRenderingContext&) const OVERRIDE;
     58 
     59     virtual bool selfHasRelativeLengths() const;
     60 
     61     static const AtomicString& filterResXIdentifier();
     62     static const AtomicString& filterResYIdentifier();
     63 
     64     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFilterElement)
     65         DECLARE_ANIMATED_ENUMERATION(FilterUnits, filterUnits, SVGUnitTypes::SVGUnitType)
     66         DECLARE_ANIMATED_ENUMERATION(PrimitiveUnits, primitiveUnits, SVGUnitTypes::SVGUnitType)
     67         DECLARE_ANIMATED_LENGTH(X, x)
     68         DECLARE_ANIMATED_LENGTH(Y, y)
     69         DECLARE_ANIMATED_LENGTH(Width, width)
     70         DECLARE_ANIMATED_LENGTH(Height, height)
     71         DECLARE_ANIMATED_INTEGER(FilterResX, filterResX)
     72         DECLARE_ANIMATED_INTEGER(FilterResY, filterResY)
     73         DECLARE_ANIMATED_STRING(Href, href)
     74         DECLARE_ANIMATED_BOOLEAN(ExternalResourcesRequired, externalResourcesRequired)
     75     END_DECLARE_ANIMATED_PROPERTIES
     76 };
     77 
     78 inline SVGFilterElement* toSVGFilterElement(Node* node)
     79 {
     80     ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::filterTag));
     81     return static_cast<SVGFilterElement*>(node);
     82 }
     83 
     84 }
     85 
     86 #endif
     87