| 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 | 111 |
| 112 SVGElementInstance::~SVGElementInstance() | 112 SVGElementInstance::~SVGElementInstance() |
| 113 { | 113 { |
| 114 // Call detach because we may be deleted directly if we are a child of a det
ached instance. | 114 // Call detach because we may be deleted directly if we are a child of a det
ached instance. |
| 115 detach(); | 115 detach(); |
| 116 | 116 |
| 117 #ifndef NDEBUG | 117 #ifndef NDEBUG |
| 118 instanceCounter.decrement(); | 118 instanceCounter.decrement(); |
| 119 #endif | 119 #endif |
| 120 | 120 |
| 121 m_element = 0; | 121 m_element = nullptr; |
| 122 } | 122 } |
| 123 | 123 |
| 124 // It's important not to inline removedLastRef, because we don't want to inline
the code to | 124 // It's important not to inline removedLastRef, because we don't want to inline
the code to |
| 125 // delete an SVGElementInstance at each deref call site. | 125 // delete an SVGElementInstance at each deref call site. |
| 126 void SVGElementInstance::removedLastRef() | 126 void SVGElementInstance::removedLastRef() |
| 127 { | 127 { |
| 128 #if SECURITY_ASSERT_ENABLED | 128 #if SECURITY_ASSERT_ENABLED |
| 129 m_deletionHasBegun = true; | 129 m_deletionHasBegun = true; |
| 130 #endif | 130 #endif |
| 131 delete this; | 131 delete this; |
| 132 } | 132 } |
| 133 | 133 |
| 134 void SVGElementInstance::detach() | 134 void SVGElementInstance::detach() |
| 135 { | 135 { |
| 136 // Clear all pointers. When the node is detached from the shadow DOM it shou
ld be removed but, | 136 // Clear all pointers. When the node is detached from the shadow DOM it shou
ld be removed but, |
| 137 // due to ref counting, it may not be. So clear everything to avoid dangling
pointers. | 137 // due to ref counting, it may not be. So clear everything to avoid dangling
pointers. |
| 138 | 138 |
| 139 for (SVGElementInstance* node = firstChild(); node; node = node->nextSibling
()) | 139 for (SVGElementInstance* node = firstChild(); node; node = node->nextSibling
()) |
| 140 node->detach(); | 140 node->detach(); |
| 141 | 141 |
| 142 // Deregister as instance for passed element, if we haven't already. | 142 // Deregister as instance for passed element, if we haven't already. |
| 143 if (m_element->instancesForElement().contains(this)) | 143 if (m_element->instancesForElement().contains(this)) |
| 144 m_element->removeInstanceMapping(this); | 144 m_element->removeInstanceMapping(this); |
| 145 // DO NOT clear ref to m_element because JavaScriptCore uses it for garbage
collection | 145 // DO NOT clear ref to m_element because JavaScriptCore uses it for garbage
collection |
| 146 | 146 |
| 147 m_shadowTreeElement = 0; | 147 m_shadowTreeElement = nullptr; |
| 148 | 148 |
| 149 m_directUseElement = 0; | 149 m_directUseElement = 0; |
| 150 m_correspondingUseElement = 0; | 150 m_correspondingUseElement = 0; |
| 151 | 151 |
| 152 removeDetachedChildrenInContainer<SVGElementInstance, SVGElementInstance>(*t
his); | 152 removeDetachedChildrenInContainer<SVGElementInstance, SVGElementInstance>(*t
his); |
| 153 } | 153 } |
| 154 | 154 |
| 155 PassRefPtr<SVGElementInstanceList> SVGElementInstance::childNodes() | 155 PassRefPtr<SVGElementInstanceList> SVGElementInstance::childNodes() |
| 156 { | 156 { |
| 157 return SVGElementInstanceList::create(this); | 157 return SVGElementInstanceList::create(this); |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 m_targetElement->setInstanceUpdatesBlocked(true); | 263 m_targetElement->setInstanceUpdatesBlocked(true); |
| 264 } | 264 } |
| 265 | 265 |
| 266 SVGElementInstance::InstanceUpdateBlocker::~InstanceUpdateBlocker() | 266 SVGElementInstance::InstanceUpdateBlocker::~InstanceUpdateBlocker() |
| 267 { | 267 { |
| 268 if (m_targetElement) | 268 if (m_targetElement) |
| 269 m_targetElement->setInstanceUpdatesBlocked(false); | 269 m_targetElement->setInstanceUpdatesBlocked(false); |
| 270 } | 270 } |
| 271 | 271 |
| 272 } | 272 } |
| OLD | NEW |