OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008, 2010 Apple Inc. All rights reserved. |
3 * Copyright (C) 2008 David Smith <catfish.man@gmail.com> | 3 * Copyright (C) 2008 David Smith <catfish.man@gmail.com> |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 return m_atomicNameCaches.isEmpty() && m_tagCollectionCacheNS.isEmpty(); | 166 return m_atomicNameCaches.isEmpty() && m_tagCollectionCacheNS.isEmpty(); |
167 } | 167 } |
168 | 168 |
169 void adoptTreeScope() | 169 void adoptTreeScope() |
170 { | 170 { |
171 invalidateCaches(); | 171 invalidateCaches(); |
172 } | 172 } |
173 | 173 |
174 void adoptDocument(Document& oldDocument, Document& newDocument) | 174 void adoptDocument(Document& oldDocument, Document& newDocument) |
175 { | 175 { |
| 176 ASSERT(oldDocument != newDocument); |
176 invalidateCaches(); | 177 invalidateCaches(); |
177 | 178 |
178 if (oldDocument != newDocument) { | 179 NodeListAtomicNameCacheMap::const_iterator atomicNameCacheEnd = m_atomic
NameCaches.end(); |
179 NodeListAtomicNameCacheMap::const_iterator atomicNameCacheEnd = m_at
omicNameCaches.end(); | 180 for (NodeListAtomicNameCacheMap::const_iterator it = m_atomicNameCaches.
begin(); it != atomicNameCacheEnd; ++it) { |
180 for (NodeListAtomicNameCacheMap::const_iterator it = m_atomicNameCac
hes.begin(); it != atomicNameCacheEnd; ++it) { | 181 LiveNodeListBase* list = it->value; |
181 LiveNodeListBase* list = it->value; | 182 oldDocument.unregisterNodeList(list); |
182 oldDocument.unregisterNodeList(list); | 183 newDocument.registerNodeList(list); |
183 newDocument.registerNodeList(list); | 184 } |
184 } | |
185 | 185 |
186 TagCollectionCacheNS::const_iterator tagEnd = m_tagCollectionCacheNS
.end(); | 186 TagCollectionCacheNS::const_iterator tagEnd = m_tagCollectionCacheNS.end
(); |
187 for (TagCollectionCacheNS::const_iterator it = m_tagCollectionCacheN
S.begin(); it != tagEnd; ++it) { | 187 for (TagCollectionCacheNS::const_iterator it = m_tagCollectionCacheNS.be
gin(); it != tagEnd; ++it) { |
188 LiveNodeListBase* list = it->value; | 188 LiveNodeListBase* list = it->value; |
189 ASSERT(!list->isRootedAtDocument()); | 189 ASSERT(!list->isRootedAtDocument()); |
190 oldDocument.unregisterNodeList(list); | 190 oldDocument.unregisterNodeList(list); |
191 newDocument.registerNodeList(list); | 191 newDocument.registerNodeList(list); |
192 } | |
193 } | 192 } |
194 } | 193 } |
195 | 194 |
196 private: | 195 private: |
197 NodeListsNodeData() | 196 NodeListsNodeData() |
198 : m_childNodeList(0) | 197 : m_childNodeList(0) |
199 { } | 198 { } |
200 | 199 |
201 std::pair<unsigned char, StringImpl*> namedNodeListKey(CollectionType type,
const AtomicString& name) | 200 std::pair<unsigned char, StringImpl*> namedNodeListKey(CollectionType type,
const AtomicString& name) |
202 { | 201 { |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 ownerNode->clearNodeLists(); | 280 ownerNode->clearNodeLists(); |
282 return true; | 281 return true; |
283 } | 282 } |
284 | 283 |
285 // Ensure the 10 bits reserved for the m_connectedFrameCount cannot overflow | 284 // Ensure the 10 bits reserved for the m_connectedFrameCount cannot overflow |
286 COMPILE_ASSERT(Page::maxNumberOfFrames < 1024, Frame_limit_should_fit_in_rare_da
ta_count); | 285 COMPILE_ASSERT(Page::maxNumberOfFrames < 1024, Frame_limit_should_fit_in_rare_da
ta_count); |
287 | 286 |
288 } // namespace WebCore | 287 } // namespace WebCore |
289 | 288 |
290 #endif // NodeRareData_h | 289 #endif // NodeRareData_h |
OLD | NEW |