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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 | 63 |
64 SVGElementInstance::~SVGElementInstance() | 64 SVGElementInstance::~SVGElementInstance() |
65 { | 65 { |
66 #ifndef NDEBUG | 66 #ifndef NDEBUG |
67 instanceCounter.decrement(); | 67 instanceCounter.decrement(); |
68 #endif | 68 #endif |
69 | 69 |
70 // Deregister as instance for passed element. | 70 // Deregister as instance for passed element. |
71 m_element->removeInstanceMapping(this); | 71 m_element->removeInstanceMapping(this); |
72 | 72 |
| 73 clearChildren(); |
| 74 } |
| 75 |
| 76 void SVGElementInstance::clearChildren() |
| 77 { |
73 removeAllChildrenInContainer<SVGElementInstance, SVGElementInstance>(this); | 78 removeAllChildrenInContainer<SVGElementInstance, SVGElementInstance>(this); |
74 } | 79 } |
75 | 80 |
76 PassRefPtr<SVGElementInstanceList> SVGElementInstance::childNodes() | 81 PassRefPtr<SVGElementInstanceList> SVGElementInstance::childNodes() |
77 { | 82 { |
78 return SVGElementInstanceList::create(this); | 83 return SVGElementInstanceList::create(this); |
79 } | 84 } |
80 | 85 |
81 void SVGElementInstance::setShadowTreeElement(SVGElement* element) | 86 void SVGElementInstance::setShadowTreeElement(SVGElement* element) |
82 { | 87 { |
(...skipping 15 matching lines...) Expand all Loading... |
98 return; | 103 return; |
99 | 104 |
100 const HashSet<SVGElementInstance*>& set = element->instancesForElement(); | 105 const HashSet<SVGElementInstance*>& set = element->instancesForElement(); |
101 if (set.isEmpty()) | 106 if (set.isEmpty()) |
102 return; | 107 return; |
103 | 108 |
104 // Mark all use elements referencing 'element' for rebuilding | 109 // Mark all use elements referencing 'element' for rebuilding |
105 const HashSet<SVGElementInstance*>::const_iterator end = set.end(); | 110 const HashSet<SVGElementInstance*>::const_iterator end = set.end(); |
106 for (HashSet<SVGElementInstance*>::const_iterator it = set.begin(); it != en
d; ++it) { | 111 for (HashSet<SVGElementInstance*>::const_iterator it = set.begin(); it != en
d; ++it) { |
107 ASSERT((*it)->correspondingElement() == element); | 112 ASSERT((*it)->correspondingElement() == element); |
108 if (SVGUseElement* element = (*it)->correspondingUseElement()) | 113 if (SVGUseElement* element = (*it)->correspondingUseElement()) { |
| 114 ASSERT(element->inDocument()); |
109 element->invalidateShadowTree(); | 115 element->invalidateShadowTree(); |
| 116 } |
110 } | 117 } |
111 | 118 |
112 // Be sure to rebuild use trees, if needed | 119 // Be sure to rebuild use trees, if needed |
113 element->document()->updateLayoutIgnorePendingStylesheets(); | 120 element->document()->updateLayoutIgnorePendingStylesheets(); |
114 } | 121 } |
115 | 122 |
116 ScriptExecutionContext* SVGElementInstance::scriptExecutionContext() const | 123 ScriptExecutionContext* SVGElementInstance::scriptExecutionContext() const |
117 { | 124 { |
118 return m_element->document(); | 125 return m_element->document(); |
119 } | 126 } |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 { | 161 { |
155 // EventTarget would use these methods if we were actually using its add/rem
oveEventListener logic. | 162 // EventTarget would use these methods if we were actually using its add/rem
oveEventListener logic. |
156 // As we're forwarding those calls to the correspondingElement(), no one sho
uld ever call this function. | 163 // As we're forwarding those calls to the correspondingElement(), no one sho
uld ever call this function. |
157 ASSERT_NOT_REACHED(); | 164 ASSERT_NOT_REACHED(); |
158 return 0; | 165 return 0; |
159 } | 166 } |
160 | 167 |
161 } | 168 } |
162 | 169 |
163 #endif | 170 #endif |
OLD | NEW |