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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 | 114 |
115 MapEntry* entry = m_map.get(key); | 115 MapEntry* entry = m_map.get(key); |
116 if (!entry) | 116 if (!entry) |
117 return 0; | 117 return 0; |
118 | 118 |
119 ASSERT(entry->count); | 119 ASSERT(entry->count); |
120 if (entry->element) | 120 if (entry->element) |
121 return entry->element; | 121 return entry->element; |
122 | 122 |
123 // We know there's at least one node that matches; iterate to find the first
one. | 123 // We know there's at least one node that matches; iterate to find the first
one. |
124 for (Element* element = ElementTraversal::firstWithin(scope->rootNode()); el
ement; element = ElementTraversal::next(*element)) { | 124 for (Element& element : ElementTraversal::fromNext(scope->rootNode())) { |
125 if (!keyMatches(key, *element)) | 125 if (!keyMatches(key, element)) |
126 continue; | 126 continue; |
127 entry->element = element; | 127 entry->element = &element; |
128 return element; | 128 return &element; |
129 } | 129 } |
130 ASSERT_NOT_REACHED(); | 130 ASSERT_NOT_REACHED(); |
131 return 0; | 131 return 0; |
132 } | 132 } |
133 | 133 |
134 Element* DocumentOrderedMap::getElementById(const AtomicString& key, const TreeS
cope* scope) const | 134 Element* DocumentOrderedMap::getElementById(const AtomicString& key, const TreeS
cope* scope) const |
135 { | 135 { |
136 return get<keyMatchesId>(key, scope); | 136 return get<keyMatchesId>(key, scope); |
137 } | 137 } |
138 | 138 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 | 188 |
189 void DocumentOrderedMap::MapEntry::trace(Visitor* visitor) | 189 void DocumentOrderedMap::MapEntry::trace(Visitor* visitor) |
190 { | 190 { |
191 visitor->trace(element); | 191 visitor->trace(element); |
192 #if ENABLE(OILPAN) | 192 #if ENABLE(OILPAN) |
193 visitor->trace(orderedList); | 193 visitor->trace(orderedList); |
194 #endif | 194 #endif |
195 } | 195 } |
196 | 196 |
197 } // namespace blink | 197 } // namespace blink |
OLD | NEW |