OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 146 matching lines...) Loading... |
157 | 157 |
158 Element* DocumentOrderedMap::getElementById(const AtomicString& key, const TreeS
cope* scope) const | 158 Element* DocumentOrderedMap::getElementById(const AtomicString& key, const TreeS
cope* scope) const |
159 { | 159 { |
160 return get<keyMatchesId>(key, scope); | 160 return get<keyMatchesId>(key, scope); |
161 } | 161 } |
162 | 162 |
163 const HeapVector<Member<Element>>& DocumentOrderedMap::getAllElementsById(const
AtomicString& key, const TreeScope* scope) const | 163 const HeapVector<Member<Element>>& DocumentOrderedMap::getAllElementsById(const
AtomicString& key, const TreeScope* scope) const |
164 { | 164 { |
165 ASSERT(key); | 165 ASSERT(key); |
166 ASSERT(scope); | 166 ASSERT(scope); |
167 DEFINE_STATIC_LOCAL(HeapVector<Member<Element>>, emptyVector, (new HeapVecto
r<Member<Element>>)); | 167 DEFINE_STATIC_LOCAL(Persistent<HeapVector<Member<Element>>>, emptyVector, (n
ew HeapVector<Member<Element>>())); |
168 | 168 |
169 Map::iterator it = m_map.find(key); | 169 Map::iterator it = m_map.find(key); |
170 if (it == m_map.end()) | 170 if (it == m_map.end()) |
171 return emptyVector; | 171 return *emptyVector; |
172 | 172 |
173 Member<MapEntry>& entry = it->value; | 173 Member<MapEntry>& entry = it->value; |
174 ASSERT(entry->count); | 174 ASSERT(entry->count); |
175 | 175 |
176 if (entry->orderedList.isEmpty()) { | 176 if (entry->orderedList.isEmpty()) { |
177 entry->orderedList.reserveCapacity(entry->count); | 177 entry->orderedList.reserveCapacity(entry->count); |
178 for (Element* element = entry->element ? entry->element.get() : ElementT
raversal::firstWithin(scope->rootNode()); entry->orderedList.size() < entry->cou
nt; element = ElementTraversal::next(*element)) { | 178 for (Element* element = entry->element ? entry->element.get() : ElementT
raversal::firstWithin(scope->rootNode()); entry->orderedList.size() < entry->cou
nt; element = ElementTraversal::next(*element)) { |
179 ASSERT(element); | 179 ASSERT(element); |
180 if (!keyMatchesId(key, *element)) | 180 if (!keyMatchesId(key, *element)) |
181 continue; | 181 continue; |
(...skipping 30 matching lines...) Loading... |
212 | 212 |
213 DEFINE_TRACE(DocumentOrderedMap::MapEntry) | 213 DEFINE_TRACE(DocumentOrderedMap::MapEntry) |
214 { | 214 { |
215 visitor->trace(element); | 215 visitor->trace(element); |
216 #if ENABLE(OILPAN) | 216 #if ENABLE(OILPAN) |
217 visitor->trace(orderedList); | 217 visitor->trace(orderedList); |
218 #endif | 218 #endif |
219 } | 219 } |
220 | 220 |
221 } // namespace blink | 221 } // namespace blink |
OLD | NEW |