| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> | |
| 3 * Copyright (C) 2011 Torch Mobile (Beijing) Co. Ltd. All rights reserved. | |
| 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 SVGElementInstance_h | |
| 22 #define SVGElementInstance_h | |
| 23 | |
| 24 #include "bindings/v8/ScriptWrappable.h" | |
| 25 #include "core/dom/TreeShared.h" | |
| 26 | |
| 27 namespace WebCore { | |
| 28 | |
| 29 namespace Private { | |
| 30 template<class GenericNode, class GenericNodeContainer> | |
| 31 void addChildNodesToDeletionQueue(GenericNode*& head, GenericNode*& tail, Generi
cNodeContainer&); | |
| 32 }; | |
| 33 | |
| 34 class Document; | |
| 35 class SVGElement; | |
| 36 class SVGUseElement; | |
| 37 | |
| 38 // SVGElementInstance mimics Node, but without providing all its functionality | |
| 39 class SVGElementInstance FINAL : public TreeSharedWillBeRefCountedGarbageCollect
ed<SVGElementInstance>, public ScriptWrappable { | |
| 40 public: | |
| 41 static PassRefPtrWillBeRawPtr<SVGElementInstance> create(SVGUseElement* corr
espondingUseElement, SVGUseElement* directUseElement, PassRefPtrWillBeRawPtr<SVG
Element> originalElement); | |
| 42 | |
| 43 virtual ~SVGElementInstance(); | |
| 44 | |
| 45 void setParentOrShadowHostNode(SVGElementInstance* instance) { m_parentInsta
nce = instance; } | |
| 46 | |
| 47 SVGElement* correspondingElement() const { return m_element.get(); } | |
| 48 SVGUseElement* correspondingUseElement() const { return m_correspondingUseEl
ement; } | |
| 49 SVGUseElement* directUseElement() const { return m_directUseElement; } | |
| 50 SVGElement* shadowTreeElement() const { return m_shadowTreeElement.get(); } | |
| 51 | |
| 52 void detach(); | |
| 53 | |
| 54 SVGElementInstance* parentNode() const { return m_parentInstance; } | |
| 55 | |
| 56 SVGElementInstance* previousSibling() const { return m_previousSibling; } | |
| 57 SVGElementInstance* nextSibling() const { return m_nextSibling; } | |
| 58 | |
| 59 SVGElementInstance* firstChild() const { return m_firstChild; } | |
| 60 SVGElementInstance* lastChild() const { return m_lastChild; } | |
| 61 | |
| 62 inline Document* ownerDocument() const; | |
| 63 | |
| 64 virtual void trace(Visitor*); | |
| 65 | |
| 66 private: | |
| 67 friend class SVGUseElement; | |
| 68 friend class TreeShared<SVGElementInstance>; | |
| 69 | |
| 70 SVGElementInstance(SVGUseElement*, SVGUseElement*, PassRefPtrWillBeRawPtr<SV
GElement> originalElement); | |
| 71 | |
| 72 #if !ENABLE(OILPAN) | |
| 73 void removedLastRef(); | |
| 74 #endif | |
| 75 | |
| 76 bool hasTreeSharedParent() const { return !!m_parentInstance; } | |
| 77 | |
| 78 void appendChild(PassRefPtrWillBeRawPtr<SVGElementInstance> child); | |
| 79 void setShadowTreeElement(SVGElement*); | |
| 80 | |
| 81 template<class GenericNode, class GenericNodeContainer> | |
| 82 friend void appendChildToContainer(GenericNode& child, GenericNodeContainer&
); | |
| 83 | |
| 84 #if !ENABLE(OILPAN) | |
| 85 template<class GenericNode, class GenericNodeContainer> | |
| 86 friend void removeDetachedChildrenInContainer(GenericNodeContainer&); | |
| 87 | |
| 88 template<class GenericNode, class GenericNodeContainer> | |
| 89 friend void Private::addChildNodesToDeletionQueue(GenericNode*& head, Generi
cNode*& tail, GenericNodeContainer&); | |
| 90 #endif | |
| 91 | |
| 92 bool hasChildren() const { return m_firstChild; } | |
| 93 | |
| 94 void setFirstChild(SVGElementInstance* child) { m_firstChild = child; } | |
| 95 void setLastChild(SVGElementInstance* child) { m_lastChild = child; } | |
| 96 | |
| 97 void setNextSibling(SVGElementInstance* sibling) { m_nextSibling = sibling;
} | |
| 98 void setPreviousSibling(SVGElementInstance* sibling) { m_previousSibling = s
ibling; } | |
| 99 | |
| 100 RawPtrWillBeMember<SVGElementInstance> m_parentInstance; | |
| 101 | |
| 102 RawPtrWillBeMember<SVGUseElement> m_correspondingUseElement; | |
| 103 RawPtrWillBeMember<SVGUseElement> m_directUseElement; | |
| 104 RefPtrWillBeMember<SVGElement> m_element; | |
| 105 RefPtrWillBeMember<SVGElement> m_shadowTreeElement; | |
| 106 | |
| 107 RawPtrWillBeMember<SVGElementInstance> m_previousSibling; | |
| 108 RawPtrWillBeMember<SVGElementInstance> m_nextSibling; | |
| 109 | |
| 110 RawPtrWillBeMember<SVGElementInstance> m_firstChild; | |
| 111 RawPtrWillBeMember<SVGElementInstance> m_lastChild; | |
| 112 }; | |
| 113 | |
| 114 } // namespace WebCore | |
| 115 | |
| 116 #endif | |
| OLD | NEW |