Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(413)

Side by Side Diff: third_party/WebKit/Source/core/dom/DocumentOrderedMap.cpp

Issue 2470233009: WTF/std normalization: replace WTF::Vector::first() with ::front() (Closed)
Patch Set: rebase Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights
3 * reserved. 3 * reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 return; 105 return;
106 106
107 Member<MapEntry>& entry = it->value; 107 Member<MapEntry>& entry = it->value;
108 DCHECK(entry->count); 108 DCHECK(entry->count);
109 if (entry->count == 1) { 109 if (entry->count == 1) {
110 DCHECK(!entry->element || entry->element == element); 110 DCHECK(!entry->element || entry->element == element);
111 m_map.remove(it); 111 m_map.remove(it);
112 } else { 112 } else {
113 if (entry->element == element) { 113 if (entry->element == element) {
114 DCHECK(entry->orderedList.isEmpty() || 114 DCHECK(entry->orderedList.isEmpty() ||
115 entry->orderedList.first() == element); 115 entry->orderedList.front() == element);
116 entry->element = 116 entry->element =
117 entry->orderedList.size() > 1 ? entry->orderedList[1] : nullptr; 117 entry->orderedList.size() > 1 ? entry->orderedList[1] : nullptr;
118 } 118 }
119 entry->count--; 119 entry->count--;
120 entry->orderedList.clear(); 120 entry->orderedList.clear();
121 } 121 }
122 } 122 }
123 123
124 template <bool keyMatches(const AtomicString&, const Element&)> 124 template <bool keyMatches(const AtomicString&, const Element&)>
125 inline Element* DocumentOrderedMap::get(const AtomicString& key, 125 inline Element* DocumentOrderedMap::get(const AtomicString& key,
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 entry->element ? entry->element.get() 179 entry->element ? entry->element.get()
180 : ElementTraversal::firstWithin(scope->rootNode()); 180 : ElementTraversal::firstWithin(scope->rootNode());
181 entry->orderedList.size() < entry->count; 181 entry->orderedList.size() < entry->count;
182 element = ElementTraversal::next(*element)) { 182 element = ElementTraversal::next(*element)) {
183 DCHECK(element); 183 DCHECK(element);
184 if (!keyMatchesId(key, *element)) 184 if (!keyMatchesId(key, *element))
185 continue; 185 continue;
186 entry->orderedList.uncheckedAppend(element); 186 entry->orderedList.uncheckedAppend(element);
187 } 187 }
188 if (!entry->element) 188 if (!entry->element)
189 entry->element = entry->orderedList.first(); 189 entry->element = entry->orderedList.front();
190 } 190 }
191 191
192 return entry->orderedList; 192 return entry->orderedList;
193 } 193 }
194 194
195 Element* DocumentOrderedMap::getElementByMapName(const AtomicString& key, 195 Element* DocumentOrderedMap::getElementByMapName(const AtomicString& key,
196 const TreeScope* scope) const { 196 const TreeScope* scope) const {
197 return get<keyMatchesMapName>(key, scope); 197 return get<keyMatchesMapName>(key, scope);
198 } 198 }
199 199
(...skipping 17 matching lines...) Expand all
217 DEFINE_TRACE(DocumentOrderedMap) { 217 DEFINE_TRACE(DocumentOrderedMap) {
218 visitor->trace(m_map); 218 visitor->trace(m_map);
219 } 219 }
220 220
221 DEFINE_TRACE(DocumentOrderedMap::MapEntry) { 221 DEFINE_TRACE(DocumentOrderedMap::MapEntry) {
222 visitor->trace(element); 222 visitor->trace(element);
223 visitor->trace(orderedList); 223 visitor->trace(orderedList);
224 } 224 }
225 225
226 } // namespace blink 226 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp ('k') | third_party/WebKit/Source/core/dom/MutationObserver.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698