Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> |
| 3 * Copyright (C) 2011 Torch Mobile (Beijing) Co. Ltd. All rights reserved. | 3 * Copyright (C) 2011 Torch Mobile (Beijing) Co. Ltd. All rights reserved. |
| 4 * | 4 * |
| 5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
| 7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 9 * | 9 * |
| 10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 30 namespace Private { | 30 namespace Private { |
| 31 template<class GenericNode, class GenericNodeContainer> | 31 template<class GenericNode, class GenericNodeContainer> |
| 32 void addChildNodesToDeletionQueue(GenericNode*& head, GenericNode*& tail, Generi cNodeContainer&); | 32 void addChildNodesToDeletionQueue(GenericNode*& head, GenericNode*& tail, Generi cNodeContainer&); |
| 33 }; | 33 }; |
| 34 | 34 |
| 35 class Document; | 35 class Document; |
| 36 class SVGElement; | 36 class SVGElement; |
| 37 class SVGUseElement; | 37 class SVGUseElement; |
| 38 | 38 |
| 39 // SVGElementInstance mimics Node, but without providing all its functionality | 39 // SVGElementInstance mimics Node, but without providing all its functionality |
| 40 class SVGElementInstance FINAL : public TreeShared<SVGElementInstance>, public E ventTarget, public ScriptWrappable { | 40 class SVGElementInstance FINAL : public TreeSharedWillBeRefCountedGarbageCollect ed<SVGElementInstance>, public EventTarget, public ScriptWrappable { |
| 41 DEFINE_EVENT_TARGET_REFCOUNTING(TreeShared<SVGElementInstance>); | 41 DEFINE_EVENT_TARGET_REFCOUNTING(TreeSharedWillBeRefCountedGarbageCollected<S VGElementInstance>); |
| 42 public: | 42 public: |
| 43 static PassRefPtr<SVGElementInstance> create(SVGUseElement* correspondingUse Element, SVGUseElement* directUseElement, PassRefPtr<SVGElement> originalElement ); | 43 static PassRefPtr<SVGElementInstance> create(SVGUseElement* correspondingUse Element, SVGUseElement* directUseElement, PassRefPtr<SVGElement> originalElement ); |
| 44 | 44 |
| 45 virtual ~SVGElementInstance(); | 45 virtual ~SVGElementInstance(); |
| 46 | 46 |
| 47 void setParentOrShadowHostNode(SVGElementInstance* instance) { m_parentInsta nce = instance; } | 47 void setParentOrShadowHostNode(SVGElementInstance* instance) { m_parentInsta nce = instance; } |
| 48 | 48 |
| 49 virtual const AtomicString& interfaceName() const OVERRIDE; | 49 virtual const AtomicString& interfaceName() const OVERRIDE; |
| 50 virtual ExecutionContext* executionContext() const OVERRIDE; | 50 virtual ExecutionContext* executionContext() const OVERRIDE; |
| 51 | 51 |
| 52 virtual bool addEventListener(const AtomicString& eventType, PassRefPtr<Even tListener>, bool useCapture = false) OVERRIDE; | 52 virtual bool addEventListener(const AtomicString& eventType, PassRefPtr<Even tListener>, bool useCapture = false) OVERRIDE; |
| 53 virtual bool removeEventListener(const AtomicString& eventType, EventListene r*, bool useCapture = false) OVERRIDE; | 53 virtual bool removeEventListener(const AtomicString& eventType, EventListene r*, bool useCapture = false) OVERRIDE; |
| 54 virtual void removeAllEventListeners() OVERRIDE; | 54 virtual void removeAllEventListeners() OVERRIDE; |
| 55 | 55 |
| 56 using EventTarget::dispatchEvent; | 56 using EventTarget::dispatchEvent; |
| 57 virtual bool dispatchEvent(PassRefPtrWillBeRawPtr<Event>) OVERRIDE; | 57 virtual bool dispatchEvent(PassRefPtrWillBeRawPtr<Event>) OVERRIDE; |
| 58 | 58 |
| 59 SVGElement* correspondingElement() const { return m_element.get(); } | 59 SVGElement* correspondingElement() const { return m_element.get(); } |
| 60 SVGUseElement* correspondingUseElement() const { return m_correspondingUseEl ement; } | 60 SVGUseElement* correspondingUseElement() const { return m_correspondingUseEl ement; } |
| 61 SVGUseElement* directUseElement() const { return m_directUseElement; } | 61 SVGUseElement* directUseElement() const { return m_directUseElement; } |
| 62 SVGElement* shadowTreeElement() const { return m_shadowTreeElement.get(); } | 62 SVGElement* shadowTreeElement() const { return m_shadowTreeElement.get(); } |
| 63 | 63 |
| 64 void detach(); | 64 void detach(); |
|
haraken
2014/05/06 15:59:42
You can add !ENABLE(OILPAN) to this.
Mads Ager (chromium)
2014/05/07 12:13:16
It is still called via SVGUseElement at this point
| |
| 65 | 65 |
| 66 SVGElementInstance* parentNode() const { return m_parentInstance; } | 66 SVGElementInstance* parentNode() const { return m_parentInstance; } |
| 67 | 67 |
| 68 SVGElementInstance* previousSibling() const { return m_previousSibling; } | 68 SVGElementInstance* previousSibling() const { return m_previousSibling; } |
| 69 SVGElementInstance* nextSibling() const { return m_nextSibling; } | 69 SVGElementInstance* nextSibling() const { return m_nextSibling; } |
| 70 | 70 |
| 71 SVGElementInstance* firstChild() const { return m_firstChild; } | 71 SVGElementInstance* firstChild() const { return m_firstChild; } |
| 72 SVGElementInstance* lastChild() const { return m_lastChild; } | 72 SVGElementInstance* lastChild() const { return m_lastChild; } |
| 73 | 73 |
| 74 inline Document* ownerDocument() const; | 74 inline Document* ownerDocument() const; |
| 75 | 75 |
| 76 virtual void trace(Visitor*) { } | 76 virtual void trace(Visitor*); |
| 77 | 77 |
| 78 // EventTarget API | 78 // EventTarget API |
| 79 DECLARE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), abort); | 79 DECLARE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), abort); |
| 80 DECLARE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), blur); | 80 DECLARE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), blur); |
| 81 DECLARE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), change); | 81 DECLARE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), change); |
| 82 DECLARE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), click); | 82 DECLARE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), click); |
| 83 DECLARE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), contextm enu); | 83 DECLARE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), contextm enu); |
| 84 DECLARE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), dblclick ); | 84 DECLARE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), dblclick ); |
| 85 DECLARE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), error); | 85 DECLARE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), error); |
| 86 DECLARE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), focus); | 86 DECLARE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), focus); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 119 DECLARE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), selectst art); | 119 DECLARE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), selectst art); |
| 120 DECLARE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), submit); | 120 DECLARE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), submit); |
| 121 DECLARE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), unload); | 121 DECLARE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), unload); |
| 122 | 122 |
| 123 private: | 123 private: |
| 124 friend class SVGUseElement; | 124 friend class SVGUseElement; |
| 125 friend class TreeShared<SVGElementInstance>; | 125 friend class TreeShared<SVGElementInstance>; |
| 126 | 126 |
| 127 SVGElementInstance(SVGUseElement*, SVGUseElement*, PassRefPtr<SVGElement> or iginalElement); | 127 SVGElementInstance(SVGUseElement*, SVGUseElement*, PassRefPtr<SVGElement> or iginalElement); |
| 128 | 128 |
| 129 void removedLastRef(); | 129 void removedLastRef(); |
|
haraken
2014/05/06 15:59:42
Can we add !ENABLE(OILPAN) to this?
Mads Ager (chromium)
2014/05/07 12:13:16
Yes, we should be able to do that.
| |
| 130 bool hasTreeSharedParent() const { return !!m_parentInstance; } | 130 bool hasTreeSharedParent() const { return !!m_parentInstance; } |
| 131 | 131 |
| 132 virtual Node* toNode() OVERRIDE; | 132 virtual Node* toNode() OVERRIDE; |
| 133 | 133 |
| 134 void appendChild(PassRefPtr<SVGElementInstance> child); | 134 void appendChild(PassRefPtr<SVGElementInstance> child); |
| 135 void setShadowTreeElement(SVGElement*); | 135 void setShadowTreeElement(SVGElement*); |
| 136 | 136 |
| 137 template<class GenericNode, class GenericNodeContainer> | 137 template<class GenericNode, class GenericNodeContainer> |
| 138 friend void appendChildToContainer(GenericNode& child, GenericNodeContainer& ); | 138 friend void appendChildToContainer(GenericNode& child, GenericNodeContainer& ); |
| 139 | 139 |
| 140 template<class GenericNode, class GenericNodeContainer> | 140 template<class GenericNode, class GenericNodeContainer> |
| 141 friend void removeDetachedChildrenInContainer(GenericNodeContainer&); | 141 friend void removeDetachedChildrenInContainer(GenericNodeContainer&); |
|
haraken
2014/05/06 15:59:42
You can add !ENABLE(OILPAN) to this (but it won't
Mads Ager (chromium)
2014/05/07 12:13:16
Done.
| |
| 142 | 142 |
| 143 template<class GenericNode, class GenericNodeContainer> | 143 template<class GenericNode, class GenericNodeContainer> |
| 144 friend void Private::addChildNodesToDeletionQueue(GenericNode*& head, Generi cNode*& tail, GenericNodeContainer&); | 144 friend void Private::addChildNodesToDeletionQueue(GenericNode*& head, Generi cNode*& tail, GenericNodeContainer&); |
| 145 | 145 |
| 146 bool hasChildren() const { return m_firstChild; } | 146 bool hasChildren() const { return m_firstChild; } |
| 147 | 147 |
| 148 void setFirstChild(SVGElementInstance* child) { m_firstChild = child; } | 148 void setFirstChild(SVGElementInstance* child) { m_firstChild = child; } |
| 149 void setLastChild(SVGElementInstance* child) { m_lastChild = child; } | 149 void setLastChild(SVGElementInstance* child) { m_lastChild = child; } |
| 150 | 150 |
| 151 void setNextSibling(SVGElementInstance* sibling) { m_nextSibling = sibling; } | 151 void setNextSibling(SVGElementInstance* sibling) { m_nextSibling = sibling; } |
| 152 void setPreviousSibling(SVGElementInstance* sibling) { m_previousSibling = s ibling; } | 152 void setPreviousSibling(SVGElementInstance* sibling) { m_previousSibling = s ibling; } |
| 153 | 153 |
| 154 virtual EventTargetData* eventTargetData() OVERRIDE; | 154 virtual EventTargetData* eventTargetData() OVERRIDE; |
| 155 virtual EventTargetData& ensureEventTargetData() OVERRIDE; | 155 virtual EventTargetData& ensureEventTargetData() OVERRIDE; |
| 156 | 156 |
| 157 SVGElementInstance* m_parentInstance; | 157 RawPtrWillBeMember<SVGElementInstance> m_parentInstance; |
| 158 | 158 |
| 159 SVGUseElement* m_correspondingUseElement; | 159 SVGUseElement* m_correspondingUseElement; |
| 160 SVGUseElement* m_directUseElement; | 160 SVGUseElement* m_directUseElement; |
|
kouhei (in TOK)
2014/05/07 01:43:13
RawPtrWillBeMember?
Mads Ager (chromium)
2014/05/07 12:13:16
Yes, and I replace the RefPtr from SVGElementInsta
| |
| 161 RefPtr<SVGElement> m_element; | 161 RefPtrWillBeMember<SVGElement> m_element; |
| 162 RefPtr<SVGElement> m_shadowTreeElement; | 162 RefPtrWillBeMember<SVGElement> m_shadowTreeElement; |
| 163 | 163 |
| 164 SVGElementInstance* m_previousSibling; | 164 RawPtrWillBeMember<SVGElementInstance> m_previousSibling; |
| 165 SVGElementInstance* m_nextSibling; | 165 RawPtrWillBeMember<SVGElementInstance> m_nextSibling; |
| 166 | 166 |
| 167 SVGElementInstance* m_firstChild; | 167 RawPtrWillBeMember<SVGElementInstance> m_firstChild; |
| 168 SVGElementInstance* m_lastChild; | 168 RawPtrWillBeMember<SVGElementInstance> m_lastChild; |
| 169 }; | 169 }; |
| 170 | 170 |
| 171 } // namespace WebCore | 171 } // namespace WebCore |
| 172 | 172 |
| 173 #endif | 173 #endif |
| OLD | NEW |