2 * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
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.
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.
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.
21 #ifndef SVGFilterPrimitiveStandardAttributes_h
22 #define SVGFilterPrimitiveStandardAttributes_h
24 #include "core/rendering/svg/RenderSVGResource.h"
25 #include "core/svg/SVGAnimatedLength.h"
26 #include "core/svg/SVGAnimatedString.h"
27 #include "core/svg/SVGElement.h"
28 #include "wtf/PassRefPtr.h"
29 #include "wtf/RefPtr.h"
35 class SVGFilterBuilder;
37 class SVGFilterPrimitiveStandardAttributes : public SVGElement {
38 // No DEFINE_WRAPPERTYPEINFO() here because a) this class is never
39 // instantiated, and b) we don't generate corresponding V8T.h or V8T.cpp.
40 // The subclasses must write DEFINE_WRAPPERTYPEINFO().
42 void setStandardAttributes(FilterEffect*) const;
44 virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*, Filter* filter) = 0;
45 // Returns true, if the new value is different from the old one.
46 virtual bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&);
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 SVGAnimatedString* result() const { return m_result.get(); }
56 SVGFilterPrimitiveStandardAttributes(const QualifiedName&, Document&);
58 bool isSupportedAttribute(const QualifiedName&);
59 virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE;
60 virtual void svgAttributeChanged(const QualifiedName&) OVERRIDE;
61 virtual void childrenChanged(const ChildrenChange&) OVERRIDE;
63 inline void invalidate()
65 if (RenderObject* primitiveRenderer = renderer())
66 RenderSVGResource::markForLayoutAndParentResourceInvalidation(primitiveRenderer);
69 void primitiveAttributeChanged(const QualifiedName&);
72 virtual bool isFilterEffect() const OVERRIDE FINAL { return true; }
74 virtual RenderObject* createRenderer(RenderStyle*) OVERRIDE FINAL;
75 virtual bool rendererIsNeeded(const RenderStyle&) OVERRIDE FINAL;
77 RefPtr<SVGAnimatedLength> m_x;
78 RefPtr<SVGAnimatedLength> m_y;
79 RefPtr<SVGAnimatedLength> m_width;
80 RefPtr<SVGAnimatedLength> m_height;
81 RefPtr<SVGAnimatedString> m_result;
84 void invalidateFilterPrimitiveParent(SVGElement*);
88 #endif // SVGFilterPrimitiveStandardAttributes_h