Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(615)

Side by Side Diff: Source/core/svg/SVGElementInstance.cpp

Issue 272623003: Stop using SVGElementInstance in SVGElement (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Do shadow dom deletion later Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/svg/SVGElement.cpp ('k') | Source/core/svg/SVGUseElement.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « Source/core/svg/SVGElement.cpp ('k') | Source/core/svg/SVGUseElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698