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) Research In Motion Limited 2010. All rights reserved. | 3 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
4 * Copyright (C) 2011 Torch Mobile (Beijing) Co. Ltd. All rights reserved. | 4 * Copyright (C) 2011 Torch Mobile (Beijing) Co. Ltd. All rights reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 void SVGElementInstance::detach() | 132 void SVGElementInstance::detach() |
133 { | 133 { |
134 // Clear all pointers. When the node is detached from the shadow DOM it shou
ld be removed but, | 134 // Clear all pointers. When the node is detached from the shadow DOM it shou
ld be removed but, |
135 // due to ref counting, it may not be. So clear everything to avoid dangling
pointers. | 135 // due to ref counting, it may not be. So clear everything to avoid dangling
pointers. |
136 | 136 |
137 for (SVGElementInstance* node = firstChild(); node; node = node->nextSibling
()) | 137 for (SVGElementInstance* node = firstChild(); node; node = node->nextSibling
()) |
138 node->detach(); | 138 node->detach(); |
139 | 139 |
140 // Deregister as instance for passed element, if we haven't already. | 140 // Deregister as instance for passed element, if we haven't already. |
141 if (shadowTreeElement() && m_element->instancesForElement().contains(shadowT
reeElement())) | 141 if (shadowTreeElement() && m_element->instancesForElement().contains(shadowT
reeElement())) |
142 m_element->removeInstanceMapping(this); | 142 m_element->removeInstanceMapping(shadowTreeElement()); |
143 // DO NOT clear ref to m_element because JavaScriptCore uses it for garbage
collection | 143 // DO NOT clear ref to m_element because JavaScriptCore uses it for garbage
collection |
144 | 144 |
145 m_shadowTreeElement = nullptr; | 145 m_shadowTreeElement = nullptr; |
146 | 146 |
147 m_directUseElement = 0; | 147 m_directUseElement = 0; |
148 m_correspondingUseElement = 0; | 148 m_correspondingUseElement = 0; |
149 | 149 |
150 #if !ENABLE(OILPAN) | 150 #if !ENABLE(OILPAN) |
151 removeDetachedChildrenInContainer<SVGElementInstance, SVGElementInstance>(*t
his); | 151 removeDetachedChildrenInContainer<SVGElementInstance, SVGElementInstance>(*t
his); |
152 #endif | 152 #endif |
153 } | 153 } |
154 | 154 |
155 void SVGElementInstance::setShadowTreeElement(SVGElement* element) | 155 void SVGElementInstance::setShadowTreeElement(SVGElement* element) |
156 { | 156 { |
157 ASSERT(element); | 157 ASSERT(element); |
158 m_shadowTreeElement = element; | 158 m_shadowTreeElement = element; |
159 // Register as instance for passed element. | 159 // Register as instance for passed element. |
160 m_element->mapInstanceToElement(this); | 160 m_element->mapInstanceToElement(shadowTreeElement()); |
161 | 161 |
162 } | 162 } |
163 | 163 |
164 void SVGElementInstance::appendChild(PassRefPtr<SVGElementInstance> child) | 164 void SVGElementInstance::appendChild(PassRefPtr<SVGElementInstance> child) |
165 { | 165 { |
166 appendChildToContainer<SVGElementInstance, SVGElementInstance>(*child, *this
); | 166 appendChildToContainer<SVGElementInstance, SVGElementInstance>(*child, *this
); |
167 } | 167 } |
168 | 168 |
169 const AtomicString& SVGElementInstance::interfaceName() const | 169 const AtomicString& SVGElementInstance::interfaceName() const |
170 { | 170 { |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 visitor->trace(m_parentInstance); | 229 visitor->trace(m_parentInstance); |
230 visitor->trace(m_element); | 230 visitor->trace(m_element); |
231 visitor->trace(m_shadowTreeElement); | 231 visitor->trace(m_shadowTreeElement); |
232 visitor->trace(m_previousSibling); | 232 visitor->trace(m_previousSibling); |
233 visitor->trace(m_nextSibling); | 233 visitor->trace(m_nextSibling); |
234 visitor->trace(m_firstChild); | 234 visitor->trace(m_firstChild); |
235 visitor->trace(m_lastChild); | 235 visitor->trace(m_lastChild); |
236 } | 236 } |
237 | 237 |
238 } | 238 } |
OLD | NEW |