| 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 { | 112 { |
| 113 return adoptPtr(new NodeListsNodeData); | 113 return adoptPtr(new NodeListsNodeData); |
| 114 } | 114 } |
| 115 | 115 |
| 116 void invalidateCaches(const QualifiedName* attrName = 0); | 116 void invalidateCaches(const QualifiedName* attrName = 0); |
| 117 bool isEmpty() const | 117 bool isEmpty() const |
| 118 { | 118 { |
| 119 return m_atomicNameCaches.isEmpty() && m_nameCaches.isEmpty() && m_tagNo
deListCacheNS.isEmpty(); | 119 return m_atomicNameCaches.isEmpty() && m_nameCaches.isEmpty() && m_tagNo
deListCacheNS.isEmpty(); |
| 120 } | 120 } |
| 121 | 121 |
| 122 void adoptTreeScope(TreeScope* oldTreeScope, TreeScope* newTreeScope, Docume
nt* oldDocument, Document* newDocument) |
| 123 { |
| 124 invalidateCaches(); |
| 125 |
| 126 if (oldDocument != newDocument) { |
| 127 NodeListAtomicNameCacheMap::const_iterator atomicNameCacheEnd = m_at
omicNameCaches.end(); |
| 128 for (NodeListAtomicNameCacheMap::const_iterator it = m_atomicNameCac
hes.begin(); it != atomicNameCacheEnd; ++it) { |
| 129 DynamicSubtreeNodeList* list = it->second; |
| 130 if (list->isRootedAtDocument()) { |
| 131 oldDocument->unregisterDynamicSubtreeNodeList(list); |
| 132 newDocument->registerDynamicSubtreeNodeList(list); |
| 133 } |
| 134 } |
| 135 |
| 136 NodeListNameCacheMap::const_iterator nameCacheEnd = m_nameCaches.end
(); |
| 137 for (NodeListNameCacheMap::const_iterator it = m_nameCaches.begin();
it != nameCacheEnd; ++it) { |
| 138 DynamicSubtreeNodeList* list = it->second; |
| 139 if (list->isRootedAtDocument()) { |
| 140 oldDocument->unregisterDynamicSubtreeNodeList(list); |
| 141 newDocument->registerDynamicSubtreeNodeList(list); |
| 142 } |
| 143 } |
| 144 } |
| 145 |
| 146 if (oldTreeScope) |
| 147 oldTreeScope->removeNodeListCache(); |
| 148 newTreeScope->addNodeListCache(); |
| 149 } |
| 150 |
| 122 private: | 151 private: |
| 123 NodeListsNodeData() { } | 152 NodeListsNodeData() { } |
| 124 | 153 |
| 125 std::pair<unsigned short, AtomicString> namedNodeListKey(DynamicNodeList::No
deListType listType, const AtomicString& name) | 154 std::pair<unsigned short, AtomicString> namedNodeListKey(DynamicNodeList::No
deListType listType, const AtomicString& name) |
| 126 { | 155 { |
| 127 return std::pair<unsigned short, AtomicString>(listType, name); | 156 return std::pair<unsigned short, AtomicString>(listType, name); |
| 128 } | 157 } |
| 129 | 158 |
| 130 std::pair<unsigned short, String> namedNodeListKey(DynamicNodeList::NodeList
Type listType, const String& name) | 159 std::pair<unsigned short, String> namedNodeListKey(DynamicNodeList::NodeList
Type listType, const String& name) |
| 131 { | 160 { |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 #endif | 362 #endif |
| 334 | 363 |
| 335 #if ENABLE(STYLE_SCOPED) | 364 #if ENABLE(STYLE_SCOPED) |
| 336 size_t m_numberOfScopedHTMLStyleChildren; | 365 size_t m_numberOfScopedHTMLStyleChildren; |
| 337 #endif | 366 #endif |
| 338 }; | 367 }; |
| 339 | 368 |
| 340 } // namespace WebCore | 369 } // namespace WebCore |
| 341 | 370 |
| 342 #endif // NodeRareData_h | 371 #endif // NodeRareData_h |
| OLD | NEW |