SVGElementInstance.h [plain text]
#ifndef SVGElementInstance_h
#define SVGElementInstance_h
#if ENABLE(SVG)
#include "EventTarget.h"
#include <wtf/RefPtr.h>
#include <wtf/PassRefPtr.h>
namespace WebCore {
class SVGElement;
class SVGUseElement;
class SVGElementInstanceList;
class SVGElementInstance : public EventTarget {
public:
SVGElementInstance(SVGUseElement*, PassRefPtr<SVGElement> originalElement);
virtual ~SVGElementInstance();
SVGElement* correspondingElement() const;
SVGUseElement* correspondingUseElement() const;
SVGElementInstance* parentNode() const;
PassRefPtr<SVGElementInstanceList> childNodes();
SVGElementInstance* previousSibling() const;
SVGElementInstance* nextSibling() const;
SVGElementInstance* firstChild() const;
SVGElementInstance* lastChild() const;
SVGElement* shadowTreeElement() const;
void setShadowTreeElement(SVGElement*);
virtual void refEventTarget() { ++m_refCount; }
virtual void derefEventTarget() { if (--m_refCount <= 0 && !m_parent) delete this; }
bool hasOneRef() { return m_refCount == 1; }
int refCount() const { return m_refCount; }
void setParent(SVGElementInstance* parent) { m_parent = parent; }
SVGElementInstance* parent() const { return m_parent; }
virtual EventTargetNode* toNode();
virtual SVGElementInstance* toSVGElementInstance();
virtual void addEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture);
virtual void removeEventListener(const AtomicString& eventType, EventListener*, bool useCapture);
virtual bool dispatchEvent(PassRefPtr<Event>, ExceptionCode&, bool tempEvent = false);
private:
SVGElementInstance(const SVGElementInstance&);
SVGElementInstance& operator=(const SVGElementInstance&);
private: friend class SVGUseElement;
void appendChild(PassRefPtr<SVGElementInstance> child);
friend class SVGStyledElement;
void updateInstance(SVGElement*);
private:
int m_refCount;
SVGElementInstance* m_parent;
SVGUseElement* m_useElement;
RefPtr<SVGElement> m_element;
SVGElement* m_shadowTreeElement;
SVGElementInstance* m_previousSibling;
SVGElementInstance* m_nextSibling;
SVGElementInstance* m_firstChild;
SVGElementInstance* m_lastChild;
};
}
#endif // ENABLE(SVG)
#endif