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 * Copyright (C) 2006 Samuel Weinig <sam.weinig@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 "core/SVGNames.h"
27#include "core/svg/SVGAnimatedBoolean.h"
28#include "core/svg/SVGAnimatedEnumeration.h"
29#include "core/svg/SVGAnimatedInteger.h"
30#include "core/svg/SVGAnimatedIntegerOptionalInteger.h"
31#include "core/svg/SVGAnimatedLength.h"
32#include "core/svg/SVGElement.h"
33#include "core/svg/SVGURIReference.h"
34#include "core/svg/SVGUnitTypes.h"
35
36namespace blink {
37
38class SVGFilterElement FINAL : public SVGElement,
39                               public SVGURIReference {
40    DEFINE_WRAPPERTYPEINFO();
41public:
42    DECLARE_NODE_FACTORY(SVGFilterElement);
43    virtual void trace(Visitor*) OVERRIDE;
44
45    void setFilterRes(unsigned x, unsigned y);
46    void addClient(Node*);
47    void removeClient(Node*);
48
49    SVGAnimatedLength* x() const { return m_x.get(); }
50    SVGAnimatedLength* y() const { return m_y.get(); }
51    SVGAnimatedLength* width() const { return m_width.get(); }
52    SVGAnimatedLength* height() const { return m_height.get(); }
53    SVGAnimatedEnumeration<SVGUnitTypes::SVGUnitType>* filterUnits() { return m_filterUnits.get(); }
54    SVGAnimatedEnumeration<SVGUnitTypes::SVGUnitType>* primitiveUnits() { return m_primitiveUnits.get(); }
55    SVGAnimatedInteger* filterResX() { return m_filterRes->firstInteger(); }
56    SVGAnimatedInteger* filterResY() { return m_filterRes->secondInteger(); }
57
58private:
59    explicit SVGFilterElement(Document&);
60
61    virtual bool needsPendingResourceHandling() const OVERRIDE { return false; }
62
63    bool isSupportedAttribute(const QualifiedName&);
64    virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE;
65    virtual void svgAttributeChanged(const QualifiedName&) OVERRIDE;
66    virtual void childrenChanged(const ChildrenChange&) OVERRIDE;
67
68    virtual RenderObject* createRenderer(RenderStyle*) OVERRIDE;
69
70    virtual bool selfHasRelativeLengths() const OVERRIDE;
71
72    RefPtr<SVGAnimatedLength> m_x;
73    RefPtr<SVGAnimatedLength> m_y;
74    RefPtr<SVGAnimatedLength> m_width;
75    RefPtr<SVGAnimatedLength> m_height;
76    RefPtr<SVGAnimatedEnumeration<SVGUnitTypes::SVGUnitType> > m_filterUnits;
77    RefPtr<SVGAnimatedEnumeration<SVGUnitTypes::SVGUnitType> > m_primitiveUnits;
78    RefPtr<SVGAnimatedIntegerOptionalInteger> m_filterRes;
79
80    WillBeHeapHashSet<RefPtrWillBeMember<Node> > m_clientsToAdd;
81};
82
83} // namespace blink
84
85#endif // SVGFilterElement_h
86