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

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

Issue 65303008: Have ElementTraversal::firstWithin() take a reference (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 7 years, 1 month 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
« no previous file with comments | « Source/core/dom/Document.cpp ('k') | Source/core/dom/ElementTraversal.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 { 115 {
116 ASSERT(key); 116 ASSERT(key);
117 ASSERT(scope); 117 ASSERT(scope);
118 118
119 Element* element = m_map.get(key); 119 Element* element = m_map.get(key);
120 if (element) 120 if (element)
121 return element; 121 return element;
122 122
123 if (m_duplicateCounts.contains(key)) { 123 if (m_duplicateCounts.contains(key)) {
124 // We know there's at least one node that matches; iterate to find the f irst one. 124 // We know there's at least one node that matches; iterate to find the f irst one.
125 for (element = ElementTraversal::firstWithin(scope->rootNode()); element ; element = ElementTraversal::next(*element)) { 125 ASSERT(scope->rootNode());
126 for (element = ElementTraversal::firstWithin(*scope->rootNode()); elemen t; element = ElementTraversal::next(*element)) {
126 if (!keyMatches(key, element)) 127 if (!keyMatches(key, element))
127 continue; 128 continue;
128 m_duplicateCounts.remove(key); 129 m_duplicateCounts.remove(key);
129 m_map.set(key, element); 130 m_map.set(key, element);
130 return element; 131 return element;
131 } 132 }
132 ASSERT_NOT_REACHED(); 133 ASSERT_NOT_REACHED();
133 } 134 }
134 135
135 return 0; 136 return 0;
(...skipping 13 matching lines...) Expand all
149 { 150 {
150 return get<keyMatchesLowercasedMapName>(key, scope); 151 return get<keyMatchesLowercasedMapName>(key, scope);
151 } 152 }
152 153
153 Element* DocumentOrderedMap::getElementByLabelForAttribute(StringImpl* key, cons t TreeScope* scope) const 154 Element* DocumentOrderedMap::getElementByLabelForAttribute(StringImpl* key, cons t TreeScope* scope) const
154 { 155 {
155 return get<keyMatchesLabelForAttribute>(key, scope); 156 return get<keyMatchesLabelForAttribute>(key, scope);
156 } 157 }
157 158
158 } // namespace WebCore 159 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/Document.cpp ('k') | Source/core/dom/ElementTraversal.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698