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

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

Issue 11093040: Merge 130855 - Recursively detach SVGElementInstances (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1229/
Patch Set: Created 8 years, 2 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 | « no previous file | no next file » | 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 m_deletionHasBegun = true; 80 m_deletionHasBegun = true;
81 #endif 81 #endif
82 delete this; 82 delete this;
83 } 83 }
84 84
85 void SVGElementInstance::detach() 85 void SVGElementInstance::detach()
86 { 86 {
87 // Clear all pointers. When the node is detached from the shadow DOM it shou ld be removed but, 87 // Clear all pointers. When the node is detached from the shadow DOM it shou ld be removed but,
88 // due to ref counting, it may not be. So clear everything to avoid dangling pointers. 88 // due to ref counting, it may not be. So clear everything to avoid dangling pointers.
89 89
90 for (SVGElementInstance* node = firstChild(); node; node = node->nextSibling ())
91 node->detach();
92
90 // Deregister as instance for passed element, if we haven't already. 93 // Deregister as instance for passed element, if we haven't already.
91 if (m_element->instancesForElement().contains(this)) 94 if (m_element->instancesForElement().contains(this))
92 m_element->removeInstanceMapping(this); 95 m_element->removeInstanceMapping(this);
93 // DO NOT clear ref to m_element because JavaScriptCore uses it for garbage collection 96 // DO NOT clear ref to m_element because JavaScriptCore uses it for garbage collection
94 97
95 m_shadowTreeElement = 0; 98 m_shadowTreeElement = 0;
96 99
97 m_directUseElement = 0; 100 m_directUseElement = 0;
98 m_correspondingUseElement = 0; 101 m_correspondingUseElement = 0;
99 102
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 216
214 SVGElementInstance::InstanceUpdateBlocker::~InstanceUpdateBlocker() 217 SVGElementInstance::InstanceUpdateBlocker::~InstanceUpdateBlocker()
215 { 218 {
216 if (m_targetElement) 219 if (m_targetElement)
217 m_targetElement->setInstanceUpdatesBlocked(false); 220 m_targetElement->setInstanceUpdatesBlocked(false);
218 } 221 }
219 222
220 } 223 }
221 224
222 #endif 225 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698