Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / 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 #include "core/svg/SVGAnimatedLength.h"
25 #include "core/svg/SVGAnimatedString.h"
26 #include "core/svg/SVGElement.h"
27 #include "wtf/PassRefPtr.h"
28 #include "wtf/RefPtr.h"
29
30 namespace blink {
31
32 class Filter;
33 class FilterEffect;
34 class SVGFilterBuilder;
35
36 class SVGFilterPrimitiveStandardAttributes : public SVGElement {
37     // No DEFINE_WRAPPERTYPEINFO() here because a) this class is never
38     // instantiated, and b) we don't generate corresponding V8T.h or V8T.cpp.
39     // The subclasses must write DEFINE_WRAPPERTYPEINFO().
40 public:
41     void setStandardAttributes(FilterEffect*) const;
42
43     virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*, Filter* filter) = 0;
44     // Returns true, if the new value is different from the old one.
45     virtual bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&);
46
47     // JS API
48     SVGAnimatedLength* x() const { return m_x.get(); }
49     SVGAnimatedLength* y() const { return m_y.get(); }
50     SVGAnimatedLength* width() const { return m_width.get(); }
51     SVGAnimatedLength* height() const { return m_height.get(); }
52     SVGAnimatedString* result() const { return m_result.get(); }
53
54 protected:
55     SVGFilterPrimitiveStandardAttributes(const QualifiedName&, Document&);
56
57     bool isSupportedAttribute(const QualifiedName&);
58     virtual void parseAttribute(const QualifiedName&, const AtomicString&) override;
59     virtual void svgAttributeChanged(const QualifiedName&) override;
60     virtual void childrenChanged(const ChildrenChange&) override;
61
62     void invalidate();
63     void primitiveAttributeChanged(const QualifiedName&);
64
65 private:
66     virtual bool isFilterEffect() const override final { return true; }
67
68     virtual RenderObject* createRenderer(RenderStyle*) override final;
69     virtual bool rendererIsNeeded(const RenderStyle&) override final;
70
71     RefPtr<SVGAnimatedLength> m_x;
72     RefPtr<SVGAnimatedLength> m_y;
73     RefPtr<SVGAnimatedLength> m_width;
74     RefPtr<SVGAnimatedLength> m_height;
75     RefPtr<SVGAnimatedString> m_result;
76 };
77
78 void invalidateFilterPrimitiveParent(SVGElement*);
79
80 } // namespace blink
81
82 #endif // SVGFilterPrimitiveStandardAttributes_h