1/*
2 * Copyright (C) 2004, 2005, 2008 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 SVGTRefElement_h
22#define SVGTRefElement_h
23
24#include "SVGTextPositioningElement.h"
25#include "SVGURIReference.h"
26
27namespace WebCore {
28
29class SVGTRefTargetEventListener;
30
31class SVGTRefElement final : public SVGTextPositioningElement,
32                             public SVGURIReference {
33public:
34    static PassRefPtr<SVGTRefElement> create(const QualifiedName&, Document&);
35
36protected:
37    virtual void didNotifySubtreeInsertions(ContainerNode*) override;
38
39private:
40    friend class SVGTRefTargetEventListener;
41
42    SVGTRefElement(const QualifiedName&, Document&);
43    virtual ~SVGTRefElement();
44
45    bool isSupportedAttribute(const QualifiedName&);
46    virtual void parseAttribute(const QualifiedName&, const AtomicString&) override;
47    virtual void svgAttributeChanged(const QualifiedName&) override;
48
49    virtual RenderPtr<RenderElement> createElementRenderer(PassRef<RenderStyle>) override;
50    virtual bool childShouldCreateRenderer(const Node&) const override;
51    virtual bool rendererIsNeeded(const RenderStyle&) override;
52
53    virtual InsertionNotificationRequest insertedInto(ContainerNode&) override;
54    virtual void removedFrom(ContainerNode&) override;
55
56    virtual void clearTarget() override;
57
58    void updateReferencedText(Element*);
59
60    void detachTarget();
61
62    virtual void buildPendingResource() override;
63
64    BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGTRefElement)
65        DECLARE_ANIMATED_STRING(Href, href)
66    END_DECLARE_ANIMATED_PROPERTIES
67
68    Ref<SVGTRefTargetEventListener> m_targetListener;
69};
70
71} // namespace WebCore
72
73#endif
74