OSDN Git Service

Merge Webkit at r70949: Initial merge by git.
[android-x86/external-webkit.git] / WebCore / svg / SVGFilterPrimitiveStandardAttributes.h
1 /*
2  * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
3  * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@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 #ifndef SVGFilterPrimitiveStandardAttributes_h
22 #define SVGFilterPrimitiveStandardAttributes_h
23
24 #if ENABLE(SVG) && ENABLE(FILTERS)
25 #include "FilterEffect.h"
26 #include "RenderSVGResource.h"
27 #include "SVGAnimatedLength.h"
28 #include "SVGAnimatedPropertyMacros.h"
29 #include "SVGFilterBuilder.h"
30 #include "SVGFilterElement.h"
31 #include "SVGNames.h"
32 #include "SVGStyledElement.h"
33
34 #include <wtf/PassRefPtr.h>
35 #include <wtf/RefPtr.h>
36
37 namespace WebCore {
38
39 class SVGFilterPrimitiveStandardAttributes : public SVGStyledElement {
40 public:
41     void setStandardAttributes(bool, FilterEffect*) const;
42
43     virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*) = 0;
44
45 protected:
46     SVGFilterPrimitiveStandardAttributes(const QualifiedName&, Document*);
47
48     virtual void parseMappedAttribute(Attribute*);
49     virtual void svgAttributeChanged(const QualifiedName&);
50     virtual void synchronizeProperty(const QualifiedName&);
51     virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
52
53 protected:
54     inline void invalidate()
55     {
56         if (RenderObject* primitiveRenderer = renderer())
57             RenderSVGResource::markForLayoutAndParentResourceInvalidation(primitiveRenderer);
58     }
59
60 private:
61     virtual bool isFilterEffect() const { return true; }
62
63     virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
64
65     DECLARE_ANIMATED_PROPERTY_NEW(SVGFilterPrimitiveStandardAttributes, SVGNames::xAttr, SVGLength, X, x)
66     DECLARE_ANIMATED_PROPERTY_NEW(SVGFilterPrimitiveStandardAttributes, SVGNames::yAttr, SVGLength, Y, y)
67     DECLARE_ANIMATED_PROPERTY_NEW(SVGFilterPrimitiveStandardAttributes, SVGNames::widthAttr, SVGLength, Width, width)
68     DECLARE_ANIMATED_PROPERTY_NEW(SVGFilterPrimitiveStandardAttributes, SVGNames::heightAttr, SVGLength, Height, height)
69     DECLARE_ANIMATED_PROPERTY(SVGFilterPrimitiveStandardAttributes, SVGNames::resultAttr, String, Result, result)
70 };
71
72 } // namespace WebCore
73
74 #endif // ENABLE(SVG)
75 #endif