22 #ifndef SVGElementInstance_h
23 #define SVGElementInstance_h
30 #include <wtf/RefPtr.h>
31 #include <wtf/PassRefPtr.h>
36 class SVGElementInstanceList;
38 class SVGElementInstance {
40 SVGElementInstance(SVGUseElement*, PassRefPtr<SVGElement> originalElement);
41 virtual ~SVGElementInstance();
44 SVGElement* correspondingElement()
const;
45 SVGUseElement* correspondingUseElement()
const;
47 SVGElementInstance* parentNode()
const;
48 PassRefPtr<SVGElementInstanceList> childNodes();
50 SVGElementInstance* previousSibling()
const;
51 SVGElementInstance* nextSibling()
const;
53 SVGElementInstance* firstChild()
const;
54 SVGElementInstance* lastChild()
const;
57 SVGElement* shadowTreeElement()
const;
58 void setShadowTreeElement(SVGElement*);
61 virtual void refEventTarget() { ++m_refCount; }
62 virtual void derefEventTarget() {
if (--m_refCount <= 0 && !m_parent)
delete this; }
64 virtual void ref() { refEventTarget(); }
65 virtual void deref() { derefEventTarget(); }
67 bool hasOneRef() {
return m_refCount == 1; }
68 int refCount()
const {
return m_refCount; }
70 void setParent(SVGElementInstance* parent) { m_parent = parent; }
71 SVGElementInstance* parent()
const {
return m_parent; }
74 virtual EventTargetNode* toNode();
75 virtual SVGElementInstance* toSVGElementInstance();
77 virtual void addEventListener(
const AtomicString& eventType, PassRefPtr<EventListener>,
bool useCapture);
78 virtual void removeEventListener(
const AtomicString& eventType, EventListener*,
bool useCapture);
79 virtual bool dispatchEvent(PassRefPtr<Event>, ExceptionCode&,
bool tempEvent =
false);
82 SVGElementInstance(
const SVGElementInstance&);
83 SVGElementInstance& operator=(
const SVGElementInstance&);
86 friend class SVGUseElement;
87 void appendChild(PassRefPtr<SVGElementInstance> child);
89 friend class SVGStyledElement;
90 void updateInstance(SVGElement*);
94 SVGElementInstance* m_parent;
96 SVGUseElement* m_useElement;
97 RefPtr<SVGElement> m_element;
98 SVGElement* m_shadowTreeElement;
100 SVGElementInstance* m_previousSibling;
101 SVGElementInstance* m_nextSibling;
103 SVGElementInstance* m_firstChild;
104 SVGElementInstance* m_lastChild;
109 #endif // ENABLE(SVG)